Skip to main content

rustnet_core/network/protocol/
mod.rs

1//! Transport layer protocol parsing
2//!
3//! This module handles transport layer protocols (Layer 4 of the OSI model):
4//! - TCP (Transmission Control Protocol)
5//! - UDP (User Datagram Protocol)
6//! - ICMP (Internet Control Message Protocol)
7//! - ICMPv6 (Internet Control Message Protocol for IPv6)
8//! - IGMP (Internet Group Management Protocol)
9
10pub mod icmp;
11pub mod igmp;
12pub mod tcp;
13pub mod udp;
14
15use std::net::IpAddr;
16
17/// Common parameters for transport layer parsing
18/// Note: Direction (is_outgoing) is determined by the protocol parsers
19/// based on local_ips, not passed as a parameter
20#[derive(Clone)]
21pub struct TransportParams {
22    pub src_ip: IpAddr,
23    pub dst_ip: IpAddr,
24    pub packet_len: usize,
25    pub process_name: Option<String>,
26    pub process_id: Option<u32>,
27}
28
29impl TransportParams {
30    pub fn new(
31        src_ip: IpAddr,
32        dst_ip: IpAddr,
33        packet_len: usize,
34        process_name: Option<String>,
35        process_id: Option<u32>,
36    ) -> Self {
37        Self {
38            src_ip,
39            dst_ip,
40            packet_len,
41            process_name,
42            process_id,
43        }
44    }
45}