Skip to content

Commit

Permalink
rust/websocket: restrict visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
catenacyber committed Jan 23, 2025
1 parent 2477e53 commit f09cfd7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion rust/src/websocket/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ pub unsafe extern "C" fn rs_websocket_logger_log(

#[no_mangle]
pub unsafe extern "C" fn SCWebSocketLogDetails(
tx: &WebSocketTransaction, js: *mut std::os::raw::c_void, pp: bool, pb64: bool,
tx: *const std::os::raw::c_void, js: *mut std::os::raw::c_void, pp: bool, pb64: bool,
) -> bool {
let js = cast_pointer!(js, JsonBuilder);
let tx = cast_pointer!(tx, WebSocketTransaction);
log_websocket(tx, js, pp, pb64).is_ok()
}
4 changes: 2 additions & 2 deletions rust/src/websocket/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use suricata_derive::EnumStringU8;

#[derive(Clone, Debug, Default, EnumStringU8)]
#[repr(u8)]
pub enum WebSocketOpcode {
pub(super) enum WebSocketOpcode {
#[default]
Continuation = 0,
Text = 1,
Expand All @@ -34,7 +34,7 @@ pub enum WebSocketOpcode {
}

#[derive(Clone, Debug, Default)]
pub struct WebSocketPdu {
pub(super) struct WebSocketPdu {
pub flags: u8,
pub fin: bool,
pub compress: bool,
Expand Down
8 changes: 4 additions & 4 deletions rust/src/websocket/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@ pub(super) static mut ALPROTO_WEBSOCKET: AppProto = ALPROTO_UNKNOWN;
static mut WEBSOCKET_MAX_PAYLOAD_SIZE: u32 = 0xFFFF;

#[derive(AppLayerFrameType)]
pub enum WebSocketFrameType {
enum WebSocketFrameType {
Header,
Pdu,
Data,
}

#[derive(AppLayerEvent)]
pub enum WebSocketEvent {
enum WebSocketEvent {
SkipEndOfPayload,
ReassemblyLimitReached,
}

#[derive(Default)]
pub struct WebSocketTransaction {
pub(super) struct WebSocketTransaction {
tx_id: u64,
pub pdu: parser::WebSocketPdu,
tx_data: AppLayerTxData,
Expand Down Expand Up @@ -80,7 +80,7 @@ struct WebSocketReassemblyBuffer {
}

#[derive(Default)]
pub struct WebSocketState {
struct WebSocketState {
state_data: AppLayerStateData,
tx_id: u64,
transactions: VecDeque<WebSocketTransaction>,
Expand Down

0 comments on commit f09cfd7

Please sign in to comment.