#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) |
JNode * | FindOptimalNode (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 DBGESCAPE | ( | a | ) |
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.
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().
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 | ) |
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().
int calloc_count = 0 |
int free_count = 0 |