pub struct VrrpPacket<'p> { /* private fields */ }
Expand description
A structure enabling manipulation of on the wire packets
Implementations§
Source§impl<'a> VrrpPacket<'a>
impl<'a> VrrpPacket<'a>
Sourcepub fn new<'p>(packet: &'p [u8]) -> Option<VrrpPacket<'p>>
pub fn new<'p>(packet: &'p [u8]) -> Option<VrrpPacket<'p>>
Constructs a new VrrpPacket. If the provided buffer is less than the minimum required packet size, this will return None.
Sourcepub fn owned(packet: Vec<u8>) -> Option<VrrpPacket<'static>>
pub fn owned(packet: Vec<u8>) -> Option<VrrpPacket<'static>>
Constructs a new VrrpPacket. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the VrrpPacket will own its own data and the underlying buffer will be dropped when the VrrpPacket is.
Sourcepub fn to_immutable<'p>(&'p self) -> VrrpPacket<'p>
pub fn to_immutable<'p>(&'p self) -> VrrpPacket<'p>
Maps from a VrrpPacket to a VrrpPacket
Sourcepub fn consume_to_immutable(self) -> VrrpPacket<'a>
pub fn consume_to_immutable(self) -> VrrpPacket<'a>
Maps from a VrrpPacket 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.