Add support for MAC to Patricia tree. Expose full API to applications. Add utility functions.
This commit is contained in:
@@ -962,7 +962,26 @@ extern "C" {
|
||||
const char* ndpi_http_method2str(ndpi_http_method m);
|
||||
ndpi_http_method ndpi_http_str2method(const char* method, u_int16_t method_len);
|
||||
|
||||
/* ptree (trie) API */
|
||||
/* Utility functions to fill prefix (used by the patricia tree) */
|
||||
int ndpi_fill_prefix_v4(ndpi_prefix_t *p, const struct in_addr *a, int b, int mb);
|
||||
int ndpi_fill_prefix_v6(ndpi_prefix_t *prefix, const struct in6_addr *addr, int bits, int maxbits);
|
||||
int ndpi_fill_prefix_mac(ndpi_prefix_t *prefix, u_int8_t *mac, int bits, int maxbits);
|
||||
|
||||
/* Patricia tree API (radix tree supporting IPv4/IPv6/MAC) */
|
||||
ndpi_patricia_tree_t *ndpi_patricia_new(u_int16_t maxbits);
|
||||
ndpi_patricia_tree_t *ndpi_patricia_clone (const ndpi_patricia_tree_t * const from);
|
||||
void ndpi_patricia_destroy(ndpi_patricia_tree_t *patricia, ndpi_void_fn_t func);
|
||||
|
||||
ndpi_patricia_node_t *ndpi_patricia_search_exact(ndpi_patricia_tree_t *patricia, ndpi_prefix_t *prefix);
|
||||
ndpi_patricia_node_t *ndpi_patricia_search_best(ndpi_patricia_tree_t *patricia, ndpi_prefix_t *prefix);
|
||||
ndpi_patricia_node_t *ndpi_patricia_lookup(ndpi_patricia_tree_t *patricia, ndpi_prefix_t *prefix);
|
||||
size_t ndpi_patricia_walk_inorder(ndpi_patricia_node_t *node, ndpi_void_fn2_t func);
|
||||
void ndpi_patricia_remove(ndpi_patricia_tree_t *patricia, ndpi_patricia_node_t *node);
|
||||
|
||||
void ndpi_patricia_set_node_u64(ndpi_patricia_node_t *node, u_int64_t value);
|
||||
u_int64_t ndpi_patricia_get_node_u64(ndpi_patricia_node_t *node);
|
||||
|
||||
/* ptree (trie) API - a wrapper on top of Patricia that seamlessly handle IPv4 and IPv6 */
|
||||
ndpi_ptree_t* ndpi_ptree_create(void);
|
||||
int ndpi_ptree_insert(ndpi_ptree_t *tree, const ndpi_ip_addr_t *addr, u_int8_t bits, u_int64_t user_data);
|
||||
int ndpi_ptree_match_addr(ndpi_ptree_t *tree, const ndpi_ip_addr_t *addr, u_int64_t *user_data);
|
||||
|
||||
Reference in New Issue
Block a user