rust: bindgen SCHTTP2MimicHttp1Request

Ticket: 7667
pull/14070/head
Philippe Antoine 1 month ago committed by Victor Julien
parent a1613fecb4
commit 93785ae357

@ -42,6 +42,7 @@ use suricata_sys::sys::{
AppLayerParserState, AppProto, SCAppLayerForceProtocolChange, AppLayerParserState, AppProto, SCAppLayerForceProtocolChange,
SCAppLayerParserConfParserEnabled, SCAppLayerParserRegisterLogger, SCAppLayerParserConfParserEnabled, SCAppLayerParserRegisterLogger,
SCAppLayerProtoDetectConfProtoDetectionEnabled, SCFileFlowFlagsToFlags, SCAppLayerProtoDetectConfProtoDetectionEnabled, SCFileFlowFlagsToFlags,
SCHTTP2MimicHttp1Request,
}; };
static mut ALPROTO_HTTP2: AppProto = ALPROTO_UNKNOWN; static mut ALPROTO_HTTP2: AppProto = ALPROTO_UNKNOWN;
@ -1431,13 +1432,6 @@ unsafe extern "C" fn http2_probing_parser_tc(
return ALPROTO_UNKNOWN; return ALPROTO_UNKNOWN;
} }
// Extern functions operating on HTTP2.
extern "C" {
pub fn HTTP2MimicHttp1Request(
orig_state: *mut std::os::raw::c_void, new_state: *mut std::os::raw::c_void,
);
}
// Suppress the unsafe warning here as creating a state for an app-layer // Suppress the unsafe warning here as creating a state for an app-layer
// is typically not unsafe. // is typically not unsafe.
#[allow(clippy::not_unsafe_ptr_arg_deref)] #[allow(clippy::not_unsafe_ptr_arg_deref)]
@ -1450,7 +1444,7 @@ extern "C" fn http2_state_new(
if !orig_state.is_null() { if !orig_state.is_null() {
//we could check ALPROTO_HTTP1 == orig_proto //we could check ALPROTO_HTTP1 == orig_proto
unsafe { unsafe {
HTTP2MimicHttp1Request(orig_state, r); SCHTTP2MimicHttp1Request(orig_state, r);
} }
} }
return r; return r;

@ -829,6 +829,11 @@ extern "C" {
event_name: *const ::std::os::raw::c_char, table: *mut SCEnumCharMap, event_id: *mut u8, event_name: *const ::std::os::raw::c_char, table: *mut SCEnumCharMap, event_id: *mut u8,
) -> ::std::os::raw::c_int; ) -> ::std::os::raw::c_int;
} }
extern "C" {
pub fn SCHTTP2MimicHttp1Request(
arg1: *mut ::std::os::raw::c_void, arg2: *mut ::std::os::raw::c_void,
);
}
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct MpmPattern_ { pub struct MpmPattern_ {

@ -69,7 +69,7 @@ void RegisterHTTP2Parsers(void)
#endif #endif
} }
void HTTP2MimicHttp1Request(void *alstate_orig, void *h2s) void SCHTTP2MimicHttp1Request(void *alstate_orig, void *h2s)
{ {
htp_tx_t *h1tx = HtpGetTxForH2(alstate_orig); htp_tx_t *h1tx = HtpGetTxForH2(alstate_orig);
if (h2s == NULL || h1tx == NULL) { if (h2s == NULL || h1tx == NULL) {

@ -26,6 +26,6 @@
void RegisterHTTP2Parsers(void); void RegisterHTTP2Parsers(void);
void HTTP2MimicHttp1Request(void *, void *); void SCHTTP2MimicHttp1Request(void *, void *);
#endif /* SURICATA_APP_LAYER_HTTP2_H */ #endif /* SURICATA_APP_LAYER_HTTP2_H */

@ -52,6 +52,7 @@
#include "app-layer-parser.h" #include "app-layer-parser.h"
#include "app-layer-register.h" #include "app-layer-register.h"
#include "app-layer-events.h" #include "app-layer-events.h"
#include "app-layer-http2.h"
#include "util-mpm.h" #include "util-mpm.h"
#include "util-file.h" #include "util-file.h"

Loading…
Cancel
Save