pub struct MutableEthernetPacket<'p> { /* private fields */ }
Expand description
A structure enabling manipulation of on the wire packets
Implementations§
Source§impl<'a> MutableEthernetPacket<'a>
impl<'a> MutableEthernetPacket<'a>
Sourcepub fn new<'p>(packet: &'p mut [u8]) -> Option<MutableEthernetPacket<'p>>
pub fn new<'p>(packet: &'p mut [u8]) -> Option<MutableEthernetPacket<'p>>
Constructs a new #name. If the provided buffer is less than the minimum required packet size, this will return None.
Sourcepub fn owned(packet: Vec<u8>) -> Option<MutableEthernetPacket<'static>>
pub fn owned(packet: Vec<u8>) -> Option<MutableEthernetPacket<'static>>
Constructs a new #name. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the #name will own its own data and the underlying buffer will be dropped when the #name is.
Sourcepub fn to_immutable<'p>(&'p self) -> EthernetPacket<'p>
pub fn to_immutable<'p>(&'p self) -> EthernetPacket<'p>
Maps from a #name to a #imm_name
Sourcepub fn consume_to_immutable(self) -> EthernetPacket<'a>
pub fn consume_to_immutable(self) -> EthernetPacket<'a>
Maps from a #name to a #imm_name while consuming the source
Sourcepub const fn minimum_packet_size() -> usize
pub const 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.
Sourcepub fn packet_size(_packet: &Ethernet) -> usize
pub fn packet_size(_packet: &Ethernet) -> usize
The size (in bytes) of a #base_name instance when converted into a byte-array
Sourcepub fn populate(&mut self, packet: &Ethernet)
pub fn populate(&mut self, packet: &Ethernet)
Populates a {name}Packet using a {name} structure
Sourcepub fn get_destination(&self) -> MacAddr
pub fn get_destination(&self) -> MacAddr
Get the value of the {name} field
Sourcepub fn get_source(&self) -> MacAddr
pub fn get_source(&self) -> MacAddr
Get the value of the {name} field
Sourcepub fn get_ethertype(&self) -> EtherType
pub fn get_ethertype(&self) -> EtherType
Get the value of the {name} field
Sourcepub fn get_payload(&self) -> Vec<u8> ⓘ
pub fn get_payload(&self) -> Vec<u8> ⓘ
Get the value of the {name} field (copies contents)
Sourcepub fn set_destination(&mut self, val: MacAddr)
pub fn set_destination(&mut self, val: MacAddr)
Set the value of the {name} field.
Sourcepub fn set_source(&mut self, val: MacAddr)
pub fn set_source(&mut self, val: MacAddr)
Set the value of the {name} field.
Sourcepub fn set_ethertype(&mut self, val: EtherType)
pub fn set_ethertype(&mut self, val: EtherType)
Set the value of the {name} field.
Sourcepub fn set_payload(&mut self, vals: &[u8])
pub fn set_payload(&mut self, vals: &[u8])
Set the value of the {name} field (copies contents)