suricata
tree.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _T_ASSERT(a)
 
#define SPLAY_HEAD(name, type)
 
#define SPLAY_INITIALIZER(root)   { NULL }
 
#define SPLAY_INIT(root)
 
#define SPLAY_ENTRY(type)
 
#define SPLAY_LEFT(elm, field)   (elm)->field.spe_left
 
#define SPLAY_RIGHT(elm, field)   (elm)->field.spe_right
 
#define SPLAY_ROOT(head)   (head)->sph_root
 
#define SPLAY_EMPTY(head)   (SPLAY_ROOT(head) == NULL)
 
#define SPLAY_ROTATE_RIGHT(head, tmp, field)
 
#define SPLAY_ROTATE_LEFT(head, tmp, field)
 
#define SPLAY_LINKLEFT(head, tmp, field)
 
#define SPLAY_LINKRIGHT(head, tmp, field)
 
#define SPLAY_ASSEMBLE(head, node, left, right, field)
 
#define SPLAY_PROTOTYPE(name, type, field, cmp)
 
#define SPLAY_GENERATE(name, type, field, cmp)
 
#define SPLAY_NEGINF   -1
 
#define SPLAY_INF   1
 
#define SPLAY_INSERT(name, x, y)   name##_SPLAY_INSERT(x, y)
 
#define SPLAY_REMOVE(name, x, y)   name##_SPLAY_REMOVE(x, y)
 
#define SPLAY_FIND(name, x, y)   name##_SPLAY_FIND(x, y)
 
#define SPLAY_NEXT(name, x, y)   name##_SPLAY_NEXT(x, y)
 
#define SPLAY_MIN(name, x)
 
#define SPLAY_MAX(name, x)
 
#define SPLAY_FOREACH(x, name, head)
 
#define RB_HEAD(name, type)
 
#define RB_INITIALIZER(root)   { NULL }
 
#define RB_INIT(root)
 
#define RB_BLACK   0
 
#define RB_RED   1
 
#define RB_ENTRY(type)
 
#define RB_LEFT(elm, field)   (elm)->field.rbe_left
 
#define RB_RIGHT(elm, field)   (elm)->field.rbe_right
 
#define RB_PARENT(elm, field)   (elm)->field.rbe_parent
 
#define RB_COLOR(elm, field)   (elm)->field.rbe_color
 
#define RB_ROOT(head)   (head)->rbh_root
 
#define RB_EMPTY(head)   (RB_ROOT(head) == NULL)
 
#define RB_SET(elm, parent, field)
 
#define RB_SET_BLACKRED(black, red, field)
 
#define RB_AUGMENT(x)   do {} while (0)
 
#define RB_ROTATE_LEFT(head, elm, tmp, field)
 
#define RB_ROTATE_RIGHT(head, elm, tmp, field)
 
#define RB_PROTOTYPE(name, type, field, cmp)   RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
 
#define RB_PROTOTYPE_STATIC(name, type, field, cmp)   RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static)
 
#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr)
 
#define RB_PROTOTYPE_INSERT_COLOR(name, type, attr)   attr void name##_RB_INSERT_COLOR(struct name *, struct type *)
 
#define RB_PROTOTYPE_REMOVE_COLOR(name, type, attr)   attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *)
 
#define RB_PROTOTYPE_REMOVE(name, type, attr)   attr struct type *name##_RB_REMOVE(struct name *, struct type *)
 
#define RB_PROTOTYPE_INSERT(name, type, attr)   attr struct type *name##_RB_INSERT(struct name *, struct type *)
 
#define RB_PROTOTYPE_FIND(name, type, attr)   attr struct type *name##_RB_FIND(struct name *, struct type *)
 
#define RB_PROTOTYPE_NFIND(name, type, attr)   attr struct type *name##_RB_NFIND(struct name *, struct type *)
 
#define RB_PROTOTYPE_NEXT(name, type, attr)   attr struct type *name##_RB_NEXT(struct type *)
 
#define RB_PROTOTYPE_PREV(name, type, attr)   attr struct type *name##_RB_PREV(struct type *)
 
#define RB_PROTOTYPE_MINMAX(name, type, attr)   attr struct type *name##_RB_MINMAX(struct name *, int)
 
