pub struct Ipv6RoutingHeader<T: AsRef<[u8]>> { /* private fields */ }
Expand description
A read/write wrapper around an IPv6 Routing Header buffer.
Implementations§
Source§impl<T: AsRef<[u8]>> Header<T>
impl<T: AsRef<[u8]>> Header<T>
Core getter methods relevant to any routing type.
Sourcepub const fn new_unchecked(buffer: T) -> Header<T>
pub const fn new_unchecked(buffer: T) -> Header<T>
Create a raw octet buffer with an IPv6 Routing Header structure.
Sourcepub fn new_checked(buffer: T) -> Result<Header<T>>
pub fn new_checked(buffer: T) -> Result<Header<T>>
Shorthand for a combination of new_unchecked and check_len.
Sourcepub fn check_len(&self) -> Result<()>
pub fn check_len(&self) -> Result<()>
Ensure that no accessor method will panic if called.
Returns Err(Error)
if the buffer is too short.
The result of this check is invalidated by calling set_header_len.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consume the header, returning the underlying buffer.
Sourcepub fn routing_type(&self) -> Type
pub fn routing_type(&self) -> Type
Return the routing type field.
Sourcepub fn segments_left(&self) -> u8
pub fn segments_left(&self) -> u8
Return the segments left field.
Source§impl<T: AsRef<[u8]>> Header<T>
impl<T: AsRef<[u8]>> Header<T>
Getter methods for the Type 2 Routing Header routing type.
Sourcepub fn home_address(&self) -> Address
pub fn home_address(&self) -> Address
Return the IPv6 Home Address
§Panics
This function may panic if this header is not the Type2 Routing Header routing type.
Source§impl<T: AsRef<[u8]>> Header<T>
impl<T: AsRef<[u8]>> Header<T>
Getter methods for the RPL Source Routing Header routing type.
Sourcepub fn cmpr_i(&self) -> u8
pub fn cmpr_i(&self) -> u8
Return the number of prefix octets elided from addresses[1..n-1].
§Panics
This function may panic if this header is not the RPL Source Routing Header routing type.
Sourcepub fn cmpr_e(&self) -> u8
pub fn cmpr_e(&self) -> u8
Return the number of prefix octets elided from the last address (addresses[n]
).
§Panics
This function may panic if this header is not the RPL Source Routing Header routing type.
Source§impl<T: AsRef<[u8]> + AsMut<[u8]>> Header<T>
impl<T: AsRef<[u8]> + AsMut<[u8]>> Header<T>
Core setter methods relevant to any routing type.
Sourcepub fn set_routing_type(&mut self, value: Type)
pub fn set_routing_type(&mut self, value: Type)
Set the routing type.
Sourcepub fn set_segments_left(&mut self, value: u8)
pub fn set_segments_left(&mut self, value: u8)
Set the segments left field.
Sourcepub fn clear_reserved(&mut self)
pub fn clear_reserved(&mut self)
Source§impl<T: AsRef<[u8]> + AsMut<[u8]>> Header<T>
impl<T: AsRef<[u8]> + AsMut<[u8]>> Header<T>
Setter methods for the RPL Source Routing Header routing type.
Sourcepub fn set_home_address(&mut self, value: Address)
pub fn set_home_address(&mut self, value: Address)
Set the Ipv6 Home Address
§Panics
This function may panic if this header is not the Type 2 Routing Header routing type.
Source§impl<T: AsRef<[u8]> + AsMut<[u8]>> Header<T>
impl<T: AsRef<[u8]> + AsMut<[u8]>> Header<T>
Setter methods for the RPL Source Routing Header routing type.
Sourcepub fn set_cmpr_i(&mut self, value: u8)
pub fn set_cmpr_i(&mut self, value: u8)
Set the number of prefix octets elided from addresses[1..n-1].
§Panics
This function may panic if this header is not the RPL Source Routing Header routing type.
Sourcepub fn set_cmpr_e(&mut self, value: u8)
pub fn set_cmpr_e(&mut self, value: u8)
Set the number of prefix octets elided from the last address (addresses[n]
).
§Panics
This function may panic if this header is not the RPL Source Routing Header routing type.
Sourcepub fn set_pad(&mut self, value: u8)
pub fn set_pad(&mut self, value: u8)
Set the number of octets used for padding after addresses[n]
.
§Panics
This function may panic if this header is not the RPL Source Routing Header routing type.
Sourcepub fn set_addresses(&mut self, value: &[u8])
pub fn set_addresses(&mut self, value: &[u8])
Set address data
§Panics
This function may panic if this header is not the RPL Source Routing Header routing type.