Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

ubi_BinTree.h File Reference

#include "sys_include.h"

Go to the source code of this file.

Defines

#define ubi_trTRUE   0xFF
#define ubi_trFALSE   0x00
#define ubi_trOVERWRITE   0x01
#define ubi_trDUPKEY   0x02
#define ubi_trLEFT   0x00
#define ubi_trPARENT   0x01
#define ubi_trRIGHT   0x02
#define ubi_trEQUAL   ubi_trPARENT
#define ubi_trNormalize(W)   ((char)( (W) - ubi_trEQUAL ))
#define ubi_trAbNormal(W)
#define ubi_trRevWay(W)   ((char)( ubi_trEQUAL - ((W) - ubi_trEQUAL) ))
#define ubi_trDups_OK(A)   ((ubi_trDUPKEY & ((A)->flags))?(ubi_trTRUE):(ubi_trFALSE))
#define ubi_trOvwt_OK(A)   ((ubi_trOVERWRITE & ((A)->flags))?(ubi_trTRUE):(ubi_trFALSE))
#define ubi_trCount(R)   (((ubi_trRootPtr)(R))->count)
#define ubi_trNewTree(N, C, F)   ubi_trRoot (N)[1] = {{ NULL, (C), 0, (F) }}
#define ubi_trItemPtr   ubi_btItemPtr
#define ubi_trNode   ubi_btNode
#define ubi_trNodePtr   ubi_btNodePtr
#define ubi_trRoot   ubi_btRoot
#define ubi_trRootPtr   ubi_btRootPtr
#define ubi_trCompFunc   ubi_btCompFunc
#define ubi_trActionRtn   ubi_btActionRtn
#define ubi_trKillNodeRtn   ubi_btKillNodeRtn
#define ubi_trSgn(x)   ubi_btSgn( x )
#define ubi_trInitNode(Np)   ubi_btInitNode( (ubi_btNodePtr)(Np) )
#define ubi_trInitTree(Rp, Cf, Fl)   ubi_btInitTree( (ubi_btRootPtr)(Rp), (ubi_btCompFunc)(Cf), (Fl) )
#define ubi_trInsert(Rp, Nn, Ip, On)
#define ubi_trRemove(Rp, Dn)   ubi_btRemove( (ubi_btRootPtr)(Rp), (ubi_btNodePtr)(Dn) )
#define ubi_trLocate(Rp, Ip, Op)
#define ubi_trFind(Rp, Ip)   ubi_btFind( (ubi_btRootPtr)(Rp), (ubi_btItemPtr)(Ip) )
#define ubi_trCheck(Rp, Fp, Ud)   ubi_btCheck( (ubi_btRootPtr)(Rp), (ubi_btCheckFunc)(Fp), (void *)(Ud) )
#define ubi_trNext(P)   ubi_btNext( (ubi_btNodePtr)(P) )
#define ubi_trPrev(P)   ubi_btPrev( (ubi_btNodePtr)(P) )
#define ubi_trFirst(P)   ubi_btFirst( (ubi_btNodePtr)(P) )
#define ubi_trLast(P)   ubi_btLast( (ubi_btNodePtr)(P) )
#define ubi_trFirstOf(Rp, Ip, P)
#define ubi_trLastOf(Rp, Ip, P)
#define ubi_trTraverse(Rp, En, Ud)   ubi_btTraverse((ubi_btRootPtr)(Rp), (ubi_btActionRtn)(En), (void *)(Ud))
#define ubi_trTraverseReverse(Rp, En, Ud)   ubi_btTraverseReverse((ubi_btRootPtr)(Rp), (ubi_btActionRtn)(En), (void *)(Ud))
#define ubi_trKillTree(Rp, Fn)   ubi_btKillTree( (ubi_btRootPtr)(Rp), (ubi_btKillNodeRtn)(Fn) )
#define ubi_trLeafNode(Nd)   ubi_btLeafNode( (ubi_btNodePtr)(Nd) )
#define ubi_trModuleID(s, l)   ubi_btModuleID( s, l )

Typedefs