#define RB_GENERATE(name, type, field, cmp)   RB_GENERATE_INTERNAL(name, type, field, cmp,)
 
#define RB_GENERATE_STATIC(name, type, field, cmp)   RB_GENERATE_INTERNAL(name, type, field, cmp, __unused static)
 
#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr)
 
#define RB_GENERATE_INSERT_COLOR(name, type, field, attr)
 
#define RB_GENERATE_REMOVE_COLOR(name, type, field, attr)
 
#define RB_GENERATE_REMOVE(name, type, field, attr)
 
#define RB_GENERATE_INSERT(name, type, field, cmp, attr)
 
#define RB_GENERATE_FIND(name, type, field, cmp, attr)
 
#define RB_GENERATE_NFIND(name, type, field, cmp, attr)
 
#define RB_GENERATE_NEXT(name, type, field, attr)
 
#define RB_GENERATE_PREV(name, type, field, attr)
 
#define RB_GENERATE_MINMAX(name, type, field, attr)
 
#define RB_NEGINF   -1
 
#define RB_INF   1
 
#define RB_INSERT(name, x, y)   name##_RB_INSERT(x, y)
 
#define RB_REMOVE(name, x, y)   name##_RB_REMOVE(x, y)
 
#define RB_FIND(name, x, y)   name##_RB_FIND(x, y)
 
#define RB_NFIND(name, x, y)   name##_RB_NFIND(x, y)
 
#define RB_NEXT(name, x, y)   name##_RB_NEXT(y)
 
#define RB_PREV(name, x, y)   name##_RB_PREV(y)
 
#define RB_MIN(name, x)   name##_RB_MINMAX(x, RB_NEGINF)
 
#define RB_MAX(name, x)   name##_RB_MINMAX(x, RB_INF)
 
#define RB_FOREACH(x, name, head)
 
#define RB_FOREACH_FROM(x, name, y)
 
#define RB_FOREACH_SAFE(x, name, head, y)
 
#define RB_FOREACH_REVERSE(x, name, head)
 
#define RB_FOREACH_REVERSE_FROM(x, name, y)
 
#define RB_FOREACH_REVERSE_SAFE(x, name, head, y)
 

Macro Definition Documentation

#define _T_ASSERT (   a)

Definition at line 38 of file tree.h.

#define RB_AUGMENT (   x)    do {} while (0)

Definition at line 343 of file tree.h.

#define RB_BLACK   0

Definition at line 314 of file tree.h.

#define RB_COLOR (   elm,
  field 
)    (elm)->field.rbe_color

Definition at line 327 of file tree.h.

#define RB_ENTRY (   type)
Value:
struct { \
struct type *rbe_left; /* left element */ \
struct type *rbe_right; /* right element */ \
struct type *rbe_parent; /* parent element */ \
int rbe_color; /* node color */ \
}
uint8_t type

Definition at line 316 of file tree.h.

#define RB_FIND (   name,
  x,
 
)    name##_RB_FIND(x, y)

Definition at line 776 of file tree.h.

