From de286192b66cc16d51772fc716bff8e678376e0a Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Wed, 23 Oct 2024 12:10:46 -0600 Subject: [PATCH] app-layer: extract out a simple function type to simple header Extract a simple function function to a simple header with no circular dependencies. Next we'll use bindgen to generate Rust bindings for this function. Ticket: #7341 --- src/Makefile.am | 1 + src/app-layer-ext.h | 8 ++++++++ src/app-layer-register.h | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/app-layer-ext.h diff --git a/src/Makefile.am b/src/Makefile.am index 6970d709f35c..d1ab3af75a83 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,6 +19,7 @@ noinst_HEADERS = \ app-layer-dnp3-objects.h \ app-layer-events.h \ app-layer-expectation.h \ + app-layer-ext.h \ app-layer-frames.h \ app-layer-ftp.h \ app-layer.h \ diff --git a/src/app-layer-ext.h b/src/app-layer-ext.h new file mode 100644 index 000000000000..5eceb863e897 --- /dev/null +++ b/src/app-layer-ext.h @@ -0,0 +1,8 @@ +#ifndef SURICATA_APP_LAYER_EXT_H +#define SURICATA_APP_LAYER_EXT_H + +#include + +typedef int (*SCAppLayerStateGetProgressFn)(void *alstate, uint8_t direction); + +#endif /* SURICATA_APP_LAYER_EXT_H */ diff --git a/src/app-layer-register.h b/src/app-layer-register.h index 78eff7d8e4ce..15e99707d3f7 100644 --- a/src/app-layer-register.h +++ b/src/app-layer-register.h @@ -25,6 +25,7 @@ #define SURICATA_APP_LAYER_REGISTER_H #include "app-layer-detect-proto.h" +#include "app-layer-ext.h" typedef struct AppLayerParser { const char *name; @@ -49,7 +50,7 @@ typedef struct AppLayerParser { const int complete_ts; const int complete_tc; - int (*StateGetProgress)(void *alstate, uint8_t direction); + SCAppLayerStateGetProgressFn StateGetProgress; int (*StateGetEventInfo)(const char *event_name, int *event_id, AppLayerEventType *event_type);