typedef unsigned char ubi_trBool
typedef void * ubi_btItemPtr
typedef ubi_btNodeStruct ubi_btNode
typedef ubi_btNodeubi_btNodePtr
typedef int(* ubi_btCheckFunc )(ubi_btNodePtr, void *)
typedef int(* ubi_btCompFunc )(ubi_btItemPtr, ubi_btNodePtr)
typedef void(* ubi_btActionRtn )(ubi_btNodePtr, void *)
typedef void(* ubi_btKillNodeRtn )(ubi_btNodePtr)
typedef ubi_btRootubi_btRootPtr

Enumerations

enum  ubi_trCompOps {
  ubi_trLT = 1, ubi_trLE, ubi_trEQ, ubi_trGE,
  ubi_trGT
}

Functions

long ubi_btSgn (long x)
ubi_btNodePtr ubi_btInitNode (ubi_btNodePtr NodePtr)
ubi_btRootPtr ubi_btInitTree (ubi_btRootPtr RootPtr, ubi_btCompFunc CompFunc, char Flags)
ubi_trBool ubi_btInsert (ubi_btRootPtr RootPtr, ubi_btNodePtr NewNode, ubi_btItemPtr ItemPtr, ubi_btNodePtr *OldNode)
ubi_btNodePtr ubi_btRemove (ubi_btRootPtr RootPtr, ubi_btNodePtr DeadNode)
ubi_btNodePtr ubi_btLocate (ubi_btRootPtr RootPtr, ubi_btItemPtr FindMe, ubi_trCompOps CompOp)
ubi_btNodePtr ubi_btFind (ubi_btRootPtr RootPtr, ubi_btItemPtr FindMe)
int ubi_btCheck (ubi_btRootPtr RootPtr, ubi_btCheckFunc func, void *UserData)
ubi_btNodePtr ubi_btNext (ubi_btNodePtr P)
ubi_btNodePtr ubi_btPrev (ubi_btNodePtr P)
ubi_btNodePtr ubi_btFirst (ubi_btNodePtr P)
ubi_btNodePtr ubi_btLast (ubi_btNodePtr P)
ubi_btNodePtr ubi_btFirstOf (ubi_btRootPtr RootPtr, ubi_btItemPtr MatchMe, ubi_btNodePtr p)
ubi_btNodePtr ubi_btLastOf (ubi_btRootPtr RootPtr, ubi_btItemPtr MatchMe, ubi_btNodePtr p)
unsigned long ubi_btTraverse (ubi_btRootPtr RootPtr, ubi_btActionRtn EachNode, void *UserData)
unsigned long ubi_btTraverseReverse (ubi_btRootPtr RootPtr, ubi_btActionRtn EachNode, void *UserData)
unsigned long ubi_btKillTree (ubi_btRootPtr RootPtr, ubi_btKillNodeRtn FreeNode)
ubi_btNodePtr ubi_btLeafNode (ubi_btNodePtr leader)
int ubi_btModuleID (int size, char *list[])


Define Documentation

#define ubi_trAbNormal  ) 
 

Value:

((char)( ((char)ubi_btSgn( (long)(W) )) \
                                         + ubi_trEQUAL ))

Definition at line 113 of file ubi_BinTree.h.

Referenced by Border(), qFind(), TreeFind(), ubi_btFirstOf(), ubi_btInsert(), and ubi_btLastOf().

#define ubi_trActionRtn   ubi_btActionRtn
 

Definition at line 699 of file ubi_BinTree.h.

#define ubi_trCheck Rp,
Fp,
Ud   )     ubi_btCheck( (ubi_btRootPtr)(Rp), (ubi_btCheckFunc)(Fp), (void *)(Ud) )
 

Definition at line 724 of file ubi_BinTree.h.

Referenced by StoreStreamPkt().

#define ubi_trCompFunc   ubi_btCompFunc
 

Definition at line 698 of file ubi_BinTree.h.

#define ubi_trCount  )     (((ubi_trRootPtr)(R))->count)
 

Definition at line 146 of file ubi_BinTree.h.

Referenced by CheckTagList(), ConvCompareFunc(), ConvFunc(), DeleteSession(), FlushDeletedStream(), FlushStream(), Frag2Defrag(), GetFragTracker(), LogStream(), PrintSessionCache(), PruneConvCache(), PruneFragCache(), PrunePortscanners(), PruneSessionCache(), PruneTagCache(), PruneTargets(), PruneTime(), psWatch(), ReassembleStream4(), RemoveSession(), TcpAction(), and TcpActionAsync().