#define RB_FOREACH (   x,
  name,
  head 
)
Value:
for ((x) = RB_MIN(name, head); \
(x) != NULL; \
(x) = name##_RB_NEXT(x))
Flow * head
Definition: flow-hash.h:102
#define RB_MIN(name, x)
Definition: tree.h:780

Definition at line 783 of file tree.h.

Referenced by DefragTrackerFreeFrags(), StreamingBufferFree(), StreamNeedsReassembly(), StreamTcpReassembleInsertSegment(), StreamTcpSegmentForEach(), and TcpSackCompare().

#define RB_FOREACH_FROM (   x,
  name,
 
)
Value:
for ((x) = (y); \
((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \
(x) = (y))

Definition at line 788 of file tree.h.

Referenced by DefragTrackerFreeFrags(), StreamingBufferFree(), TcpSackCompare(), and TcpSegmentCompare().

#define RB_FOREACH_REVERSE (   x,
  name,
  head 
)
Value:
for ((x) = RB_MAX(name, head); \
(x) != NULL; \
(x) = name##_RB_PREV(x))
Flow * head
Definition: flow-hash.h:102
#define RB_MAX(name, x)
Definition: tree.h:781

Definition at line 798 of file tree.h.

#define RB_FOREACH_REVERSE_FROM (   x,
  name,
 
)
Value:
for ((x) = (y); \
((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \
(x) = (y))

Definition at line 803 of file tree.h.

Referenced by StreamingBufferFree(), TcpSackCompare(), and TcpSegmentCompare().

#define RB_FOREACH_REVERSE_SAFE (   x,
  name,
  head,
 
)
Value:
for ((x) = RB_MAX(name, head); \
((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \
(x) = (y))
Flow * head
Definition: flow-hash.h:102
#define RB_MAX(name, x)
Definition: tree.h:781

Definition at line 808 of file tree.h.

#define RB_FOREACH_SAFE (   x,
  name,
  head,
 
)
Value:
for ((x) = RB_MIN(name, head); \
((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \
(x) = (y))
Flow * head
Definition: flow-hash.h:102
#define RB_MIN(name, x)
Definition: tree.h:780

Definition at line 793 of file tree.h.

Referenced by DefragTrackerFreeFrags(), StreamingBufferFree(), StreamTcpPruneSession(), StreamTcpReassembleInsertSegment(), StreamTcpReturnStreamSegments(), StreamTcpSackFreeList(), and StreamTcpSackPruneList().

#define RB_GENERATE (   name,
  type,
  field,
  cmp 
)    RB_GENERATE_INTERNAL(name, type, field, cmp,)

Definition at line 423 of file tree.h.

#define RB_GENERATE_FIND (   name,
  type,
  field,
  cmp,
  attr 
)
Value:
/* Finds the node with the same key as elm */ \
attr struct type * \
name##_RB_FIND(struct name *head, struct type *elm) \
{ \
struct type *tmp = RB_ROOT(head); \
int comp; \
while (tmp) { \
comp = cmp(elm, tmp); \
if (comp < 0) \
tmp = RB_LEFT(tmp, field); \
else if (comp > 0) \
tmp = RB_RIGHT(tmp, field); \
else \
return (tmp); \
} \
return (NULL); \
}
#define RB_ROOT(head)
Definition: tree.h:328
Flow * head
Definition: flow-hash.h:102
#define RB_LEFT(elm, field)
Definition: tree.h:324
uint8_t type
#define RB_RIGHT(elm, field)
Definition: tree.h:325

Definition at line 668 of file tree.h.

#define RB_GENERATE_INSERT (   name,
  type,
  field,
  cmp,
  attr 
)
Value:
/* Inserts a node into the RB tree */ \
attr struct type * \
name##_RB_INSERT(struct name *head, struct type *elm) \
{ \
struct type *tmp; \
struct type *parent = NULL; \
int comp = 0; \
tmp = RB_ROOT(head); \
while (tmp) { \
parent = tmp; \
comp = (cmp)(elm, parent); \
if (comp < 0) \
tmp = RB_LEFT(tmp, field); \
else if (comp > 0) \
tmp = RB_RIGHT(tmp, field); \
else \
return (tmp); \
} \
RB_SET(elm, parent, field); \
if (parent != NULL) { \
if (comp < 0) \
RB_LEFT(parent, field) = elm; \
RB_RIGHT(parent, field) = elm; \
RB_AUGMENT(parent); \
RB_ROOT(head) = elm; \
name##_RB_INSERT_COLOR(head, elm); \
return (NULL); \
}
#define RB_ROOT(head)
Definition: tree.h:328
Flow * head
Definition: flow-hash.h:102
#define RB_LEFT(elm, field)
Definition: tree.h:324
#define RB_AUGMENT(x)
Definition: tree.h:343
uint8_t type
#define RB_RIGHT(elm, field)
Definition: tree.h:325
#define RB_SET(elm, parent, field)
Definition: tree.h:331

Definition at line 636 of file tree.h.

#define RB_GENERATE_INSERT_COLOR (   name,
  type,
  field,
  attr 
)

Definition at line 438 of file tree.h.

#define RB_GENERATE_INTERNAL (   name,
  type,
  field,
  cmp,
  attr 
)
Value:
RB_GENERATE_INSERT_COLOR(name, type, field, attr) \
RB_GENERATE_REMOVE_COLOR(name, type, field, attr) \
RB_GENERATE_INSERT(name, type, field, cmp, attr) \
RB_GENERATE_REMOVE(name, type, field, attr) \
RB_GENERATE_FIND(name, type, field, cmp, attr) \
RB_GENERATE_NFIND(name, type, field, cmp, attr) \
RB_GENERATE_NEXT(name, type, field, attr) \
RB_GENERATE_PREV(name, type, field, attr) \
RB_GENERATE_MINMAX(name, type, field, attr)
#define RB_GENERATE_REMOVE_COLOR(name, type, field, attr)
Definition: tree.h:484
#define RB_GENERATE_NEXT(name, type, field, attr)
Definition: tree.h:709
uint8_t type
#define RB_GENERATE_NFIND(name, type, field, cmp, attr)
Definition: tree.h:687
#define RB_GENERATE_FIND(name, type, field, cmp, attr)
Definition: tree.h:668
#define RB_GENERATE_INSERT_COLOR(name, type, field, attr)
Definition: tree.h:438
#define RB_GENERATE_MINMAX(name, type, field, attr)
Definition: tree.h:755
#define RB_GENERATE_REMOVE(name, type, field, attr)
Definition: tree.h:565
#define RB_GENERATE_PREV(name, type, field, attr)
Definition: tree.h:732
#define RB_GENERATE_INSERT(name, type, field, cmp, attr)
Definition: tree.h:636

Definition at line 427 of file tree.h.

#define RB_GENERATE_MINMAX (   name,
  type,
  field,
  attr 
)
Value:
attr struct type * \
name##_RB_MINMAX(struct name *head, int val) \
{ \
struct type *tmp = RB_ROOT(head); \
struct type *parent = NULL; \
while (tmp) { \
parent = tmp; \
if (val < 0) \
tmp = RB_LEFT(tmp, field); \
else \
tmp = RB_RIGHT(tmp, field); \
} \
return (parent); \
}
#define RB_ROOT(head)
Definition: tree.h:328
Flow * head
Definition: flow-hash.h:102
#define RB_LEFT(elm, field)
Definition: tree.h:324
uint8_t type
#define RB_RIGHT(elm, field)
Definition: tree.h:325

