00001 #ifndef HLBR_JTREE_H 00002 #define HLBR_JTREE_H 00003 00004 #include "hlbr.h" 00005 00006 #define MAX_STRING_LEN 1024 00007 00008 #define NODE_TYPE_NORMAL 1 00009 #define NODE_TYPE_SHORT 2 00010 00011 typedef struct short_jnode{ 00012 unsigned char NodeType; 00013 unsigned char temp; 00014 unsigned char Byte; 00015 struct jnode* PassNode; 00016 struct jnode* FailNode; 00017 char IsTerminal; 00018 int TerminalRuleID; 00019 struct jnode* Parent; 00020 } SJNode; 00021 00022 typedef struct jnode{ 00023 unsigned char NodeType; 00024 unsigned char temp; 00025 struct jnode* Bytes[256]; 00026 struct jnode* FailNode; 00027 char IsTerminal; 00028 int TerminalRuleID; 00029 int Count; 00030 } JNode; 00031 00032 typedef struct jtree{ 00033 JNode* Head; 00034 char NoCase; 00035 char IsFinalized; 00036 unsigned char DependMask[MAX_RULES/8]; 00037 } JTree; 00038 00039 00040 int InitJTree(JTree* j, char NoCase); 00041 int AddStringJTree(JTree* j, unsigned char* String, int SLen, int RuleID); 00042 int FinalizeJTree(JTree* j); 00043 int MatchStrings(JTree* j, unsigned char* PacketRuleBits, unsigned char* String, int SLen); 00044 00045 #endif