#define ubi_trDUPKEY   0x02
 

Definition at line 79 of file ubi_BinTree.h.

Referenced by CreateNewSession(), parse_one_v1(), and ubi_btInitTree().

#define ubi_trDups_OK  )     ((ubi_trDUPKEY & ((A)->flags))?(ubi_trTRUE):(ubi_trFALSE))
 

Definition at line 122 of file ubi_BinTree.h.

Referenced by Border(), and ubi_btInsert().

#define ubi_trEQUAL   ubi_trPARENT
 

Definition at line 85 of file ubi_BinTree.h.

Referenced by Border(), qFind(), Splay(), TreeFind(), ubi_btFirstOf(), ubi_btInitNode(), ubi_btInsert(), and ubi_btLastOf().

#define ubi_trFALSE   0x00
 

Definition at line 76 of file ubi_BinTree.h.

Referenced by AddPortScanner(), AddTarget(), ConvGetSession(), CreateNewSession(), InsertFrag(), StoreStreamPkt(), ubi_btInsert(), and ubi_sptInsert().

#define ubi_trFind Rp,
Ip   )     ubi_btFind( (ubi_btRootPtr)(Rp), (ubi_btItemPtr)(Ip) )
 

Definition at line 721 of file ubi_BinTree.h.

#define ubi_trFirst  )     ubi_btFirst( (ubi_btNodePtr)(P) )
 

Definition at line 731 of file ubi_BinTree.h.

Referenced by PurgeSessionCache().

#define ubi_trFirstOf Rp,
Ip,
 ) 
 

Value:

Definition at line 735 of file ubi_BinTree.h.

#define ubi_trInitNode Np   )     ubi_btInitNode( (ubi_btNodePtr)(Np) )
 

Definition at line 704 of file ubi_BinTree.h.

#define ubi_trInitTree Rp,
Cf,
Fl   )     ubi_btInitTree( (ubi_btRootPtr)(Rp), (ubi_btCompFunc)(Cf), (Fl) )
 

Definition at line 706 of file ubi_BinTree.h.

Referenced by AddPortScanner(), ConvInit(), CreateNewSession(), Frag2Init(), InitSessionCache(), InitTag(), NewFragTracker(), parse_one_v1(), Scan2Init(), and Stream4Init().

#define ubi_trInsert Rp,
Nn,
Ip,
On   ) 
 

Value:

Definition at line 709 of file ubi_BinTree.h.

#define ubi_trItemPtr   ubi_btItemPtr
 

Definition at line 690 of file ubi_BinTree.h.

#define ubi_trKillNodeRtn   ubi_btKillNodeRtn
 

Definition at line 700 of file ubi_BinTree.h.

#define ubi_trKillTree Rp,
Fn   )     ubi_btKillTree( (ubi_btRootPtr)(Rp), (ubi_btKillNodeRtn)(Fn) )
 

Definition at line 751 of file ubi_BinTree.h.

Referenced by DeletePortscanner(), DeleteSpd(), and Frag2DeleteFrag().

#define ubi_trLast  )     ubi_btLast( (ubi_btNodePtr)(P) )
 

Definition at line 733 of file ubi_BinTree.h.

Referenced by FlushDeletedStream().

#define ubi_trLastOf Rp,
Ip,
 ) 
 

Value:

Definition at line 740 of file ubi_BinTree.h.

#define ubi_trLeafNode Nd   )     ubi_btLeafNode( (ubi_btNodePtr)(Nd) )
 

Definition at line 754 of file ubi_BinTree.h.

#define ubi_trLEFT   0x00
 

Definition at line 82 of file ubi_BinTree.h.

Referenced by ReplaceNode(), ubi_btFirst(), ubi_btFirstOf(), ubi_btInitNode(), ubi_btKillTree(), ubi_btLeafNode(), ubi_btLocate(), ubi_btPrev(), ubi_btRemove(), and ubi_sptRemove().

#define ubi_trLocate Rp,
Ip,
Op   ) 
 

Value:

Definition at line 716 of file ubi_BinTree.h.

#define ubi_trModuleID s,
 )     ubi_btModuleID( s, l )
 

