OpenSDN source code
patricia_api.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Juniper Networks, Inc. All rights reserved.
3  * Copyright Contributors to the OpenSDN project
4  */
5 
6 #ifndef vnsw_agent_patricia_api_h
7 #define vnsw_agent_patricia_api_h
8 
9 #include "mcast_common.h"
10 
11 typedef struct patroot_ {
14 
15 typedef struct patnode_ {
18 
19 #define PATNODE_TO_STRUCT(function, structure, pat_node) \
20  static inline structure *(function)(patnode *node) { \
21  if (node) { \
22  return (structure *)((char *)node - offsetof(structure, pat_node)); \
23  } \
24  return NULL; \
25  }
26 
27 extern patroot *patricia_root_init(patroot *root, boolean key_is_ptr,
28  uint16_t klen, uint8_t offset);
29 extern void patricia_root_delete(patroot *root);
30 extern boolean patricia_add(patroot *root, patnode *node);
31 extern boolean patricia_delete(patroot *root, patnode *node);
32 extern patnode *patricia_lookup(patroot *root, const void *key);
35 extern patnode *patricia_get_next(patroot *root, patnode *node);
36 extern patnode *patricia_get_previous(patroot *root, patnode *node);
37 extern patnode *patricia_lookup_geq(patroot *root, patnode *node);
38 
39 #endif /* vnsw_agent_patricia_api_h */
boolean patricia_delete(patroot *root, patnode *node)
Definition: patricia_api.cc:67
boolean patricia_add(patroot *root, patnode *node)
Definition: patricia_api.cc:50
patnode * patricia_lookup_geq(patroot *root, patnode *node)
patnode * patricia_lookup(patroot *root, const void *key)
Definition: patricia_api.cc:83
patnode * patricia_get_next(patroot *root, patnode *node)
struct patnode_ patnode
patnode * patricia_lookup_least(patroot *root)
void patricia_root_delete(patroot *root)
Definition: patricia_api.cc:36
struct patroot_ patroot
patnode * patricia_get_previous(patroot *root, patnode *node)
patnode * patricia_lookup_greatest(patroot *root)
patroot * patricia_root_init(patroot *root, boolean key_is_ptr, uint16_t klen, uint8_t offset)
Definition: patricia_api.cc:15
void * agent_patnode
Definition: patricia_api.h:16
void * agent_patroot
Definition: patricia_api.h:12