Definition at line 755 of file tree.h.

#define RB_GENERATE_NEXT (   name,
  type,
  field,
  attr 
)
Value:
/* ARGSUSED */ \
attr struct type * \
name##_RB_NEXT(struct type *elm) \
{ \
if (RB_RIGHT(elm, field)) { \
elm = RB_RIGHT(elm, field); \
while (RB_LEFT(elm, field)) \
elm = RB_LEFT(elm, field); \
} else { \
if (RB_PARENT(elm, field) && \
(elm == RB_LEFT(RB_PARENT(elm, field), field))) \
elm = RB_PARENT(elm, field); \
else { \
while (RB_PARENT(elm, field) && \
(elm == RB_RIGHT(RB_PARENT(elm, field), field)))\
elm = RB_PARENT(elm, field); \
elm = RB_PARENT(elm, field); \
} \
} \
return (elm); \
}
#define RB_LEFT(elm, field)
Definition: tree.h:324
uint8_t type
#define RB_RIGHT(elm, field)
Definition: tree.h:325
#define RB_PARENT(elm, field)
Definition: tree.h:326

Definition at line 709 of file tree.h.

#define RB_GENERATE_NFIND (   name,
  type,
  field,
  cmp,
  attr 
)
Value:
/* Finds the first node greater than or equal to the search key */ \
attr struct type * \
name##_RB_NFIND(struct name *head, struct type *elm) \
{ \
struct type *tmp = RB_ROOT(head); \
struct type *res = NULL; \
int comp; \
while (tmp) { \
comp = cmp(elm, tmp); \
if (comp < 0) { \
res = tmp; \
tmp = RB_LEFT(tmp, field); \
} \
else if (comp > 0) \
tmp = RB_RIGHT(tmp, field); \
else \
return (tmp); \
} \
return (res); \
}
#define RB_ROOT(head)
Definition: tree.h:328
Flow * head
Definition: flow-hash.h:102
#define RB_LEFT(elm, field)
Definition: tree.h:324
uint8_t type
#define RB_RIGHT(elm, field)
Definition: tree.h:325
PoolThreadReserved res

