summaryrefslogtreecommitdiffstats
path: root/epan/manuf.h
blob: 5f5ca1bdfea95a6fba00a8b006da2a66fbef46f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* manuf.h
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */
#ifndef __MANUF_H__
#define __MANUF_H__

#include <wireshark.h>

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#define MANUF_BLOCK_SIZE 5

struct ws_manuf {
    uint8_t block[MANUF_BLOCK_SIZE];
    uint8_t mask;
    const char *short_name;
    const char *long_name;
};

/* Internal structure, not supposed to be accessed by users. */
struct ws_manuf_iter {
    size_t idx24, idx28, idx36;
    struct ws_manuf buf24;
    struct ws_manuf buf28;
    struct ws_manuf buf36;
};

typedef struct ws_manuf_iter ws_manuf_iter_t;

/* Returns the short name. Takes an optional pointer to return the long name. */
WS_DLL_PUBLIC
const char *
ws_manuf_lookup_str(const uint8_t addr[6], const char **long_name_ptr);

WS_DLL_PUBLIC
void
ws_manuf_iter_init(ws_manuf_iter_t *iter);

WS_DLL_PUBLIC
bool
ws_manuf_iter_next(ws_manuf_iter_t *iter, struct ws_manuf *result);

WS_DLL_PUBLIC
const char *
ws_manuf_block_str(char *buf, size_t buf_size, const struct ws_manuf *ptr);

WS_DLL_PUBLIC void
ws_manuf_dump(FILE *fp);

WS_DLL_PUBLIC
size_t
ws_manuf_count(void);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif