pub struct MctpI2cEncap { /* private fields */ }
Expand description
Simple packet processing to add/remove the 4 byte MCTP-I2C header.
Implementations§
Source§impl MctpI2cEncap
impl MctpI2cEncap
pub fn new(own_addr: u8) -> Self
pub fn own_addr(&self) -> u8
pub fn decode<'f>(&self, packet: &'f [u8], pec: bool) -> Result<(&'f [u8], u8)>
Sourcepub fn receive_done_pec<'f>(
&self,
packet: &[u8],
mctp: &'f mut Stack,
) -> Result<Option<(MctpMessage<'f>, u8, ReceiveHandle)>>
pub fn receive_done_pec<'f>( &self, packet: &[u8], mctp: &'f mut Stack, ) -> Result<Option<(MctpMessage<'f>, u8, ReceiveHandle)>>
Handles a MCTP fragment with the PEC already validated
packet
should omit the PEC byte.
Returns the MCTP message and the i2c source address.
Sourcepub fn send<'f>(
&self,
i2c_dest: u8,
payload: &[u8],
out: &'f mut [u8],
fragmenter: &mut Fragmenter,
) -> SendOutput<'f>
pub fn send<'f>( &self, i2c_dest: u8, payload: &[u8], out: &'f mut [u8], fragmenter: &mut Fragmenter, ) -> SendOutput<'f>
out
must be sized to hold 8+mctp_mtu, to allow for MCTP and I2C headers
TODO: optionally add PEC.
pub fn encode<'f>( &self, i2c_dest: u8, inp: &[u8], out: &'f mut [u8], pec: bool, ) -> Result<&'f mut [u8]>
Trait Implementations§
Source§impl Clone for MctpI2cEncap
impl Clone for MctpI2cEncap
Source§fn clone(&self) -> MctpI2cEncap
fn clone(&self) -> MctpI2cEncap
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for MctpI2cEncap
impl RefUnwindSafe for MctpI2cEncap
impl Send for MctpI2cEncap
impl Sync for MctpI2cEncap
impl Unpin for MctpI2cEncap
impl UnwindSafe for MctpI2cEncap
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