Struct capsules_extra::ieee802154::framer::Framer

source ·
pub struct Framer<'a, M: Mac<'a>, A: AES128CCM<'a>> { /* private fields */ }
Expand description

This struct wraps an IEEE 802.15.4 radio device kernel::hil::radio::Radio and exposes IEEE 802.15.4 MAC device functionality as the trait capsules::mac::Mac. It hides header preparation, transmission and processing logic from the user by essentially maintaining multiple state machines corresponding to the transmission, reception and encryption/decryption pipelines. See the documentation in capsules/src/mac.rs for more details.

Implementations§

source§

impl<'a, M: Mac<'a>, A: AES128CCM<'a>> Framer<'a, M, A>

source

pub fn new( mac: &'a M, aes_ccm: &'a A, crypt_buf: SubSliceMut<'static, u8> ) -> Framer<'a, M, A>

source

pub fn set_key_procedure(&self, key_procedure: &'a dyn KeyProcedure)

Sets the IEEE 802.15.4 key lookup procedure to be used.

source

pub fn set_device_procedure(&self, device_procedure: &'a dyn DeviceProcedure)

Sets the IEEE 802.15.4 key lookup procedure to be used.

Trait Implementations§

source§

impl<'a, M: Mac<'a>, A: AES128CCM<'a>> CCMClient for Framer<'a, M, A>

source§

fn crypt_done( &self, buf: &'static mut [u8], res: Result<(), ErrorCode>, tag_is_valid: bool )

res is Ok(()) if the encryption/decryption process succeeded. This does not mean that the message has been verified in the case of decryption. If we are encrypting: tag_is_valid is true iff res is Ok(()). If we are decrypting: tag_is_valid is true iff res is Ok(()) and the message authentication tag is valid.
source§

impl<'a, M: Mac<'a>, A: AES128CCM<'a>> ConfigClient for Framer<'a, M, A>

source§

impl<'a, M: Mac<'a>, A: AES128CCM<'a>> MacDevice<'a> for Framer<'a, M, A>

source§

fn set_transmit_client(&self, client: &'a dyn TxClient)

Sets the transmission client of this MAC device
source§

fn set_receive_client(&self, client: &'a dyn RxClient)

Sets the receive client of this MAC device
source§

fn set_receive_secured_frame_no_decrypt_client( &self, client: &'a dyn SecuredFrameNoDecryptRxClient )

Sets the secure frame no decrypt receive client of this MAC device
source§

fn get_address(&self) -> u16

The short 16-bit address of the MAC device
source§

fn get_address_long(&self) -> [u8; 8]

The long 64-bit address (EUI-64) of the MAC device
source§

fn get_pan(&self) -> u16

The 16-bit PAN ID of the MAC device
source§

fn set_address(&self, addr: u16)

Set the short 16-bit address of the MAC device
source§

fn set_address_long(&self, addr: [u8; 8])

Set the long 64-bit address (EUI-64) of the MAC device
source§

fn set_pan(&self, id: u16)

Set the 16-bit PAN ID of the MAC device
source§

fn config_commit(&self)

This method must be called after one or more calls to set_*. If set_* is called without calling config_commit, there is no guarantee that the underlying hardware configuration (addresses, pan ID) is in line with this MAC device implementation.
source§

fn is_on(&self) -> bool

Returns if the MAC device is currently on.
source§

fn prepare_data_frame( &self, buf: &'static mut [u8], dst_pan: PanID, dst_addr: MacAddress, src_pan: PanID, src_addr: MacAddress, security_needed: Option<(SecurityLevel, KeyId)> ) -> Result<Frame, &'static mut [u8]>

Prepares a mutable buffer slice as an 802.15.4 frame by writing the appropriate header bytes into the buffer. This needs to be done before adding the payload because the length of the header is not fixed. Read more
source§

fn buf_to_frame( &self, buf: &'static mut [u8], len: usize ) -> Result<Frame, (ErrorCode, &'static mut [u8])>

Creates an IEEE 802.15.4 Frame object that is compatible with the MAC transmit and append payload methods. This serves to provide functionality for sending packets fully formed by the userprocess and that the 15.4 capsule does not modify. The len field may be less than the length of the buffer as the len field is the length of the current frame while the buffer is the maximum 15.4 frame size. Read more
source§

fn transmit(&self, frame: Frame) -> Result<(), (ErrorCode, &'static mut [u8])>

Transmits a frame that has been prepared by the above process. If the transmission process fails, the buffer inside the frame is returned so that it can be re-used.
source§

impl<'a, M: Mac<'a>, A: AES128CCM<'a>> RxClient for Framer<'a, M, A>

source§

fn receive( &self, buf: &'static mut [u8], frame_len: usize, lqi: u8, crc_valid: bool, _: Result<(), ErrorCode> )

source§

impl<'a, M: Mac<'a>, A: AES128CCM<'a>> TxClient for Framer<'a, M, A>

source§

fn send_done( &self, buf: &'static mut [u8], acked: bool, result: Result<(), ErrorCode> )

Auto Trait Implementations§

§

impl<'a, M, A> !Freeze for Framer<'a, M, A>

§

impl<'a, M, A> !RefUnwindSafe for Framer<'a, M, A>

§

impl<'a, M, A> !Send for Framer<'a, M, A>

§

impl<'a, M, A> !Sync for Framer<'a, M, A>

§

impl<'a, M, A> Unpin for Framer<'a, M, A>

§

impl<'a, M, A> !UnwindSafe for Framer<'a, M, A>

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> SizedTypeProperties for T

source§

#[doc(hidden)] const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
source§

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

§

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>,

§

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.