UndecodedMessage

Struct UndecodedMessage 

Source
pub struct UndecodedMessage(/* private fields */);
Expand description

UndecodedMessage takes a message’s byte array from the socket. It can return smaller slices that can be later decoded into a Message’s field via DecodeMessage.

An advantage to using this over Slicer is that this doesn’t process input from start to end, so you may call its methods in any order and as many times as desired without needing to reset.

Implementations§

Source§

impl<'s> UndecodedMessage

Source

pub fn new(buffer: MessageBuffer) -> Self

input must be at least 240 bytes, where 240 is the sum of all fixed Message field’s bytes and the first 4 (“magic”) bytes of the variable options field.

Source

pub fn slice_op(&self) -> u8

Slices 1 byte to be used for the op field

Source

pub fn slice_htype(&self) -> u8

Slices 1 byte to be used for the htype field

Source

pub fn slice_hlen(&self) -> u8

Slices 1 byte to be used for the hlen field

Source

pub fn slice_hops(&self) -> u8

Slices 1 byte to be used for the hops field

Source

pub fn slice_xid(&self) -> [u8; 4]

Slices 4 bytes to be used for the xid field

Source

pub fn slice_secs(&self) -> [u8; 2]

Slices 2 bytes to be used for the secs field

Source

pub fn slice_flags(&self) -> [u8; 2]

Slices 2 bytes to be used for the flags field

Source

pub fn slice_flags_temporary(&self) -> u8

Slices the only byte currently used by the flags field.

If more bit flags are added via RFC then this may need to change or be removed.

Source

pub fn slice_ciaddr(&self) -> [u8; 4]

Slices 4 bytes to be used for the ciaddr field

Source

pub fn slice_yiaddr(&self) -> [u8; 4]

Slices 4 bytes to be used for the yiaddr field

Source

pub fn slice_siaddr(&self) -> [u8; 4]

Slices 4 bytes to be used for the siaddr field

Source

pub fn slice_giaddr(&self) -> [u8; 4]

Slices 4 bytes to be used for the giaddr field

Source

pub fn slice_chaddr(&self) -> [u8; 16]

Slices 16 bytes to be used for the chaddr field

Source

pub fn slice_sname(&self) -> [u8; 64]

Slices 64 bytes to be used for the sname field

Source

pub fn slice_file(&self) -> [u8; 128]

Slices 128 bytes to be used for the file field

Source

pub fn slice_magic(&self) -> [u8; 4]

Slices 4 bytes to be used as the magic field

Source

pub fn slice_options(&'s self) -> &'s [u8]

Slices all remaining bytes in the input to be used as the options field

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V