diff options
author | Luca Deri <deri@ntop.org> | 2018-08-16 12:03:09 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2018-08-16 12:03:09 +0200 |
commit | 9847c2ccbbe3db62b39249126fb5c86298f37c9d (patch) | |
tree | d9b75fbc58bebfe14622f0ed5d5d9fe2b4de259d /src/lib/third_party/include | |
parent | 70eb619b86656cf8ee8425fe67d862f554ebfbe2 (diff) |
Generic protocol cleanup (work in progress)
Diffstat (limited to 'src/lib/third_party/include')
-rw-r--r-- | src/lib/third_party/include/actypes.h | 14 | ||||
-rw-r--r-- | src/lib/third_party/include/ahocorasick.h | 6 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/third_party/include/actypes.h b/src/lib/third_party/include/actypes.h index 807e5026a..c09d787c6 100644 --- a/src/lib/third_party/include/actypes.h +++ b/src/lib/third_party/include/actypes.h @@ -42,9 +42,9 @@ typedef char AC_ALPHABET_t; * automata for further reference. we provisioned two possible types as a * union for this purpose. you can add your desired type in it. **/ -typedef union { - char * stringy; /* null-terminated string */ - unsigned long number; +typedef struct { + int number; + u_int16_t category, breed; } AC_REP_t; /* AC_PATTERN_t: @@ -112,20 +112,20 @@ typedef enum ac_automata_finalize() you can not add new patterns to the automata. */ } AC_ERROR_t; -/* MATCH_CALBACK_t: +/* MATCH_CALLBACK_t: * This is the call-back function type that must be given to automata at * initialization to report match occurrence to the caller. * at a match event, the automata will reach you using this function and sends * you a pointer to AC_MATCH_t. using that pointer you can handle * matches. you can send parameters to the call-back function when you call * ac_automata_search(). at call-back, the automata will sent you those - * parameters as the second parameter (void *) of MATCH_CALBACK_t. inside + * parameters as the second parameter (void *) of MATCH_CALLBACK_t. inside * the call-back function you can cast it to whatever you want. - * If you return 0 from MATCH_CALBACK_t function to the automata, it will + * If you return 0 from MATCH_CALLBACK_t function to the automata, it will * continue searching, otherwise it will return from ac_automata_search() * to your calling function. **/ -typedef int (*MATCH_CALBACK_f)(AC_MATCH_t *, AC_TEXT_t *, void *); +typedef int (*MATCH_CALLBACK_f)(AC_MATCH_t *, AC_TEXT_t *, AC_REP_t *); /* AC_PATTRN_MAX_LENGTH: * Maximum acceptable pattern length in AC_PATTERN_t.length diff --git a/src/lib/third_party/include/ahocorasick.h b/src/lib/third_party/include/ahocorasick.h index ea92e4a1b..192a0e728 100644 --- a/src/lib/third_party/include/ahocorasick.h +++ b/src/lib/third_party/include/ahocorasick.h @@ -36,7 +36,7 @@ typedef struct unsigned int all_nodes_max; /* Current max allocated memory for *all_nodes */ AC_MATCH_t match; /* Any match is reported with this */ - MATCH_CALBACK_f match_callback; /* Match call-back function */ + MATCH_CALLBACK_f match_callback; /* Match call-back function */ /* this flag indicates that if automata is finalized by * ac_automata_finalize() or not. 1 means finalized and 0 @@ -58,10 +58,10 @@ typedef struct } AC_AUTOMATA_t; -AC_AUTOMATA_t * ac_automata_init (MATCH_CALBACK_f mc); +AC_AUTOMATA_t * ac_automata_init (MATCH_CALLBACK_f mc); AC_ERROR_t ac_automata_add (AC_AUTOMATA_t * thiz, AC_PATTERN_t * str); void ac_automata_finalize (AC_AUTOMATA_t * thiz); -int ac_automata_search (AC_AUTOMATA_t * thiz, AC_TEXT_t * str, void * param); +int ac_automata_search (AC_AUTOMATA_t * thiz, AC_TEXT_t * str, AC_REP_t * param); void ac_automata_reset (AC_AUTOMATA_t * thiz); void ac_automata_release (AC_AUTOMATA_t * thiz); void ac_automata_display (AC_AUTOMATA_t * thiz, char repcast); |