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
impl<'s> UndecodedMessage
Sourcepub fn new(buffer: MessageBuffer) -> Self
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.
Sourcepub fn slice_htype(&self) -> u8
pub fn slice_htype(&self) -> u8
Slices 1 byte to be used for the htype field
Sourcepub fn slice_hlen(&self) -> u8
pub fn slice_hlen(&self) -> u8
Slices 1 byte to be used for the hlen field
Sourcepub fn slice_hops(&self) -> u8
pub fn slice_hops(&self) -> u8
Slices 1 byte to be used for the hops field
Sourcepub fn slice_secs(&self) -> [u8; 2]
pub fn slice_secs(&self) -> [u8; 2]
Slices 2 bytes to be used for the secs field
Sourcepub fn slice_flags(&self) -> [u8; 2]
pub fn slice_flags(&self) -> [u8; 2]
Slices 2 bytes to be used for the flags field
Sourcepub fn slice_flags_temporary(&self) -> u8
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.
Sourcepub fn slice_ciaddr(&self) -> [u8; 4]
pub fn slice_ciaddr(&self) -> [u8; 4]
Slices 4 bytes to be used for the ciaddr field
Sourcepub fn slice_yiaddr(&self) -> [u8; 4]
pub fn slice_yiaddr(&self) -> [u8; 4]
Slices 4 bytes to be used for the yiaddr field
Sourcepub fn slice_siaddr(&self) -> [u8; 4]
pub fn slice_siaddr(&self) -> [u8; 4]
Slices 4 bytes to be used for the siaddr field
Sourcepub fn slice_giaddr(&self) -> [u8; 4]
pub fn slice_giaddr(&self) -> [u8; 4]
Slices 4 bytes to be used for the giaddr field
Sourcepub fn slice_chaddr(&self) -> [u8; 16]
pub fn slice_chaddr(&self) -> [u8; 16]
Slices 16 bytes to be used for the chaddr field
Sourcepub fn slice_sname(&self) -> [u8; 64]
pub fn slice_sname(&self) -> [u8; 64]
Slices 64 bytes to be used for the sname field
Sourcepub fn slice_file(&self) -> [u8; 128]
pub fn slice_file(&self) -> [u8; 128]
Slices 128 bytes to be used for the file field
Sourcepub fn slice_magic(&self) -> [u8; 4]
pub fn slice_magic(&self) -> [u8; 4]
Slices 4 bytes to be used as the magic field
Sourcepub fn slice_options(&'s self) -> &'s [u8] ⓘ
pub fn slice_options(&'s self) -> &'s [u8] ⓘ
Slices all remaining bytes in the input to be used as the options field