diff --git a/rust/src/applayer.rs b/rust/src/applayer.rs index 40d9064aba..d1086c7bc0 100644 --- a/rust/src/applayer.rs +++ b/rust/src/applayer.rs @@ -256,7 +256,7 @@ pub type ParseFn = extern "C" fn (flow: *const Flow, data: *const c_void, flags: u8) -> AppLayerResult; pub type ProbeFn = extern "C" fn (flow: *const Flow,direction: u8,input:*const u8, input_len: u32, rdir: *mut u8) -> AppProto; -pub type StateAllocFn = extern "C" fn () -> *mut c_void; +pub type StateAllocFn = extern "C" fn (*mut c_void, AppProto) -> *mut c_void; pub type StateFreeFn = extern "C" fn (*mut c_void); pub type StateTxFreeFn = extern "C" fn (*mut c_void, u64); pub type StateGetTxFn = extern "C" fn (*mut c_void, u64) -> *mut c_void; diff --git a/rust/src/applayertemplate/template.rs b/rust/src/applayertemplate/template.rs index c1c1d656b7..09a57fb806 100644 --- a/rust/src/applayertemplate/template.rs +++ b/rust/src/applayertemplate/template.rs @@ -284,7 +284,7 @@ pub extern "C" fn rs_template_probing_parser( } #[no_mangle] -pub extern "C" fn rs_template_state_new() -> *mut std::os::raw::c_void { +pub extern "C" fn rs_template_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { let state = TemplateState::new(); let boxed = Box::new(state); return unsafe { transmute(boxed) }; @@ -607,4 +607,4 @@ mod test { let r = state.parse_request(&buf[0..9]); assert_eq!(r, AppLayerResult{ status: 1, consumed: 7, needed: 3}); } -} \ No newline at end of file +} diff --git a/rust/src/dcerpc/dcerpc.rs b/rust/src/dcerpc/dcerpc.rs index 54f2302477..e6b615a563 100644 --- a/rust/src/dcerpc/dcerpc.rs +++ b/rust/src/dcerpc/dcerpc.rs @@ -1137,7 +1137,7 @@ pub extern "C" fn rs_dcerpc_parse_response( } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_state_new() -> *mut std::os::raw::c_void { +pub unsafe extern "C" fn rs_dcerpc_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: core::AppProto) -> *mut std::os::raw::c_void { let state = DCERPCState::new(); let boxed = Box::new(state); transmute(boxed) diff --git a/rust/src/dcerpc/dcerpc_udp.rs b/rust/src/dcerpc/dcerpc_udp.rs index 798eb80991..30612a4985 100644 --- a/rust/src/dcerpc/dcerpc_udp.rs +++ b/rust/src/dcerpc/dcerpc_udp.rs @@ -308,7 +308,7 @@ pub extern "C" fn rs_dcerpc_udp_state_free(state: *mut std::os::raw::c_void) { } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_udp_state_new() -> *mut std::os::raw::c_void { +pub unsafe extern "C" fn rs_dcerpc_udp_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: core::AppProto) -> *mut std::os::raw::c_void { let state = DCERPCUDPState::new(); let boxed = Box::new(state); transmute(boxed) diff --git a/rust/src/dhcp/dhcp.rs b/rust/src/dhcp/dhcp.rs index 75ee8a9ed5..6db2e5cf0c 100644 --- a/rust/src/dhcp/dhcp.rs +++ b/rust/src/dhcp/dhcp.rs @@ -306,7 +306,7 @@ pub extern "C" fn rs_dhcp_state_tx_free( } #[no_mangle] -pub extern "C" fn rs_dhcp_state_new() -> *mut std::os::raw::c_void { +pub extern "C" fn rs_dhcp_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { let state = DHCPState::new(); let boxed = Box::new(state); return unsafe { diff --git a/rust/src/dns/dns.rs b/rust/src/dns/dns.rs index 2a8f0cc126..c1824cb800 100644 --- a/rust/src/dns/dns.rs +++ b/rust/src/dns/dns.rs @@ -714,7 +714,7 @@ pub fn probe_tcp(input: &[u8]) -> (bool, bool, bool) { /// Returns *mut DNSState #[no_mangle] -pub extern "C" fn rs_dns_state_new() -> *mut std::os::raw::c_void { +pub extern "C" fn rs_dns_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { let state = DNSState::new(); let boxed = Box::new(state); return unsafe{transmute(boxed)}; diff --git a/rust/src/http2/http2.rs b/rust/src/http2/http2.rs index 52e1447566..b525f81193 100644 --- a/rust/src/http2/http2.rs +++ b/rust/src/http2/http2.rs @@ -878,7 +878,7 @@ pub extern "C" fn rs_http2_probing_parser_tc( } #[no_mangle] -pub extern "C" fn rs_http2_state_new() -> *mut std::os::raw::c_void { +pub extern "C" fn rs_http2_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { let state = HTTP2State::new(); let boxed = Box::new(state); return unsafe { transmute(boxed) }; diff --git a/rust/src/ikev2/ikev2.rs b/rust/src/ikev2/ikev2.rs index 82717b0a19..f027c584c9 100644 --- a/rust/src/ikev2/ikev2.rs +++ b/rust/src/ikev2/ikev2.rs @@ -445,7 +445,7 @@ impl Drop for IKEV2Transaction { /// Returns *mut IKEV2State #[no_mangle] -pub extern "C" fn rs_ikev2_state_new() -> *mut std::os::raw::c_void { +pub extern "C" fn rs_ikev2_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { let state = IKEV2State::new(); let boxed = Box::new(state); return unsafe{std::mem::transmute(boxed)}; diff --git a/rust/src/krb/krb5.rs b/rust/src/krb/krb5.rs index ef2a928e83..84b8187f2b 100644 --- a/rust/src/krb/krb5.rs +++ b/rust/src/krb/krb5.rs @@ -273,7 +273,7 @@ pub fn test_weak_encryption(alg:EncryptionType) -> bool { /// Returns *mut KRB5State #[no_mangle] -pub extern "C" fn rs_krb5_state_new() -> *mut std::os::raw::c_void { +pub extern "C" fn rs_krb5_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { let state = KRB5State::new(); let boxed = Box::new(state); return unsafe{std::mem::transmute(boxed)}; diff --git a/rust/src/mqtt/mqtt.rs b/rust/src/mqtt/mqtt.rs index 7c5643fc35..0da856e1c1 100644 --- a/rust/src/mqtt/mqtt.rs +++ b/rust/src/mqtt/mqtt.rs @@ -578,7 +578,7 @@ pub extern "C" fn rs_mqtt_probing_parser( } #[no_mangle] -pub extern "C" fn rs_mqtt_state_new() -> *mut std::os::raw::c_void { +pub extern "C" fn rs_mqtt_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { let state = MQTTState::new(); let boxed = Box::new(state); return unsafe { transmute(boxed) }; diff --git a/rust/src/nfs/nfs.rs b/rust/src/nfs/nfs.rs index 8b65c792c2..283370fe16 100644 --- a/rust/src/nfs/nfs.rs +++ b/rust/src/nfs/nfs.rs @@ -1408,7 +1408,7 @@ impl NFSState { /// Returns *mut NFSState #[no_mangle] -pub extern "C" fn rs_nfs_state_new() -> *mut std::os::raw::c_void { +pub extern "C" fn rs_nfs_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { let state = NFSState::new(); let boxed = Box::new(state); SCLogDebug!("allocating state"); diff --git a/rust/src/ntp/ntp.rs b/rust/src/ntp/ntp.rs index 8d7d7d609c..b76e9237c7 100644 --- a/rust/src/ntp/ntp.rs +++ b/rust/src/ntp/ntp.rs @@ -175,7 +175,7 @@ impl Drop for NTPTransaction { /// Returns *mut NTPState #[no_mangle] -pub extern "C" fn rs_ntp_state_new() -> *mut std::os::raw::c_void { +pub extern "C" fn rs_ntp_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { let state = NTPState::new(); let boxed = Box::new(state); return unsafe{std::mem::transmute(boxed)}; diff --git a/rust/src/rdp/rdp.rs b/rust/src/rdp/rdp.rs index 20780bca13..8b8d134566 100644 --- a/rust/src/rdp/rdp.rs +++ b/rust/src/rdp/rdp.rs @@ -365,7 +365,7 @@ impl RdpState { } #[no_mangle] -pub extern "C" fn rs_rdp_state_new() -> *mut std::os::raw::c_void { +pub extern "C" fn rs_rdp_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { let state = RdpState::new(); let boxed = Box::new(state); return unsafe { std::mem::transmute(boxed) }; diff --git a/rust/src/rfb/rfb.rs b/rust/src/rfb/rfb.rs index 9cb596790c..bdd0dd784d 100644 --- a/rust/src/rfb/rfb.rs +++ b/rust/src/rfb/rfb.rs @@ -518,7 +518,7 @@ export_tx_set_detect_state!( ); #[no_mangle] -pub extern "C" fn rs_rfb_state_new() -> *mut std::os::raw::c_void { +pub extern "C" fn rs_rfb_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { let state = RFBState::new(); let boxed = Box::new(state); return unsafe { transmute(boxed) }; diff --git a/rust/src/sip/sip.rs b/rust/src/sip/sip.rs index b20735ce85..b44461d84e 100755 --- a/rust/src/sip/sip.rs +++ b/rust/src/sip/sip.rs @@ -169,7 +169,7 @@ impl Drop for SIPTransaction { } #[no_mangle] -pub extern "C" fn rs_sip_state_new() -> *mut std::os::raw::c_void { +pub extern "C" fn rs_sip_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { let state = SIPState::new(); let boxed = Box::new(state); return unsafe { std::mem::transmute(boxed) }; diff --git a/rust/src/smb/smb.rs b/rust/src/smb/smb.rs index c8874e0d01..8071d50ca8 100644 --- a/rust/src/smb/smb.rs +++ b/rust/src/smb/smb.rs @@ -1824,7 +1824,7 @@ impl SMBState { /// Returns *mut SMBState #[no_mangle] -pub extern "C" fn rs_smb_state_new() -> *mut std::os::raw::c_void { +pub extern "C" fn rs_smb_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { let state = SMBState::new(); let boxed = Box::new(state); SCLogDebug!("allocating state"); diff --git a/rust/src/snmp/snmp.rs b/rust/src/snmp/snmp.rs index cbdf6d2c21..a96e4a25dc 100644 --- a/rust/src/snmp/snmp.rs +++ b/rust/src/snmp/snmp.rs @@ -297,7 +297,7 @@ impl<'a> Drop for SNMPTransaction<'a> { /// Returns *mut SNMPState #[no_mangle] -pub extern "C" fn rs_snmp_state_new() -> *mut std::os::raw::c_void { +pub extern "C" fn rs_snmp_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { let state = SNMPState::new(); let boxed = Box::new(state); return unsafe{std::mem::transmute(boxed)}; diff --git a/rust/src/ssh/ssh.rs b/rust/src/ssh/ssh.rs index b4e93e8009..34e62bf763 100644 --- a/rust/src/ssh/ssh.rs +++ b/rust/src/ssh/ssh.rs @@ -428,7 +428,7 @@ pub extern "C" fn rs_ssh_state_get_event_info_by_id( } #[no_mangle] -pub extern "C" fn rs_ssh_state_new() -> *mut std::os::raw::c_void { +pub extern "C" fn rs_ssh_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { let state = SSHState::new(); let boxed = Box::new(state); return unsafe { transmute(boxed) }; diff --git a/src/app-layer-dcerpc-udp.c b/src/app-layer-dcerpc-udp.c index 052cb6bc1f..6c2e96b53d 100644 --- a/src/app-layer-dcerpc-udp.c +++ b/src/app-layer-dcerpc-udp.c @@ -57,9 +57,9 @@ static AppLayerResult RustDCERPCUDPParse(Flow *f, void *dcerpc_state, local_data, flags); } -static void *RustDCERPCUDPStateNew(void) +static void *RustDCERPCUDPStateNew(void *state_orig, AppProto proto_orig) { - return rs_dcerpc_udp_state_new(); + return rs_dcerpc_udp_state_new(state_orig, proto_orig); } static void RustDCERPCUDPStateFree(void *s) diff --git a/src/app-layer-dcerpc.c b/src/app-layer-dcerpc.c index bb0d1baac9..45ad3ac31b 100644 --- a/src/app-layer-dcerpc.c +++ b/src/app-layer-dcerpc.c @@ -81,9 +81,9 @@ static AppLayerResult DCERPCParseResponse(Flow *f, void *dcerpc_state, } } -static void *RustDCERPCStateNew(void) +static void *RustDCERPCStateNew(void *state_orig, AppProto proto_orig) { - return rs_dcerpc_state_new(); + return rs_dcerpc_state_new(state_orig, proto_orig); } static void DCERPCStateFree(void *s) diff --git a/src/app-layer-dnp3.c b/src/app-layer-dnp3.c index 0a9a0cbadc..e87d7453b4 100644 --- a/src/app-layer-dnp3.c +++ b/src/app-layer-dnp3.c @@ -432,7 +432,7 @@ static int DNP3ReassembleApplicationLayer(const uint8_t *input, * * The DNP3 state object represents a single DNP3 TCP session. */ -static void *DNP3StateAlloc(void) +static void *DNP3StateAlloc(void *orig_state, AppProto proto_orig) { SCEnter(); DNP3State *dnp3; @@ -2510,7 +2510,7 @@ static int DNP3ParserTestParsePDU01(void) 0xe1, 0xc8, 0x01, 0x01, 0x00, 0x06, 0x77, 0x6e }; - DNP3State *dnp3state = DNP3StateAlloc(); + DNP3State *dnp3state = DNP3StateAlloc(NULL, ALPROTO_UNKNOWN); int pdus = DNP3HandleRequestLinkLayer(dnp3state, pkt, sizeof(pkt)); FAIL_IF(pdus < 1); DNP3Transaction *dnp3tx = DNP3GetTx(dnp3state, 0); @@ -2549,7 +2549,7 @@ static int DNP3ParserDecodeG70V3Test(void) 0xc4, 0x8b }; - DNP3State *dnp3state = DNP3StateAlloc(); + DNP3State *dnp3state = DNP3StateAlloc(NULL, ALPROTO_UNKNOWN); FAIL_IF_NULL(dnp3state); int bytes = DNP3HandleRequestLinkLayer(dnp3state, pkt, sizeof(pkt)); FAIL_IF(bytes != sizeof(pkt)); @@ -2610,7 +2610,7 @@ static int DNP3ParserUnknownEventAlertTest(void) DNP3FixCrc(pkt + 10, sizeof(pkt) - 10); - DNP3State *dnp3state = DNP3StateAlloc(); + DNP3State *dnp3state = DNP3StateAlloc(NULL, ALPROTO_UNKNOWN); FAIL_IF_NULL(dnp3state); int bytes = DNP3HandleRequestLinkLayer(dnp3state, pkt, sizeof(pkt)); FAIL_IF(bytes != sizeof(pkt)); diff --git a/src/app-layer-enip.c b/src/app-layer-enip.c index aace890a8e..339edcb4bf 100644 --- a/src/app-layer-enip.c +++ b/src/app-layer-enip.c @@ -159,7 +159,7 @@ static int ENIPStateGetEventInfoById(int event_id, const char **event_name, * * return state */ -static void *ENIPStateAlloc(void) +static void *ENIPStateAlloc(void *orig_state, AppProto proto_orig) { SCLogDebug("ENIPStateAlloc"); void *s = SCMalloc(sizeof(ENIPState)); diff --git a/src/app-layer-ftp.c b/src/app-layer-ftp.c index 1a3e91cb27..66a4a65149 100644 --- a/src/app-layer-ftp.c +++ b/src/app-layer-ftp.c @@ -833,7 +833,7 @@ static uint64_t ftp_state_memuse = 0; static uint64_t ftp_state_memcnt = 0; #endif -static void *FTPStateAlloc(void) +static void *FTPStateAlloc(void *orig_state, AppProto proto_orig) { void *s = FTPCalloc(1, sizeof(FtpState)); if (unlikely(s == NULL)) @@ -1152,7 +1152,7 @@ static uint64_t ftpdata_state_memuse = 0; static uint64_t ftpdata_state_memcnt = 0; #endif -static void *FTPDataStateAlloc(void) +static void *FTPDataStateAlloc(void *orig_state, AppProto proto_orig) { void *s = FTPCalloc(1, sizeof(FtpDataState)); if (unlikely(s == NULL)) diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index a573c32300..06f9a31245 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -340,7 +340,7 @@ static AppLayerDecoderEvents *HTPGetEvents(void *tx) /** \brief Function to allocates the HTTP state memory and also creates the HTTP * connection parser to be used by the HTP library */ -static void *HTPStateAlloc(void) +static void *HTPStateAlloc(void *orig_state, AppProto proto_orig) { SCEnter(); diff --git a/src/app-layer-modbus.c b/src/app-layer-modbus.c index f5908e7fc9..97cfa7e336 100644 --- a/src/app-layer-modbus.c +++ b/src/app-layer-modbus.c @@ -1394,7 +1394,7 @@ static AppLayerResult ModbusParseResponse(Flow *f, /** \internal * \brief Function to allocate the Modbus state memory */ -static void *ModbusStateAlloc(void) +static void *ModbusStateAlloc(void *orig_state, AppProto proto_orig) { ModbusState *modbus; diff --git a/src/app-layer-nfs-tcp.c b/src/app-layer-nfs-tcp.c index 0d753d5547..92ed47e937 100644 --- a/src/app-layer-nfs-tcp.c +++ b/src/app-layer-nfs-tcp.c @@ -66,9 +66,9 @@ SCEnumCharMap nfs_decoder_event_table[] = { { NULL, 0 } }; -static void *NFSTCPStateAlloc(void) +static void *NFSTCPStateAlloc(void *orig_state, AppProto proto_orig) { - return rs_nfs_state_new(); + return rs_nfs_state_new(orig_state, proto_orig); } static void NFSTCPStateFree(void *state) diff --git a/src/app-layer-nfs-udp.c b/src/app-layer-nfs-udp.c index a7a8bc224d..7b44487d82 100644 --- a/src/app-layer-nfs-udp.c +++ b/src/app-layer-nfs-udp.c @@ -63,9 +63,9 @@ SCEnumCharMap nfs_udp_decoder_event_table[] = { { NULL, 0 } }; -static void *NFSStateAlloc(void) +static void *NFSStateAlloc(void *orig_state, AppProto proto_orig) { - return rs_nfs_state_new(); + return rs_nfs_state_new(orig_state, proto_orig); } static void NFSStateFree(void *state) diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index 7c0fdcbdfc..f3b92c1675 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -99,7 +99,7 @@ typedef struct AppLayerParserProtoCtx_ bool logger; uint32_t logger_bits; /**< registered loggers for this proto */ - void *(*StateAlloc)(void); + void *(*StateAlloc)(void *, AppProto); void (*StateFree)(void *); void (*StateTransactionFree)(void *, uint64_t); void *(*LocalStorageAlloc)(void); @@ -396,8 +396,7 @@ uint32_t AppLayerParserGetOptionFlags(uint8_t protomap, AppProto alproto) } void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto, - void *(*StateAlloc)(void), - void (*StateFree)(void *)) + void *(*StateAlloc)(void *, AppProto), void (*StateFree)(void *)) { SCEnter(); @@ -1216,7 +1215,7 @@ int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow alstate = f->alstate; if (alstate == NULL) { - f->alstate = alstate = p->StateAlloc(); + f->alstate = alstate = p->StateAlloc(alstate, f->alproto_orig); if (alstate == NULL) goto error; SCLogDebug("alloced new app layer state %p (name %s)", @@ -1679,7 +1678,7 @@ static AppLayerResult TestProtocolParser(Flow *f, void *test_state, AppLayerPars /** \brief Function to allocates the Test protocol state memory */ -static void *TestProtocolStateAlloc(void) +static void *TestProtocolStateAlloc(void *orig_state, AppProto proto_orig) { SCEnter(); void *s = SCMalloc(sizeof(TestState)); diff --git a/src/app-layer-parser.h b/src/app-layer-parser.h index 19201d6a4e..d662f18665 100644 --- a/src/app-layer-parser.h +++ b/src/app-layer-parser.h @@ -145,8 +145,7 @@ void AppLayerParserRegisterParserAcceptableDataDirection(uint8_t ipproto, void AppLayerParserRegisterOptionFlags(uint8_t ipproto, AppProto alproto, uint32_t flags); void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto, - void *(*StateAlloc)(void), - void (*StateFree)(void *)); + void *(*StateAlloc)(void *, AppProto), void (*StateFree)(void *)); void AppLayerParserRegisterLocalStorageFunc(uint8_t ipproto, AppProto proto, void *(*LocalStorageAlloc)(void), void (*LocalStorageFree)(void *)); diff --git a/src/app-layer-register.h b/src/app-layer-register.h index 29aba9d417..7e5ef8c1f1 100644 --- a/src/app-layer-register.h +++ b/src/app-layer-register.h @@ -35,7 +35,7 @@ typedef struct AppLayerParser { uint16_t min_depth; uint16_t max_depth; - void *(*StateAlloc)(void); + void *(*StateAlloc)(void *, AppProto); void (*StateFree)(void *); AppLayerParserFPtr ParseTS; diff --git a/src/app-layer-smtp.c b/src/app-layer-smtp.c index 2de623d34a..68defb13dd 100644 --- a/src/app-layer-smtp.c +++ b/src/app-layer-smtp.c @@ -1432,7 +1432,7 @@ static AppLayerResult SMTPParseServerRecord(Flow *f, void *alstate, * \internal * \brief Function to allocate SMTP state memory. */ -void *SMTPStateAlloc(void) +void *SMTPStateAlloc(void *orig_state, AppProto proto_orig) { SMTPState *smtp_state = SCMalloc(sizeof(SMTPState)); if (unlikely(smtp_state == NULL)) @@ -5154,7 +5154,7 @@ static int SMTPProcessDataChunkTest02(void){ memset(&ssn, 0, sizeof(ssn)); FLOW_INITIALIZE(&f); f.protoctx = &ssn; - f.alstate = SMTPStateAlloc(); + f.alstate = SMTPStateAlloc(NULL, ALPROTO_UNKNOWN); MimeDecParseState *state = MimeDecInitParser(&f, NULL); ((MimeDecEntity *)state->stack->top->data)->ctnt_flags = CTNT_IS_ATTACHMENT; state->body_begin = 1; @@ -5185,7 +5185,7 @@ static int SMTPProcessDataChunkTest03(void){ Flow f; FLOW_INITIALIZE(&f); f.protoctx = &ssn; - f.alstate = SMTPStateAlloc(); + f.alstate = SMTPStateAlloc(NULL, ALPROTO_UNKNOWN); MimeDecParseState *state = MimeDecInitParser(&f, NULL); ((MimeDecEntity *)state->stack->top->data)->ctnt_flags = CTNT_IS_ATTACHMENT; int ret; @@ -5241,7 +5241,7 @@ static int SMTPProcessDataChunkTest04(void){ Flow f; FLOW_INITIALIZE(&f); f.protoctx = &ssn; - f.alstate = SMTPStateAlloc(); + f.alstate = SMTPStateAlloc(NULL, ALPROTO_UNKNOWN); MimeDecParseState *state = MimeDecInitParser(&f, NULL); ((MimeDecEntity *)state->stack->top->data)->ctnt_flags = CTNT_IS_ATTACHMENT; int ret = MIME_DEC_OK; @@ -5281,7 +5281,7 @@ static int SMTPProcessDataChunkTest05(void){ int ret; FLOW_INITIALIZE(&f); f.protoctx = &ssn; - f.alstate = SMTPStateAlloc(); + f.alstate = SMTPStateAlloc(NULL, ALPROTO_UNKNOWN); FAIL_IF(f.alstate == NULL); MimeDecParseState *state = MimeDecInitParser(&f, NULL); ((MimeDecEntity *)state->stack->top->data)->ctnt_flags = CTNT_IS_ATTACHMENT; diff --git a/src/app-layer-smtp.h b/src/app-layer-smtp.h index 473652a573..b8ca5e0fcb 100644 --- a/src/app-layer-smtp.h +++ b/src/app-layer-smtp.h @@ -174,7 +174,7 @@ typedef struct SMTPState_ { extern SMTPConfig smtp_config; int SMTPProcessDataChunk(const uint8_t *chunk, uint32_t len, MimeDecParseState *state); -void *SMTPStateAlloc(void); +void *SMTPStateAlloc(void *orig_state, AppProto proto_orig); void RegisterSMTPParsers(void); void SMTPParserCleanup(void); void SMTPParserRegisterTests(void); diff --git a/src/app-layer-ssl.c b/src/app-layer-ssl.c index 557253058e..2cd1f861d4 100644 --- a/src/app-layer-ssl.c +++ b/src/app-layer-ssl.c @@ -2634,7 +2634,7 @@ static AppLayerResult SSLParseServerRecord(Flow *f, void *alstate, AppLayerParse * \internal * \brief Function to allocate the SSL state memory. */ -static void *SSLStateAlloc(void) +static void *SSLStateAlloc(void *orig_state, AppProto proto_orig) { SSLState *ssl_state = SCMalloc(sizeof(SSLState)); if (unlikely(ssl_state == NULL)) diff --git a/src/app-layer-template.c b/src/app-layer-template.c index 83eab5fa3d..d01968cad6 100644 --- a/src/app-layer-template.c +++ b/src/app-layer-template.c @@ -105,7 +105,7 @@ static void TemplateTxFree(void *txv) SCFree(tx); } -static void *TemplateStateAlloc(void) +static void *TemplateStateAlloc(void *orig_state, AppProto proto_orig) { SCLogNotice("Allocating template state."); TemplateState *state = SCCalloc(1, sizeof(TemplateState)); diff --git a/src/app-layer-tftp.c b/src/app-layer-tftp.c index f5ec69e7f6..f41a059a36 100644 --- a/src/app-layer-tftp.c +++ b/src/app-layer-tftp.c @@ -44,7 +44,7 @@ * be the size of a header. */ #define TFTP_MIN_FRAME_LEN 4 -static void *TFTPStateAlloc(void) +static void *TFTPStateAlloc(void *orig_state, AppProto proto_orig) { return rs_tftp_state_alloc(); } diff --git a/src/tests/detect-file-data.c b/src/tests/detect-file-data.c index d1dabd67a6..8dbcf73a9b 100644 --- a/src/tests/detect-file-data.c +++ b/src/tests/detect-file-data.c @@ -73,7 +73,7 @@ static int DetectEngineSMTPFiledataTest01(void) f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; f.flags |= FLOW_IPV4; - f.alstate = SMTPStateAlloc(); + f.alstate = SMTPStateAlloc(NULL, ALPROTO_UNKNOWN); MimeDecParseState *state = MimeDecInitParser(&f, NULL); ((MimeDecEntity *)state->stack->top->data)->ctnt_flags = CTNT_IS_ATTACHMENT; @@ -205,7 +205,7 @@ static int DetectEngineSMTPFiledataTest03(void) f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; f.flags |= FLOW_IPV4; - f.alstate = SMTPStateAlloc(); + f.alstate = SMTPStateAlloc(NULL, ALPROTO_UNKNOWN); MimeDecParseState *state = MimeDecInitParser(&f, NULL); ((MimeDecEntity *)state->stack->top->data)->ctnt_flags = CTNT_IS_ATTACHMENT;