/src/ntopng/include/MacManufacturers.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * |
3 | | * (C) 2013-25 - ntop.org |
4 | | * |
5 | | * |
6 | | * This program is free software; you can redistribute it and/or modify |
7 | | * it under the terms of the GNU General Public License as published by |
8 | | * the Free Software Foundation; either version 3 of the License, or |
9 | | * (at your option) any later version. |
10 | | * |
11 | | * This program is distributed in the hope that it will be useful, |
12 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | | * GNU General Public License for more details. |
15 | | * |
16 | | * You should have received a copy of the GNU General Public License |
17 | | * along with this program; if not, write to the Free Software Foundation, |
18 | | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | | * |
20 | | */ |
21 | | |
22 | | #ifndef _MAC_MANUFACTURERS_H_ |
23 | | #define _MAC_MANUFACTURERS_H_ |
24 | | |
25 | | #include "ntop_includes.h" |
26 | | |
27 | | typedef struct { |
28 | | char *manufacturer_name; |
29 | | char *short_name; |
30 | | } mac_manufacturers_t; |
31 | | |
32 | | class MacManufacturers { |
33 | | private: |
34 | | char manufacturers_file[MAX_PATH]; |
35 | | std::map<u_int32_t, mac_manufacturers_t> mac_manufacturers; |
36 | | |
37 | 0 | inline u_int32_t mac2key(u_int8_t mac[]) { |
38 | 0 | u_int32_t v = 0; |
39 | 0 | memcpy(&v, mac, 3); |
40 | 0 | return (v); |
41 | 0 | } |
42 | | |
43 | | void init(); |
44 | | |
45 | | public: |
46 | | MacManufacturers(const char *mac_file_home); |
47 | | ~MacManufacturers(); |
48 | | |
49 | | const char *getManufacturer(u_int8_t mac[]); |
50 | | void getMacManufacturer(u_int8_t mac[], lua_State *vm); |
51 | | }; |
52 | | |
53 | | #endif /* _MAC_MANUFACTURERS_H_ */ |