Struct pnet::packet::ipv4::MutableIpv4Packet
[−]
[src]
pub struct MutableIpv4Packet<'p> { // some fields omitted }
A structure enabling manipulation of on the wire packets
Methods
impl<'a> MutableIpv4Packet<'a>
[src]
fn new<'p>(packet: &'p mut [u8]) -> Option<MutableIpv4Packet<'p>>
Constructs a new MutableIpv4Packet. 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 MutableIpv4Packet 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 populate(&mut self, packet: &Ipv4)
Populates a Ipv4Packet using a Ipv4 structure
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
fn set_version(&mut self, val: u4)
Set the version field
fn set_header_length(&mut self, val: u4)
Set the header_length field
fn set_dscp(&mut self, val: u6)
Set the dscp field
fn set_ecn(&mut self, val: u2)
Set the ecn field
fn set_total_length(&mut self, val: u16be)
Set the total_length field
fn set_identification(&mut self, val: u16be)
Set the identification field
fn set_flags(&mut self, val: u3)
Set the flags field
fn set_fragment_offset(&mut self, val: u13be)
Set the fragment_offset field
fn set_ttl(&mut self, val: u8)
Set the ttl field
fn set_next_level_protocol(&mut self, val: IpNextHeaderProtocol)
Set the value of the next_level_protocol field
fn set_checksum(&mut self, val: u16be)
Set the checksum field
fn set_source(&mut self, val: Ipv4Addr)
Set the value of the source field
fn set_destination(&mut self, val: Ipv4Addr)
Set the value of the destination field
fn get_options_raw_mut(&mut self) -> &mut [u8]
Get the raw &mut [u8] value of the options field, without copying
fn set_options(&mut self, vals: &[Ipv4Option])
Set the value of the options field (copies contents)
fn set_payload(&mut self, vals: &[u8])
Set the value of the payload field (copies contents)
Trait Implementations
impl<'a> PacketSize for MutableIpv4Packet<'a>
[src]
fn packet_size(&self) -> usize
Get the calculated size of the packet
impl<'a> MutablePacket for MutableIpv4Packet<'a>
[src]
fn packet_mut<'p>(&'p mut self) -> &'p mut [u8]
Retreive the underlying, mutable, buffer for the packet
fn payload_mut<'p>(&'p mut self) -> &'p mut [u8]
Retreive the mutable payload for the packet
fn clone_from<T: Packet>(&mut self, other: &T)
Initialize this packet by cloning another
impl<'a> Packet for MutableIpv4Packet<'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 MutableIpv4Packet<'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
impl<'p> Debug for MutableIpv4Packet<'p>
[src]
Derived Implementations
impl<'p> PartialEq for MutableIpv4Packet<'p>
[src]
fn eq(&self, __arg_0: &MutableIpv4Packet<'p>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &MutableIpv4Packet<'p>) -> bool
This method tests for !=
.