Definition at line 687 of file tree.h.

#define RB_GENERATE_PREV (   name,
  type,
  field,
  attr 
)
Value:
/* ARGSUSED */ \
attr struct type * \
name##_RB_PREV(struct type *elm) \
{ \
if (RB_LEFT(elm, field)) { \
elm = RB_LEFT(elm, field); \
while (RB_RIGHT(elm, field)) \
elm = RB_RIGHT(elm, field); \
} else { \
if (RB_PARENT(elm, field) && \
(elm == RB_RIGHT(RB_PARENT(elm, field), field))) \
elm = RB_PARENT(elm, field); \
else { \
while (RB_PARENT(elm, field) && \
(elm == RB_LEFT(RB_PARENT(elm, field), field)))\
elm = RB_PARENT(elm, field); \
elm = RB_PARENT(elm, field); \
} \
} \
return (elm); \
}
#define RB_LEFT(elm, field)
Definition: tree.h:324
uint8_t type
#define RB_RIGHT(elm, field)
Definition: tree.h:325
#define RB_PARENT(elm, field)
Definition: tree.h:326

Definition at line 732 of file tree.h.

#define RB_GENERATE_REMOVE (   name,
  type,
  field,
  attr 
)

Definition at line 565 of file tree.h.

#define RB_GENERATE_REMOVE_COLOR (   name,
  type,
  field,
  attr 
)

Definition at line 484 of file tree.h.

#define RB_GENERATE_STATIC (   name,
  type,
  field,
  cmp 
)    RB_GENERATE_INTERNAL(name, type, field, cmp, __unused static)

Definition at line 425 of file tree.h.

#define RB_HEAD (   name,
  type 
)
Value:
struct name { \
struct type *rbh_root; /* root of the tree */ \
}
uint8_t type

Definition at line 302 of file tree.h.

#define RB_INF   1

Definition at line 772 of file tree.h.

#define RB_INIT (   root)
Value:
do { \
(root)->rbh_root = NULL; \
} while (/*CONSTCOND*/ 0)

Definition at line 310 of file tree.h.

#define RB_INITIALIZER (   root)    { NULL }

Definition at line 307 of file tree.h.

#define RB_INSERT (   name,
  x,
 
)    name##_RB_INSERT(x, y)

Definition at line 774 of file tree.h.

#define RB_LEFT (   elm,
  field 
)    (elm)->field.rbe_left

Definition at line 324 of file tree.h.

Referenced by SBB_RB_FIND_INCLUSIVE().

#define RB_MAX (   name,
 
)    name##_RB_MINMAX(x, RB_INF)

Definition at line 781 of file tree.h.

#define RB_MIN (   name,
 
)    name##_RB_MINMAX(x, RB_NEGINF)
#define RB_NEGINF   -1

Definition at line 771 of file tree.h.

#define RB_NEXT (   name,
  x,
 
)    name##_RB_NEXT(y)

Definition at line 778 of file tree.h.

#define RB_NFIND (   name,
  x,
 
)    name##_RB_NFIND(x, y)

Definition at line 777 of file tree.h.

Referenced by DefragRbFragCompare().

#define RB_PARENT (   elm,
  field 
)    (elm)->field.rbe_parent

Definition at line 326 of file tree.h.

#define RB_PREV (   name,
  x,
 
)    name##_RB_PREV(y)

Definition at line 779 of file tree.h.

#define RB_PROTOTYPE (   name,
  type,
  field,
  cmp 
)    RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)

Definition at line 387 of file tree.h.

#define RB_PROTOTYPE_FIND (   name,
  type,
  attr 
)    attr struct type *name##_RB_FIND(struct name *, struct type *)

Definition at line 409 of file tree.h.

#define RB_PROTOTYPE_INSERT (   name,
  type,
  attr 
)    attr struct type *name##_RB_INSERT(struct name *, struct type *)