Definition at line 757 of file ubi_BinTree.h.

#define ubi_trNewTree N,
C,
 )     ubi_trRoot (N)[1] = {{ NULL, (C), 0, (F) }}
 

Definition at line 148 of file ubi_BinTree.h.

#define ubi_trNext  )     ubi_btNext( (ubi_btNodePtr)(P) )
 

Definition at line 727 of file ubi_BinTree.h.

#define ubi_trNode   ubi_btNode
 

Definition at line 692 of file ubi_BinTree.h.

#define ubi_trNodePtr   ubi_btNodePtr
 

Definition at line 693 of file ubi_BinTree.h.

#define ubi_trNormalize  )     ((char)( (W) - ubi_trEQUAL ))
 

Definition at line 112 of file ubi_BinTree.h.

#define ubi_trOVERWRITE   0x01
 

Definition at line 78 of file ubi_BinTree.h.

#define ubi_trOvwt_OK  )     ((ubi_trOVERWRITE & ((A)->flags))?(ubi_trTRUE):(ubi_trFALSE))
 

Definition at line 124 of file ubi_BinTree.h.

Referenced by ubi_btInsert().

#define ubi_trPARENT   0x01
 

Definition at line 83 of file ubi_BinTree.h.

Referenced by Border(), Neighbor(), ReplaceNode(), Rotate(), Splay(), SwapNodes(), ubi_btInitNode(), ubi_btInsert(), ubi_btKillTree(), ubi_btRemove(), and ubi_sptRemove().

#define ubi_trPrev  )     ubi_btPrev( (ubi_btNodePtr)(P) )
 

Definition at line 729 of file ubi_BinTree.h.

#define ubi_trRemove Rp,
Dn   )     ubi_btRemove( (ubi_btRootPtr)(Rp), (ubi_btNodePtr)(Dn) )
 

Definition at line 713 of file ubi_BinTree.h.

#define ubi_trRevWay  )     ((char)( ubi_trEQUAL - ((W) - ubi_trEQUAL) ))
 

Definition at line 115 of file ubi_BinTree.h.

Referenced by Neighbor(), Rotate(), and ubi_btLeafNode().

#define ubi_trRIGHT   0x02
 

Definition at line 84 of file ubi_BinTree.h.

Referenced by ReplaceNode(), ubi_btInitNode(), ubi_btInsert(), ubi_btKillTree(), ubi_btLast(), ubi_btLastOf(), ubi_btLocate(), ubi_btNext(), ubi_btRemove(), and ubi_sptRemove().

#define ubi_trRoot   ubi_btRoot
 

Definition at line 695 of file ubi_BinTree.h.

#define ubi_trRootPtr   ubi_btRootPtr
 

Definition at line 696 of file ubi_BinTree.h.

Referenced by AddTagNode(), CheckTagList(), DropSession(), and psWatch().

#define ubi_trSgn  )     ubi_btSgn( x )
 

Definition at line 702 of file ubi_BinTree.h.

#define ubi_trTraverse Rp,
En,
Ud   )     ubi_btTraverse((ubi_btRootPtr)(Rp), (ubi_btActionRtn)(En), (void *)(Ud))
 

Definition at line 745 of file ubi_BinTree.h.

Referenced by BuildPacket(), FragIsComplete(), LogStream(), and RebuildFrag().

#define ubi_trTraverseReverse Rp,
En,
Ud   )     ubi_btTraverseReverse((ubi_btRootPtr)(Rp), (ubi_btActionRtn)(En), (void *)(Ud))
 

Definition at line 748 of file ubi_BinTree.h.

Referenced by BuildPacket(), and LogStream().

#define ubi_trTRUE   0xFF
 

Definition at line 75 of file ubi_BinTree.h.

Referenced by ubi_btInsert(), and ubi_sptInsert().


Typedef Documentation

typedef void(* ubi_btActionRtn)(ubi_btNodePtr, void *)
 

Definition at line 226 of file ubi_BinTree.h.

typedef int(* ubi_btCheckFunc)(ubi_btNodePtr, void *)
 

Definition at line 222 of file ubi_BinTree.h.

typedef int(* ubi_btCompFunc)(ubi_btItemPtr, ubi_btNodePtr)
 

Definition at line 224 of file ubi_BinTree.h.

