Struct pnet::packet::ipv4::Ipv4Packet
[−]
[src]
pub struct Ipv4Packet<'p> { /* fields omitted */ }
A structure enabling manipulation of on the wire packets
Methods
impl<'a> Ipv4Packet<'a>
[src]
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 owned(packet: Vec<u8>) -> Option<Ipv4Packet<'static>>
Constructs a new Ipv4Packet. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the Ipv4Packet will own its own data and the underlying buffer will be dropped when the Ipv4Packet is.
fn to_immutable<'p>(&'p self) -> Ipv4Packet<'p>
Maps from a Ipv4Packet to a Ipv4Packet
fn consume_to_immutable(self) -> Ipv4Packet<'a>
Maps from a Ipv4Packet to a Ipv4Packet while consuming the source
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)
fn get_options_iter(&self) -> Ipv4OptionIterable
Get the value of the options field as iterator
Trait Implementations
impl<'p> PartialEq for Ipv4Packet<'p>
[src]
fn eq(&self, __arg_0: &Ipv4Packet<'p>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Ipv4Packet<'p>) -> bool
This method tests for !=
.
impl<'a> PacketSize for Ipv4Packet<'a>
[src]
fn packet_size(&self) -> usize
Get the calculated size of the packet
impl<'a> Packet for Ipv4Packet<'a>
[src]
fn packet<'p>(&'p self) -> &'p [u8]
Retreive the underlying buffer for the packet
fn payload<'p>(&'p self) -> &'p [u8]
Retreive the payload for the packet
impl<'p> FromPacket for Ipv4Packet<'p>
[src]
type T = Ipv4
The type of the packet to convert from
fn from_packet(&self) -> Ipv4
Converts a wire-format packet to #[packet] struct format