Struct FragmentHeaderReader

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

Reads the Fragment header fields.

Fields§

§bytes: &'a [u8]

Implementations§

Source§

impl<'a> FragmentHeaderReader<'a>

Source

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

Source

pub fn next_header(&self) -> u8

Returns the next header field.

Identifies the type of the next header.

Source

pub fn reserved(&self) -> u8

Returns the reserved field.

Should be all zeroes.

Source

pub fn fragment_offset(&self) -> u16

Returns the fragment offset field.

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

Source

pub fn res(&self) -> u8

Returns the res field.

Reserved and should be all zeroes.

Source

pub fn m_flag(&self) -> bool

Returns the M flag.

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

Source

pub fn identification(&self) -> u32

Returns the identification field.

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

Source

pub fn header_len(&self) -> usize

Returns the length of the Fragment header.

Source

pub fn header(&self) -> &'a [u8]

Returns a reference to the header.

Source

pub fn payload(&self) -> &'a [u8]

Returns a reference to the payload.

Trait Implementations§

Source§

impl Debug for FragmentHeaderReader<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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.