typedef void* ubi_btItemPtr
 

Definition at line 164 of file ubi_BinTree.h.

typedef void(* ubi_btKillNodeRtn)(ubi_btNodePtr)
 

Definition at line 228 of file ubi_BinTree.h.

typedef struct ubi_btNodeStruct ubi_btNode
 

typedef ubi_btNode* ubi_btNodePtr
 

Definition at line 195 of file ubi_BinTree.h.

typedef ubi_btRoot* ubi_btRootPtr
 

Definition at line 259 of file ubi_BinTree.h.

typedef unsigned char ubi_trBool
 

Definition at line 162 of file ubi_BinTree.h.


Enumeration Type Documentation

enum ubi_trCompOps
 

Enumeration values:
ubi_trLT 
ubi_trLE 
ubi_trEQ 
ubi_trGE 
ubi_trGT 

Definition at line 87 of file ubi_BinTree.h.


Function Documentation

int ubi_btCheck ubi_btRootPtr  RootPtr,
ubi_btCheckFunc  func,
void *  UserData
 

Definition at line 719 of file ubi_BinTree.c.

References NULL, ubi_btRoot::root, ubi_btFirst(), and ubi_btNext().

ubi_btNodePtr ubi_btFind ubi_btRootPtr  RootPtr,
ubi_btItemPtr  FindMe
 

Definition at line 695 of file ubi_BinTree.c.

References ubi_btRoot::cmp, qFind(), and ubi_btRoot::root.

Referenced by ubi_sptFind().

ubi_btNodePtr ubi_btFirst ubi_btNodePtr  P  ) 
 

Definition at line 775 of file ubi_BinTree.c.

References SubSlide(), and ubi_trLEFT.

Referenced by LogTcpdumpStream(), OldUnifiedLogPacketAlert(), PruneConvCache(), PruneFragCache(), PrunePortscanners(), PruneTargets(), PruneTime(), RealUnifiedLogAlert(), RealUnifiedLogStreamAlert(), SegmentCleanTraverse(), ubi_btCheck(), ubi_btKillTree(), and ubi_btTraverse().

ubi_btNodePtr ubi_btFirstOf ubi_btRootPtr  RootPtr,
ubi_btItemPtr  MatchMe,
ubi_btNodePtr  p
 

Definition at line 805 of file ubi_BinTree.c.

References Border(), ubi_btRoot::cmp, NULL, ubi_trAbNormal, ubi_trEQUAL, and ubi_trLEFT.

ubi_btNodePtr ubi_btInitNode ubi_btNodePtr  NodePtr  ) 
 

Definition at line 372 of file ubi_BinTree.c.

References ubi_btNodeStruct::balance, ubi_btNodeStruct::gender, ubi_btNodeStruct::Link, NULL, ubi_trEQUAL, ubi_trLEFT, ubi_trPARENT, and ubi_trRIGHT.

Referenced by ubi_btInsert().

ubi_btRootPtr ubi_btInitTree ubi_btRootPtr  RootPtr,
ubi_btCompFunc  CompFunc,
char  Flags
 

Definition at line 390 of file ubi_BinTree.c.

References ubi_btRoot::cmp, ubi_btRoot::count, ubi_btRoot::flags, NULL, ubi_btRoot::root, and ubi_trDUPKEY.

Referenced by ubi_btKillTree().

ubi_trBool ubi_btInsert ubi_btRootPtr  RootPtr,
ubi_btNodePtr  NewNode,
ubi_btItemPtr  ItemPtr,
ubi_btNodePtr OldNode
 

Definition at line 428 of file ubi_BinTree.c.

References ubi_btRoot::cmp, ubi_btRoot::count, ubi_btNodeStruct::gender, int(), ubi_btNodeStruct::Link, NULL, ReplaceNode(), ubi_btRoot::root, TreeFind(), ubi_btInitNode(), ubi_trAbNormal, ubi_trDups_OK, ubi_trEQUAL, ubi_trFALSE, ubi_trOvwt_OK, ubi_trPARENT, ubi_trRIGHT, and ubi_trTRUE.

Referenced by ubi_sptInsert().

unsigned long ubi_btKillTree ubi_btRootPtr  RootPtr,
ubi_btKillNodeRtn  FreeNode
 

