]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
app-layer: parser flags to u16
authorVictor Julien <vjulien@oisf.net>
Fri, 19 Aug 2022 08:49:41 +0000 (10:49 +0200)
committerVictor Julien <vjulien@oisf.net>
Fri, 30 Sep 2022 07:46:05 +0000 (09:46 +0200)
rust/src/applayer.rs
src/app-layer-parser.c
src/app-layer-parser.h

index d6b08ad5a0444b987a85dcd965a478b0ea740f5a..f44b5b63b9a2f8237cac4f121a5ace1a86c64bcf 100644 (file)
@@ -424,12 +424,12 @@ extern {
 }
 
 // Defined in app-layer-parser.h
-pub const APP_LAYER_PARSER_EOF_TS : u8 = BIT_U8!(5);
-pub const APP_LAYER_PARSER_EOF_TC : u8 = BIT_U8!(6);
-pub const APP_LAYER_PARSER_NO_INSPECTION : u8 = BIT_U8!(1);
-pub const APP_LAYER_PARSER_NO_REASSEMBLY : u8 = BIT_U8!(2);
-pub const APP_LAYER_PARSER_NO_INSPECTION_PAYLOAD : u8 = BIT_U8!(3);
-pub const APP_LAYER_PARSER_BYPASS_READY : u8 = BIT_U8!(4);
+pub const APP_LAYER_PARSER_NO_INSPECTION : u16 = BIT_U16!(1);
+pub const APP_LAYER_PARSER_NO_REASSEMBLY : u16 = BIT_U16!(2);
+pub const APP_LAYER_PARSER_NO_INSPECTION_PAYLOAD : u16 = BIT_U16!(3);
+pub const APP_LAYER_PARSER_BYPASS_READY : u16 = BIT_U16!(4);
+pub const APP_LAYER_PARSER_EOF_TS : u16 = BIT_U16!(5);
+pub const APP_LAYER_PARSER_EOF_TC : u16 = BIT_U16!(6);
 
 pub const APP_LAYER_PARSER_OPT_ACCEPT_GAPS: u32 = BIT_U32!(0);
 pub const APP_LAYER_PARSER_OPT_UNIDIR_TXS: u32 = BIT_U32!(1);
@@ -442,8 +442,8 @@ pub type AppLayerGetTxIteratorFn = unsafe extern "C" fn (ipproto: u8,
                                                   istate: &mut u64) -> applayer::AppLayerGetTxIterTuple;
 
 extern {
-    pub fn AppLayerParserStateSetFlag(state: *mut c_void, flag: u8);
-    pub fn AppLayerParserStateIssetFlag(state: *mut c_void, flag: u8) -> c_int;
+    pub fn AppLayerParserStateSetFlag(state: *mut c_void, flag: u16);
+    pub fn AppLayerParserStateIssetFlag(state: *mut c_void, flag: u16) -> u16;
     pub fn AppLayerParserSetStreamDepth(ipproto: u8, alproto: AppProto, stream_depth: u32);
     pub fn AppLayerParserConfParserEnabled(ipproto: *const c_char, proto: *const c_char) -> c_int;
     pub fn AppLayerParserRegisterGetTxIterator(ipproto: u8, alproto: AppProto, fun: AppLayerGetTxIteratorFn);
index 2ace163b10e88a9f192477400082eefd9c44c110..3bc32d1e06ab326cf46c13be4b2f1a11e87370b2 100644 (file)
@@ -155,7 +155,7 @@ typedef struct AppLayerParserCtx_ {
 
 struct AppLayerParserState_ {
     /* coccinelle: AppLayerParserState:flags:APP_LAYER_PARSER_ */
-    uint8_t flags;
+    uint16_t flags;
 
     /* Indicates the current transaction that is being inspected.
      * We have a var per direction. */
@@ -1741,7 +1741,7 @@ void AppLayerParserRegisterProtocolParsers(void)
 
 
 /* coccinelle: AppLayerParserStateSetFlag():2,2:APP_LAYER_PARSER_ */
-void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint8_t flag)
+void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint16_t flag)
 {
     SCEnter();
     pstate->flags |= flag;
@@ -1749,10 +1749,10 @@ void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint8_t flag)
 }
 
 /* coccinelle: AppLayerParserStateIssetFlag():2,2:APP_LAYER_PARSER_ */
-int AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint8_t flag)
+uint16_t AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint16_t flag)
 {
     SCEnter();
-    SCReturnInt(pstate->flags & flag);
+    SCReturnUInt(pstate->flags & flag);
 }
 
 
index fb9f6510bda24138befc0c43b581daff0bcb4a17..21565af316d66dc2cdcd3465ba3fab1e707ee884 100644 (file)
 #include "util-config.h"
 
 /* Flags for AppLayerParserState. */
-// flag available                               BIT_U8(0)
-#define APP_LAYER_PARSER_NO_INSPECTION          BIT_U8(1)
-#define APP_LAYER_PARSER_NO_REASSEMBLY          BIT_U8(2)
-#define APP_LAYER_PARSER_NO_INSPECTION_PAYLOAD  BIT_U8(3)
-#define APP_LAYER_PARSER_BYPASS_READY           BIT_U8(4)
-#define APP_LAYER_PARSER_EOF_TS                 BIT_U8(5)
-#define APP_LAYER_PARSER_EOF_TC                 BIT_U8(6)
+// flag available                               BIT_U16(0)
+#define APP_LAYER_PARSER_NO_INSPECTION         BIT_U16(1)
+#define APP_LAYER_PARSER_NO_REASSEMBLY         BIT_U16(2)
+#define APP_LAYER_PARSER_NO_INSPECTION_PAYLOAD BIT_U16(3)
+#define APP_LAYER_PARSER_BYPASS_READY          BIT_U16(4)
+#define APP_LAYER_PARSER_EOF_TS                BIT_U16(5)
+#define APP_LAYER_PARSER_EOF_TC                BIT_U16(6)
 
 /* Flags for AppLayerParserProtoCtx. */
 #define APP_LAYER_PARSER_OPT_ACCEPT_GAPS        BIT_U32(0)
@@ -286,15 +286,12 @@ void AppLayerParserStateCleanup(const Flow *f, void *alstate, AppLayerParserStat
 
 void AppLayerParserRegisterProtocolParsers(void);
 
-
-void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint8_t flag);
-int AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint8_t flag);
+void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint16_t flag);
+uint16_t AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint16_t flag);
 
 void AppLayerParserStreamTruncated(uint8_t ipproto, AppProto alproto, void *alstate,
                         uint8_t direction);
 
-
-
 AppLayerParserState *AppLayerParserStateAlloc(void);
 void AppLayerParserStateFree(AppLayerParserState *pstate);