Skip to main content

ParsedPacket

Struct ParsedPacket 

Source
pub struct ParsedPacket {
Show 13 fields pub protocol: Protocol, pub local_addr: SocketAddr, pub remote_addr: SocketAddr, pub local_addr_kind: AddrKind, pub remote_addr_kind: AddrKind, pub remote_is_gateway: bool, pub tcp_header: Option<TcpHeaderInfo>, pub protocol_state: ProtocolState, pub is_outgoing: bool, pub packet_len: usize, pub dpi_result: Option<DpiResult>, pub process_name: Option<String>, pub process_id: Option<u32>,
}
Expand description

Result of parsing a packet

Fields§

§protocol: Protocol§local_addr: SocketAddr§remote_addr: SocketAddr§local_addr_kind: AddrKind

Endpoint address kinds, stamped centrally in PacketParser::parse_packet (subnet-broadcast detection needs the parser’s interface snapshot).

§remote_addr_kind: AddrKind§remote_is_gateway: bool

Whether the remote endpoint is a default-gateway address, stamped centrally alongside the address kinds from the parser’s route snapshot.

§tcp_header: Option<TcpHeaderInfo>§protocol_state: ProtocolState§is_outgoing: bool§packet_len: usize§dpi_result: Option<DpiResult>§process_name: Option<String>§process_id: Option<u32>

Implementations§

Source§

impl ParsedPacket

Source

pub fn new( protocol: Protocol, local_addr: SocketAddr, remote_addr: SocketAddr, protocol_state: ProtocolState, is_outgoing: bool, packet_len: usize, process_name: Option<String>, process_id: Option<u32>, ) -> Self

Packet with the given flow fields and process attribution. The address kinds and gateway flag start at their unicast/false defaults (they are overwritten centrally in PacketParser::parse_packet), and tcp_header/dpi_result start as None for the caller to fill in where applicable.

Source

pub fn connection_key(&self) -> ConnectionKey

The flow identity this packet belongs to, derived from protocol and addresses. ConnectionKey is Copy, so this costs nothing on the per-packet path (no allocation, unlike the former String key field).

Trait Implementations§

Source§

impl Debug for ParsedPacket

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.