"Fossies" - the Fresh Open Source Software Archive

Member "snort-2.9.17/src/detection-plugins/sp_byte_math.h" (16 Oct 2020, 1454 Bytes) of package /linux/misc/snort-2.9.17.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "sp_byte_math.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.9.16.1_vs_2.9.17.

    1 #ifndef __SP_BYTE_MATH_H__
    2 #define __SP_BYTE_MATH_H__
    3 
    4 #include "sf_engine/sf_snort_plugin_api.h"
    5 #include "decode.h"
    6 #include "plugbase.h"
    7 
    8 #define BM_PLUS                 CHECK_ADD
    9 #define BM_MINUS                CHECK_SUB
   10 #define BM_MULTIPLY             CHECK_MUL
   11 #define BM_DIVIDE               CHECK_DIV
   12 #define BM_LEFT_SHIFT           CHECK_LS
   13 #define BM_RIGHT_SHIFT          CHECK_RS
   14 #define BM_CHECK_NONE           CHECK_NONE
   15 
   16 #define BIG    0
   17 #define LITTLE 1
   18 
   19 #define BYTE_MATH_VAR_INDEX 2
   20 #define COMMON_VAR_INDEX 3
   21 
   22 #define MIN_RVAL 1
   23 #define MAX_RVAL 4294967295
   24 
   25 extern char *bytemath_variable_name;
   26 extern uint32_t bytemath_variable;
   27 extern uint32_t common_var;
   28 
   29 typedef struct _ByteMathData
   30 {
   31     uint32_t bytes_to_extract; /* lvalue : number of bytes to extract */
   32     uint32_t rvalue;
   33     uint32_t operator;
   34     int32_t offset;
   35     uint8_t relative_flag;
   36     uint8_t data_string_convert_flag;
   37     int8_t endianess;
   38     uint32_t base;
   39     uint32_t bitmask_val;
   40     int8_t rvalue_var;
   41     int8_t offset_var;
   42     char *result_var;
   43     RuleOptByteOrderFunc byte_order_func;
   44 } ByteMathData;
   45 
   46 void SetupByteMath(void);
   47 uint32_t ByteMathHash(void *d);
   48 int8_t GetVarByName_check(char *name);
   49 void ClearByteMathVarNames(OptFpList *fpl);
   50 void AddVarName_Bytemath(ByteMathData *data);
   51 int ByteMathCompare(void *l, void *r);
   52 int ByteMath(void *, Packet *);
   53 void ByteMathFree(void *d);
   54 uint32_t find_value (char* );
   55 
   56 #endif  /* __SP_BYTE_MATH_H__ */