fn to_cstring(&self) -> *const std::os::raw::c_char;
/// Converts a C string formatted name to a frame type ID.
- extern "C" fn ffi_id_from_name(name: *const std::os::raw::c_char) -> i32 where Self: Sized {
+ unsafe extern "C" fn ffi_id_from_name(name: *const std::os::raw::c_char) -> i32 where Self: Sized {
if name.is_null() {
return -1;
}
- unsafe {
- let frame_id = if let Ok(s) = std::ffi::CStr::from_ptr(name).to_str() {
- Self::from_str(s).map(|t| t.as_u8() as i32).unwrap_or(-1)
- } else {
- -1
- };
- frame_id
- }
+ let frame_id = if let Ok(s) = std::ffi::CStr::from_ptr(name).to_str() {
+ Self::from_str(s).map(|t| t.as_u8() as i32).unwrap_or(-1)
+ } else {
+ -1
+ };
+ frame_id
}
/// Converts a variant ID to an FFI safe name.
}
impl Frame {
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
pub fn new(
flow: *const Flow, stream_slice: &StreamSlice, frame_start: &[u8], frame_len: i64,
frame_type: u8,
}
}
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
pub fn set_len(&self, flow: *const Flow, len: i64) {
unsafe {
AppLayerFrameSetLengthById(flow, self.direction(), self.id, len);
};
}
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
pub fn set_tx(&self, flow: *const Flow, tx_id: u64) {
unsafe {
AppLayerFrameSetTxIdById(flow, self.direction(), self.id, tx_id);
};
}
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
pub fn add_event(&self, flow: *const Flow, event: u8) {
unsafe {
AppLayerFrameAddEventById(flow, self.direction(), self.id, event);