Struct pnet::packet::ipv4::MutableIpv4Packet
[−]
pub struct MutableIpv4Packet<'p> {
// some fields omitted
}A structure enabling manipulation of on the wire packets
Methods
impl<'a> MutableIpv4Packet<'a>
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 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: Vec<Ipv4Option>)
Set the value of the options field (copies contents)
fn set_payload(&mut self, vals: Vec<u8>)
Set the value of the payload field (copies contents)