Definition at line 407 of file tree.h.

#define RB_PROTOTYPE_INSERT_COLOR (   name,
  type,
  attr 
)    attr void name##_RB_INSERT_COLOR(struct name *, struct type *)

Definition at line 401 of file tree.h.

#define RB_PROTOTYPE_INTERNAL (   name,
  type,
  field,
  cmp,
  attr 
)
Value:
RB_PROTOTYPE_FIND(name, type, attr); \
RB_PROTOTYPE_NFIND(name, type, attr); \
RB_PROTOTYPE_NEXT(name, type, attr); \
RB_PROTOTYPE_PREV(name, type, attr); \
#define RB_PROTOTYPE_INSERT(name, type, attr)
Definition: tree.h:407
#define RB_PROTOTYPE_FIND(name, type, attr)
Definition: tree.h:409
uint8_t type
#define RB_PROTOTYPE_INSERT_COLOR(name, type, attr)
Definition: tree.h:401
#define RB_PROTOTYPE_REMOVE_COLOR(name, type, attr)
Definition: tree.h:403
#define RB_PROTOTYPE_NFIND(name, type, attr)
Definition: tree.h:411
#define RB_PROTOTYPE_MINMAX(name, type, attr)
Definition: tree.h:417
#define RB_PROTOTYPE_REMOVE(name, type, attr)
Definition: tree.h:405
#define RB_PROTOTYPE_PREV(name, type, attr)
Definition: tree.h:415
#define RB_PROTOTYPE_NEXT(name, type, attr)
Definition: tree.h:413

Definition at line 391 of file tree.h.

#define RB_PROTOTYPE_MINMAX (   name,
  type,
  attr 
)    attr struct type *name##_RB_MINMAX(struct name *, int)

Definition at line 417 of file tree.h.

#define RB_PROTOTYPE_NEXT (   name,
  type,
  attr 
)    attr struct type *name##_RB_NEXT(struct type *)

Definition at line 413 of file tree.h.

#define RB_PROTOTYPE_NFIND (   name,
  type,
  attr 
)    attr struct type *name##_RB_NFIND(struct name *, struct type *)

Definition at line 411 of file tree.h.

#define RB_PROTOTYPE_PREV (   name,
  type,
  attr 
)    attr struct type *name##_RB_PREV(struct type *)

Definition at line 415 of file tree.h.

#define RB_PROTOTYPE_REMOVE (   name,
  type,
  attr 
)    attr struct type *name##_RB_REMOVE(struct name *, struct type *)

Definition at line 405 of file tree.h.

#define RB_PROTOTYPE_REMOVE_COLOR (   name,
  type,
  attr 
)    attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *)

Definition at line 403 of file tree.h.

#define RB_PROTOTYPE_STATIC (   name,
  type,
  field,
  cmp 
)    RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static)

Definition at line 389 of file tree.h.

#define RB_RED   1

Definition at line 315 of file tree.h.

#define RB_REMOVE (   name,
  x,
 
)    name##_RB_REMOVE(x, y)
#define RB_RIGHT (   elm,
  field 
)    (elm)->field.rbe_right

Definition at line 325 of file tree.h.

Referenced by SBB_RB_FIND_INCLUSIVE().

#define RB_ROOT (   head)    (head)->rbh_root

Definition at line 328 of file tree.h.

Referenced by SBB_RB_FIND_INCLUSIVE().

#define RB_ROTATE_LEFT (   head,
  elm,
  tmp,
  field 
)
Value:
do { \
(tmp) = RB_RIGHT(elm, field); \
if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \
RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \
} \
RB_AUGMENT(elm); \
if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \
if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \
RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \
RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \
} else \
(head)->rbh_root = (tmp); \
RB_LEFT(tmp, field) = (elm); \
RB_PARENT(elm, field) = (tmp); \
RB_AUGMENT(tmp); \
if ((RB_PARENT(tmp, field))) \
RB_AUGMENT(RB_PARENT(tmp, field)); \
} while (/*CONSTCOND*/ 0)
Flow * head
Definition: flow-hash.h:102
#define RB_LEFT(elm, field)
Definition: tree.h:324
#define RB_AUGMENT(x)
Definition: tree.h:343
#define RB_RIGHT(elm, field)
Definition: tree.h:325
#define RB_PARENT(elm, field)
Definition: tree.h:326

