pub struct Message { /* private fields */ }Expand description
Opaque struct Message: abstracts NFLOG data representing a packet data and metadata
Implementations§
Source§impl Message
impl Message
Sourcepub fn get_msg_packet_hdr(&self) -> NfMsgPacketHdr
pub fn get_msg_packet_hdr(&self) -> NfMsgPacketHdr
Return the metaheader that wraps the packet
Sourcepub fn get_hwtype(&self) -> u16
pub fn get_hwtype(&self) -> u16
Get the hardware link layer type from logging data
Sourcepub fn get_packet_hwhdr<'a>(&'a self) -> &'a [u8] ⓘ
pub fn get_packet_hwhdr<'a>(&'a self) -> &'a [u8] ⓘ
Get the hardware link layer header
Sourcepub fn get_nfmark(&self) -> u32
pub fn get_nfmark(&self) -> u32
Get the packet mark
Sourcepub fn get_timestamp(&self) -> Result<timeval, NflogError>
pub fn get_timestamp(&self) -> Result<timeval, NflogError>
Get the packet timestamp
Sourcepub fn get_indev(&self) -> u32
pub fn get_indev(&self) -> u32
Get the interface that the packet was received through
Returns the index of the device the packet was received via.
If the returned index is 0, the packet was locally generated or the
input interface is not known (ie. POSTROUTING?).
Sourcepub fn get_physindev(&self) -> u32
pub fn get_physindev(&self) -> u32
Get the physical interface that the packet was received through
Returns the index of the physical device the packet was received via.
If the returned index is 0, the packet was locally generated or the
physical input interface is no longer known (ie. POSTROUTING?).
Sourcepub fn get_outdev(&self) -> u32
pub fn get_outdev(&self) -> u32
Get the interface that the packet will be routed out
Returns the index of the device the packet will be sent out.
If the returned index is 0, the packet is destined to localhost or
the output interface is not yet known (ie. PREROUTING?).
Sourcepub fn get_physoutdev(&self) -> u32
pub fn get_physoutdev(&self) -> u32
Get the physical interface that the packet will be routed out
Returns the index of the physical device the packet will be sent out.
If the returned index is 0, the packet is destined to localhost or
the physical output interface is not yet known (ie. PREROUTING?).
Sourcepub fn get_packet_hw<'a>(&'a self) -> Result<HwAddr<'a>, NflogError>
pub fn get_packet_hw<'a>(&'a self) -> Result<HwAddr<'a>, NflogError>
Get hardware address
Retrieves the hardware address associated with the given packet.
For ethernet packets, the hardware address returned (if any) will be the MAC address of the packet source host.
The destination MAC address is not known until after POSTROUTING and a successful ARP request, so cannot currently be retrieved.
Sourcepub fn get_payload<'a>(&'a self) -> &'a [u8] ⓘ
pub fn get_payload<'a>(&'a self) -> &'a [u8] ⓘ
Get payload
Depending on set_mode, we may not have a payload
The actual amount and type of data retrieved by this function will
depend on the mode set with the set_mode() function.
Sourcepub fn get_prefix(&self) -> Result<String, Utf8Error>
pub fn get_prefix(&self) -> Result<String, Utf8Error>
Return the log prefix as configured using --nflog-prefix "..."
in iptables rules.
Sourcepub fn get_gid(&self) -> Result<u32, NflogError>
pub fn get_gid(&self) -> Result<u32, NflogError>
Available only for outgoing packets
Sourcepub fn get_seq(&self) -> Result<u32, NflogError>
pub fn get_seq(&self) -> Result<u32, NflogError>
Get the local nflog sequence number
You must enable this via set_flags(nflog::CfgFlags::CfgFlagsSeq).
Sourcepub fn get_seq_global(&self) -> Result<u32, NflogError>
pub fn get_seq_global(&self) -> Result<u32, NflogError>
Get the global nflog sequence number
You must enable this via set_flags(nflog::CfgFlags::CfgFlagsSeqGlobal).
Sourcepub fn as_xml_str(&self, flags: &[XMLFormatFlags]) -> Result<String, Utf8Error>
pub fn as_xml_str(&self, flags: &[XMLFormatFlags]) -> Result<String, Utf8Error>
Print the logged packet in XML format into a buffer