mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-02 00:40:10 +00:00
Reworked AddressTree implementation
This commit is contained in:
parent
a3f19f69c3
commit
9d4df13c1a
23 changed files with 269 additions and 199 deletions
|
|
@ -25,24 +25,20 @@
|
|||
#include "ntop_includes.h"
|
||||
|
||||
class AddressTree {
|
||||
u_int8_t numAddresses;
|
||||
char *addressString[CONST_MAX_NUM_NETWORKS];
|
||||
patricia_tree_t *ptree;
|
||||
|
||||
u_int16_t numAddresses;
|
||||
patricia_tree_t *ptree_v4, *ptree_v6;
|
||||
|
||||
public:
|
||||
AddressTree();
|
||||
~AddressTree();
|
||||
|
||||
u_int8_t getNumAddresses();
|
||||
/*
|
||||
Returns the id of the network added. A negative number is returned on error.
|
||||
*/
|
||||
int16_t addAddress(char *_net);
|
||||
bool addAddresses(char *net);
|
||||
inline u_int16_t getNumAddresses() { return(numAddresses); }
|
||||
bool removeAddress(char *net);
|
||||
int16_t findAddress(int family, void *addr); /* if(rc > 0) networdId else notfound */
|
||||
inline patricia_tree_t* getTree(bool isV4) { return(isV4 ? ptree_v4 : ptree_v6); }
|
||||
patricia_node_t* addAddress(char *_net);
|
||||
bool addAddresses(char *net);
|
||||
void getAddresses(lua_State* vm);
|
||||
inline char *getAddressString(u_int8_t id) { return((id < numAddresses) ? addressString[id] : NULL); };
|
||||
int16_t findAddress(int family, void *addr);
|
||||
};
|
||||
|
||||
#endif /* _ADDRESS_TREE_H_ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue