pub struct MutableVrrpPacket<'p> { /* private fields */ }
Expand description
A structure enabling manipulation of on the wire packets
Implementations§
Source§impl<'a> MutableVrrpPacket<'a>
impl<'a> MutableVrrpPacket<'a>
Sourcepub fn new<'p>(packet: &'p mut [u8]) -> Option<MutableVrrpPacket<'p>>
pub fn new<'p>(packet: &'p mut [u8]) -> Option<MutableVrrpPacket<'p>>
Constructs a new MutableVrrpPacket. If the provided buffer is less than the minimum required packet size, this will return None.
Sourcepub fn owned(packet: Vec<u8>) -> Option<MutableVrrpPacket<'static>>
pub fn owned(packet: Vec<u8>) -> Option<MutableVrrpPacket<'static>>
Constructs a new MutableVrrpPacket. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the MutableVrrpPacket will own its own data and the underlying buffer will be dropped when the MutableVrrpPacket is.
Sourcepub fn to_immutable<'p>(&'p self) -> VrrpPacket<'p>
pub fn to_immutable<'p>(&'p self) -> VrrpPacket<'p>
Maps from a MutableVrrpPacket to a VrrpPacket
Sourcepub fn consume_to_immutable(self) -> VrrpPacket<'a>
pub fn consume_to_immutable(self) -> VrrpPacket<'a>
Maps from a MutableVrrpPacket to a VrrpPacket 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: &Vrrp) -> usize
pub fn packet_size(_packet: &Vrrp) -> usize
The size (in bytes) of a Vrrp instance when converted into a byte-array
Sourcepub fn get_version(&self) -> u4
pub fn get_version(&self) -> u4
Get the version field.
Sourcepub fn get_header_type(&self) -> u4
pub fn get_header_type(&self) -> u4
Get the header_type field.
Sourcepub fn get_priority(&self) -> u8
pub fn get_priority(&self) -> u8
Get the priority field.
Sourcepub fn get_count_ip(&self) -> u8
pub fn get_count_ip(&self) -> u8
Get the count_ip field.
Sourcepub fn get_auth_type(&self) -> u8
pub fn get_auth_type(&self) -> u8
Get the auth_type field.
Sourcepub fn get_advert_int(&self) -> u8
pub fn get_advert_int(&self) -> u8
Get the advert_int field.
Sourcepub fn get_checksum(&self) -> u16be
pub fn get_checksum(&self) -> u16be
Get the checksum field. This field is always stored big-endian within the struct, but this accessor returns host order.
Sourcepub fn get_ip_addresses_raw(&self) -> &[u8] ⓘ
pub fn get_ip_addresses_raw(&self) -> &[u8] ⓘ
Get the raw &u8 value of the ip_addresses field, without copying
Sourcepub fn get_ip_addresses(&self) -> Vec<u8> ⓘ
pub fn get_ip_addresses(&self) -> Vec<u8> ⓘ
Get the value of the ip_addresses field (copies contents)
Sourcepub fn get_auth_data(&self) -> u32be
pub fn get_auth_data(&self) -> u32be
Get the auth_data field. This field is always stored big-endian within the struct, but this accessor returns host order.
Sourcepub fn get_auth_data2(&self) -> u32be
pub fn get_auth_data2(&self) -> u32be
Get the auth_data2 field. This field is always stored big-endian within the struct, but this accessor returns host order.
Sourcepub fn set_version(&mut self, val: u4)
pub fn set_version(&mut self, val: u4)
Set the version field.
Sourcepub fn set_header_type(&mut self, val: u4)
pub fn set_header_type(&mut self, val: u4)
Set the header_type field.
Sourcepub fn set_priority(&mut self, val: u8)
pub fn set_priority(&mut self, val: u8)
Set the priority field.
Sourcepub fn set_count_ip(&mut self, val: u8)
pub fn set_count_ip(&mut self, val: u8)
Set the count_ip field.
Sourcepub fn set_auth_type(&mut self, val: u8)
pub fn set_auth_type(&mut self, val: u8)
Set the auth_type field.
Sourcepub fn set_advert_int(&mut self, val: u8)
pub fn set_advert_int(&mut self, val: u8)
Set the advert_int field.
Sourcepub fn set_checksum(&mut self, val: u16be)
pub fn set_checksum(&mut self, val: u16be)
Set the checksum field. This field is always stored big-endian within the struct, but this mutator wants host order.
Sourcepub fn get_ip_addresses_raw_mut(&mut self) -> &mut [u8] ⓘ
pub fn get_ip_addresses_raw_mut(&mut self) -> &mut [u8] ⓘ
Get the raw &mut u8 value of the ip_addresses field, without copying
Sourcepub fn set_ip_addresses(&mut self, vals: &[u8])
pub fn set_ip_addresses(&mut self, vals: &[u8])
Set the value of the ip_addresses field (copies contents)
Sourcepub fn set_auth_data(&mut self, val: u32be)
pub fn set_auth_data(&mut self, val: u32be)
Set the auth_data field. This field is always stored big-endian within the struct, but this mutator wants host order.
Sourcepub fn set_auth_data2(&mut self, val: u32be)
pub fn set_auth_data2(&mut self, val: u32be)
Set the auth_data2 field. This field is always stored big-endian within the struct, but this mutator wants host order.
Sourcepub fn set_payload(&mut self, vals: &[u8])
pub fn set_payload(&mut self, vals: &[u8])
Set the value of the payload field (copies contents)