From: Jason Ish Date: Mon, 5 May 2025 15:35:00 +0000 (-0600) Subject: rust/rfb: replace rs_ naming with SC X-Git-Tag: suricata-8.0.0-rc1~355 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=2c98ee73ce8e5bd4c3e169bb5a8f0225587e3c2a;p=thirdparty%2Fsuricata.git rust/rfb: replace rs_ naming with SC --- diff --git a/rust/cbindgen.toml b/rust/cbindgen.toml index 4e858daba1..6741c25d7f 100644 --- a/rust/cbindgen.toml +++ b/rust/cbindgen.toml @@ -74,6 +74,7 @@ documentation_style = "doxy" # default: [] include = [ "StreamSlice", + "AppLayerResult", "AppLayerStateData", "AppLayerGetFileState", "AppLayerGetTxIterTuple", diff --git a/rust/src/rfb/logger.rs b/rust/src/rfb/logger.rs index 10211832ee..9934aae057 100644 --- a/rust/src/rfb/logger.rs +++ b/rust/src/rfb/logger.rs @@ -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); diff --git a/rust/src/rfb/rfb.rs b/rust/src/rfb/rfb.rs index c931e55b5a..0e94af4593 100644 --- a/rust/src/rfb/rfb.rs +++ b/rust/src/rfb/rfb.rs @@ -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, diff --git a/src/output.c b/src/output.c index 9cc7030b48..6453bc1d3d 100644 --- a/src/output.c +++ b/src/output.c @@ -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);