Struct pnet::packet::gre::MutableGrePacket
[−]
[src]
pub struct MutableGrePacket<'p> { /* fields omitted */ }
A structure enabling manipulation of on the wire packets
Methods
impl<'a> MutableGrePacket<'a>
[src]
fn new<'p>(packet: &'p mut [u8]) -> Option<MutableGrePacket<'p>>
Constructs a new MutableGrePacket. If the provided buffer is less than the minimum required packet size, this will return None.
fn owned(packet: Vec<u8>) -> Option<MutableGrePacket<'static>>
Constructs a new MutableGrePacket. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the MutableGrePacket will own its own data and the underlying buffer will be dropped when the MutableGrePacket is.
fn to_immutable<'p>(&'p self) -> GrePacket<'p>
Maps from a MutableGrePacket to a GrePacket
fn consume_to_immutable(self) -> GrePacket<'a>
Maps from a MutableGrePacket to a GrePacket 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: &Gre) -> usize
The size (in bytes) of a Gre instance when converted into a byte-array
fn populate(&mut self, packet: &Gre)
Populates a GrePacket using a Gre structure
fn get_checksum_present(&self) -> u1
Get the checksum_present field
fn get_routing_present(&self) -> u1
Get the routing_present field
fn get_key_present(&self) -> u1
Get the key_present field
fn get_sequence_present(&self) -> u1
Get the sequence_present field
fn get_strict_source_route(&self) -> u1
Get the strict_source_route field
fn get_recursion_control(&self) -> u3
Get the recursion_control field
fn get_zero_flags(&self) -> u5
Get the zero_flags field
fn get_version(&self) -> u3
Get the version field
fn get_protocol_type(&self) -> u16be
Get the protocol_type field
fn get_checksum_raw(&self) -> &[u8]
Get the raw &[u8] value of the checksum field, without copying
fn get_checksum(&self) -> Vec<U16BE>
Get the value of the checksum field (copies contents)
fn get_checksum_iter(&self) -> U16BEIterable
Get the value of the checksum field as iterator
fn get_offset_raw(&self) -> &[u8]
Get the raw &[u8] value of the offset field, without copying
fn get_offset(&self) -> Vec<U16BE>
Get the value of the offset field (copies contents)
fn get_offset_iter(&self) -> U16BEIterable
Get the value of the offset field as iterator
fn get_key_raw(&self) -> &[u8]
Get the raw &[u8] value of the key field, without copying
fn get_key(&self) -> Vec<U32BE>
Get the value of the key field (copies contents)
fn get_key_iter(&self) -> U32BEIterable
Get the value of the key field as iterator
fn get_sequence_raw(&self) -> &[u8]
Get the raw &[u8] value of the sequence field, without copying
fn get_sequence(&self) -> Vec<U32BE>
Get the value of the sequence field (copies contents)
fn get_sequence_iter(&self) -> U32BEIterable
Get the value of the sequence field as iterator
fn get_routing_raw(&self) -> &[u8]
Get the raw &[u8] value of the routing field, without copying
fn get_routing(&self) -> Vec<u8>
Get the value of the routing field (copies contents)
fn set_checksum_present(&mut self, val: u1)
Set the checksum_present field
fn set_routing_present(&mut self, val: u1)
Set the routing_present field
fn set_key_present(&mut self, val: u1)
Set the key_present field
fn set_sequence_present(&mut self, val: u1)
Set the sequence_present field
fn set_strict_source_route(&mut self, val: u1)
Set the strict_source_route field
fn set_recursion_control(&mut self, val: u3)
Set the recursion_control field
fn set_zero_flags(&mut self, val: u5)
Set the zero_flags field
fn set_version(&mut self, val: u3)
Set the version field
fn set_protocol_type(&mut self, val: u16be)
Set the protocol_type field
fn get_checksum_raw_mut(&mut self) -> &mut [u8]
Get the raw &mut [u8] value of the checksum field, without copying
fn set_checksum(&mut self, vals: &[U16BE])
Set the value of the checksum field (copies contents)
fn get_offset_raw_mut(&mut self) -> &mut [u8]
Get the raw &mut [u8] value of the offset field, without copying
fn set_offset(&mut self, vals: &[U16BE])
Set the value of the offset field (copies contents)
fn get_key_raw_mut(&mut self) -> &mut [u8]
Get the raw &mut [u8] value of the key field, without copying
fn set_key(&mut self, vals: &[U32BE])
Set the value of the key field (copies contents)
fn get_sequence_raw_mut(&mut self) -> &mut [u8]
Get the raw &mut [u8] value of the sequence field, without copying
fn set_sequence(&mut self, vals: &[U32BE])
Set the value of the sequence field (copies contents)
fn get_routing_raw_mut(&mut self) -> &mut [u8]
Get the raw &mut [u8] value of the routing field, without copying
fn set_routing(&mut self, vals: &[u8])
Set the value of the routing field (copies contents)
fn set_payload(&mut self, vals: &[u8])
Set the value of the payload field (copies contents)
Trait Implementations
impl<'p> PartialEq for MutableGrePacket<'p>
[src]
fn eq(&self, __arg_0: &MutableGrePacket<'p>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &MutableGrePacket<'p>) -> bool
This method tests for !=
.
impl<'a> PacketSize for MutableGrePacket<'a>
[src]
fn packet_size(&self) -> usize
Get the calculated size of the packet
impl<'a> MutablePacket for MutableGrePacket<'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 MutableGrePacket<'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 MutableGrePacket<'p>
[src]
type T = Gre
The type of the packet to convert from
fn from_packet(&self) -> Gre
Converts a wire-format packet to #[packet] struct format