pub flags: u32,
- /// Function to handle the end of data coming on one of the sides
- /// due to the stream reaching its 'depth' limit.
- pub truncate: Option<TruncateFn>,
-
pub get_frame_id_by_name: Option<GetFrameIdByName>,
pub get_frame_name_by_id: Option<GetFrameNameById>,
}
pub type GetTxDataFn = unsafe extern "C" fn(*mut c_void) -> *mut AppLayerTxData;
pub type GetStateDataFn = unsafe extern "C" fn(*mut c_void) -> *mut AppLayerStateData;
pub type ApplyTxConfigFn = unsafe extern "C" fn (*mut c_void, *mut c_void, c_int, AppLayerTxConfig);
-pub type TruncateFn = unsafe extern "C" fn (*mut c_void, u8);
pub type GetFrameIdByName = unsafe extern "C" fn(*const c_char) -> c_int;
pub type GetFrameNameById = unsafe extern "C" fn(u8) -> *const c_char;
get_state_data: rs_template_get_state_data,
apply_tx_config: None,
flags: APP_LAYER_PARSER_OPT_ACCEPT_GAPS,
- truncate: None,
get_frame_id_by_name: None,
get_frame_name_by_id: None,
};
get_state_data: rs_bittorrent_dht_get_state_data,
apply_tx_config: None,
flags: 0,
- truncate: None,
get_frame_id_by_name: None,
get_frame_name_by_id: None,
};
pub tc_gap: bool,
pub ts_ssn_gap: bool,
pub tc_ssn_gap: bool,
- pub ts_ssn_trunc: bool, /// true if Truncated in this direction
- pub tc_ssn_trunc: bool,
pub flow: Option<*const core::Flow>,
state_data: AppLayerStateData,
}
tx.call_id = call_id;
tx.endianness = endianness;
self.tx_id += 1;
- tx.req_done = self.ts_ssn_trunc;
- tx.resp_done = self.tc_ssn_trunc;
if self.transactions.len() > unsafe { DCERPC_MAX_TX } {
let mut index = self.tx_index_completed;
for tx_old in &mut self.transactions.range_mut(self.tx_index_completed..) {
dce_state.free_tx(tx_id);
}
-#[no_mangle]
-pub unsafe extern "C" fn rs_dcerpc_state_trunc(state: *mut std::os::raw::c_void, direction: u8) {
- let dce_state = cast_pointer!(state, DCERPCState);
- match direction.into() {
- Direction::ToServer => {
- dce_state.ts_ssn_trunc = true;
- for tx in &mut dce_state.transactions {
- tx.req_done = true;
- if let Some(flow) = dce_state.flow {
- sc_app_layer_parser_trigger_raw_stream_reassembly(flow, Direction::ToServer as i32);
- }
- }
- SCLogDebug!("dce_state.ts_ssn_trunc = true; txs {}", dce_state.transactions.len());
- }
- Direction::ToClient => {
- dce_state.tc_ssn_trunc = true;
- for tx in &mut dce_state.transactions {
- tx.resp_done = true;
- if let Some(flow) = dce_state.flow {
- sc_app_layer_parser_trigger_raw_stream_reassembly(flow, Direction::ToClient as i32);
- }
- }
- SCLogDebug!("dce_state.tc_ssn_trunc = true; txs {}", dce_state.transactions.len());
- }
- }
-}
-
#[no_mangle]
pub unsafe extern "C" fn rs_dcerpc_get_tx(
vtx: *mut std::os::raw::c_void, tx_id: u64,
get_state_data: rs_dcerpc_get_state_data,
apply_tx_config: None,
flags: APP_LAYER_PARSER_OPT_ACCEPT_GAPS,
- truncate: None,
get_frame_id_by_name: None,
get_frame_name_by_id: None,
};
get_state_data: rs_dcerpc_udp_get_state_data,
apply_tx_config: None,
flags: 0,
- truncate: None,
get_frame_id_by_name: None,
get_frame_name_by_id: None,
};
get_state_data : rs_dhcp_get_state_data,
apply_tx_config : None,
flags : 0,
- truncate : None,
get_frame_id_by_name: None,
get_frame_name_by_id: None,
};
get_state_data: rs_dns_get_state_data,
apply_tx_config: Some(apply_tx_config),
flags: 0,
- truncate: None,
get_frame_id_by_name: Some(DnsFrameType::ffi_id_from_name),
get_frame_name_by_id: Some(DnsFrameType::ffi_name_from_id),
};
get_state_data: rs_dns_get_state_data,
apply_tx_config: Some(apply_tx_config),
flags: APP_LAYER_PARSER_OPT_ACCEPT_GAPS,
- truncate: None,
get_frame_id_by_name: Some(DnsFrameType::ffi_id_from_name),
get_frame_name_by_id: Some(DnsFrameType::ffi_name_from_id),
};
get_state_data: SCEnipTxGetState_data,
apply_tx_config: None,
flags: 0,
- truncate: None,
get_frame_id_by_name: Some(EnipFrameType::ffi_id_from_name),
get_frame_name_by_id: Some(EnipFrameType::ffi_name_from_id),
};
get_state_data: rs_http2_get_state_data,
apply_tx_config: None,
flags: 0,
- truncate: None,
get_frame_id_by_name: None,
get_frame_name_by_id: None,
};
get_state_data: rs_ike_get_state_data,
apply_tx_config: None,
flags: 0,
- truncate: None,
get_frame_id_by_name: None,
get_frame_name_by_id: None,
};
get_state_data : rs_krb5_get_state_data,
apply_tx_config : None,
flags : 0,
- truncate : None,
get_frame_id_by_name: None,
get_frame_name_by_id: None,
};
get_state_data: rs_modbus_get_state_data,
apply_tx_config: None,
flags: 0,
- truncate: None,
get_frame_id_by_name: None,
get_frame_name_by_id: None,
};
get_state_data: rs_mqtt_get_state_data,
apply_tx_config: None,
flags: 0,
- truncate: None,
get_frame_id_by_name: Some(MQTTFrameType::ffi_id_from_name),
get_frame_name_by_id: Some(MQTTFrameType::ffi_name_from_id),
};
get_state_data: rs_nfs_get_state_data,
apply_tx_config: None,
flags: APP_LAYER_PARSER_OPT_ACCEPT_GAPS,
- truncate: None,
get_frame_id_by_name: Some(NFSFrameType::ffi_id_from_name),
get_frame_name_by_id: Some(NFSFrameType::ffi_name_from_id),
};
get_state_data: rs_nfs_get_state_data,
apply_tx_config: None,
flags: 0,
- truncate: None,
get_frame_id_by_name: Some(NFSFrameType::ffi_id_from_name),
get_frame_name_by_id: Some(NFSFrameType::ffi_name_from_id),
};
get_state_data : rs_ntp_get_state_data,
apply_tx_config : None,
flags : 0,
- truncate : None,
get_frame_id_by_name: None,
get_frame_name_by_id: None,
};
get_state_data: rs_pgsql_get_state_data,
apply_tx_config: None,
flags: APP_LAYER_PARSER_OPT_ACCEPT_GAPS,
- truncate: None,
get_frame_id_by_name: None,
get_frame_name_by_id: None,
};
get_state_data: rs_quic_get_state_data,
apply_tx_config: None,
flags: 0,
- truncate: None,
get_frame_id_by_name: None,
get_frame_name_by_id: None,
};
get_state_data: rs_rdp_get_state_data,
apply_tx_config: None,
flags: 0,
- truncate: None,
get_frame_id_by_name: None,
get_frame_name_by_id: None,
};
get_state_data: rs_rfb_get_state_data,
apply_tx_config: None,
flags: 0,
- truncate: None,
get_frame_id_by_name: Some(RFBFrameType::ffi_id_from_name),
get_frame_name_by_id: Some(RFBFrameType::ffi_name_from_id),
};
get_state_data: rs_sip_get_state_data,
apply_tx_config: None,
flags: 0,
- truncate: None,
get_frame_id_by_name: Some(SIPFrameType::ffi_id_from_name),
get_frame_name_by_id: Some(SIPFrameType::ffi_name_from_id),
};
return &mut tx.tx_data;
}
-
-#[no_mangle]
-pub unsafe extern "C" fn rs_smb_state_truncate(
- state: *mut std::ffi::c_void,
- direction: u8)
-{
- let state = cast_pointer!(state, SMBState);
- match direction.into() {
- Direction::ToServer => {
- state.trunc_ts();
- }
- Direction::ToClient => {
- state.trunc_tc();
- }
- }
-}
-
#[no_mangle]
pub unsafe extern "C" fn rs_smb_state_get_event_info_by_id(
event_id: std::os::raw::c_int,
get_state_data: rs_smb_get_state_data,
apply_tx_config: None,
flags: APP_LAYER_PARSER_OPT_ACCEPT_GAPS,
- truncate: Some(rs_smb_state_truncate),
get_frame_id_by_name: Some(SMBFrameType::ffi_id_from_name),
get_frame_name_by_id: Some(SMBFrameType::ffi_name_from_id),
};
get_state_data : rs_snmp_get_state_data,
apply_tx_config : None,
flags : 0,
- truncate : None,
get_frame_id_by_name: None,
get_frame_name_by_id: None,
};
get_state_data: rs_ssh_get_state_data,
apply_tx_config: None,
flags: 0,
- truncate: None,
get_frame_id_by_name: None,
get_frame_name_by_id: None,
};
get_state_data: rs_telnet_get_state_data,
apply_tx_config: None,
flags: APP_LAYER_PARSER_OPT_ACCEPT_GAPS,
- truncate: None,
get_frame_id_by_name: Some(TelnetFrameType::ffi_id_from_name),
get_frame_name_by_id: Some(TelnetFrameType::ffi_name_from_id),
get_state_data: rs_websocket_get_state_data,
apply_tx_config: None,
flags: 0, // do not accept gaps as there is no good way to resync
- truncate: None,
get_frame_id_by_name: Some(WebSocketFrameType::ffi_id_from_name),
get_frame_name_by_id: Some(WebSocketFrameType::ffi_name_from_id),
};
void *(*LocalStorageAlloc)(void);
void (*LocalStorageFree)(void *);
- void (*Truncate)(void *, uint8_t);
-
/** get FileContainer reference from the TX. MUST return a non-NULL reference if the TX
* has or may have files in the requested direction at some point. */
AppLayerGetFileState (*GetTxFiles)(void *, uint8_t);
SCReturn;
}
-void AppLayerParserRegisterTruncateFunc(uint8_t ipproto, AppProto alproto,
- void (*Truncate)(void *, uint8_t))
-{
- SCEnter();
-
- alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].Truncate = Truncate;
-
- SCReturn;
-}
-
void AppLayerParserRegisterGetStateProgressFunc(uint8_t ipproto, AppProto alproto,
int (*StateGetProgress)(void *alstate, uint8_t direction))
{
uint8_t ipproto, AppProto alproto, AppLayerGetFileState (*GetTxFiles)(void *, uint8_t));
void AppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto);
void AppLayerParserRegisterLoggerBits(uint8_t ipproto, AppProto alproto, LoggerId bits);
-void AppLayerParserRegisterTruncateFunc(uint8_t ipproto, AppProto alproto,
- void (*Truncate)(void *, uint8_t));
void AppLayerParserRegisterGetStateProgressFunc(uint8_t ipproto, AppProto alproto,
int (*StateGetStateProgress)(void *alstate, uint8_t direction));
void AppLayerParserRegisterTxFreeFunc(uint8_t ipproto, AppProto alproto,
}
- if (p->Truncate) {
- AppLayerParserRegisterTruncateFunc(p->ip_proto, alproto, p->Truncate);
- }
-
if (p->GetFrameIdByName && p->GetFrameNameById) {
AppLayerParserRegisterGetFrameFuncs(
p->ip_proto, alproto, p->GetFrameIdByName, p->GetFrameNameById);
uint32_t flags;
- void (*Truncate)(void *state, uint8_t direction);
-
AppLayerParserGetFrameIdByNameFn GetFrameIdByName;
AppLayerParserGetFrameNameByIdFn GetFrameNameById;