Struct pnet::packet::ipv4::Ipv4Packet
[−]
pub struct Ipv4Packet<'p> {
// some fields omitted
}A structure enabling manipulation of on the wire packets
Methods
impl<'a> Ipv4Packet<'a>
fn new<'p>(packet: &'p [u8]) -> Option<Ipv4Packet<'p>>
Constructs a new Ipv4Packet. If the provided buffer is less than the minimum required packet size, this will return None.
fn to_immutable<'p>(&'p self) -> Ipv4Packet<'p>
Maps from a Ipv4Packet to a Ipv4Packet
fn minimum_packet_size() -> usize
The minimum size (in bytes) a packet of this type can be. It's based on the total size of the fixed-size fields.
fn packet_size(_packet: &Ipv4) -> usize
The size (in bytes) of a Ipv4 instance when converted into a byte-array
fn get_version(&self) -> u4
Get the version field
fn get_header_length(&self) -> u4
Get the header_length field
fn get_dscp(&self) -> u6
Get the dscp field
fn get_ecn(&self) -> u2
Get the ecn field
fn get_total_length(&self) -> u16be
Get the total_length field
fn get_identification(&self) -> u16be
Get the identification field
fn get_flags(&self) -> u3
Get the flags field
fn get_fragment_offset(&self) -> u13be
Get the fragment_offset field
fn get_ttl(&self) -> u8
Get the ttl field
fn get_next_level_protocol(&self) -> IpNextHeaderProtocol
Get the value of the next_level_protocol field
fn get_checksum(&self) -> u16be
Get the checksum field
fn get_source(&self) -> Ipv4Addr
Get the value of the source field
fn get_destination(&self) -> Ipv4Addr
Get the value of the destination field
fn get_options_raw(&self) -> &[u8]
Get the raw &[u8] value of the options field, without copying
fn get_options(&self) -> Vec<Ipv4Option>
Get the value of the options field (copies contents)