pub struct NetworkPacketEvent {
pub direction: Option<i32>,
pub interface: Option<String>,
pub length: Option<u32>,
pub uid: Option<u32>,
pub tag: Option<u32>,
pub ip_proto: Option<u32>,
pub tcp_flags: Option<u32>,
pub local_port: Option<u32>,
pub remote_port: Option<u32>,
pub icmp_type: Option<u32>,
pub icmp_code: Option<u32>,
}
Expand description
NetworkPacketEvent records the details of a single packet sent or received on the network (in Linux kernel terminology, one sk_buff struct).
Fields§
§direction: Option<i32>
The direction traffic is flowing for this event.
interface: Option<String>
The name of the interface if available (e.g. ‘rmnet0’).
length: Option<u32>
The length of the packet in bytes (wire_size - L2_header_size). Ignored when using NetworkPacketEvent as the ctx in either NetworkPacketBundle or NetworkPacketContext.
uid: Option<u32>
The Linux user id associated with the packet’s socket.
tag: Option<u32>
The Android network tag associated with the packet’s socket.
ip_proto: Option<u32>
The packet’s IP protocol (TCP=6, UDP=17, etc).
tcp_flags: Option<u32>
The packet’s TCP flags as a bitmask (FIN=0x1, SYN=0x2, RST=0x4, etc).
local_port: Option<u32>
The local udp/tcp port of the packet.
remote_port: Option<u32>
The remote udp/tcp port of the packet.
icmp_type: Option<u32>
The 1-byte ICMP type identifier.
icmp_code: Option<u32>
The 1-byte ICMP code identifier.
Implementations§
Source§impl NetworkPacketEvent
impl NetworkPacketEvent
Sourcepub fn direction(&self) -> TrafficDirection
pub fn direction(&self) -> TrafficDirection
Returns the enum value of direction
, or the default if the field is unset or set to an invalid enum value.
Sourcepub fn set_direction(&mut self, value: TrafficDirection)
pub fn set_direction(&mut self, value: TrafficDirection)
Sets direction
to the provided enum value.
Sourcepub fn interface(&self) -> &str
pub fn interface(&self) -> &str
Returns the value of interface
, or the default value if interface
is unset.
Sourcepub fn length(&self) -> u32
pub fn length(&self) -> u32
Returns the value of length
, or the default value if length
is unset.
Sourcepub fn ip_proto(&self) -> u32
pub fn ip_proto(&self) -> u32
Returns the value of ip_proto
, or the default value if ip_proto
is unset.
Sourcepub fn tcp_flags(&self) -> u32
pub fn tcp_flags(&self) -> u32
Returns the value of tcp_flags
, or the default value if tcp_flags
is unset.
Sourcepub fn local_port(&self) -> u32
pub fn local_port(&self) -> u32
Returns the value of local_port
, or the default value if local_port
is unset.
Sourcepub fn remote_port(&self) -> u32
pub fn remote_port(&self) -> u32
Returns the value of remote_port
, or the default value if remote_port
is unset.
Trait Implementations§
Source§impl Clone for NetworkPacketEvent
impl Clone for NetworkPacketEvent
Source§fn clone(&self) -> NetworkPacketEvent
fn clone(&self) -> NetworkPacketEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for NetworkPacketEvent
impl Debug for NetworkPacketEvent
Source§impl Default for NetworkPacketEvent
impl Default for NetworkPacketEvent
Source§impl Message for NetworkPacketEvent
impl Message for NetworkPacketEvent
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
Source§fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
Source§fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
Source§fn decode<B>(buf: B) -> Result<Self, DecodeError>
fn decode<B>(buf: B) -> Result<Self, DecodeError>
Source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
Source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
self
. Read moreSource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
self
.