Definition at line 346 of file tree.h.

#define RB_ROTATE_RIGHT (   head,
  elm,
  tmp,
  field 
)
Value:
do { \
(tmp) = RB_LEFT(elm, field); \
if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \
RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \
} \
RB_AUGMENT(elm); \
if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \
if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \
RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \
RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \
} else \
(head)->rbh_root = (tmp); \
RB_RIGHT(tmp, field) = (elm); \
RB_PARENT(elm, field) = (tmp); \
RB_AUGMENT(tmp); \
if ((RB_PARENT(tmp, field))) \
RB_AUGMENT(RB_PARENT(tmp, field)); \
} while (/*CONSTCOND*/ 0)
Flow * head
Definition: flow-hash.h:102
#define RB_LEFT(elm, field)
Definition: tree.h:324
#define RB_AUGMENT(x)
Definition: tree.h:343
#define RB_RIGHT(elm, field)
Definition: tree.h:325
#define RB_PARENT(elm, field)
Definition: tree.h:326

Definition at line 366 of file tree.h.

#define RB_SET (   elm,
  parent,
  field 
)
Value:
do { \
RB_PARENT(elm, field) = parent; \
RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \
RB_COLOR(elm, field) = RB_RED; \
} while (/*CONSTCOND*/ 0)
#define RB_LEFT(elm, field)
Definition: tree.h:324
#define RB_RED
Definition: tree.h:315
#define RB_COLOR(elm, field)
Definition: tree.h:327
#define RB_RIGHT(elm, field)
Definition: tree.h:325
#define RB_PARENT(elm, field)
Definition: tree.h:326

Definition at line 331 of file tree.h.

#define RB_SET_BLACKRED (   black,
  red,
  field 
)
Value:
do { \
RB_COLOR(black, field) = RB_BLACK; \
RB_COLOR(red, field) = RB_RED; \
} while (/*CONSTCOND*/ 0)
#define RB_BLACK
Definition: tree.h:314
#define RB_RED
Definition: tree.h:315
#define RB_COLOR(elm, field)
Definition: tree.h:327

Definition at line 337 of file tree.h.

#define SPLAY_ASSEMBLE (   head,
  node,
  left,
  right,
  field 
)
Value:
do { \
SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field); \
SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field);\
SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field); \
SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field); \
} while (/*CONSTCOND*/ 0)
Flow * head
Definition: flow-hash.h:102
#define SPLAY_LEFT(elm, field)
Definition: tree.h:86
#define SPLAY_RIGHT(elm, field)
Definition: tree.h:87

Definition at line 116 of file tree.h.

#define SPLAY_EMPTY (   head)    (SPLAY_ROOT(head) == NULL)

Definition at line 89 of file tree.h.

#define SPLAY_ENTRY (   type)
Value:
struct { \
struct type *spe_left; /* left element */ \
struct type *spe_right; /* right element */ \
}
uint8_t type

Definition at line 80 of file tree.h.

#define SPLAY_FIND (   name,
  x,
 
)    name##_SPLAY_FIND(x, y)

Definition at line 289 of file tree.h.

#define SPLAY_FOREACH (   x,
  name,
  head 
)
Value:
for ((x) = SPLAY_MIN(name, head); \
(x) != NULL; \
(x) = SPLAY_NEXT(name, head, x))
Flow * head
Definition: flow-hash.h:102
#define SPLAY_NEXT(name, x, y)
Definition: tree.h:290
#define SPLAY_MIN(name, x)
Definition: tree.h:291

Definition at line 296 of file tree.h.

#define SPLAY_GENERATE (   name,
  type,
  field,
  cmp 
)

Definition at line 167 of file tree.h.

#define SPLAY_HEAD (   name,
  type 
)
Value:
struct name { \
struct type *sph_root; /* root of the tree */ \
}
uint8_t type

Definition at line 68 of file tree.h.

#define SPLAY_INF   1

Definition at line 285 of file tree.h.

