2 * netsniff-ng - the packet sniffing beast
3 * By Daniel Borkmann <daniel@netsniff-ng.org>
4 * Copyright 2011 Daniel Borkmann, rewritten
5 * Copyright 1991-2007 Kawahara Lab., Kyoto University
6 * Copyright 2000-2005 Shikano Lab., Nara Institute of Science and Technology
7 * Copyright 2005-2007 Julius project team, Nagoya Institute of Technology
9 * Subject to the GPL, version 2.
15 #include <netinet/in.h>
19 struct patricia_node
{
22 struct sockaddr_storage
*addr
;
28 struct patricia_node
*l
, *r
;
29 } __cacheline_aligned
;
31 extern int ptree_search_data_nearest(void *str
, size_t sstr
,
32 struct sockaddr_storage
*addr
, size_t *alen
,
33 struct patricia_node
*root
);
34 extern int ptree_search_data_exact(void *str
, size_t sstr
,
35 struct sockaddr_storage
*addr
, size_t *alen
,
36 struct patricia_node
*root
);
37 extern int ptree_add_entry(void *str
, size_t sstr
, int data
,
38 struct sockaddr_storage
*addr
, size_t alen
,
39 struct patricia_node
**root
);
40 extern void ptree_del_entry(void *str
, size_t sstr
,
41 struct patricia_node
**root
);
42 extern void ptree_get_key(int data
, struct patricia_node
*node
,
43 struct patricia_node
**wanted
);
44 extern void ptree_get_key_addr(struct sockaddr_storage
*addr
, size_t alen
,
45 struct patricia_node
*node
,
46 struct patricia_node
**wanted
);
47 extern void ptree_display(struct patricia_node
*node
, int level
);
48 extern void ptree_free(struct patricia_node
*root
);
50 #define ptree_maybe_add_entry ptree_add_entry
52 #endif /* PATRICIA_H */