[][src]Struct jnet::sixlowpan::iphc::Packet

pub struct Packet<BUFFER> where
    BUFFER: AsSlice<Element = u8>, 
{ /* fields omitted */ }

LOWPAN_IPHC compressed IPv6 packet

Methods

impl<B> Packet<B> where
    B: AsSlice<Element = u8>, 
[src]

pub fn parse(bytes: B) -> Result<Self, B>[src]

Parses the bytes as a LOWPAN_IPHC compressed IPv6 packet

Notes

The following field values are currently not supported and treated as errors

  • CID = 1
  • SAC = 1 && SAM != 0
  • DAC = 1

Likewise, extension headers are not supported and their presence are treated as errors

pub fn get_next_header(&self) -> Option<NextHeader>[src]

Reads the 'Next header' field

NOTE: This returns None if the next header is encoded using the LOWPAN_NHC format. In that case the slice returned by payload starts with a LOWPAN_NHC encoding and must be parsed using one of the encoders in the nhc module

pub fn get_hop_limit(&self) -> u8[src]

Reads the (potentially compressed) 'Hop limit' field

pub fn get_source(&self) -> Addr[src]

Reads the (potentially compressed) 'Source Address' field

pub fn get_destination(&self) -> Addr[src]

Reads the (potentially compressed) 'Destination Address' field

pub fn header(&self) -> &[u8][src]

Immutable view into the header

pub fn payload(&self) -> &[u8][src]

Immutable view into the payload

pub fn bytes(&self) -> &[u8][src]

Byte representation of this packet

pub fn get_tf(&self) -> u8[src]

Reads the 'Traffic class, Flow label' field

pub fn get_nh(&self) -> bool[src]

Reads the 'Next Header field

pub fn get_hlim(&self) -> u8[src]

Reads the 'Hop Limit' field

pub fn get_cid(&self) -> bool[src]

Reads the 'Context IDentifier extension' field

pub fn get_sac(&self) -> bool[src]

Reads the 'Source Address Compression' field

pub fn get_sam(&self) -> u8[src]

Reads the 'Source Address Mode' field

pub fn get_m(&self) -> bool[src]

Reads the 'Multicast compression' field

pub fn get_dac(&self) -> bool[src]

Reads the 'Destination Address Compression' field

pub fn get_dam(&self) -> u8[src]

Reads the 'Destination Address Mode' IPHC field

impl<B> Packet<B> where
    B: AsMutSlice<Element = u8>, 
[src]

pub fn payload_mut(&mut self) -> &mut [u8][src]

Mutable view into the payload

impl<B> Packet<B> where
    B: AsMutSlice<Element = u8> + Truncate<u8>, 
[src]

pub fn set_payload(&mut self, payload: &[u8])[src]

Fills the payload with the given data and adjusts the length of the CoAP message

Trait Implementations

impl<B> Debug for Packet<B> where
    B: AsSlice<Element = u8>, 
[src]

impl<BUFFER: Copy> Copy for Packet<BUFFER> where
    BUFFER: AsSlice<Element = u8>, 
[src]

impl<BUFFER: Clone> Clone for Packet<BUFFER> where
    BUFFER: AsSlice<Element = u8>, 
[src]

Auto Trait Implementations

impl<BUFFER> Unpin for Packet<BUFFER> where
    BUFFER: Unpin

impl<BUFFER> Send for Packet<BUFFER> where
    BUFFER: Send

impl<BUFFER> Sync for Packet<BUFFER> where
    BUFFER: Sync

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self