Struct FragmentHeaderWriter

Source
pub struct FragmentHeaderWriter<'a> {
    pub bytes: &'a mut [u8],
}
Expand description

Writes the Fragment header fields.

Fields§

§bytes: &'a mut [u8]

Implementations§

Source§

impl<'a> FragmentHeaderWriter<'a>

Source

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

Creates a new FragmentHeaderWriter from the given data slice.

Source

pub fn header_len(&self) -> usize

Returns the length of the Fragment header.

Source

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

Sets the next header field.

Identifies the type of the next header.

Source

pub fn set_reserved(&mut self, reserved: u8)

Sets the reserved field.

Should be all zeroes.

Source

pub fn set_fragment_offset(&mut self, fragment_offset: u16)

Sets the fragment offset field.

Offset in 8 bytes relative to the start of the fragmentable part of the original packet.

Source

pub fn set_res(&mut self, res: u8)

Sets the res field.

Reserved and should be all zeroes.

Source

pub fn set_m_flag(&mut self, m_flag: bool)

Sets the M flag.

1 means more fragments follow, 0 means this is the last fragment.

Source

pub fn set_identification(&mut self, identification: u32)

Sets the identification field.

Identifies the packet, generated by the sender, to help the receiver reassemble the fragments.

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.