engine/jtree.c File Reference

#include "jtree.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "bits.h"

Go to the source code of this file.

Defines

#define DBGESCAPE(a)

Functions

int FreeNode (JNode *n)
int InitJTree (JTree *j, char NoCase)
int AddStringJTreeReal (JTree *j, unsigned char *String, int SLen, int RuleID)
int AddStringJTree (JTree *j, unsigned char *String, int SLen, int RuleID)
JNodeFindOptimalNode (JTree *j, JNode *n, unsigned char *String, int SLen)
int ConvertNode (JNode *n, JNode **Parent, int NoCase)
int CompressJTree (JTree *j)
int FinalizeJTree (JTree *j)
int MatchStrings (JTree *j, unsigned char *PacketRuleBits, unsigned char *String, int SLen)

Variables

int calloc_count = 0
int free_count = 0
GlobalVars Globals


Define Documentation

#define DBGESCAPE (  ) 

Definition at line 29 of file jtree.c.

Referenced by AddStringJTree().


Function Documentation

int AddStringJTree ( JTree j,
unsigned char *  String,
int  SLen,
int  RuleID 
)

Add a string to the tree. Decode binary sections (defined between ||).

Definition at line 126 of file jtree.c.

References AddStringJTreeReal(), DBGESCAPE, DEBUGPATH, FALSE, MAX_STRING_LEN, NULL, PRINTERROR, PRINTERROR1, and TRUE.

Referenced by TCPContentAddNode(), TCPListContentAddNode(), TCPListNoCaseAddNode(), TCPNoCaseAddNode(), UDPContentAddNode(), and UDPNoCaseAddNode().

int AddStringJTreeReal ( JTree j,
unsigned char *  String,
int  SLen,
int  RuleID 
)

Add a string to the tree.

Definition at line 56 of file jtree.c.

References jnode::Bytes, calloc_count, jnode::Count, DEBUGPATH, FALSE, jtree::Head, jtree::IsFinalized, MAX_STRING_LEN, jtree::NoCase, and jnode::temp.

Referenced by AddStringJTree().

int CompressJTree ( JTree j  ) 

Definition at line 359 of file jtree.c.

References ConvertNode(), DEBUGPATH, jtree::Head, jtree::NoCase, and NULL.

int ConvertNode ( JNode n,
JNode **  Parent,
int  NoCase 
)

Definition at line 280 of file jtree.c.

References jnode::Bytes, jnode::Count, DEBUGPATH, FALSE, NODE_TYPE_SHORT, short_jnode::NodeType, NULL, short_jnode::PassNode, jnode::temp, and TRUE.

Referenced by CompressJTree().

int FinalizeJTree ( JTree j  ) 

Definition at line 370 of file jtree.c.

References DEBUGPATH, jnode::FailNode, FALSE, FindOptimalNode(), jtree::Head, NULL, and TRUE.

Referenced by TestTCPContentFinishedSetup(), TestTCPListContentFinishedSetup(), TestTCPListNoCaseFinishedSetup(), TestTCPNoCaseFinishedSetup(), TestUDPContentFinishedSetup(), and TestUDPNoCaseFinishedSetup().

JNode* FindOptimalNode ( JTree j,
JNode n,
unsigned char *  String,
int  SLen 
)

Find the optimal node (jtree) to continue from for the given string.

Definition at line 200 of file jtree.c.

References jnode::Bytes, DEBUGPATH, and jtree::Head.

Referenced by FinalizeJTree().

int FreeNode ( JNode n  ) 

Definition at line 338 of file jtree.c.

References jnode::Bytes, and NULL.

int InitJTree ( JTree j,
char  NoCase 
)

Set up the tree.

Definition at line 42 of file jtree.c.

References DEBUGPATH, jtree::NoCase, and TRUE.

Referenced by InitTestTCPContent(), InitTestTCPListContent(), InitTestTCPListNoCase(), InitTestTCPNoCase(), InitTestUDPContent(), and InitTestUDPNoCase().

int MatchStrings ( JTree j,
unsigned char *  PacketRuleBits,
unsigned char *  String,
int  SLen 
)

Definition at line 401 of file jtree.c.

References jnode::Bytes, DEBUGPATH, jtree::DependMask, Globals, jtree::Head, jnode::IsTerminal, MAX_RULES, global_vars::NumRules, SetBit(), jnode::temp, and jnode::TerminalRuleID.

Referenced by TestTCPContent(), TestTCPListContent(), TestTCPListNoCase(), TestTCPNoCase(), TestUDPContent(), and TestUDPNoCase().


Variable Documentation

int calloc_count = 0

Definition at line 33 of file jtree.c.

Referenced by AddStringJTreeReal().

int free_count = 0

Definition at line 34 of file jtree.c.

GlobalVars Globals

Definition at line 41 of file hlbr.c.


Generated on Sat Jul 7 23:33:10 2007 for HLBR by  doxygen 1.5.2