Struct pnet::packet::icmp::destination_unreachable::MutableDestinationUnreachablePacket
[−]
[src]
pub struct MutableDestinationUnreachablePacket<'p> { /* fields omitted */ }
A structure enabling manipulation of on the wire packets
Methods
impl<'a> MutableDestinationUnreachablePacket<'a>
[src]
fn new<'p>(packet: &'p mut [u8])
-> Option<MutableDestinationUnreachablePacket<'p>>
-> Option<MutableDestinationUnreachablePacket<'p>>
Constructs a new MutableDestinationUnreachablePacket. If the provided buffer is less than the minimum required packet size, this will return None.
fn owned(packet: Vec<u8>)
-> Option<MutableDestinationUnreachablePacket<'static>>
-> Option<MutableDestinationUnreachablePacket<'static>>
Constructs a new MutableDestinationUnreachablePacket. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the MutableDestinationUnreachablePacket will own its own data and the underlying buffer will be dropped when the MutableDestinationUnreachablePacket is.
fn to_immutable<'p>(&'p self) -> DestinationUnreachablePacket<'p>
Maps from a MutableDestinationUnreachablePacket to a DestinationUnreachablePacket
fn consume_to_immutable(self) -> DestinationUnreachablePacket<'a>
Maps from a MutableDestinationUnreachablePacket to a DestinationUnreachablePacket 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: &DestinationUnreachable) -> usize
The size (in bytes) of a DestinationUnreachable instance when converted into a byte-array
fn populate(&mut self, packet: &DestinationUnreachable)
Populates a DestinationUnreachablePacket using a DestinationUnreachable structure
fn get_icmp_type(&self) -> IcmpType
Get the value of the icmp_type field
fn get_icmp_code(&self) -> IcmpCode
Get the value of the icmp_code field
fn get_checksum(&self) -> u16be
Get the checksum field
fn get_unused(&self) -> u32be
Get the unused field
fn set_icmp_type(&mut self, val: IcmpType)
Set the value of the icmp_type field
fn set_icmp_code(&mut self, val: IcmpCode)
Set the value of the icmp_code field
fn set_checksum(&mut self, val: u16be)
Set the checksum field
fn set_unused(&mut self, val: u32be)
Set the unused field
fn set_payload(&mut self, vals: &[u8])
Set the value of the payload field (copies contents)
Trait Implementations
impl<'p> PartialEq for MutableDestinationUnreachablePacket<'p>
[src]
fn eq(&self, __arg_0: &MutableDestinationUnreachablePacket<'p>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &MutableDestinationUnreachablePacket<'p>) -> bool
This method tests for !=
.
impl<'a> PacketSize for MutableDestinationUnreachablePacket<'a>
[src]
fn packet_size(&self) -> usize
Get the calculated size of the packet
impl<'a> MutablePacket for MutableDestinationUnreachablePacket<'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 MutableDestinationUnreachablePacket<'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 MutableDestinationUnreachablePacket<'p>
[src]
type T = DestinationUnreachable
The type of the packet to convert from
fn from_packet(&self) -> DestinationUnreachable
Converts a wire-format packet to #[packet] struct format