pub struct RoutingHeaderWriter<'a> {
pub bytes: &'a mut [u8],
}
Expand description
Writes the Routing extension header fields.
Fields§
§bytes: &'a mut [u8]
Implementations§
Source§impl<'a> RoutingHeaderWriter<'a>
impl<'a> RoutingHeaderWriter<'a>
Sourcepub fn new(bytes: &'a mut [u8]) -> Result<Self, &'static str>
pub fn new(bytes: &'a mut [u8]) -> Result<Self, &'static str>
Creates a new RoutingHeaderWriter
from the given data slice.
Sourcepub fn header_len(&self) -> usize
pub fn header_len(&self) -> usize
Returns the total header length in bytes.
Sourcepub fn set_next_header(&mut self, next_header: u8)
pub fn set_next_header(&mut self, next_header: u8)
Sets the next header field.
Specifies the type of the next header.
Sourcepub fn set_header_ext_len(&mut self, header_ext_len: u8)
pub fn set_header_ext_len(&mut self, header_ext_len: u8)
Sets the header extension length field.
Length of the header in 8 bytes, not including the first 8 bytes.
E.g. Header length = (header_ext_len + 1) * 8.
Sourcepub fn set_routing_type(&mut self, routing_type: u8)
pub fn set_routing_type(&mut self, routing_type: u8)
Sets the routing type field.
Value between 0 and 255, see IANA:
- 0: deprecated, since it enabled DoS attacks.
- 1: deprecated, used for the Nimrod project by DARPA.
- 2: allowed, limited version of type 0, used for Mobile IPv6.
- 3: allowed, RPL Source Route Header for low-power and lossy networks.
- 4: allowed, Segment Routing Header (SHR).
Sourcepub fn set_segments_left(&mut self, segments_left: u8)
pub fn set_segments_left(&mut self, segments_left: u8)
Sets the segments left field.
Number of nodes this packet has to visit before reaching its final destination.
Auto Trait Implementations§
impl<'a> Freeze for RoutingHeaderWriter<'a>
impl<'a> RefUnwindSafe for RoutingHeaderWriter<'a>
impl<'a> Send for RoutingHeaderWriter<'a>
impl<'a> Sync for RoutingHeaderWriter<'a>
impl<'a> Unpin for RoutingHeaderWriter<'a>
impl<'a> !UnwindSafe for RoutingHeaderWriter<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more