manuf: Move private declarations out of header
This commit is contained in:
parent
4838556b3a
commit
341c03713f
|
@ -14,7 +14,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
static ws_manuf_registry_t ieee_registry_table[] = {
|
||||
static manuf_registry_t ieee_registry_table[] = {
|
||||
{ { 0x00, 0x1B, 0xC5 }, MA_S },
|
||||
{ { 0x00, 0x50, 0xC2 }, MA_S },
|
||||
{ { 0x00, 0x55, 0xDA }, MA_M },
|
||||
|
@ -346,7 +346,7 @@ static ws_manuf_registry_t ieee_registry_table[] = {
|
|||
{ { 0xFC, 0xD2, 0xB6 }, MA_M },
|
||||
};
|
||||
|
||||
static ws_manuf_oui24_t global_manuf_oui24_table[] = {
|
||||
static manuf_oui24_t global_manuf_oui24_table[] = {
|
||||
{ { 0x00, 0x00, 0x00 }, "Xerox", "Xerox Corporation" },
|
||||
{ { 0x00, 0x00, 0x01 }, "Xerox", "Xerox Corporation" },
|
||||
{ { 0x00, 0x00, 0x02 }, "Xerox", "Xerox Corporation" },
|
||||
|
@ -34237,7 +34237,7 @@ static ws_manuf_oui24_t global_manuf_oui24_table[] = {
|
|||
{ { 0xFC, 0xFE, 0xC2 }, "InvensysCont", "Invensys Controls UK Limited" },
|
||||
};
|
||||
|
||||
static ws_manuf_oui28_t global_manuf_oui28_table[] = {
|
||||
static manuf_oui28_t global_manuf_oui28_table[] = {
|
||||
{ { 0x00, 0x55, 0xDA, 0x00 }, "ShinkoTechno", "Shinko Technos co.,ltd." },
|
||||
{ { 0x00, 0x55, 0xDA, 0x10 }, "KoolPOS", "KoolPOS Inc." },
|
||||
{ { 0x00, 0x55, 0xDA, 0x20 }, "ConnectedInf", "Beijing Connected Information Technology Co.,Ltd." },
|
||||
|
@ -39057,7 +39057,7 @@ static ws_manuf_oui28_t global_manuf_oui28_table[] = {
|
|||
{ { 0xFC, 0xD2, 0xB6, 0xE0 }, "Univer", "Univer S.p.A." },
|
||||
};
|
||||
|
||||
static ws_manuf_oui36_t global_manuf_oui36_table[] = {
|
||||
static manuf_oui36_t global_manuf_oui36_table[] = {
|
||||
{ { 0x00, 0x1B, 0xC5, 0x00, 0x00 }, "Converging", "Converging Systems Inc." },
|
||||
{ { 0x00, 0x1B, 0xC5, 0x00, 0x10 }, "OpenRBcomDir", "OpenRB.com, Direct SIA" },
|
||||
{ { 0x00, 0x1B, 0xC5, 0x00, 0x20 }, "GORAMOJanusz", "GORAMO - Janusz Gorecki" },
|
||||
|
|
46
epan/manuf.c
46
epan/manuf.c
|
@ -14,12 +14,36 @@
|
|||
#define MA_M 1
|
||||
#define MA_S 2
|
||||
|
||||
typedef struct {
|
||||
uint8_t oui24[3];
|
||||
/* Identifies the 3-byte prefix as part of MA-M or MA-S (or MA-L if none of those). */
|
||||
uint8_t kind;
|
||||
} manuf_registry_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t oui24[3];
|
||||
const char *short_name;
|
||||
const char *long_name;
|
||||
} manuf_oui24_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t oui28[4];
|
||||
const char *short_name;
|
||||
const char *long_name;
|
||||
} manuf_oui28_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t oui36[5];
|
||||
const char *short_name;
|
||||
const char *long_name;
|
||||
} manuf_oui36_t;
|
||||
|
||||
#include "manuf-data.c"
|
||||
|
||||
static int
|
||||
compare_oui24_entry(const void *a, const void *b)
|
||||
{
|
||||
return memcmp(a, ((const ws_manuf_oui24_t *)b)->oui24, 3);
|
||||
return memcmp(a, ((const manuf_oui24_t *)b)->oui24, 3);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -28,7 +52,7 @@ compare_oui28_entry(const void *a, const void *b)
|
|||
uint8_t addr[4];
|
||||
memcpy(addr, a, 4);
|
||||
addr[3] &= 0xF0;
|
||||
return memcmp(addr, ((const ws_manuf_oui28_t *)b)->oui28, 4);
|
||||
return memcmp(addr, ((const manuf_oui28_t *)b)->oui28, 4);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -37,15 +61,15 @@ compare_oui36_entry(const void *a, const void *b)
|
|||
uint8_t addr[5];
|
||||
memcpy(addr, a, 5);
|
||||
addr[4] &= 0xF0;
|
||||
return memcmp(addr, ((const ws_manuf_oui36_t *)b)->oui36, 5);
|
||||
return memcmp(addr, ((const manuf_oui36_t *)b)->oui36, 5);
|
||||
}
|
||||
|
||||
static int
|
||||
select_registry(const uint8_t addr[6])
|
||||
{
|
||||
ws_manuf_registry_t *entry;
|
||||
manuf_registry_t *entry;
|
||||
|
||||
entry = bsearch(addr, ieee_registry_table, G_N_ELEMENTS(ieee_registry_table), sizeof(ws_manuf_registry_t), compare_oui24_entry);
|
||||
entry = bsearch(addr, ieee_registry_table, G_N_ELEMENTS(ieee_registry_table), sizeof(manuf_registry_t), compare_oui24_entry);
|
||||
if (entry)
|
||||
return entry->kind;
|
||||
return MA_L;
|
||||
|
@ -54,7 +78,7 @@ select_registry(const uint8_t addr[6])
|
|||
static struct ws_manuf *
|
||||
manuf_oui24_lookup(const uint8_t addr[6], struct ws_manuf *result)
|
||||
{
|
||||
ws_manuf_oui24_t *oui24 = bsearch(addr, global_manuf_oui24_table, G_N_ELEMENTS(global_manuf_oui24_table), sizeof(ws_manuf_oui24_t), compare_oui24_entry);
|
||||
manuf_oui24_t *oui24 = bsearch(addr, global_manuf_oui24_table, G_N_ELEMENTS(global_manuf_oui24_table), sizeof(manuf_oui24_t), compare_oui24_entry);
|
||||
if (!oui24)
|
||||
return NULL;
|
||||
|
||||
|
@ -68,7 +92,7 @@ manuf_oui24_lookup(const uint8_t addr[6], struct ws_manuf *result)
|
|||
static struct ws_manuf *
|
||||
manuf_oui28_lookup(const uint8_t addr[6], struct ws_manuf *result)
|
||||
{
|
||||
ws_manuf_oui28_t *oui28 = bsearch(addr, global_manuf_oui28_table, G_N_ELEMENTS(global_manuf_oui28_table), sizeof(ws_manuf_oui28_t), compare_oui28_entry);
|
||||
manuf_oui28_t *oui28 = bsearch(addr, global_manuf_oui28_table, G_N_ELEMENTS(global_manuf_oui28_table), sizeof(manuf_oui28_t), compare_oui28_entry);
|
||||
if (!oui28)
|
||||
return NULL;
|
||||
|
||||
|
@ -82,7 +106,7 @@ manuf_oui28_lookup(const uint8_t addr[6], struct ws_manuf *result)
|
|||
static struct ws_manuf *
|
||||
manuf_oui36_lookup(const uint8_t addr[6], struct ws_manuf *result)
|
||||
{
|
||||
ws_manuf_oui36_t *oui36 = bsearch(addr, global_manuf_oui36_table, G_N_ELEMENTS(global_manuf_oui36_table), sizeof(ws_manuf_oui36_t), compare_oui36_entry);
|
||||
manuf_oui36_t *oui36 = bsearch(addr, global_manuf_oui36_table, G_N_ELEMENTS(global_manuf_oui36_table), sizeof(manuf_oui36_t), compare_oui36_entry);
|
||||
if (!oui36)
|
||||
return NULL;
|
||||
|
||||
|
@ -131,9 +155,9 @@ ws_manuf_iter_init(ws_manuf_iter_t *iter)
|
|||
struct ws_manuf *
|
||||
ws_manuf_iter_next(ws_manuf_iter_t *iter, struct ws_manuf manuf[NUM_REGISTRIES])
|
||||
{
|
||||
ws_manuf_oui24_t *ptr24 = NULL;
|
||||
ws_manuf_oui28_t *ptr28 = NULL;
|
||||
ws_manuf_oui36_t *ptr36 = NULL;
|
||||
manuf_oui24_t *ptr24 = NULL;
|
||||
manuf_oui28_t *ptr28 = NULL;
|
||||
manuf_oui36_t *ptr36 = NULL;
|
||||
struct ws_manuf *ptr;
|
||||
|
||||
memset(manuf, 0, NUM_REGISTRIES * sizeof(struct ws_manuf));
|
||||
|
|
38
epan/manuf.h
38
epan/manuf.h
|
@ -11,32 +11,12 @@
|
|||
|
||||
#include <wireshark.h>
|
||||
|
||||
typedef struct {
|
||||
uint8_t oui24[3];
|
||||
/* Identifies the 3-byte prefix as part of MA-M or MA-S (or MA-L if none of those). */
|
||||
uint8_t kind;
|
||||
} ws_manuf_registry_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t oui24[3];
|
||||
struct ws_manuf {
|
||||
uint8_t addr[6];
|
||||
uint8_t mask;
|
||||
const char *short_name;
|
||||
const char *long_name;
|
||||
} ws_manuf_oui24_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t oui28[4];
|
||||
const char *short_name;
|
||||
const char *long_name;
|
||||
} ws_manuf_oui28_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t oui36[5];
|
||||
const char *short_name;
|
||||
const char *long_name;
|
||||
} ws_manuf_oui36_t;
|
||||
|
||||
struct ws_manuf *
|
||||
global_manuf_lookup(const uint8_t addr[6], struct ws_manuf *result);
|
||||
};
|
||||
|
||||
struct ws_manuf_iter {
|
||||
size_t idx24, idx28, idx36;
|
||||
|
@ -44,16 +24,12 @@ struct ws_manuf_iter {
|
|||
|
||||
typedef struct ws_manuf_iter ws_manuf_iter_t;
|
||||
|
||||
struct ws_manuf *
|
||||
global_manuf_lookup(const uint8_t addr[6], struct ws_manuf *result);
|
||||
|
||||
void
|
||||
ws_manuf_iter_init(ws_manuf_iter_t *iter);
|
||||
|
||||
struct ws_manuf {
|
||||
uint8_t addr[6];
|
||||
uint8_t mask;
|
||||
const char *short_name;
|
||||
const char *long_name;
|
||||
};
|
||||
|
||||
struct ws_manuf *
|
||||
ws_manuf_iter_next(ws_manuf_iter_t *iter, struct ws_manuf manuf_ptr[3]);
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ def main():
|
|||
''')
|
||||
|
||||
# Write the prefix map
|
||||
manuf_fd.write("static ws_manuf_registry_t ieee_registry_table[] = {\n")
|
||||
manuf_fd.write("static manuf_registry_t ieee_registry_table[] = {\n")
|
||||
keys = list(prefix_map.keys())
|
||||
keys.sort()
|
||||
for oui in keys:
|
||||
|
@ -300,7 +300,7 @@ def main():
|
|||
manuf_fd.write("};\n\n")
|
||||
|
||||
# write the MA-L table
|
||||
manuf_fd.write("static ws_manuf_oui24_t global_manuf_oui24_table[] = {\n")
|
||||
manuf_fd.write("static manuf_oui24_t global_manuf_oui24_table[] = {\n")
|
||||
keys = list(oui_d[MA_L].keys())
|
||||
keys.sort()
|
||||
for oui in keys:
|
||||
|
@ -319,7 +319,7 @@ def main():
|
|||
manuf_fd.write("};\n\n")
|
||||
|
||||
# write the MA-M table
|
||||
manuf_fd.write("static ws_manuf_oui28_t global_manuf_oui28_table[] = {\n")
|
||||
manuf_fd.write("static manuf_oui28_t global_manuf_oui28_table[] = {\n")
|
||||
keys = list(oui_d[MA_M].keys())
|
||||
keys.sort()
|
||||
for oui in keys:
|
||||
|
@ -338,7 +338,7 @@ def main():
|
|||
manuf_fd.write("};\n\n")
|
||||
|
||||
#write the MA-S table
|
||||
manuf_fd.write("static ws_manuf_oui36_t global_manuf_oui36_table[] = {\n")
|
||||
manuf_fd.write("static manuf_oui36_t global_manuf_oui36_table[] = {\n")
|
||||
keys = list(oui_d[MA_S].keys())
|
||||
keys.sort()
|
||||
for oui in keys:
|
||||
|
|
Loading…
Reference in New Issue