Coverage Report

Created: 2024-02-25 06:37

/src/ntopng/include/VLANAddressTree.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 *
3
 * (C) 2017-24 - 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 _VLAN_ADDRESS_TREE_H_
23
#define _VLAN_ADDRESS_TREE_H_
24
25
class AddressTree;
26
27
class VLANAddressTree {
28
 protected:
29
  AddressTree **tree;
30
  ndpi_void_fn_t free_func;
31
32
 public:
33
  VLANAddressTree(ndpi_void_fn_t data_free_func = NULL);
34
  ~VLANAddressTree();
35
36
  bool addAddress(u_int16_t vlan_id, char *_net, const int16_t user_data = -1);
37
  bool addAddresses(u_int16_t vlan_id, char *net, const int16_t user_data = -1);
38
39
  int16_t findAddress(u_int16_t vlan_id, int family, void *addr,
40
                      u_int8_t *network_mask_bits = NULL);
41
  int16_t findMac(u_int16_t vlan_id, const u_int8_t addr[]);
42
  void *findAndGetData(u_int16_t vlan_id, IpAddress *ipa) const;
43
  bool addVLANAddressAndData(u_int16_t vlan_id, const char *_what,
44
                             void *user_data);
45
46
0
  inline AddressTree *getAddressTree(u_int16_t vlan_id) {
47
0
    return tree[vlan_id];
48
0
  };
49
};
50
51
#endif