From: Pierre Chifflier Date: Fri, 27 Oct 2017 11:07:29 +0000 (+0200) Subject: applayer: add typedef for Parsing functions X-Git-Tag: suricata-4.1.0-beta1~559 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c8bdfd3dd6a1cb93f26f87ac0a512119bfdb9ff;p=thirdparty%2Fsuricata.git applayer: add typedef for Parsing functions --- diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index b564c06d35..4045a8ed81 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -88,10 +88,7 @@ struct AppLayerParserThreadCtx_ { typedef struct AppLayerParserProtoCtx_ { /* 0 - to_server, 1 - to_client. */ - int (*Parser[2])(Flow *f, void *protocol_state, - AppLayerParserState *pstate, - uint8_t *input, uint32_t input_len, - void *local_storage); + AppLayerParserFPtr Parser[2]; char logger; void *(*StateAlloc)(void); @@ -349,10 +346,7 @@ int AppLayerParserConfParserEnabled(const char *ipproto, int AppLayerParserRegisterParser(uint8_t ipproto, AppProto alproto, uint8_t direction, - int (*Parser)(Flow *f, void *protocol_state, - AppLayerParserState *pstate, - uint8_t *buf, uint32_t buf_len, - void *local_storage)) + AppLayerParserFPtr Parser) { SCEnter(); diff --git a/src/app-layer-parser.h b/src/app-layer-parser.h index f7343cde2a..efaa02c87a 100644 --- a/src/app-layer-parser.h +++ b/src/app-layer-parser.h @@ -103,6 +103,12 @@ void AppLayerParserThreadCtxFree(AppLayerParserThreadCtx *tctx); int AppLayerParserConfParserEnabled(const char *ipproto, const char *alproto_name); +/** \brief Prototype for parsing functions */ +typedef int (*AppLayerParserFPtr)(Flow *f, void *protocol_state, + AppLayerParserState *pstate, + uint8_t *buf, uint32_t buf_len, + void *local_storage); + /***** Parser related registration *****/ /** @@ -113,10 +119,7 @@ int AppLayerParserConfParserEnabled(const char *ipproto, */ int AppLayerParserRegisterParser(uint8_t ipproto, AppProto alproto, uint8_t direction, - int (*Parser)(Flow *f, void *protocol_state, - AppLayerParserState *pstate, - uint8_t *buf, uint32_t buf_len, - void *local_storage)); + AppLayerParserFPtr Parser); void AppLayerParserRegisterParserAcceptableDataDirection(uint8_t ipproto, AppProto alproto, uint8_t direction);