Definition at line 937 of file ubi_BinTree.c.

References ubi_btRoot::cmp, ubi_btRoot::flags, ubi_btNodeStruct::Link, NULL, ubi_btRoot::root, SubSlide(), ubi_btFirst(), ubi_btInitTree(), ubi_trLEFT, ubi_trPARENT, and ubi_trRIGHT.

ubi_btNodePtr ubi_btLast ubi_btNodePtr  P  ) 
 

Definition at line 790 of file ubi_BinTree.c.

References SubSlide(), and ubi_trRIGHT.

Referenced by PruneSessionCache(), ubi_btTraverseReverse(), and ubi_sptRemove().

ubi_btNodePtr ubi_btLastOf ubi_btRootPtr  RootPtr,
ubi_btItemPtr  MatchMe,
ubi_btNodePtr  p
 

Definition at line 835 of file ubi_BinTree.c.

References Border(), ubi_btRoot::cmp, NULL, ubi_trAbNormal, ubi_trEQUAL, and ubi_trRIGHT.

ubi_btNodePtr ubi_btLeafNode ubi_btNodePtr  leader  ) 
 

Definition at line 988 of file ubi_BinTree.c.

References ubi_btNodeStruct::Link, NULL, ubi_trLEFT, and ubi_trRevWay.

Referenced by PruneConvCache(), PruneFragCache(), PrunePortscanners(), PruneSessionCache(), PruneTagCache(), and PruneTargets().

ubi_btNodePtr ubi_btLocate ubi_btRootPtr  RootPtr,
ubi_btItemPtr  FindMe,
ubi_trCompOps  CompOp
 

Definition at line 601 of file ubi_BinTree.c.

References Border(), ubi_btRoot::cmp, Neighbor(), NULL, ubi_btRoot::root, TreeFind(), ubi_trEQ, ubi_trGT, ubi_trLE, ubi_trLEFT, ubi_trLT, and ubi_trRIGHT.

Referenced by ubi_sptLocate().

int ubi_btModuleID int  size,
char *  list[]
 

Definition at line 1033 of file ubi_BinTree.c.

References ModuleID, and NULL.

Referenced by ubi_sptModuleID().

ubi_btNodePtr ubi_btNext ubi_btNodePtr  P  ) 
 

Definition at line 749 of file ubi_BinTree.c.

References Neighbor(), and ubi_trRIGHT.

Referenced by LogTcpdumpStream(), OldUnifiedLogPacketAlert(), PruneConvCache(), PruneFragCache(), PrunePortscanners(), PruneTargets(), PruneTime(), RealUnifiedLogStreamAlert(), SegmentCleanTraverse(), ubi_btCheck(), and ubi_btTraverse().

ubi_btNodePtr ubi_btPrev ubi_btNodePtr  P  ) 
 

Definition at line 762 of file ubi_BinTree.c.

References Neighbor(), and ubi_trLEFT.

Referenced by PruneSessionCache(), ubi_btRemove(), and ubi_btTraverseReverse().

ubi_btNodePtr ubi_btRemove ubi_btRootPtr  RootPtr,
ubi_btNodePtr  DeadNode
 

Definition at line 547 of file ubi_BinTree.c.

References ubi_btRoot::count, ubi_btNodeStruct::gender, int(), ubi_btNodeStruct::Link, NULL, ubi_btRoot::root, SwapNodes(), ubi_btPrev(), ubi_trLEFT, ubi_trPARENT, and ubi_trRIGHT.

long ubi_btSgn long  x  ) 
 

unsigned long ubi_btTraverse ubi_btRootPtr  RootPtr,
ubi_btActionRtn  EachNode,
void *  UserData
 

Definition at line 865 of file ubi_BinTree.c.

References ubi_btRoot::count, NULL, ubi_btRoot::root, ubi_btFirst(), and ubi_btNext().

unsigned long ubi_btTraverseReverse ubi_btRootPtr  RootPtr,
ubi_btActionRtn  EachNode,
void *  UserData
 

Definition at line 901 of file ubi_BinTree.c.

References ubi_btRoot::count, NULL, ubi_btRoot::root, ubi_btLast(), and ubi_btPrev().


Generated on Sun May 14 14:51:27 2006 by  doxygen 1.4.2