app-layer: parser flags to u16

pull/7954/head
Victor Julien 3 years ago
parent a1d728bb65
commit ff9d1807f9

@ -424,12 +424,12 @@ extern {
} }
// Defined in app-layer-parser.h // Defined in app-layer-parser.h
pub const APP_LAYER_PARSER_EOF_TS : u8 = BIT_U8!(5); pub const APP_LAYER_PARSER_NO_INSPECTION : u16 = BIT_U16!(1);
pub const APP_LAYER_PARSER_EOF_TC : u8 = BIT_U8!(6); pub const APP_LAYER_PARSER_NO_REASSEMBLY : u16 = BIT_U16!(2);
pub const APP_LAYER_PARSER_NO_INSPECTION : u8 = BIT_U8!(1); pub const APP_LAYER_PARSER_NO_INSPECTION_PAYLOAD : u16 = BIT_U16!(3);
pub const APP_LAYER_PARSER_NO_REASSEMBLY : u8 = BIT_U8!(2); pub const APP_LAYER_PARSER_BYPASS_READY : u16 = BIT_U16!(4);
pub const APP_LAYER_PARSER_NO_INSPECTION_PAYLOAD : u8 = BIT_U8!(3); pub const APP_LAYER_PARSER_EOF_TS : u16 = BIT_U16!(5);
pub const APP_LAYER_PARSER_BYPASS_READY : u8 = BIT_U8!(4); 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_ACCEPT_GAPS: u32 = BIT_U32!(0);
pub const APP_LAYER_PARSER_OPT_UNIDIR_TXS: u32 = BIT_U32!(1); 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; istate: &mut u64) -> applayer::AppLayerGetTxIterTuple;
extern { extern {
pub fn AppLayerParserStateSetFlag(state: *mut c_void, flag: u8); pub fn AppLayerParserStateSetFlag(state: *mut c_void, flag: u16);
pub fn AppLayerParserStateIssetFlag(state: *mut c_void, flag: u8) -> c_int; pub fn AppLayerParserStateIssetFlag(state: *mut c_void, flag: u16) -> u16;
pub fn AppLayerParserSetStreamDepth(ipproto: u8, alproto: AppProto, stream_depth: u32); 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 AppLayerParserConfParserEnabled(ipproto: *const c_char, proto: *const c_char) -> c_int;
pub fn AppLayerParserRegisterGetTxIterator(ipproto: u8, alproto: AppProto, fun: AppLayerGetTxIteratorFn); pub fn AppLayerParserRegisterGetTxIterator(ipproto: u8, alproto: AppProto, fun: AppLayerGetTxIteratorFn);

@ -155,7 +155,7 @@ typedef struct AppLayerParserCtx_ {
struct AppLayerParserState_ { struct AppLayerParserState_ {
/* coccinelle: AppLayerParserState:flags:APP_LAYER_PARSER_ */ /* coccinelle: AppLayerParserState:flags:APP_LAYER_PARSER_ */
uint8_t flags; uint16_t flags;
/* Indicates the current transaction that is being inspected. /* Indicates the current transaction that is being inspected.
* We have a var per direction. */ * We have a var per direction. */
@ -1741,7 +1741,7 @@ void AppLayerParserRegisterProtocolParsers(void)
/* coccinelle: AppLayerParserStateSetFlag():2,2:APP_LAYER_PARSER_ */ /* coccinelle: AppLayerParserStateSetFlag():2,2:APP_LAYER_PARSER_ */
void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint8_t flag) void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint16_t flag)
{ {
SCEnter(); SCEnter();
pstate->flags |= flag; pstate->flags |= flag;
@ -1749,10 +1749,10 @@ void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint8_t flag)
} }
/* coccinelle: AppLayerParserStateIssetFlag():2,2:APP_LAYER_PARSER_ */ /* coccinelle: AppLayerParserStateIssetFlag():2,2:APP_LAYER_PARSER_ */
int AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint8_t flag) uint16_t AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint16_t flag)
{ {
SCEnter(); SCEnter();
SCReturnInt(pstate->flags & flag); SCReturnUInt(pstate->flags & flag);
} }

@ -31,13 +31,13 @@
#include "util-config.h" #include "util-config.h"
/* Flags for AppLayerParserState. */ /* Flags for AppLayerParserState. */
// flag available BIT_U8(0) // flag available BIT_U16(0)
#define APP_LAYER_PARSER_NO_INSPECTION BIT_U8(1) #define APP_LAYER_PARSER_NO_INSPECTION BIT_U16(1)
#define APP_LAYER_PARSER_NO_REASSEMBLY BIT_U8(2) #define APP_LAYER_PARSER_NO_REASSEMBLY BIT_U16(2)
#define APP_LAYER_PARSER_NO_INSPECTION_PAYLOAD BIT_U8(3) #define APP_LAYER_PARSER_NO_INSPECTION_PAYLOAD BIT_U16(3)
#define APP_LAYER_PARSER_BYPASS_READY BIT_U8(4) #define APP_LAYER_PARSER_BYPASS_READY BIT_U16(4)
#define APP_LAYER_PARSER_EOF_TS BIT_U8(5) #define APP_LAYER_PARSER_EOF_TS BIT_U16(5)
#define APP_LAYER_PARSER_EOF_TC BIT_U8(6) #define APP_LAYER_PARSER_EOF_TC BIT_U16(6)
/* Flags for AppLayerParserProtoCtx. */ /* Flags for AppLayerParserProtoCtx. */
#define APP_LAYER_PARSER_OPT_ACCEPT_GAPS BIT_U32(0) #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 AppLayerParserRegisterProtocolParsers(void);
void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint16_t flag);
void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint8_t flag); uint16_t AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint16_t flag);
int AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint8_t flag);
void AppLayerParserStreamTruncated(uint8_t ipproto, AppProto alproto, void *alstate, void AppLayerParserStreamTruncated(uint8_t ipproto, AppProto alproto, void *alstate,
uint8_t direction); uint8_t direction);
AppLayerParserState *AppLayerParserStateAlloc(void); AppLayerParserState *AppLayerParserStateAlloc(void);
void AppLayerParserStateFree(AppLayerParserState *pstate); void AppLayerParserStateFree(AppLayerParserState *pstate);

Loading…
Cancel
Save