Changeset View
Changeset View
Standalone View
Standalone View
sys/net/radix.h
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | |||||
#define RNF_ACTIVE 4 /* This node is alive (for rtfree) */ | #define RNF_ACTIVE 4 /* This node is alive (for rtfree) */ | ||||
union { | union { | ||||
struct { /* leaf only data: */ | struct { /* leaf only data: */ | ||||
caddr_t rn_Key; /* object of search */ | caddr_t rn_Key; /* object of search */ | ||||
caddr_t rn_Mask; /* netmask, if present */ | caddr_t rn_Mask; /* netmask, if present */ | ||||
struct radix_node *rn_Dupedkey; | struct radix_node *rn_Dupedkey; | ||||
} rn_leaf; | } rn_leaf; | ||||
struct { /* node only data: */ | struct { /* node only data: */ | ||||
int rn_Off; /* where to start compare */ | int16_t rn_Off; /* where to start compare */ | ||||
int16_t rn_Salen; /* total length of sockaddr */ | |||||
struct radix_node *rn_L;/* progeny */ | struct radix_node *rn_L;/* progeny */ | ||||
struct radix_node *rn_R;/* progeny */ | struct radix_node *rn_R;/* progeny */ | ||||
} rn_node; | } rn_node; | ||||
} rn_u; | } rn_u; | ||||
#ifdef RN_DEBUG | #ifdef RN_DEBUG | ||||
int rn_info; | int rn_info; | ||||
struct radix_node *rn_twin; | struct radix_node *rn_twin; | ||||
struct radix_node *rn_ybro; | struct radix_node *rn_ybro; | ||||
#endif | #endif | ||||
}; | }; | ||||
#define rn_dupedkey rn_u.rn_leaf.rn_Dupedkey | #define rn_dupedkey rn_u.rn_leaf.rn_Dupedkey | ||||
#define rn_key rn_u.rn_leaf.rn_Key | #define rn_key rn_u.rn_leaf.rn_Key | ||||
#define rn_mask rn_u.rn_leaf.rn_Mask | #define rn_mask rn_u.rn_leaf.rn_Mask | ||||
#define rn_offset rn_u.rn_node.rn_Off | #define rn_offset rn_u.rn_node.rn_Off | ||||
#define rn_salen rn_u.rn_node.rn_Salen | |||||
#define rn_left rn_u.rn_node.rn_L | #define rn_left rn_u.rn_node.rn_L | ||||
#define rn_right rn_u.rn_node.rn_R | #define rn_right rn_u.rn_node.rn_R | ||||
/* | /* | ||||
* Annotations to tree concerning potential routes applying to subtrees. | * Annotations to tree concerning potential routes applying to subtrees. | ||||
*/ | */ | ||||
struct radix_mask { | struct radix_mask { | ||||
Show All 9 Lines | |||||
}; | }; | ||||
#define rm_mask rm_rmu.rmu_mask | #define rm_mask rm_rmu.rmu_mask | ||||
#define rm_leaf rm_rmu.rmu_leaf /* extra field would make 32 bytes */ | #define rm_leaf rm_rmu.rmu_leaf /* extra field would make 32 bytes */ | ||||
struct radix_head; | struct radix_head; | ||||
typedef int walktree_f_t(struct radix_node *, void *); | typedef int walktree_f_t(struct radix_node *, void *); | ||||
typedef struct radix_node *rn_matchaddr_f_t(void *v, | typedef struct radix_node *rn_matchaddr_f_t(const void *v, | ||||
struct radix_head *head); | struct radix_head *head); | ||||
typedef struct radix_node *rn_addaddr_f_t(void *v, void *mask, | typedef struct radix_node *rn_addaddr_f_t(void *v, void *mask, | ||||
struct radix_head *head, struct radix_node nodes[]); | struct radix_head *head, struct radix_node nodes[]); | ||||
typedef struct radix_node *rn_deladdr_f_t(void *v, void *mask, | typedef struct radix_node *rn_deladdr_f_t(void *v, void *mask, | ||||
struct radix_head *head); | struct radix_head *head); | ||||
typedef struct radix_node *rn_lookup_f_t(void *v, void *mask, | typedef struct radix_node *rn_lookup_f_t(void *v, void *mask, | ||||
struct radix_head *head); | struct radix_head *head); | ||||
typedef int rn_walktree_t(struct radix_head *head, walktree_f_t *f, | typedef int rn_walktree_t(struct radix_head *head, walktree_f_t *f, | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | #define RADIX_NODE_HEAD_RUNLOCK(rnh) rm_runlock(&(rnh)->rnh_lock,\ | ||||
&_rnh_tracker) | &_rnh_tracker) | ||||
#define RADIX_NODE_HEAD_DESTROY(rnh) rm_destroy(&(rnh)->rnh_lock) | #define RADIX_NODE_HEAD_DESTROY(rnh) rm_destroy(&(rnh)->rnh_lock) | ||||
#define RADIX_NODE_HEAD_LOCK_ASSERT(rnh) rm_assert(&(rnh)->rnh_lock, RA_LOCKED) | #define RADIX_NODE_HEAD_LOCK_ASSERT(rnh) rm_assert(&(rnh)->rnh_lock, RA_LOCKED) | ||||
#define RADIX_NODE_HEAD_WLOCK_ASSERT(rnh) rm_assert(&(rnh)->rnh_lock, RA_WLOCKED) | #define RADIX_NODE_HEAD_WLOCK_ASSERT(rnh) rm_assert(&(rnh)->rnh_lock, RA_WLOCKED) | ||||
#endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
int rn_inithead(void **, int); | int rn_inithead(void **, int); | ||||
int rn_detachhead(void **); | int rn_detachhead(void **); | ||||
void rn_setkeylen(struct radix_head *, int keylen); | |||||
int rn_refines(void *, void *); | int rn_refines(void *, void *); | ||||
struct radix_node *rn_addroute(void *, void *, struct radix_head *, | struct radix_node *rn_addroute(void *, void *, struct radix_head *, | ||||
struct radix_node[2]); | struct radix_node[2]); | ||||
struct radix_node *rn_delete(void *, void *, struct radix_head *); | struct radix_node *rn_delete(void *, void *, struct radix_head *); | ||||
struct radix_node *rn_lookup (void *v_arg, void *m_arg, | struct radix_node *rn_lookup (void *v_arg, void *m_arg, | ||||
struct radix_head *head); | struct radix_head *head); | ||||
struct radix_node *rn_match(void *, struct radix_head *); | struct radix_node *rn_match(const void *, struct radix_head *); | ||||
struct radix_node *rn_match_fixed(const void *, struct radix_head *); | |||||
int rn_walktree_from(struct radix_head *h, void *a, void *m, | int rn_walktree_from(struct radix_head *h, void *a, void *m, | ||||
walktree_f_t *f, void *w); | walktree_f_t *f, void *w); | ||||
int rn_walktree(struct radix_head *, walktree_f_t *, void *); | int rn_walktree(struct radix_head *, walktree_f_t *, void *); | ||||
#endif /* _RADIX_H_ */ | #endif /* _RADIX_H_ */ |