Move the Rust Flow support from core.rs to flow.rs.
//! Parser registration functions and common interface module.
use std;
-use crate::core::{self,DetectEngineState,Flow,AppLayerEventType,AppProto,Direction};
+use crate::core::{self,DetectEngineState,AppLayerEventType,AppProto,Direction};
use crate::filecontainer::FileContainer;
+use crate::flow::Flow;
use std::os::raw::{c_void,c_char,c_int};
use crate::core::SC;
use std::ffi::CStr;
use super::parser;
use crate::applayer::{self, *};
use crate::conf::conf_get;
-use crate::core::{AppProto, Flow, ALPROTO_UNKNOWN, IPPROTO_TCP};
+use crate::core::{AppProto, ALPROTO_UNKNOWN, IPPROTO_TCP};
+use crate::flow::Flow;
use nom7 as nom;
use std;
use std::collections::VecDeque;
use crate::bittorrent_dht::parser::{
parse_bittorrent_dht_packet, BitTorrentDHTError, BitTorrentDHTRequest, BitTorrentDHTResponse,
};
-use crate::core::{AppProto, Flow, ALPROTO_UNKNOWN, IPPROTO_UDP, Direction};
+use crate::core::{AppProto, ALPROTO_UNKNOWN, IPPROTO_UDP, Direction};
+use crate::flow::Flow;
use std::ffi::CString;
use std::os::raw::c_char;
use std;
use crate::filecontainer::*;
use crate::debug_validate_fail;
+use crate::flow::Flow;
/// Opaque C types.
pub enum DetectEngineState {}
($x:expr) => (1 << $x);
}
-// Flow flags
-pub const FLOW_DIR_REVERSED: u32 = BIT_U32!(26);
-
// Defined in app-layer-protos.h
/// cbindgen:ignore
extern {
}
}
-/// Opaque flow type (defined in C)
-pub enum Flow {}
-
-// Extern functions operating on Flow.
-/// cbindgen:ignore
-extern {
- pub fn FlowGetLastTimeAsParts(flow: &Flow, secs: *mut u64, usecs: *mut u64);
- pub fn FlowGetFlags(flow: &Flow) -> u32;
- pub fn FlowGetSourcePort(flow: &Flow) -> u16;
- pub fn FlowGetDestinationPort(flow: &Flow) -> u16;
-}
-
-/// Rust implementation of Flow.
-impl Flow {
-
- /// Return the time of the last flow update as a `Duration`
- /// since the epoch.
- pub fn get_last_time(&mut self) -> std::time::Duration {
- unsafe {
- let mut secs: u64 = 0;
- let mut usecs: u64 = 0;
- FlowGetLastTimeAsParts(self, &mut secs, &mut usecs);
- std::time::Duration::new(secs, usecs as u32 * 1000)
- }
- }
-
- /// Return the flow flags.
- pub fn get_flags(&self) -> u32 {
- unsafe { FlowGetFlags(self) }
- }
-
- /// Return flow ports
- pub fn get_ports(&self) -> (u16, u16) {
- unsafe { (FlowGetSourcePort(self), FlowGetDestinationPort(self)) }
- }
-}
-
#[cfg(test)]
mod test {
use super::*;
use crate::applayer::{self, *};
use crate::core::{self, *};
use crate::dcerpc::parser;
+use crate::flow::Flow;
use nom7::error::{Error, ErrorKind};
use nom7::number::Endianness;
use nom7::{Err, IResult, Needed};
pub tc_gap: bool,
pub ts_ssn_gap: bool,
pub tc_ssn_gap: bool,
- pub flow: Option<*const core::Flow>,
+ pub flow: Option<*const Flow>,
state_data: AppLayerStateData,
}
#[no_mangle]
pub unsafe extern "C" fn rs_dcerpc_parse_request(
- flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void,
+ 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 {
#[no_mangle]
pub unsafe extern "C" fn rs_dcerpc_parse_response(
- flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void,
+ 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 {
}
}
-pub unsafe extern "C" fn rs_dcerpc_probe_tcp(_f: *const core::Flow, direction: u8, input: *const u8,
+pub unsafe extern "C" fn rs_dcerpc_probe_tcp(_f: *const Flow, direction: u8, input: *const u8,
len: u32, rdir: *mut u8) -> AppProto
{
SCLogDebug!("Probing packet for DCERPC");
DCERPCTransaction, DCERPC_MAX_TX, DCERPC_TYPE_REQUEST, DCERPC_TYPE_RESPONSE, PFCL1_FRAG, PFCL1_LASTFRAG,
rs_dcerpc_get_alstate_progress, ALPROTO_DCERPC, PARSER_NAME,
};
+use crate::flow::Flow;
use nom7::Err;
use std;
use std::ffi::CString;
#[no_mangle]
pub unsafe extern "C" fn rs_dcerpc_udp_parse(
- _flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void,
+ _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 {
}
}
-pub unsafe extern "C" fn rs_dcerpc_probe_udp(_f: *const core::Flow, direction: u8, input: *const u8,
+pub unsafe extern "C" fn rs_dcerpc_probe_udp(_f: *const Flow, direction: u8, input: *const u8,
len: u32, rdir: *mut u8) -> core::AppProto
{
SCLogDebug!("Probing the packet for DCERPC/UDP");
*/
use crate::applayer::{self, *};
-use crate::core;
-use crate::core::{ALPROTO_UNKNOWN, AppProto, Flow, IPPROTO_UDP};
+use crate::core::{ALPROTO_UNKNOWN, AppProto, IPPROTO_UDP};
use crate::dhcp::parser::*;
+use crate::flow::Flow;
use std;
use std::ffi::CString;
}
#[no_mangle]
-pub unsafe extern "C" fn rs_dhcp_parse(_flow: *const core::Flow,
+pub unsafe extern "C" fn rs_dhcp_parse(_flow: *const Flow,
state: *mut std::os::raw::c_void,
_pstate: *mut std::os::raw::c_void,
stream_slice: StreamSlice,
use crate::applayer::*;
use crate::core::{self, *};
use crate::dns::parser;
+use crate::flow::Flow;
use crate::frames::Frame;
use nom7::number::streaming::be_u16;
}
fn parse_request(
- &mut self, input: &[u8], is_tcp: bool, frame: Option<Frame>, flow: *const core::Flow,
+ &mut self, input: &[u8], is_tcp: bool, frame: Option<Frame>, flow: *const Flow,
) -> bool {
match dns_parse_request(input) {
Ok(mut tx) => {
}
}
- fn parse_request_udp(&mut self, flow: *const core::Flow, stream_slice: StreamSlice) -> bool {
+ fn parse_request_udp(&mut self, flow: *const Flow, stream_slice: StreamSlice) -> bool {
let input = stream_slice.as_slice();
let frame = Frame::new(
flow,
self.parse_request(input, false, frame, flow)
}
- fn parse_response_udp(&mut self, flow: *const core::Flow, stream_slice: StreamSlice) -> bool {
+ fn parse_response_udp(&mut self, flow: *const Flow, stream_slice: StreamSlice) -> bool {
let input = stream_slice.as_slice();
let frame = Frame::new(
flow,
}
fn parse_response(
- &mut self, input: &[u8], is_tcp: bool, frame: Option<Frame>, flow: *const core::Flow,
+ &mut self, input: &[u8], is_tcp: bool, frame: Option<Frame>, flow: *const Flow,
) -> bool {
match dns_parse_response(input) {
Ok(mut tx) => {
///
/// Returns the number of messages parsed.
fn parse_request_tcp(
- &mut self, flow: *const core::Flow, stream_slice: StreamSlice,
+ &mut self, flow: *const Flow, stream_slice: StreamSlice,
) -> AppLayerResult {
let input = stream_slice.as_slice();
if self.gap {
///
/// Returns the number of messages parsed.
fn parse_response_tcp(
- &mut self, flow: *const core::Flow, stream_slice: StreamSlice,
+ &mut self, flow: *const Flow, stream_slice: StreamSlice,
) -> AppLayerResult {
let input = stream_slice.as_slice();
if self.gap {
/// C binding parse a DNS request. Returns 1 on success, -1 on failure.
unsafe extern "C" fn parse_request(
- flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void,
+ 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 {
let state = cast_pointer!(state, DNSState);
}
unsafe extern "C" fn parse_response(
- flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void,
+ 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 {
let state = cast_pointer!(state, DNSState);
/// C binding parse a DNS request. Returns 1 on success, -1 on failure.
unsafe extern "C" fn parse_request_tcp(
- flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void,
+ 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 {
let state = cast_pointer!(state, DNSState);
}
unsafe extern "C" fn parse_response_tcp(
- flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void,
+ 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 {
let state = cast_pointer!(state, DNSState);
}
unsafe extern "C" fn probe_udp(
- _flow: *const core::Flow, _dir: u8, input: *const u8, len: u32, rdir: *mut u8,
+ _flow: *const Flow, _dir: u8, input: *const u8, len: u32, rdir: *mut u8,
) -> AppProto {
if input.is_null() || len < std::mem::size_of::<DNSHeader>() as u32 {
return core::ALPROTO_UNKNOWN;
}
unsafe extern "C" fn c_probe_tcp(
- _flow: *const core::Flow, direction: u8, input: *const u8, len: u32, rdir: *mut u8,
+ _flow: *const Flow, direction: u8, input: *const u8, len: u32, rdir: *mut u8,
) -> AppProto {
if input.is_null() || len < std::mem::size_of::<DNSHeader>() as u32 + 2 {
return core::ALPROTO_UNKNOWN;
use crate::applayer::{self, *};
use crate::conf::conf_get;
use crate::core::{
- AppProto, Direction, Flow, ALPROTO_FAILED, ALPROTO_UNKNOWN, IPPROTO_TCP, IPPROTO_UDP,
+ AppProto, Direction, ALPROTO_FAILED, ALPROTO_UNKNOWN, IPPROTO_TCP, IPPROTO_UDP,
STREAM_TOCLIENT, STREAM_TOSERVER,
};
use crate::detect::EnumString;
+use crate::flow::Flow;
use crate::frames::Frame;
use nom7 as nom;
use std;
--- /dev/null
+/* Copyright (C) 2017-2025 Open Information Security Foundation
+ *
+ * You can copy, redistribute or modify this Program under the terms of
+ * the GNU General Public License version 2 as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+/// Flow API from C.
+/// cbindgen:ignore
+extern "C" {
+ fn FlowGetLastTimeAsParts(flow: &Flow, secs: *mut u64, usecs: *mut u64);
+ fn FlowGetFlags(flow: &Flow) -> u32;
+ fn FlowGetSourcePort(flow: &Flow) -> u16;
+ fn FlowGetDestinationPort(flow: &Flow) -> u16;
+}
+
+// Flow flags
+pub const FLOW_DIR_REVERSED: u32 = BIT_U32!(26);
+
+/// Opaque flow type (defined in C)
+pub enum Flow {}
+
+/// Rust implementation of Flow.
+impl Flow {
+ /// Return the time of the last flow update as a `Duration`
+ /// since the epoch.
+ pub fn get_last_time(&mut self) -> std::time::Duration {
+ unsafe {
+ let mut secs: u64 = 0;
+ let mut usecs: u64 = 0;
+ FlowGetLastTimeAsParts(self, &mut secs, &mut usecs);
+ std::time::Duration::new(secs, usecs as u32 * 1000)
+ }
+ }
+
+ /// Return the flow flags.
+ pub fn get_flags(&self) -> u32 {
+ unsafe { FlowGetFlags(self) }
+ }
+
+ /// Return flow ports
+ pub fn get_ports(&self) -> (u16, u16) {
+ unsafe { (FlowGetSourcePort(self), FlowGetDestinationPort(self)) }
+ }
+}
//! Module for bindings to the Suricata C frame API.
use crate::applayer::StreamSlice;
-use crate::core::Flow;
+use crate::flow::Flow;
#[cfg(not(test))]
use crate::core::STREAM_TOSERVER;
use crate::core::Direction;
use crate::core::*;
use crate::filecontainer::*;
use crate::filetracker::*;
+use crate::flow::Flow;
use crate::frames::Frame;
use crate::dns::dns::{dns_parse_request, dns_parse_response, DNSTransaction};
use super::detect;
use crate::core::{
- Direction, Flow, HttpRangeContainerBlock, StreamingBufferConfig, SuricataFileContext, SC,
+ Direction, HttpRangeContainerBlock, StreamingBufferConfig, SuricataFileContext, SC,
};
+use crate::flow::Flow;
use crate::http2::http2::HTTP2Transaction;
use crate::http2::http2::SURICATA_HTTP2_FILE_CONFIG;
use crate::applayer;
use crate::applayer::*;
use crate::core::{self, *};
+use crate::flow::Flow;
use crate::ike::ikev1::{handle_ikev1, IkeV1Header, Ikev1Container};
use crate::ike::ikev2::{handle_ikev2, Ikev2Container};
use crate::ike::parser::*;
use asn1_rs::FromDer;
use crate::applayer::{self, *};
use crate::core;
-use crate::core::{AppProto,Flow,ALPROTO_FAILED,ALPROTO_UNKNOWN,Direction, IPPROTO_TCP, IPPROTO_UDP};
+use crate::core::{AppProto,ALPROTO_FAILED,ALPROTO_UNKNOWN,Direction, IPPROTO_TCP, IPPROTO_UDP};
+use crate::flow::Flow;
#[derive(AppLayerEvent)]
pub enum KRB5Event {
}
#[no_mangle]
-pub unsafe extern "C" fn rs_krb5_parse_request(_flow: *const core::Flow,
+pub unsafe extern "C" fn rs_krb5_parse_request(_flow: *const Flow,
state: *mut std::os::raw::c_void,
_pstate: *mut std::os::raw::c_void,
stream_slice: StreamSlice,
}
#[no_mangle]
-pub unsafe extern "C" fn rs_krb5_parse_response(_flow: *const core::Flow,
+pub unsafe extern "C" fn rs_krb5_parse_response(_flow: *const Flow,
state: *mut std::os::raw::c_void,
_pstate: *mut std::os::raw::c_void,
stream_slice: StreamSlice,
}
#[no_mangle]
-pub unsafe extern "C" fn rs_krb5_parse_request_tcp(_flow: *const core::Flow,
+pub unsafe extern "C" fn rs_krb5_parse_request_tcp(_flow: *const Flow,
state: *mut std::os::raw::c_void,
_pstate: *mut std::os::raw::c_void,
stream_slice: StreamSlice,
}
#[no_mangle]
-pub unsafe extern "C" fn rs_krb5_parse_response_tcp(_flow: *const core::Flow,
+pub unsafe extern "C" fn rs_krb5_parse_response_tcp(_flow: *const Flow,
state: *mut std::os::raw::c_void,
_pstate: *mut std::os::raw::c_void,
stream_slice: StreamSlice,
use crate::applayer::{self, *};
use crate::conf::conf_get;
-use crate::core::{Flow, *};
+use crate::core::*;
+use crate::flow::Flow;
use crate::frames::*;
use nom7 as nom;
use std;
pub mod feature;
pub mod sdp;
pub mod ldap;
+pub mod flow;
#[allow(unused_imports)]
pub use suricata_lua_sys;
* 02110-1301, USA.
*/
use crate::applayer::{self, *};
-use crate::core::{self, AppProto, ALPROTO_FAILED, ALPROTO_UNKNOWN, IPPROTO_TCP};
+use crate::core::{AppProto, ALPROTO_FAILED, ALPROTO_UNKNOWN, IPPROTO_TCP};
+use crate::flow::Flow;
use std::ffi::CString;
/// Probe input to see if it looks like Modbus.
#[no_mangle]
pub extern "C" fn rs_modbus_probe(
- _flow: *const core::Flow, _direction: u8, input: *const u8, len: u32, _rdir: *mut u8,
+ _flow: *const Flow, _direction: u8, input: *const u8, len: u32, _rdir: *mut u8,
) -> AppProto {
if input.is_null() {
return ALPROTO_UNKNOWN;
#[no_mangle]
pub unsafe extern "C" fn rs_modbus_parse_request(
- _flow: *const core::Flow, state: *mut std::os::raw::c_void, pstate: *mut std::os::raw::c_void,
+ _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 {
#[no_mangle]
pub unsafe extern "C" fn rs_modbus_parse_response(
- _flow: *const core::Flow, state: *mut std::os::raw::c_void, pstate: *mut std::os::raw::c_void,
+ _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 {
use crate::applayer::{self, LoggerFlags};
use crate::conf::{conf_get, get_memval};
use crate::core::*;
+use crate::flow::Flow;
use crate::frames::*;
use nom7::Err;
use std;
use crate::applayer;
use crate::applayer::*;
+use crate::flow::Flow;
use crate::frames::*;
use crate::core::*;
use crate::conf::*;
extern crate ntp_parser;
use self::ntp_parser::*;
use crate::core;
-use crate::core::{AppProto,Flow,ALPROTO_UNKNOWN,ALPROTO_FAILED,Direction};
+use crate::core::{AppProto,ALPROTO_UNKNOWN,ALPROTO_FAILED,Direction};
use crate::applayer::{self, *};
+use crate::flow::Flow;
use std;
use std::ffi::CString;
}
#[no_mangle]
-pub unsafe extern "C" fn rs_ntp_parse_request(_flow: *const core::Flow,
+pub unsafe extern "C" fn rs_ntp_parse_request(_flow: *const Flow,
state: *mut std::os::raw::c_void,
_pstate: *mut std::os::raw::c_void,
stream_slice: StreamSlice,
}
#[no_mangle]
-pub unsafe extern "C" fn rs_ntp_parse_response(_flow: *const core::Flow,
+pub unsafe extern "C" fn rs_ntp_parse_response(_flow: *const Flow,
state: *mut std::os::raw::c_void,
_pstate: *mut std::os::raw::c_void,
stream_slice: StreamSlice,
use super::parser::{self, ConsolidatedDataRowPacket, PgsqlBEMessage, PgsqlFEMessage};
use crate::applayer::*;
use crate::conf::*;
-use crate::core::{AppProto, Direction, Flow, ALPROTO_FAILED, ALPROTO_UNKNOWN, IPPROTO_TCP, *};
+use crate::core::{AppProto, Direction, ALPROTO_FAILED, ALPROTO_UNKNOWN, IPPROTO_TCP, *};
+use crate::flow::Flow;
use nom7::{Err, IResult};
use std;
use std::collections::VecDeque;
frames::{Frame, QuicTlsExtension, StreamTag},
parser::{quic_pkt_num, QuicData, QuicHeader, QuicType},
};
-use crate::applayer::{self, *};
-use crate::core::{AppProto, Direction, Flow, ALPROTO_FAILED, ALPROTO_UNKNOWN, IPPROTO_UDP};
+use crate::{applayer::{self, *}, flow::Flow};
+use crate::core::{AppProto, Direction, ALPROTO_FAILED, ALPROTO_UNKNOWN, IPPROTO_UDP};
use std::collections::VecDeque;
use std::ffi::CString;
use tls_parser::TlsExtensionType;
//! RDP application layer
use crate::applayer::{self, *};
-use crate::core::{AppProto, Flow, ALPROTO_UNKNOWN, IPPROTO_TCP};
+use crate::core::{AppProto, ALPROTO_UNKNOWN, IPPROTO_TCP};
+use crate::flow::Flow;
use crate::rdp::parser::*;
use nom7::Err;
use std;
use super::parser;
use crate::applayer;
use crate::applayer::*;
-use crate::core::{AppProto, Flow, ALPROTO_UNKNOWN, IPPROTO_TCP};
+use crate::core::{AppProto, ALPROTO_UNKNOWN, IPPROTO_TCP};
+use crate::flow::Flow;
use crate::frames::*;
use nom7::Err;
use std;
use crate::applayer::{self, *};
use crate::core;
use crate::core::{AppProto, ALPROTO_UNKNOWN, IPPROTO_TCP, IPPROTO_UDP};
+use crate::flow::Flow;
use crate::frames::*;
use crate::sip::parser::*;
use nom7::Err;
}
// app-layer-frame-documentation tag start: parse_request
- fn parse_request(&mut self, flow: *const core::Flow, stream_slice: StreamSlice) -> bool {
+ fn parse_request(&mut self, flow: *const Flow, stream_slice: StreamSlice) -> bool {
let input = stream_slice.as_slice();
let _pdu = Frame::new(
flow,
}
fn parse_request_tcp(
- &mut self, flow: *const core::Flow, stream_slice: StreamSlice,
+ &mut self, flow: *const Flow, stream_slice: StreamSlice,
) -> AppLayerResult {
let input = stream_slice.as_slice();
if input.is_empty() {
return AppLayerResult::ok();
}
- fn parse_response(&mut self, flow: *const core::Flow, stream_slice: StreamSlice) -> bool {
+ fn parse_response(&mut self, flow: *const Flow, stream_slice: StreamSlice) -> bool {
let input = stream_slice.as_slice();
let _pdu = Frame::new(
flow,
}
fn parse_response_tcp(
- &mut self, flow: *const core::Flow, stream_slice: StreamSlice,
+ &mut self, flow: *const Flow, stream_slice: StreamSlice,
) -> AppLayerResult {
let input = stream_slice.as_slice();
if input.is_empty() {
}
// app-layer-frame-documentation tag start: function to add frames
-fn sip_frames_ts(flow: *const core::Flow, stream_slice: &StreamSlice, r: &Request, tx_id: u64) {
+fn sip_frames_ts(flow: *const Flow, stream_slice: &StreamSlice, r: &Request, tx_id: u64) {
let oi = stream_slice.as_slice();
let _f = Frame::new(
flow,
}
// app-layer-frame-documentation tag end: function to add frames
-fn sip_frames_tc(flow: *const core::Flow, stream_slice: &StreamSlice, r: &Response, tx_id: u64) {
+fn sip_frames_tc(flow: *const Flow, stream_slice: &StreamSlice, r: &Response, tx_id: u64) {
let oi = stream_slice.as_slice();
let _f = Frame::new(
flow,
#[no_mangle]
pub unsafe extern "C" fn rs_sip_parse_request(
- flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void,
+ 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 {
let state = cast_pointer!(state, SIPState);
#[no_mangle]
pub unsafe extern "C" fn rs_sip_parse_request_tcp(
- flow: *const core::Flow, state: *mut std::os::raw::c_void, pstate: *mut std::os::raw::c_void,
+ 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 {
if stream_slice.is_empty() {
#[no_mangle]
pub unsafe extern "C" fn rs_sip_parse_response(
- flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void,
+ 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 {
let state = cast_pointer!(state, SIPState);
#[no_mangle]
pub unsafe extern "C" fn rs_sip_parse_response_tcp(
- flow: *const core::Flow, state: *mut std::os::raw::c_void, pstate: *mut std::os::raw::c_void,
+ 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 {
if stream_slice.is_empty() {
use crate::core::*;
use crate::applayer;
use crate::applayer::*;
+use crate::flow::{Flow, FLOW_DIR_REVERSED};
use crate::frames::*;
use crate::conf::*;
use crate::applayer::{AppLayerResult, AppLayerTxData, AppLayerEvent};
// written by Pierre Chifflier <chifflier@wzdftpd.net>
+use crate::flow::Flow;
use crate::snmp::snmp_parser::*;
use crate::core::{self, *};
use crate::applayer::{self, *};
}
#[no_mangle]
-pub unsafe extern "C" fn rs_snmp_parse_request(_flow: *const core::Flow,
+pub unsafe extern "C" fn rs_snmp_parse_request(_flow: *const Flow,
state: *mut std::os::raw::c_void,
_pstate: *mut std::os::raw::c_void,
stream_slice: StreamSlice,
}
#[no_mangle]
-pub unsafe extern "C" fn rs_snmp_parse_response(_flow: *const core::Flow,
+pub unsafe extern "C" fn rs_snmp_parse_response(_flow: *const Flow,
state: *mut std::os::raw::c_void,
_pstate: *mut std::os::raw::c_void,
stream_slice: StreamSlice,
use super::parser;
use crate::applayer::*;
use crate::core::*;
+use crate::flow::Flow;
use nom7::Err;
use std::ffi::CString;
use std::sync::atomic::{AtomicBool, Ordering};
*/
use std;
-use crate::core::{ALPROTO_UNKNOWN, AppProto, Flow, IPPROTO_TCP};
+use crate::core::{ALPROTO_UNKNOWN, AppProto, IPPROTO_TCP};
use crate::applayer::{self, *};
+use crate::flow::Flow;
use crate::frames::*;
use std::ffi::CString;
use nom7::IResult;
use super::parser;
use crate::applayer::{self, *};
use crate::conf::conf_get;
-use crate::core::{AppProto, Direction, Flow, ALPROTO_FAILED, ALPROTO_UNKNOWN, IPPROTO_TCP};
+use crate::core::{AppProto, Direction, ALPROTO_FAILED, ALPROTO_UNKNOWN, IPPROTO_TCP};
+use crate::flow::Flow;
use crate::frames::Frame;
use nom7 as nom;