]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust/http2: replace rs_ naming with SC
authorJason Ish <jason.ish@oisf.net>
Fri, 2 May 2025 22:29:42 +0000 (16:29 -0600)
committerVictor Julien <victor@inliniac.net>
Sat, 3 May 2025 06:19:41 +0000 (08:19 +0200)
22 files changed:
rust/cbindgen.toml
rust/src/http2/detect.rs
rust/src/http2/http2.rs
rust/src/http2/logger.rs
rust/src/http2/range.rs
src/app-layer-htp-file.c
src/app-layer-http2.c
src/detect-http-cookie.c
src/detect-http-header-names.c
src/detect-http-header.c
src/detect-http-headers-stub.h
src/detect-http-host.c
src/detect-http-method.c
src/detect-http-raw-header.c
src/detect-http-request-line.c
src/detect-http-response-line.c
src/detect-http-stat-code.c
src/detect-http-ua.c
src/detect-http-uri.c
src/detect-http2.c
src/output-json-dns.c
src/output.c

index 7636ef2ca49b3f94aac5b57689a537bc863187e4..961483041f54cdd876369bbcd7df9ca6c109d74e 100644 (file)
@@ -86,6 +86,7 @@ include = [
     "FtpRequestCommand",
     "FtpStateValues",
     "FtpDataStateValues",
+    "HTTP2TransactionState",
     "SCSigTableAppLiteElmt",
     "SCTransformTableElmt",
     "DataRepType",
index b54a821a73cc8c3019ae9285f50cbb34001143c4..dc5b796583f1c3b2ef4b2188ac6026457e5165c5 100644 (file)
@@ -48,7 +48,7 @@ fn http2_tx_has_frametype(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_has_frametype(
+pub unsafe extern "C" fn SCHttp2TxHasFrametype(
     tx: *mut std::os::raw::c_void, direction: u8, value: u8,
 ) -> std::os::raw::c_int {
     let tx = cast_pointer!(tx, HTTP2Transaction);
@@ -56,7 +56,7 @@ pub unsafe extern "C" fn rs_http2_tx_has_frametype(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_parse_frametype(
+pub unsafe extern "C" fn SCHttp2ParseFrametype(
     str: *const std::os::raw::c_char,
 ) -> std::os::raw::c_int {
     let ft_name: &CStr = CStr::from_ptr(str); //unsafe
@@ -108,7 +108,7 @@ fn http2_tx_has_errorcode(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_has_errorcode(
+pub unsafe extern "C" fn SCHttp2TxHasErrorCode(
     tx: *mut std::os::raw::c_void, direction: u8, code: u32,
 ) -> std::os::raw::c_int {
     let tx = cast_pointer!(tx, HTTP2Transaction);
@@ -116,7 +116,7 @@ pub unsafe extern "C" fn rs_http2_tx_has_errorcode(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_parse_errorcode(
+pub unsafe extern "C" fn SCHttp2ParseErrorCode(
     str: *const std::os::raw::c_char,
 ) -> std::os::raw::c_int {
     let ft_name: &CStr = CStr::from_ptr(str); //unsafe
@@ -181,7 +181,7 @@ fn http2_tx_get_next_priority(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_next_priority(
+pub unsafe extern "C" fn SCHttp2TxGetNextPriority(
     tx: *mut std::os::raw::c_void, direction: u8, nb: u32,
 ) -> std::os::raw::c_int {
     let tx = cast_pointer!(tx, HTTP2Transaction);
@@ -217,7 +217,7 @@ fn http2_tx_get_next_window(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_next_window(
+pub unsafe extern "C" fn SCHttp2TxGetNextWindow(
     tx: *mut std::os::raw::c_void, direction: u8, nb: u32,
 ) -> std::os::raw::c_int {
     let tx = cast_pointer!(tx, HTTP2Transaction);
@@ -225,7 +225,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_next_window(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_detect_settingsctx_parse(
+pub unsafe extern "C" fn SCHttp2DetectSettingsCtxParse(
     str: *const std::os::raw::c_char,
 ) -> *mut std::os::raw::c_void {
     let ft_name: &CStr = CStr::from_ptr(str); //unsafe
@@ -239,7 +239,7 @@ pub unsafe extern "C" fn rs_http2_detect_settingsctx_parse(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_detect_settingsctx_free(ctx: *mut std::os::raw::c_void) {
+pub unsafe extern "C" fn SCHttp2DetectSettingsCtxFree(ctx: *mut std::os::raw::c_void) {
     // Just unbox...
     std::mem::drop(Box::from_raw(ctx as *mut parser::DetectHTTP2settingsSigCtx));
 }
@@ -288,7 +288,7 @@ fn http2_detect_settingsctx_match(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_detect_settingsctx_match(
+pub unsafe extern "C" fn SCHttp2DetectSettingsCtxMatch(
     ctx: *const std::os::raw::c_void, tx: *mut std::os::raw::c_void, direction: u8,
 ) -> std::os::raw::c_int {
     let ctx = cast_pointer!(ctx, parser::DetectHTTP2settingsSigCtx);
@@ -349,7 +349,7 @@ fn http2_detect_sizeupdatectx_match(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_detect_sizeupdatectx_match(
+pub unsafe extern "C" fn SCHttp2DetectSizeUpdateCtxMatch(
     ctx: *const std::os::raw::c_void, tx: *mut std::os::raw::c_void, direction: u8,
 ) -> std::os::raw::c_int {
     let ctx = cast_pointer!(ctx, DetectUintData<u64>);
@@ -357,10 +357,10 @@ pub unsafe extern "C" fn rs_http2_detect_sizeupdatectx_match(
     return http2_detect_sizeupdatectx_match(ctx, tx, direction.into());
 }
 
-//TODOask better syntax between rs_http2_tx_get_header_name in argument
-// and rs_http2_detect_sizeupdatectx_match explicitly casting
+//TODOask better syntax between SCHttp2TxGetHeaderName in argument
+// and SCHttp2DetectSizeUpdateCtxMatch explicitly casting
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_header_name(
+pub unsafe extern "C" fn SCHttp2TxGetHeaderName(
     _de: *mut DetectEngineThreadCtx, tx: *const c_void, direction: u8, nb: u32,
     buffer: *mut *const u8, buffer_len: *mut u32,
 ) -> bool {
@@ -530,7 +530,7 @@ fn http2_tx_get_req_line(tx: &mut HTTP2Transaction) {
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_request_line(
+pub unsafe extern "C" fn SCHttp2TxGetRequestLine(
     tx: &mut HTTP2Transaction, buffer: *mut *const u8, buffer_len: *mut u32,
 ) -> u8 {
     http2_tx_get_req_line(tx);
@@ -559,7 +559,7 @@ fn http2_tx_get_resp_line(tx: &mut HTTP2Transaction) {
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_response_line(
+pub unsafe extern "C" fn SCHttp2TxGetResponseLine(
     tx: &mut HTTP2Transaction, buffer: *mut *const u8, buffer_len: *mut u32,
 ) -> u8 {
     http2_tx_get_resp_line(tx);
@@ -569,7 +569,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_response_line(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_uri(
+pub unsafe extern "C" fn SCHttp2TxGetUri(
     tx: &mut HTTP2Transaction, buffer: *mut *const u8, buffer_len: *mut u32,
 ) -> u8 {
     if let Ok(value) = http2_frames_get_header_firstvalue(tx, Direction::ToServer, ":path") {
@@ -581,7 +581,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_uri(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_method(
+pub unsafe extern "C" fn SCHttp2TxGetMethod(
     tx: &mut HTTP2Transaction, buffer: *mut *const u8, buffer_len: *mut u32,
 ) -> u8 {
     if let Ok(value) = http2_frames_get_header_firstvalue(tx, Direction::ToServer, ":method") {
@@ -593,7 +593,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_method(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_host(
+pub unsafe extern "C" fn SCHttp2TxGetHost(
     tx: &mut HTTP2Transaction, buffer: *mut *const u8, buffer_len: *mut u32,
 ) -> u8 {
     if let Ok(value) = http2_frames_get_header_value(tx, Direction::ToServer, ":authority") {
@@ -645,7 +645,7 @@ fn http2_normalize_host(value: &[u8]) -> &[u8] {
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_host_norm(
+pub unsafe extern "C" fn SCHttp2TxGetHostNorm(
     tx: &mut HTTP2Transaction, buffer: *mut *const u8, buffer_len: *mut u32,
 ) -> u8 {
     if let Ok(value) = http2_frames_get_header_value(tx, Direction::ToServer, ":authority") {
@@ -674,7 +674,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_host_norm(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_useragent(
+pub unsafe extern "C" fn SCHttp2TxGetUserAgent(
     tx: &mut HTTP2Transaction, buffer: *mut *const u8, buffer_len: *mut u32,
 ) -> u8 {
     if let Ok(value) = http2_frames_get_header_value(tx, Direction::ToServer, "user-agent") {
@@ -686,7 +686,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_useragent(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_status(
+pub unsafe extern "C" fn SCHttp2TxGetStatus(
     tx: &mut HTTP2Transaction, buffer: *mut *const u8, buffer_len: *mut u32,
 ) -> u8 {
     if let Ok(value) = http2_frames_get_header_firstvalue(tx, Direction::ToClient, ":status") {
@@ -698,7 +698,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_status(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_cookie(
+pub unsafe extern "C" fn SCHttp2TxGetCookie(
     tx: &mut HTTP2Transaction, direction: u8, buffer: *mut *const u8, buffer_len: *mut u32,
 ) -> u8 {
     if direction == u8::from(Direction::ToServer) {
@@ -716,7 +716,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_cookie(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_header_value(
+pub unsafe extern "C" fn SCHttp2TxGetHeaderValue(
     tx: &mut HTTP2Transaction, direction: u8, strname: *const std::os::raw::c_char,
     buffer: *mut *const u8, buffer_len: *mut u32,
 ) -> u8 {
@@ -742,7 +742,7 @@ fn http2_escape_header(blocks: &[parser::HTTP2FrameHeaderBlock], i: u32) -> Vec<
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_header_names(
+pub unsafe extern "C" fn SCHttp2TxGetHeaderNames(
     tx: &mut HTTP2Transaction, direction: u8, buffer: *mut *const u8, buffer_len: *mut u32,
 ) -> u8 {
     let mut vec = vec![b'\r', b'\n'];
@@ -806,7 +806,7 @@ fn http2_header_trimspaces(value: &[u8]) -> &[u8] {
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_headers(
+pub unsafe extern "C" fn SCHttp2TxGetHeaders(
     tx: &mut HTTP2Transaction, direction: u8, buffer: *mut *const u8, buffer_len: *mut u32,
 ) -> u8 {
     let mut vec = Vec::new();
@@ -840,7 +840,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_headers(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_headers_raw(
+pub unsafe extern "C" fn SCHttp2TxGetHeadersRaw(
     tx: &mut HTTP2Transaction, direction: u8, buffer: *mut *const u8, buffer_len: *mut u32,
 ) -> u8 {
     let mut vec = Vec::new();
@@ -872,7 +872,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_headers_raw(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_header(
+pub unsafe extern "C" fn SCHttp2TxGetHeader(
     _de: *mut DetectEngineThreadCtx, tx: *const c_void, direction: u8, nb: u32,
     buffer: *mut *const u8, buffer_len: *mut u32,
 ) -> bool {
@@ -951,7 +951,7 @@ fn http2_tx_set_header(state: &mut HTTP2State, name: &[u8], input: &[u8]) {
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_set_method(
+pub unsafe extern "C" fn SCHttp2TxSetMethod(
     state: &mut HTTP2State, buffer: *const u8, buffer_len: u32,
 ) {
     let slice = build_slice!(buffer, buffer_len as usize);
@@ -959,7 +959,7 @@ pub unsafe extern "C" fn rs_http2_tx_set_method(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_set_uri(
+pub unsafe extern "C" fn SCHttp2TxSetUri(
     state: &mut HTTP2State, buffer: *const u8, buffer_len: u32,
 ) {
     let slice = build_slice!(buffer, buffer_len as usize);
@@ -1011,7 +1011,7 @@ fn http2_caseinsensitive_cmp(s1: &[u8], s2: &str) -> bool {
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_add_header(
+pub unsafe extern "C" fn SCHttp2TxAddHeader(
     state: &mut HTTP2State, name: *const u8, name_len: u32, value: *const u8, value_len: u32,
 ) {
     let slice_name = build_slice!(name, name_len as usize);
index f541ea0a9728c91599413c72cbf4ceea83a9fcbd..66035e0985f4a93099e96151b50928b0275b592c 100644 (file)
@@ -49,7 +49,7 @@ const HTTP2_MIN_HANDLED_FRAME_SIZE: usize = 256;
 pub static mut SURICATA_HTTP2_FILE_CONFIG: Option<&'static SuricataFileContext> = None;
 
 #[no_mangle]
-pub extern "C" fn rs_http2_init(context: &'static mut SuricataFileContext) {
+pub extern "C" fn SCHttp2Init(context: &'static mut SuricataFileContext) {
     unsafe {
         SURICATA_HTTP2_FILE_CONFIG = Some(context);
     }
@@ -1394,8 +1394,7 @@ export_tx_data_get!(http2_get_tx_data, HTTP2Transaction);
 export_state_data_get!(http2_get_state_data, HTTP2State);
 
 /// C entry point for a probing parser.
-#[no_mangle]
-pub unsafe extern "C" fn rs_http2_probing_parser_tc(
+unsafe extern "C" fn http2_probing_parser_tc(
     _flow: *const Flow, _direction: u8, input: *const u8, input_len: u32, _rdir: *mut u8,
 ) -> AppProto {
     if !input.is_null() {
@@ -1431,9 +1430,8 @@ extern "C" {
 
 // Suppress the unsafe warning here as creating a state for an app-layer
 // is typically not unsafe.
-#[no_mangle]
 #[allow(clippy::not_unsafe_ptr_arg_deref)]
-pub extern "C" fn rs_http2_state_new(
+extern "C" fn http2_state_new(
     orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto,
 ) -> *mut std::os::raw::c_void {
     let state = HTTP2State::new();
@@ -1448,20 +1446,17 @@ pub extern "C" fn rs_http2_state_new(
     return r;
 }
 
-#[no_mangle]
-pub unsafe extern "C" fn rs_http2_state_free(state: *mut std::os::raw::c_void) {
+unsafe extern "C" fn http2_state_free(state: *mut std::os::raw::c_void) {
     let mut state: Box<HTTP2State> = Box::from_raw(state as _);
     state.free();
 }
 
-#[no_mangle]
-pub unsafe extern "C" fn rs_http2_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) {
+unsafe extern "C" fn http2_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) {
     let state = cast_pointer!(state, HTTP2State);
     state.free_tx(tx_id);
 }
 
-#[no_mangle]
-pub unsafe extern "C" fn rs_http2_parse_ts(
+unsafe extern "C" fn http2_parse_ts(
     flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void,
     stream_slice: StreamSlice, _data: *const std::os::raw::c_void,
 ) -> AppLayerResult {
@@ -1469,8 +1464,7 @@ pub unsafe extern "C" fn rs_http2_parse_ts(
     return state.parse_ts(flow, stream_slice);
 }
 
-#[no_mangle]
-pub unsafe extern "C" fn rs_http2_parse_tc(
+unsafe extern "C" fn http2_parse_tc(
     flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void,
     stream_slice: StreamSlice, _data: *const std::os::raw::c_void,
 ) -> AppLayerResult {
@@ -1478,8 +1472,7 @@ pub unsafe extern "C" fn rs_http2_parse_tc(
     return state.parse_tc(flow, stream_slice);
 }
 
-#[no_mangle]
-pub unsafe extern "C" fn rs_http2_state_get_tx(
+unsafe extern "C" fn http2_state_get_tx(
     state: *mut std::os::raw::c_void, tx_id: u64,
 ) -> *mut std::os::raw::c_void {
     let state = cast_pointer!(state, HTTP2State);
@@ -1493,29 +1486,25 @@ pub unsafe extern "C" fn rs_http2_state_get_tx(
     }
 }
 
-#[no_mangle]
-pub unsafe extern "C" fn rs_http2_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 {
+unsafe extern "C" fn http2_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 {
     let state = cast_pointer!(state, HTTP2State);
     return state.tx_id;
 }
 
-#[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_state(
+unsafe extern "C" fn http2_tx_get_state(
     tx: *mut std::os::raw::c_void,
 ) -> HTTP2TransactionState {
     let tx = cast_pointer!(tx, HTTP2Transaction);
     return tx.state;
 }
 
-#[no_mangle]
-pub unsafe extern "C" fn rs_http2_tx_get_alstate_progress(
+unsafe extern "C" fn http2_tx_get_alstate_progress(
     tx: *mut std::os::raw::c_void, _direction: u8,
 ) -> std::os::raw::c_int {
-    return rs_http2_tx_get_state(tx) as i32;
+    return http2_tx_get_state(tx) as i32;
 }
 
-#[no_mangle]
-pub unsafe extern "C" fn rs_http2_getfiles(
+unsafe extern "C" fn http2_getfiles(
     tx: *mut std::os::raw::c_void, direction: u8,
 ) -> AppLayerGetFileState {
     let tx = cast_pointer!(tx, HTTP2Transaction);
@@ -1539,31 +1528,31 @@ pub unsafe extern "C" fn rs_http2_getfiles(
 const PARSER_NAME: &[u8] = b"http2\0";
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_register_parser() {
+pub unsafe extern "C" fn SCRegisterHttp2Parser() {
     let default_port = CString::new("[80]").unwrap();
     let mut parser = RustParser {
         name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char,
         default_port: default_port.as_ptr(),
         ipproto: IPPROTO_TCP,
         probe_ts: None, // big magic string should be enough
-        probe_tc: Some(rs_http2_probing_parser_tc),
+        probe_tc: Some(http2_probing_parser_tc),
         min_depth: HTTP2_FRAME_HEADER_LEN as u16,
         max_depth: HTTP2_MAGIC_LEN as u16,
-        state_new: rs_http2_state_new,
-        state_free: rs_http2_state_free,
-        tx_free: rs_http2_state_tx_free,
-        parse_ts: rs_http2_parse_ts,
-        parse_tc: rs_http2_parse_tc,
-        get_tx_count: rs_http2_state_get_tx_count,
-        get_tx: rs_http2_state_get_tx,
+        state_new: http2_state_new,
+        state_free: http2_state_free,
+        tx_free: http2_state_tx_free,
+        parse_ts: http2_parse_ts,
+        parse_tc: http2_parse_tc,
+        get_tx_count: http2_state_get_tx_count,
+        get_tx: http2_state_get_tx,
         tx_comp_st_ts: HTTP2TransactionState::HTTP2StateClosed as i32,
         tx_comp_st_tc: HTTP2TransactionState::HTTP2StateClosed as i32,
-        tx_get_progress: rs_http2_tx_get_alstate_progress,
+        tx_get_progress: http2_tx_get_alstate_progress,
         get_eventinfo: Some(HTTP2Event::get_event_info),
         get_eventinfo_byid: Some(HTTP2Event::get_event_info_by_id),
         localstorage_new: None,
         localstorage_free: None,
-        get_tx_files: Some(rs_http2_getfiles),
+        get_tx_files: Some(http2_getfiles),
         get_tx_iterator: Some(applayer::state_get_tx_iterator::<HTTP2State, HTTP2Transaction>),
         get_tx_data: http2_get_tx_data,
         get_state_data: http2_get_state_data,
index bf5fc9b1ea458d62dc5cc81a2075622f461e61c1..c231f599e40967231fc2d5d2cb7a2ab08c7fb86c 100644 (file)
@@ -285,7 +285,7 @@ fn log_http2(tx: &HTTP2Transaction, js: &mut JsonBuilder) -> Result<bool, JsonEr
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http2_log_json(
+pub unsafe extern "C" fn SCHttp2LogJson(
     tx: *mut std::os::raw::c_void, js: &mut JsonBuilder,
 ) -> bool {
     let tx = cast_pointer!(tx, HTTP2Transaction);
index 41366f8a16ebb6b8443424e341230ede3885d09d..7002572ef8ebd48d4748c59b2eb12d31360744ca 100644 (file)
@@ -86,7 +86,7 @@ pub fn http2_parse_check_content_range(input: &[u8]) -> IResult<&[u8], HTTPConte
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_http_parse_content_range(
+pub unsafe extern "C" fn SCHttpParseContentRange(
     cr: &mut HTTPContentRange, buffer: *const u8, buffer_len: u32,
 ) -> std::os::raw::c_int {
     let slice = build_slice!(buffer, buffer_len as usize);
index 75ef52c53056a281b9b2ec4125338c5510486033..efac979d3b7483f16053624ebd1b9549e3adc862 100644 (file)
@@ -96,7 +96,7 @@ int HTPFileOpen(HtpState *s, HtpTxUserData *tx, const uint8_t *filename, uint16_
 int HTPParseContentRange(const bstr *rawvalue, HTTPContentRange *range)
 {
     uint32_t len = (uint32_t)bstr_len(rawvalue);
-    return rs_http_parse_content_range(range, bstr_ptr(rawvalue), len);
+    return SCHttpParseContentRange(range, bstr_ptr(rawvalue), len);
 }
 
 /**
index bababc099c228232eba1f0f25f9b0aa5dc3e09c8..727971ce6fd067c3b0b4af46197fd1390b7377f0 100644 (file)
@@ -62,8 +62,8 @@ void RegisterHTTP2Parsers(void)
         if (HTTP2RegisterPatternsForProtocolDetection() < 0)
             return;
 
-        rs_http2_init(&sfc);
-        rs_http2_register_parser();
+        SCHttp2Init(&sfc);
+        SCRegisterHttp2Parser();
     }
 
 #ifdef UNITTESTS
@@ -82,18 +82,18 @@ void HTTP2MimicHttp1Request(void *alstate_orig, void *h2s)
         return;
     }
     // else
-    rs_http2_tx_set_method(h2s, bstr_ptr(htp_tx_request_method(h1tx)),
+    SCHttp2TxSetMethod(h2s, bstr_ptr(htp_tx_request_method(h1tx)),
             (uint32_t)bstr_len(htp_tx_request_method(h1tx)));
     if (htp_tx_request_uri(h1tx) != NULL) {
         // A request line without spaces gets interpreted as a request_method
         // and has request_uri=NULL
-        rs_http2_tx_set_uri(h2s, bstr_ptr(htp_tx_request_uri(h1tx)),
+        SCHttp2TxSetUri(h2s, bstr_ptr(htp_tx_request_uri(h1tx)),
                 (uint32_t)bstr_len(htp_tx_request_uri(h1tx)));
     }
     size_t nbheaders = htp_tx_request_headers_size(h1tx);
     for (size_t i = 0; i < nbheaders; i++) {
         const htp_header_t *h = htp_tx_request_header_index(h1tx, i);
-        rs_http2_tx_add_header(h2s, htp_header_name_ptr(h), (uint32_t)htp_header_name_len(h),
+        SCHttp2TxAddHeader(h2s, htp_header_name_ptr(h), (uint32_t)htp_header_name_len(h),
                 htp_header_value_ptr(h), (uint32_t)htp_header_value_len(h));
     }
 }
index bfa58f36088164184dabbb3902f362db8493d19b..2e614af66fc90de29e8da3dcc38f4b6746aaa041 100644 (file)
@@ -234,7 +234,7 @@ static InspectionBuffer *GetRequestData2(DetectEngineThreadCtx *det_ctx,
         uint32_t b_len = 0;
         const uint8_t *b = NULL;
 
-        if (rs_http2_tx_get_cookie(txv, STREAM_TOSERVER, &b, &b_len) != 1)
+        if (SCHttp2TxGetCookie(txv, STREAM_TOSERVER, &b, &b_len) != 1)
             return NULL;
         if (b == NULL || b_len == 0)
             return NULL;
@@ -254,7 +254,7 @@ static InspectionBuffer *GetResponseData2(DetectEngineThreadCtx *det_ctx,
         uint32_t b_len = 0;
         const uint8_t *b = NULL;
 
-        if (rs_http2_tx_get_cookie(txv, STREAM_TOCLIENT, &b, &b_len) != 1)
+        if (SCHttp2TxGetCookie(txv, STREAM_TOCLIENT, &b, &b_len) != 1)
             return NULL;
         if (b == NULL || b_len == 0)
             return NULL;
index ebd36282d0a637dc1fdef32aea59039317564a03..54c37a71a57d8623dd558e00d6cffd873a0b09e3 100644 (file)
@@ -170,7 +170,7 @@ static InspectionBuffer *GetBuffer2ForTX(DetectEngineThreadCtx *det_ctx,
         uint32_t b_len = 0;
         const uint8_t *b = NULL;
 
-        if (rs_http2_tx_get_header_names(txv, flow_flags, &b, &b_len) != 1)
+        if (SCHttp2TxGetHeaderNames(txv, flow_flags, &b, &b_len) != 1)
             return NULL;
         if (b == NULL || b_len == 0)
             return NULL;
index d2add08f11381ec1932a1b7c79411a156be84f2d..cef3f0d260a892c39d32867db2a897eefa34963b 100644 (file)
@@ -152,7 +152,7 @@ static InspectionBuffer *GetBuffer2ForTX(DetectEngineThreadCtx *det_ctx,
         uint32_t b_len = 0;
         const uint8_t *b = NULL;
 
-        if (rs_http2_tx_get_headers(txv, flow_flags, &b, &b_len) != 1)
+        if (SCHttp2TxGetHeaders(txv, flow_flags, &b, &b_len) != 1)
             return NULL;
         if (b == NULL || b_len == 0)
             return NULL;
@@ -592,7 +592,7 @@ void DetectHttpRequestHeaderRegister(void)
             SIGMATCH_NOOPT | SIGMATCH_INFO_STICKY_BUFFER;
 
     DetectAppLayerMultiRegister("http_request_header", ALPROTO_HTTP2, SIG_FLAG_TOSERVER,
-            HTTP2StateOpen, rs_http2_tx_get_header, 2);
+            HTTP2StateOpen, SCHttp2TxGetHeader, 2);
     DetectAppLayerMultiRegister("http_request_header", ALPROTO_HTTP1, SIG_FLAG_TOSERVER,
             HTP_REQUEST_PROGRESS_HEADERS, GetHttp1HeaderData, 2);
 
@@ -625,7 +625,7 @@ void DetectHttpResponseHeaderRegister(void)
             SIGMATCH_NOOPT | SIGMATCH_INFO_STICKY_BUFFER;
 
     DetectAppLayerMultiRegister("http_response_header", ALPROTO_HTTP2, SIG_FLAG_TOCLIENT,
-            HTTP2StateOpen, rs_http2_tx_get_header, 2);
+            HTTP2StateOpen, SCHttp2TxGetHeader, 2);
     DetectAppLayerMultiRegister("http_response_header", ALPROTO_HTTP1, SIG_FLAG_TOCLIENT,
             HTP_RESPONSE_PROGRESS_HEADERS, GetHttp1HeaderData, 2);
 
index da74c0266e3de1a9c565040e95f0e634fe5705c5..ce95371c412844cbc3f2c5e0263dc50c8759a3d6 100644 (file)
@@ -85,7 +85,7 @@ static InspectionBuffer *GetRequestData2(DetectEngineThreadCtx *det_ctx,
         uint32_t b_len = 0;
         const uint8_t *b = NULL;
 
-        if (rs_http2_tx_get_header_value(txv, STREAM_TOSERVER, HEADER_NAME, &b, &b_len) != 1)
+        if (SCHttp2TxGetHeaderValue(txv, STREAM_TOSERVER, HEADER_NAME, &b, &b_len) != 1)
             return NULL;
         if (b == NULL || b_len == 0)
             return NULL;
@@ -139,7 +139,7 @@ static InspectionBuffer *GetResponseData2(DetectEngineThreadCtx *det_ctx,
         uint32_t b_len = 0;
         const uint8_t *b = NULL;
 
-        if (rs_http2_tx_get_header_value(txv, STREAM_TOCLIENT, HEADER_NAME, &b, &b_len) != 1)
+        if (SCHttp2TxGetHeaderValue(txv, STREAM_TOCLIENT, HEADER_NAME, &b, &b_len) != 1)
             return NULL;
         if (b == NULL || b_len == 0)
             return NULL;
index 1d0b39e0e31d9770854b0759a6033f883968dc47..dcc69b6d6feccb304971c150b1574b37a3750b7f 100644 (file)
@@ -270,7 +270,7 @@ static InspectionBuffer *GetData2(DetectEngineThreadCtx *det_ctx,
         uint32_t b_len = 0;
         const uint8_t *b = NULL;
 
-        if (rs_http2_tx_get_host_norm(txv, &b, &b_len) != 1)
+        if (SCHttp2TxGetHostNorm(txv, &b, &b_len) != 1)
             return NULL;
         if (b == NULL || b_len == 0)
             return NULL;
@@ -290,7 +290,7 @@ static InspectionBuffer *GetRawData2(DetectEngineThreadCtx *det_ctx,
         uint32_t b_len = 0;
         const uint8_t *b = NULL;
 
-        if (rs_http2_tx_get_host(txv, &b, &b_len) != 1)
+        if (SCHttp2TxGetHost(txv, &b, &b_len) != 1)
             return NULL;
         if (b == NULL || b_len == 0)
             return NULL;
index 732b46b13394115e8340e279ca6a2fbca578a9fc..95dba72f489557c1dbc381256c5a7528130ea836 100644 (file)
@@ -229,7 +229,7 @@ static InspectionBuffer *GetData2(DetectEngineThreadCtx *det_ctx,
         uint32_t b_len = 0;
         const uint8_t *b = NULL;
 
-        if (rs_http2_tx_get_method(txv, &b, &b_len) != 1)
+        if (SCHttp2TxGetMethod(txv, &b, &b_len) != 1)
             return NULL;
         if (b == NULL || b_len == 0)
             return NULL;
index 682bb29a61c14839d6dad818faa9a531d31327f3..3ce8966d3c6fead32511de33614c1d51db4c2955 100644 (file)
@@ -217,7 +217,7 @@ static InspectionBuffer *GetData2(DetectEngineThreadCtx *det_ctx,
         uint32_t b_len = 0;
         const uint8_t *b = NULL;
 
-        if (rs_http2_tx_get_headers_raw(txv, flow_flags, &b, &b_len) != 1)
+        if (SCHttp2TxGetHeadersRaw(txv, flow_flags, &b, &b_len) != 1)
             return NULL;
         if (b == NULL || b_len == 0)
             return NULL;
index bd997fe867b3f71687546cf3e125a891312c67ed..0226c87d9d04667e5538eaaa2b34d2818ed32c96 100644 (file)
@@ -82,7 +82,7 @@ static InspectionBuffer *GetData2(DetectEngineThreadCtx *det_ctx,
         uint32_t b_len = 0;
         const uint8_t *b = NULL;
 
-        if (rs_http2_tx_get_request_line(txv, &b, &b_len) != 1)
+        if (SCHttp2TxGetRequestLine(txv, &b, &b_len) != 1)
             return NULL;
         if (b == NULL || b_len == 0)
             return NULL;
index fae4b1ad491de6e9383065db3d2332c2cdd568ef..12b7ec1d721b96d77627ea875cbbd6399fd7f5fb 100644 (file)
@@ -82,7 +82,7 @@ static InspectionBuffer *GetData2(DetectEngineThreadCtx *det_ctx,
         uint32_t b_len = 0;
         const uint8_t *b = NULL;
 
-        if (rs_http2_tx_get_response_line(txv, &b, &b_len) != 1)
+        if (SCHttp2TxGetResponseLine(txv, &b, &b_len) != 1)
             return NULL;
         if (b == NULL || b_len == 0)
             return NULL;
index a66a1e99f3fd51fd9130954959544c437dee0692..4c8d58ff249959d300f17ef63a7aad595b5be9a9 100644 (file)
@@ -188,7 +188,7 @@ static InspectionBuffer *GetData2(DetectEngineThreadCtx *det_ctx,
         uint32_t b_len = 0;
         const uint8_t *b = NULL;
 
-        if (rs_http2_tx_get_status(txv, &b, &b_len) != 1)
+        if (SCHttp2TxGetStatus(txv, &b, &b_len) != 1)
             return NULL;
         if (b == NULL || b_len == 0)
             return NULL;
index 7bd6b48dca8ed0540d2b92f3b750479383b97cc4..a527bfa0f8decd7a3e7c9e62df75a17057b9b3b1 100644 (file)
@@ -193,7 +193,7 @@ static InspectionBuffer *GetData2(DetectEngineThreadCtx *det_ctx,
         uint32_t b_len = 0;
         const uint8_t *b = NULL;
 
-        if (rs_http2_tx_get_useragent(txv, &b, &b_len) != 1)
+        if (SCHttp2TxGetUserAgent(txv, &b, &b_len) != 1)
             return NULL;
         if (b == NULL || b_len == 0)
             return NULL;
index 0686a7b797f0485e848421eaeea02ce6111e9f14..0c8e8941309813d54ab7ad4103b32fed5b819143 100644 (file)
@@ -242,7 +242,7 @@ static InspectionBuffer *GetData2(DetectEngineThreadCtx *det_ctx,
         uint32_t b_len = 0;
         const uint8_t *b = NULL;
 
-        if (rs_http2_tx_get_uri(txv, &b, &b_len) != 1)
+        if (SCHttp2TxGetUri(txv, &b, &b_len) != 1)
             return NULL;
         if (b == NULL || b_len == 0)
             return NULL;
index b00f227c5d0038b65a02dcb7257b5343527af56d..f5c0a4d78870c147de015edf812e9e8784ff027e 100644 (file)
@@ -175,9 +175,9 @@ void DetectHttp2Register(void)
     sigmatch_table[DETECT_HTTP2_HEADERNAME].flags |= SIGMATCH_NOOPT | SIGMATCH_INFO_STICKY_BUFFER;
 
     DetectAppLayerMultiRegister("http2_header_name", ALPROTO_HTTP2, SIG_FLAG_TOCLIENT,
-            HTTP2StateOpen, rs_http2_tx_get_header_name, 2);
+            HTTP2StateOpen, SCHttp2TxGetHeaderName, 2);
     DetectAppLayerMultiRegister("http2_header_name", ALPROTO_HTTP2, SIG_FLAG_TOSERVER,
-            HTTP2StateOpen, rs_http2_tx_get_header_name, 2);
+            HTTP2StateOpen, SCHttp2TxGetHeaderName, 2);
 
     DetectBufferTypeSupportsMultiInstance("http2_header_name");
     DetectBufferTypeSetDescriptionByName("http2_header_name",
@@ -205,7 +205,7 @@ static int DetectHTTP2frametypeMatch(DetectEngineThreadCtx *det_ctx,
 {
     uint8_t *detect = (uint8_t *)ctx;
 
-    return rs_http2_tx_has_frametype(txv, flags, *detect);
+    return SCHttp2TxHasFrametype(txv, flags, *detect);
 }
 
 static int DetectHTTP2FuncParseFrameType(const char *str, uint8_t *ft)
@@ -216,7 +216,7 @@ static int DetectHTTP2FuncParseFrameType(const char *str, uint8_t *ft)
     }
 
     // it it failed so far, parse string value from enumeration
-    int r = rs_http2_parse_frametype(str);
+    int r = SCHttp2ParseFrametype(str);
     if (r >= 0 && r <= UINT8_MAX) {
         *ft = (uint8_t)r;
         return 1;
@@ -284,7 +284,7 @@ static int DetectHTTP2errorcodeMatch(DetectEngineThreadCtx *det_ctx,
 {
     uint32_t *detect = (uint32_t *)ctx;
 
-    return rs_http2_tx_has_errorcode(txv, flags, *detect);
+    return SCHttp2TxHasErrorCode(txv, flags, *detect);
     //TODOask handle negation rules
 }
 
@@ -296,7 +296,7 @@ static int DetectHTTP2FuncParseErrorCode(const char *str, uint32_t *ec)
     }
 
     // it it failed so far, parse string value from enumeration
-    int r = rs_http2_parse_errorcode(str);
+    int r = SCHttp2ParseErrorCode(str);
     if (r >= 0) {
         *ec = r;
         return 1;
@@ -363,14 +363,14 @@ static int DetectHTTP2priorityMatch(DetectEngineThreadCtx *det_ctx,
 
 {
     uint32_t nb = 0;
-    int value = rs_http2_tx_get_next_priority(txv, flags, nb);
+    int value = SCHttp2TxGetNextPriority(txv, flags, nb);
     const DetectU8Data *du8 = (const DetectU8Data *)ctx;
     while (value >= 0) {
         if (DetectU8Match((uint8_t)value, du8)) {
             return 1;
         }
         nb++;
-        value = rs_http2_tx_get_next_priority(txv, flags, nb);
+        value = SCHttp2TxGetNextPriority(txv, flags, nb);
     }
     return 0;
 }
@@ -425,14 +425,14 @@ static int DetectHTTP2windowMatch(DetectEngineThreadCtx *det_ctx,
 
 {
     uint32_t nb = 0;
-    int value = rs_http2_tx_get_next_window(txv, flags, nb);
+    int value = SCHttp2TxGetNextWindow(txv, flags, nb);
     const DetectU32Data *du32 = (const DetectU32Data *)ctx;
     while (value >= 0) {
         if (DetectU32Match(value, du32)) {
             return 1;
         }
         nb++;
-        value = rs_http2_tx_get_next_window(txv, flags, nb);
+        value = SCHttp2TxGetNextWindow(txv, flags, nb);
     }
     return 0;
 }
@@ -486,7 +486,7 @@ static int DetectHTTP2sizeUpdateMatch(DetectEngineThreadCtx *det_ctx,
                                const SigMatchCtx *ctx)
 
 {
-    return rs_http2_detect_sizeupdatectx_match(ctx, txv, flags);
+    return SCHttp2DetectSizeUpdateCtxMatch(ctx, txv, flags);
 }
 
 /**
@@ -538,7 +538,7 @@ static int DetectHTTP2settingsMatch(DetectEngineThreadCtx *det_ctx,
                                const SigMatchCtx *ctx)
 
 {
-    return rs_http2_detect_settingsctx_match(ctx, txv, flags);
+    return SCHttp2DetectSettingsCtxMatch(ctx, txv, flags);
 }
 
 /**
@@ -556,7 +556,7 @@ static int DetectHTTP2settingsSetup (DetectEngineCtx *de_ctx, Signature *s, cons
     if (DetectSignatureSetAppProto(s, ALPROTO_HTTP2) != 0)
         return -1;
 
-    void *http2set = rs_http2_detect_settingsctx_parse(str);
+    void *http2set = SCHttp2DetectSettingsCtxParse(str);
     if (http2set == NULL)
         return -1;
 
@@ -576,7 +576,7 @@ static int DetectHTTP2settingsSetup (DetectEngineCtx *de_ctx, Signature *s, cons
  */
 void DetectHTTP2settingsFree(DetectEngineCtx *de_ctx, void *ptr)
 {
-    rs_http2_detect_settingsctx_free(ptr);
+    SCHttp2DetectSettingsCtxFree(ptr);
 }
 
 static int DetectHTTP2headerNameSetup(DetectEngineCtx *de_ctx, Signature *s, const char *arg)
index 77d51760ec36e7c4b913d8f3d1916cbf3e684fa7..2fe5b8eee699e81a4fe8af2d54ce43bf92f46e4d 100644 (file)
@@ -260,7 +260,7 @@ bool AlertJsonDoh2(void *txptr, SCJsonBuilder *js)
 
     SCJbGetMark(js, &mark);
     // first log HTTP2 part
-    bool r = rs_http2_log_json(txptr, js);
+    bool r = SCHttp2LogJson(txptr, js);
     if (!r) {
         SCJbRestoreMark(js, &mark);
     }
@@ -296,7 +296,7 @@ static int JsonDoh2Logger(ThreadVars *tv, void *thread_data, const Packet *p, Fl
 
     SCJbGetMark(jb, &mark);
     // first log HTTP2 part
-    bool r = rs_http2_log_json(txptr, jb);
+    bool r = SCHttp2LogJson(txptr, jb);
     if (!r) {
         SCJbRestoreMark(jb, &mark);
     }
index a82eaffcc2a2e1c1d133869632333bacd8e08f9d..cabc70e3c94eb3bf48d88475102840f8be983eb9 100644 (file)
@@ -932,8 +932,7 @@ void OutputRegisterRootLoggers(void)
             ALPROTO_TEMPLATE, (EveJsonSimpleTxLogFunc)rs_template_logger_log, NULL);
     RegisterSimpleJsonApplayerLogger(ALPROTO_RDP, (EveJsonSimpleTxLogFunc)SCRdpToJson, NULL);
     // special case : http2 is logged in http object
-    RegisterSimpleJsonApplayerLogger(
-            ALPROTO_HTTP2, (EveJsonSimpleTxLogFunc)rs_http2_log_json, "http");
+    RegisterSimpleJsonApplayerLogger(ALPROTO_HTTP2, (EveJsonSimpleTxLogFunc)SCHttp2LogJson, "http");
     // underscore instead of dash for bittorrent_dht
     RegisterSimpleJsonApplayerLogger(ALPROTO_BITTORRENT_DHT,
             (EveJsonSimpleTxLogFunc)SCBittorrentDhtLogger, "bittorrent_dht");