Struct RoutingHeaderWriter

Source
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>

Source

pub fn new(bytes: &'a mut [u8]) -> Result<Self, &'static str>

Creates a new RoutingHeaderWriter from the given data slice.

Source

pub fn header_len(&self) -> usize

Returns the total header length in bytes.

Source

pub fn set_next_header(&mut self, next_header: u8)

Sets the next header field.

Specifies the type of the next header.

Source

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.

Source

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).
Source

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.

Source

pub fn set_data(&mut self, data: &[u8]) -> Result<(), &'static str>

Sets the data field.

The data field is a variable-length field.

The first 4 bytes are reserved with zeroes.

If you set data then set blocks of 8 bytes.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.