diff --git a/rust/src/applayer.rs b/rust/src/applayer.rs index d6b08ad5a0..f44b5b63b9 100644 --- a/rust/src/applayer.rs +++ b/rust/src/applayer.rs @@ -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); diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index 2ace163b10..3bc32d1e06 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -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); } diff --git a/src/app-layer-parser.h b/src/app-layer-parser.h index fb9f6510bd..21565af316 100644 --- a/src/app-layer-parser.h +++ b/src/app-layer-parser.h @@ -31,13 +31,13 @@ #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);