]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust/rfb: replace rs_ naming with SC
authorJason Ish <jason.ish@oisf.net>
Mon, 5 May 2025 15:35:00 +0000 (09:35 -0600)
committerVictor Julien <victor@inliniac.net>
Mon, 5 May 2025 19:41:03 +0000 (21:41 +0200)
rust/cbindgen.toml
rust/src/rfb/logger.rs
rust/src/rfb/rfb.rs
src/output.c

index 4e858daba1461acae830773ceca4e9ca36ec93ec..6741c25d7f325588e442d349f99ab5628d9fbb1f 100644 (file)
@@ -74,6 +74,7 @@ documentation_style = "doxy"
 # default: []
 include = [
     "StreamSlice",
+    "AppLayerResult",
     "AppLayerStateData",
     "AppLayerGetFileState",
     "AppLayerGetTxIterTuple",
index 10211832eebaf106a4cb5972f4aa1f2ece1d1481..9934aae057331879c5a612b9932268d38547d98d 100644 (file)
@@ -128,7 +128,7 @@ fn log_rfb(tx: &RFBTransaction, js: &mut JsonBuilder) -> Result<(), JsonError> {
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_rfb_logger_log(
+pub unsafe extern "C" fn SCRfbJsonLogger(
     tx: *mut std::os::raw::c_void, js: &mut JsonBuilder,
 ) -> bool {
     let tx = cast_pointer!(tx, RFBTransaction);
index c931e55b5a0c1da8ff032e3680174cd447a5dc95..0e94af45938ba31f60185989fd2fb71edd222f1d 100644 (file)
@@ -763,8 +763,7 @@ impl RFBState {
 
 // C exports.
 
-#[no_mangle]
-pub extern "C" fn rs_rfb_state_new(
+extern "C" fn rfb_state_new(
     _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto,
 ) -> *mut std::os::raw::c_void {
     let state = RFBState::new();
@@ -772,20 +771,17 @@ pub extern "C" fn rs_rfb_state_new(
     return Box::into_raw(boxed) as *mut _;
 }
 
-#[no_mangle]
-pub extern "C" fn rs_rfb_state_free(state: *mut std::os::raw::c_void) {
+extern "C" fn rfb_state_free(state: *mut std::os::raw::c_void) {
     // Just unbox...
     std::mem::drop(unsafe { Box::from_raw(state as *mut RFBState) });
 }
 
-#[no_mangle]
-pub unsafe extern "C" fn rs_rfb_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) {
+unsafe extern "C" fn rfb_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) {
     let state = cast_pointer!(state, RFBState);
     state.free_tx(tx_id);
 }
 
-#[no_mangle]
-pub unsafe extern "C" fn rs_rfb_parse_request(
+unsafe extern "C" fn rfb_parse_request(
     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 {
@@ -793,8 +789,7 @@ pub unsafe extern "C" fn rs_rfb_parse_request(
     return state.parse_request(flow, stream_slice);
 }
 
-#[no_mangle]
-pub unsafe extern "C" fn rs_rfb_parse_response(
+unsafe extern "C" fn rfb_parse_response(
     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 {
@@ -802,8 +797,7 @@ pub unsafe extern "C" fn rs_rfb_parse_response(
     return state.parse_response(flow, stream_slice);
 }
 
-#[no_mangle]
-pub unsafe extern "C" fn rs_rfb_state_get_tx(
+unsafe extern "C" fn rfb_state_get_tx(
     state: *mut std::os::raw::c_void, tx_id: u64,
 ) -> *mut std::os::raw::c_void {
     let state = cast_pointer!(state, RFBState);
@@ -817,14 +811,12 @@ pub unsafe extern "C" fn rs_rfb_state_get_tx(
     }
 }
 
-#[no_mangle]
-pub unsafe extern "C" fn rs_rfb_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 {
+unsafe extern "C" fn rfb_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 {
     let state = cast_pointer!(state, RFBState);
     return state.tx_id;
 }
 
-#[no_mangle]
-pub unsafe extern "C" fn rs_rfb_tx_get_alstate_progress(
+unsafe extern "C" fn rfb_tx_get_alstate_progress(
     tx: *mut std::os::raw::c_void, _direction: u8,
 ) -> std::os::raw::c_int {
     let tx = cast_pointer!(tx, RFBTransaction);
@@ -850,16 +842,16 @@ pub unsafe extern "C" fn SCRfbRegisterParser() {
         probe_tc: None,
         min_depth: 0,
         max_depth: 16,
-        state_new: rs_rfb_state_new,
-        state_free: rs_rfb_state_free,
-        tx_free: rs_rfb_state_tx_free,
-        parse_ts: rs_rfb_parse_request,
-        parse_tc: rs_rfb_parse_response,
-        get_tx_count: rs_rfb_state_get_tx_count,
-        get_tx: rs_rfb_state_get_tx,
+        state_new: rfb_state_new,
+        state_free: rfb_state_free,
+        tx_free: rfb_state_tx_free,
+        parse_ts: rfb_parse_request,
+        parse_tc: rfb_parse_response,
+        get_tx_count: rfb_state_get_tx_count,
+        get_tx: rfb_state_get_tx,
         tx_comp_st_ts: 1,
         tx_comp_st_tc: 1,
-        tx_get_progress: rs_rfb_tx_get_alstate_progress,
+        tx_get_progress: rfb_tx_get_alstate_progress,
         get_eventinfo: Some(RFBEvent::get_event_info),
         get_eventinfo_byid: Some(RFBEvent::get_event_info_by_id),
         localstorage_new: None,
index 9cc7030b481abcbbd814e419b05f6e6110336879..6453bc1d3d70517f8359dd76dbff6e0ead654762 100644 (file)
@@ -916,7 +916,7 @@ void OutputRegisterRootLoggers(void)
     RegisterSimpleJsonApplayerLogger(ALPROTO_QUIC, (EveJsonSimpleTxLogFunc)SCQuicLogJson, NULL);
     // ALPROTO_DHCP TODO missing
     RegisterSimpleJsonApplayerLogger(ALPROTO_SIP, (EveJsonSimpleTxLogFunc)SCSipLogJson, NULL);
-    RegisterSimpleJsonApplayerLogger(ALPROTO_RFB, (EveJsonSimpleTxLogFunc)rs_rfb_logger_log, NULL);
+    RegisterSimpleJsonApplayerLogger(ALPROTO_RFB, (EveJsonSimpleTxLogFunc)SCRfbJsonLogger, NULL);
     RegisterSimpleJsonApplayerLogger(ALPROTO_POP3, (EveJsonSimpleTxLogFunc)SCPop3LoggerLog, NULL);
     RegisterSimpleJsonApplayerLogger(
             ALPROTO_MQTT, (EveJsonSimpleTxLogFunc)JsonMQTTAddMetadata, NULL);