]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
applayer: add typedef for Parsing functions
authorPierre Chifflier <chifflier@wzdftpd.net>
Fri, 27 Oct 2017 11:07:29 +0000 (13:07 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 23 Nov 2017 06:14:16 +0000 (07:14 +0100)
src/app-layer-parser.c
src/app-layer-parser.h

index b564c06d356ec16eb7eeba78da8a8c8982e272f8..4045a8ed814e7e2d60440d236d18cdd98b290d3c 100644 (file)
@@ -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();
 
index f7343cde2a90831df0c1d12d832671a7e6474e22..efaa02c87a5b0c497a935b73f08ceae3e9f2ad52 100644 (file)
@@ -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);