Struct t2plugin::nethdr::Packet [] [src]

#[repr(C)]
pub struct Packet { pub l2_hdr_len: u16, pub l3_hdr_len: u16, pub l4_hdr_len: u16, pub snap_l2_len: u16, pub snap_l3_len: u16, pub snap_l4_len: u16, pub snap_l7_len: u16, pub packet_l2_len: u16, pub packet_raw_len: u16, pub packet_len: u16, pub src_port: u16, pub dst_port: u16, pub inner_vlan: u16, pub l2_type: u16, pub status: u64, // some fields omitted }

Represents a packet with its different headers and associated lengths.

Fields

Length of the layer 2 header (Ethernet, ...).

Length of the layer 3 header (IPv4, IPv6, ...).

Length of the layer 4 header (TCP, UDP, ICMP, ...).

Packet snapped length starting from layer 2.

Packet snapped length starting from layer 3.

Packet snapped length starting from layer 4.

Packet snapped length starting from layer 7.

On wire packet length starting from layer2.

On wire full packet length (from the per-packet PCAP header).

Packet length depending on Tranalyzer2 PACKETLENGTH value, see networkHeaders.h for details.

Source port in host order.

Destination port in host order.

Inner VLAN ID

Type of the layer 2 header.

Per packet status bits.

Methods

impl Packet
[src]

Timestamp of when the packet was captured (as the number of seconds since 1970-01-01).

Returns an EthernetHeader if the packet contains an Ethernet header and is long enough. Returns None otherwise.

Returns an Ip4Header if the packet contains an IPv4 header and is long enough. Returns None otherwise.

Returns an Ip4Header if the packet contains an IPv6 header and is long enough. Returns None otherwise.

Returns an TcpHeader if the packet contains a TCP header and is long enough. Returns None otherwise.

Returns an UdpHeader if the packet contains a UDP header and is long enough. Returns None otherwise.

Returns an IcmpHeader if the packet contains an ICMP header and is long enough. Returns None otherwise.

Returns the layer 7 as a slice of bytes.

This is how the layer 7 is typically accessed in content processing plugins.

Returns the layer 2 header as a slice of bytes.

Returns the layer 3 header as a slice of bytes.

This function can be used to access the IP options as a Rust inferface is not yet implemented for IPv4 options and IPv6 extension headers.

Returns the layer 4 header as a slice of bytes.

This function can be used to access TCP options as a Rust interface is not yet implemented.

Type of the layer 3 header as defined in L3Type.

Type of the layer 4 header as defined in L4Type.