pub struct Ieee802154Repr {
pub frame_type: FrameType,
pub security_enabled: bool,
pub frame_pending: bool,
pub ack_request: bool,
pub sequence_number: Option<u8>,
pub pan_id_compression: bool,
pub frame_version: FrameVersion,
pub dst_pan_id: Option<Pan>,
pub dst_addr: Option<Address>,
pub src_pan_id: Option<Pan>,
pub src_addr: Option<Address>,
}Expand description
The fields of an IEEE 802.15.4 MAC header.
The layout of the header depends on its own fields (which addresses are present, whether the PAN identifier is compressed), so the header is parsed and emitted as a whole.
Fields§
§frame_type: FrameType§security_enabled: bool§frame_pending: bool§ack_request: bool§sequence_number: Option<u8>§pan_id_compression: bool§frame_version: FrameVersion§dst_pan_id: Option<Pan>§dst_addr: Option<Address>§src_pan_id: Option<Pan>§src_addr: Option<Address>Implementations§
Source§impl Repr
impl Repr
Sourcepub fn parse(buf: &[u8]) -> Result<(Repr, usize)>
pub fn parse(buf: &[u8]) -> Result<(Repr, usize)>
Parse the MAC header of a frame.
Returns the header and its length, the auxiliary security header included. The payload starts at that offset.
Errors:
Errorif the buffer is shorter than the header, or longer than 127 bytes, or the frame version or an addressing mode is unknown.
Sourcepub const fn buffer_len(&self) -> usize
pub const fn buffer_len(&self) -> usize
Return the length of the MAC header this will emit.
Sourcepub fn emit(&self, buf: &mut [u8])
pub fn emit(&self, buf: &mut [u8])
Write the MAC header into the front of buf.
Writes exactly buffer_len bytes. A missing
sequence number or PAN identifier is written as zero.
§Panics
Panics if buf is shorter than buffer_len.
Trait Implementations§
impl Copy for Repr
impl Eq for Repr
impl StructuralPartialEq for Repr
Auto Trait Implementations§
impl Freeze for Repr
impl RefUnwindSafe for Repr
impl Send for Repr
impl Sync for Repr
impl Unpin for Repr
impl UnsafeUnpin for Repr
impl UnwindSafe for Repr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more