Azinix

rlpUtil.c File Reference

Routines for manipulating rules. More...

#include "rlp.h"

Go to the source code of this file.

Functions

char * Rlp_ConvertParseTreeToText (Rlp_Formula_t *aFormula)
 Convert a rule parse tree to a formula text string.
int Rlp_PrintFormulaTree (Rlp_Formula_t *aFormula)
 Print a rule parse tree.
void Rlp_FormulaFree (Rlp_Formula_t *aFormula)
 Free a parse tree.
Rlp_Formula_tRlp_CreateParseTreeFromText (char *text)
 Create a parse tree for an L7 formula from raw text of formula.
Rlp_Formula_tRlp_CreateParseTreeFromAttribValuePairArray (array_t *aRule)
 Create a parse tree from a L7 formula that is presented as an array of (attribute,value) pairs.
int Rlp_ParsedRulePrint (Rlp_Formula_t *aTree)
 Print a parse tree.
util_byte_array_tRlp_ByteCodeToByteArray (char *byteCode)
 Convert byte code to a byte array.
int Rlp_NodePrint (Rlp_Formula_t *entry)
 Print a node, which is assumed to be an entry in a parse tree.
array_tRlp_TestReadL7FormulasFromFile (char *fileName)
 Read a bunch of L7 formulas from a file, return them in an array.
char * Rlp_GetL4ComponentFromRawRule (char *rawRule)
 Get the L4 text from a rule.
char * Rlp_GetL7ComponentFromRawRule (char *rawRule)
 Get the L7 text from a rule.
char * Rlp_GetActionComponentFromRawRule (char *rawRule)
 Get the action component from a rule.
int Rlp_FreeArrayOfStrings (array_t *stringArray)
 Free an array_t and the strings in it.
st_tableRlp_L7CheckGetContentChecks (array_t *L7CheckArray)
 Return a hash containing all the content checks for in the given rule.
void Rlp_TestParseContent (char *fileName)
 Code to test parsing of content.
int Rlp_UpdateDefineTable (st_table *aTable, char *anEntry)
 Adds a mapping from a macro name to definition.


Detailed Description

Routines for manipulating rules.

Definition in file rlpUtil.c.


Function Documentation

util_byte_array_t* Rlp_ByteCodeToByteArray ( char *  byteCode  ) 

Convert byte code to a byte array.

Input assumed to be in hex, with possible whitespace.

Definition at line 1522 of file rlpUtil.c.

char* Rlp_ConvertParseTreeToText ( Rlp_Formula_t aFormula  ) 

Convert a rule parse tree to a formula text string.

Definition at line 43 of file rlpUtil.c.

Rlp_Formula_t* Rlp_CreateParseTreeFromAttribValuePairArray ( array_t aRule  ) 

Create a parse tree from a L7 formula that is presented as an array of (attribute,value) pairs.

Returns NIL if the array is of length 0, otherwise list has as many entries as the array has members.

Definition at line 575 of file rlpUtil.c.

Rlp_Formula_t* Rlp_CreateParseTreeFromText ( char *  text  ) 

Create a parse tree for an L7 formula from raw text of formula.

Definition at line 553 of file rlpUtil.c.

void Rlp_FormulaFree ( Rlp_Formula_t aFormula  ) 

Free a parse tree.

Definition at line 479 of file rlpUtil.c.

int Rlp_FreeArrayOfStrings ( array_t stringArray  ) 

Free an array_t and the strings in it.

Definition at line 2013 of file rlpUtil.c.

char* Rlp_GetActionComponentFromRawRule ( char *  rawRule  ) 

Get the action component from a rule.

The assumption is that the rule consists of layer 4 string, layer 7 string, which is enclosed in parens, and then action string. The right parens symbol should NOT appear in the action string.

Definition at line 1979 of file rlpUtil.c.

char* Rlp_GetL4ComponentFromRawRule ( char *  rawRule  ) 

Get the L4 text from a rule.

Definition at line 1910 of file rlpUtil.c.

char* Rlp_GetL7ComponentFromRawRule ( char *  rawRule  ) 

Get the L7 text from a rule.

Definition at line 1940 of file rlpUtil.c.

st_table* Rlp_L7CheckGetContentChecks ( array_t L7CheckArray  ) 

Return a hash containing all the content checks for in the given rule.

We're passing in an array containing Rlp_L7Check_t entries - these are all the L7 checks in the corresponding rule.

Definition at line 2034 of file rlpUtil.c.

int Rlp_NodePrint ( Rlp_Formula_t entry  ) 

Print a node, which is assumed to be an entry in a parse tree.

Definition at line 1621 of file rlpUtil.c.

int Rlp_ParsedRulePrint ( Rlp_Formula_t aTree  ) 

Print a parse tree.

Definition at line 777 of file rlpUtil.c.

int Rlp_PrintFormulaTree ( Rlp_Formula_t aFormula  ) 

Print a rule parse tree.

Definition at line 335 of file rlpUtil.c.

void Rlp_TestParseContent ( char *  fileName  ) 

Code to test parsing of content.

Definition at line 2061 of file rlpUtil.c.

array_t* Rlp_TestReadL7FormulasFromFile ( char *  fileName  ) 

Read a bunch of L7 formulas from a file, return them in an array.

Definition at line 1880 of file rlpUtil.c.

int Rlp_UpdateDefineTable ( st_table aTable,
char *  anEntry 
)

Adds a mapping from a macro name to definition.

Typically anEntry will be "var foo 192.168.1.1" We will add "foo" to the table, and map it to "192.168.1.1"

Definition at line 2116 of file rlpUtil.c.