]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
src: clean includes for app-layer-parser.h
authorPhilippe Antoine <pantoine@oisf.net>
Mon, 9 Jun 2025 20:05:12 +0000 (22:05 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 10 Jun 2025 20:13:53 +0000 (22:13 +0200)
To prepare bindgening

20 files changed:
src/app-layer-dnp3.c
src/app-layer-ftp.c
src/app-layer-htp.c
src/app-layer-modbus.c
src/app-layer-parser.c
src/app-layer-parser.h
src/app-layer-register.c
src/app-layer-smtp.c
src/app-layer-ssl.c
src/app-layer.c
src/detect-app-layer-event.c
src/detect-bytemath.c
src/detect-engine.c
src/detect-flowbits.c
src/detect-ike-vendor.c
src/detect-lua-extensions.c
src/flow.c
src/output-tx.c
src/rust-context.c
src/tests/fuzz/fuzz_applayerparserparse.c

index 63e5972319afb97a0825347518db8a846a65a10d..4fe796d58a8a0840703a028085b15d8f7ab34380 100644 (file)
@@ -32,6 +32,7 @@
 #include "app-layer-protos.h"
 #include "app-layer-parser.h"
 #include "app-layer-detect-proto.h"
+#include "app-layer-events.h"
 
 #include "app-layer-dnp3.h"
 #include "app-layer-dnp3-objects.h"
index e84fbb7072819b9203304a9f5ef0bbd40acbbc59..24245593d87bca39f6fdc034e8ca5a6046961834 100644 (file)
@@ -31,6 +31,7 @@
 #include "app-layer-parser.h"
 #include "app-layer-expectation.h"
 #include "app-layer-detect-proto.h"
+#include "app-layer-events.h"
 
 #include "rust.h"
 
index 4cc879a586c8bad4f40d1f29910332ccdc2bd88b..8ad24fe970d3f1b754118b96d0e8fb679c946421 100644 (file)
@@ -55,6 +55,7 @@
 #include "app-layer-htp-xff.h"
 #include "app-layer-htp-range.h"
 #include "app-layer-htp-mem.h"
+#include "app-layer-events.h"
 
 #include "util-debug.h"
 #include "util-misc.h"
index 5640953a53d5e9c829f5bee916f82c70f80a3e74..e0bd7f253f7637120b6743e5a36e2fd90e8ab4cb 100644 (file)
@@ -40,6 +40,7 @@
 
 #include "app-layer-parser.h"
 #include "app-layer-modbus.h"
+#include "rust.h"
 
 void ModbusParserRegisterTests(void);
 
index ff4d13c4c206ad3fd3feb793df94b253bd4c62b9..bd0f536c359fe882ab6909e1751a6d63febf78ac 100644 (file)
 #include "flow-util.h"
 
 #include "app-layer-frames.h"
+#include "app-layer-events.h"
 
 #include "stream-tcp.h"
 
 #include "util-validate.h"
+#include "util-config.h"
 
 #include "app-layer.h"
 #include "app-layer-detect-proto.h"
index d269c177e1e3fc8b90c0294ebafa54aefc7a5e06..f1ef43691492b1e9e50fab6a549ff6ac240aa499 100644 (file)
 #ifndef SURICATA_APP_LAYER_PARSER_H
 #define SURICATA_APP_LAYER_PARSER_H
 
-#include "app-layer-events.h"
-#include "util-file.h"
-#include "rust.h"
-#include "util-config.h"
+#include "app-layer-protos.h"
+// Forward declarations for bindgen
+enum ConfigAction;
+typedef struct Flow_ Flow;
+typedef struct AppLayerParserState_ AppLayerParserState;
+typedef struct AppLayerDecoderEvents_ AppLayerDecoderEvents;
+typedef struct ThreadVars_ ThreadVars;
+typedef struct File_ File;
+// Forward declarations from rust
+typedef struct StreamSlice StreamSlice;
+typedef struct AppLayerResult AppLayerResult;
+typedef struct AppLayerGetTxIterTuple AppLayerGetTxIterTuple;
+typedef struct AppLayerGetFileState AppLayerGetFileState;
+typedef struct AppLayerTxData AppLayerTxData;
+typedef enum AppLayerEventType AppLayerEventType;
+typedef struct AppLayerStateData AppLayerStateData;
+typedef struct AppLayerTxConfig AppLayerTxConfig;
 
 /* Flags for AppLayerParserState. */
 // flag available                               BIT_U16(0)
@@ -248,27 +261,9 @@ AppLayerStateData *AppLayerParserGetStateData(uint8_t ipproto, AppProto alproto,
 void AppLayerParserApplyTxConfig(uint8_t ipproto, AppProto alproto,
         void *state, void *tx, enum ConfigAction mode, AppLayerTxConfig);
 
-static inline bool AppLayerParserIsFileTx(const AppLayerTxData *txd)
-{
-    if (txd->file_tx != 0) {
-        return true;
-    }
-    return false;
-}
-
-static inline bool AppLayerParserIsFileTxInDir(const AppLayerTxData *txd, const uint8_t direction)
-{
-    if ((txd->file_tx & direction) != 0) {
-        return true;
-    }
-    return false;
-}
-
 /** \brief check if tx (possibly) has files in this tx for the direction */
-static inline bool AppLayerParserHasFilesInDir(const AppLayerTxData *txd, const uint8_t direction)
-{
-    return (txd->files_opened && AppLayerParserIsFileTxInDir(txd, direction));
-}
+#define AppLayerParserHasFilesInDir(txd, direction)                                                \
+    ((txd)->files_opened && ((txd)->file_tx & (direction)) != 0)
 
 /***** General *****/
 
index d60110c5e0ab2c2d74bd1bb03bd18331a7e1c6c3..00f08186824c4322f7782705db6c7a62ee3479f2 100644 (file)
@@ -27,6 +27,7 @@
 #include "suricata.h"
 #include "stream.h"
 #include "conf.h"
+#include "rust.h"
 
 #include "app-layer-detect-proto.h"
 #include "app-layer-parser.h"
index 5dfa7737b730118cfe8fbd5d0199e64b7ed507f7..12bf050ba920d3007254c2766e5a274735b8c7b0 100644 (file)
@@ -32,6 +32,7 @@
 #include "app-layer-protos.h"
 #include "app-layer-parser.h"
 #include "app-layer-frames.h"
+#include "app-layer-events.h"
 #include "app-layer-smtp.h"
 
 #include "util-enum.h"
index 8a64884525edb0b86719e0cd973e278def571925..2af5ac514bddd244e615ae7844c621272b3261b1 100644 (file)
@@ -32,6 +32,7 @@
 #include "app-layer-protos.h"
 #include "app-layer-parser.h"
 #include "app-layer-frames.h"
+#include "app-layer-events.h"
 #include "app-layer-ssl.h"
 
 #include "conf.h"
index 0171db8cf5d66c96d6ee2c8360aa8abb81974cc1..13dcee2a58b705d6ca2a901668b2783634139181 100644 (file)
@@ -34,6 +34,7 @@
 #include "app-layer-htp-range.h"
 #include "app-layer-detect-proto.h"
 #include "app-layer-frames.h"
+#include "app-layer-events.h"
 #include "stream-tcp-reassemble.h"
 #include "stream-tcp-private.h"
 #include "stream-tcp-inline.h"
index 88db53fa50c66c6ab142efe38b7593c233599b60..e7886da5d7d6f181d4bad72f933ee4f5ade2d702 100644 (file)
@@ -28,6 +28,7 @@
 #include "app-layer.h"
 #include "app-layer-protos.h"
 #include "app-layer-parser.h"
+#include "app-layer-events.h"
 #include "app-layer-smtp.h"
 #include "detect.h"
 #include "detect-parse.h"
index 053e07f28b650cb548f7c7a40ed59183fe3dc25d..10902cf8cc037d674040b2ccc8d194b7366fdbbe 100644 (file)
@@ -29,6 +29,7 @@
 #include "threads.h"
 #include "decode.h"
 
+#include "rust.h"
 #include "app-layer-parser.h"
 #include "app-layer-protos.h"
 
@@ -40,8 +41,6 @@
 #include "detect-engine-state.h"
 #include "detect-engine-build.h"
 
-#include "rust-bindings.h"
-
 #include "detect-content.h"
 #include "detect-pcre.h"
 #include "detect-byte.h"
index 42b28f711af9fa6c1ca2aefdf5a2fe1a2c92a55d..ba3a54b93f72bbc082840af75ac96dc73d96098d 100644 (file)
@@ -33,6 +33,7 @@
 #include "datasets.h"
 
 #include "app-layer-parser.h"
+#include "app-layer-events.h"
 #include "app-layer-htp.h"
 
 #include "detect-parse.h"
index 2d810112c279427b1b7ca6f3551fcb303fa814fb..ba029ccd7452acd7d859d2cdb3b5ec273a3a82c3 100644 (file)
@@ -34,6 +34,7 @@
 #include "flow-util.h"
 #include "detect-flowbits.h"
 #include "util-spm.h"
+#include "rust.h"
 
 #include "app-layer-parser.h"
 
index 220487f72399b026863ee51de81b3e6270e909ac..694ddfb95433c6004c449c8a17b6c8ed52c96f49 100644 (file)
 #include "detect-engine-content-inspection.h"
 #include "detect-engine-mpm.h"
 #include "detect-ike-vendor.h"
+#include "rust.h"
 #include "app-layer-parser.h"
 #include "util-byte.h"
 
-#include "rust-bindings.h"
 #include "util-profiling.h"
 
 static int DetectIkeVendorSetup(DetectEngineCtx *, Signature *, const char *);
index 339292d76ca19d8cec7a9fb870a156e8d69892fd..30b9e5771e020bad6a542f70bf66c1a7088d0f4b 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "detect-lua.h"
 
+#include "rust.h"
 #include "app-layer-parser.h"
 
 #include "util-lua.h"
index 751515303b32c18c787bf83d5da57c3276afd191..ef10da305ec26a7ef0069886b16ea83dbeca04e5 100644 (file)
@@ -57,6 +57,7 @@
 
 #include "util-debug.h"
 
+#include "rust.h"
 #include "app-layer-parser.h"
 #include "app-layer-expectation.h"
 
index 9bc08ad45cfeff0dfd2b27af70d3a550b17a74e1..996febf05736cb2d8767bf4eef653a30dba4266c 100644 (file)
@@ -29,6 +29,7 @@
 #include "stream.h"
 #include "app-layer.h"
 #include "app-layer-parser.h"
+#include "util-config.h"
 #include "util-profiling.h"
 #include "util-validate.h"
 
@@ -427,8 +428,8 @@ static TmEcode OutputTxLog(ThreadVars *tv, Packet *p, void *thread_data)
                 op_thread_data->filedata);
 
         if (file_logging_active) {
-            if (AppLayerParserIsFileTx(txd)) { // need to process each tx that might be a file tx,
-                                               // even if there are not files (yet)
+            if (txd->file_tx != 0) { // need to process each tx that might be a file tx,
+                                     // even if there are not files (yet)
                 const bool ts_ready = (tx_progress_ts == complete_ts);
                 const bool tc_ready = (tx_progress_tc == complete_tc);
                 SCLogDebug("ts_ready %d tc_ready %d", ts_ready, tc_ready);
@@ -444,7 +445,7 @@ static TmEcode OutputTxLog(ThreadVars *tv, Packet *p, void *thread_data)
                 /* call only for the correct direction, except when it looks anything like a end of
                  * transaction or end of stream. Since OutputTxLogFiles has complicated logic around
                  * that, we just leave it to that function to sort things out for now. */
-                if (eval_files || AppLayerParserIsFileTxInDir(txd, pkt_dir)) {
+                if (eval_files || ((txd->file_tx & pkt_dir) != 0)) {
                     OutputTxLogFiles(tv, op_thread_data->file, op_thread_data->filedata, p, f, tx,
                             tx_id, txd, tx_complete, ts_ready, tc_ready, ts_eof, tc_eof, eof);
                 }
index 226ae5c0442ba23f3b1a8e30d352759f4bed2ca9..2155121f30a372e98e501dec92202abe5f623149 100644 (file)
@@ -18,6 +18,7 @@
 #include "suricata-common.h"
 #include "rust-context.h"
 #include "app-layer-parser.h"
+#include "app-layer-events.h"
 #include "app-layer-register.h"
 #include "app-layer-htp-range.h"
 #include "app-layer-htp-file.h"
index 759dcd371f432166049252a277dab48773ceaa50..4e4c7cfe48fdc38b02c860855d4bf5acd9cf431e 100644 (file)
@@ -13,6 +13,7 @@
 #include "util-byte.h"
 #include "conf-yaml-loader.h"
 #include "util-conf.h"
+#include "rust.h"
 
 #define HEADER_LEN 6