00001 #ifndef HLBR_BOYER_MOORE_TREE_H 00002 #define HLBR_BOYER_MOORE_TREE_H 00003 00004 #include "../config.h" 00005 #include "hlbr.h" 00006 00007 typedef struct bnode{ 00008 unsigned char byte; 00009 struct bnode* Child; 00010 struct bnode* NextPeer; 00011 char IsTerminal; 00012 int TerminalRuleID; 00013 } BNode; 00014 00015 typedef struct bm_tree{ 00016 BNode* TreeHead; 00017 unsigned char TreeDependMask[MAX_RULES/8]; 00018 char IgnoreCase; 00019 }BMTree; 00020 00021 00022 int InitTree(BMTree* Tree, char IgnoreCase); 00023 int AddToTree(BMTree* Tree, char* String, int Len, int RuleID); 00024 int MatchStringTree(BMTree* Tree, unsigned char* PacketRuleBits, char* Packet, int Plen); 00025 void FreeTree(BMTree* Tree); 00026 00027 #endif