#define SPLAY_INIT (   root)
Value:
do { \
(root)->sph_root = NULL; \
} while (/*CONSTCOND*/ 0)

Definition at line 76 of file tree.h.

#define SPLAY_INITIALIZER (   root)    { NULL }

Definition at line 73 of file tree.h.

#define SPLAY_INSERT (   name,
  x,
 
)    name##_SPLAY_INSERT(x, y)

Definition at line 287 of file tree.h.

#define SPLAY_LEFT (   elm,
  field 
)    (elm)->field.spe_left

Definition at line 86 of file tree.h.

#define SPLAY_LINKLEFT (   head,
  tmp,
  field 
)
Value:
do { \
SPLAY_LEFT(tmp, field) = (head)->sph_root; \
tmp = (head)->sph_root; \
(head)->sph_root = SPLAY_LEFT((head)->sph_root, field); \
} while (/*CONSTCOND*/ 0)
Flow * head
Definition: flow-hash.h:102
#define SPLAY_LEFT(elm, field)
Definition: tree.h:86

Definition at line 104 of file tree.h.

#define SPLAY_LINKRIGHT (   head,
  tmp,
  field 
)
Value:
do { \
SPLAY_RIGHT(tmp, field) = (head)->sph_root; \
tmp = (head)->sph_root; \
(head)->sph_root = SPLAY_RIGHT((head)->sph_root, field); \
} while (/*CONSTCOND*/ 0)
Flow * head
Definition: flow-hash.h:102
#define SPLAY_RIGHT(elm, field)
Definition: tree.h:87

Definition at line 110 of file tree.h.

#define SPLAY_MAX (   name,
 
)
Value:
(SPLAY_EMPTY(x) ? NULL \
: name##_SPLAY_MIN_MAX(x, SPLAY_INF))
#define SPLAY_EMPTY(head)
Definition: tree.h:89
#define SPLAY_INF
Definition: tree.h:285

Definition at line 293 of file tree.h.

#define SPLAY_MIN (   name,
 
)
Value:
(SPLAY_EMPTY(x) ? NULL \
: name##_SPLAY_MIN_MAX(x, SPLAY_NEGINF))
#define SPLAY_NEGINF
Definition: tree.h:284
#define SPLAY_EMPTY(head)
Definition: tree.h:89

Definition at line 291 of file tree.h.

#define SPLAY_NEGINF   -1

Definition at line 284 of file tree.h.

#define SPLAY_NEXT (   name,
  x,
 
)    name##_SPLAY_NEXT(x, y)

Definition at line 290 of file tree.h.

#define SPLAY_PROTOTYPE (   name,
  type,
  field,
  cmp 
)

Definition at line 125 of file tree.h.

#define SPLAY_REMOVE (   name,
  x,
 
)    name##_SPLAY_REMOVE(x, y)

Definition at line 288 of file tree.h.

#define SPLAY_RIGHT (   elm,
  field 
)    (elm)->field.spe_right

Definition at line 87 of file tree.h.

#define SPLAY_ROOT (   head)    (head)->sph_root

Definition at line 88 of file tree.h.

#define SPLAY_ROTATE_LEFT (   head,
  tmp,
  field 
)
Value:
do { \
SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field); \
SPLAY_LEFT(tmp, field) = (head)->sph_root; \
(head)->sph_root = tmp; \
} while (/*CONSTCOND*/ 0)
Flow * head
Definition: flow-hash.h:102
#define SPLAY_LEFT(elm, field)
Definition: tree.h:86
#define SPLAY_RIGHT(elm, field)
Definition: tree.h:87

Definition at line 98 of file tree.h.

#define SPLAY_ROTATE_RIGHT (   head,
  tmp,
  field 
)
Value:
do { \
SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field); \
SPLAY_RIGHT(tmp, field) = (head)->sph_root; \
(head)->sph_root = tmp; \
} while (/*CONSTCOND*/ 0)
Flow * head
Definition: flow-hash.h:102
#define SPLAY_LEFT(elm, field)
Definition: tree.h:86
#define SPLAY_RIGHT(elm, field)
Definition: tree.h:87

Definition at line 92 of file tree.h.