[][src]Struct jnet::sixlowpan::nhc::UdpPacket

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

LOWPAN_NHC compressed UDP packet

Methods

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

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

Parses the bytes as a LOWPAN_IPHC compressed IPv6 packet

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

Reads the (potentially compressed) 'Source Port' field

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

Reads the (potentially compressed) 'Destination Port' field

pub fn get_checksum(&self) -> Option<u16>[src]

Reads the (potentially compressed) 'Checksum' field

None means that the checksum has been elided by the compressor

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

Immutable view into the UDP payload

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

Byte representation of this packet

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

Reads the 'Checksum' NHC field

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

Reads the 'Ports' NHC field

pub fn verify_ipv6_checksum(&self, src: Addr, dest: Addr) -> bool[src]

Verifies the 'Checksum' field

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

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

Mutable view into the payload

pub fn update_checksum(&mut self, src: Addr, dest: Addr)[src]

Updates the checksum field, if not elided

impl<B> UdpPacket<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

pub fn coap<F>(&mut self, token_length: u8, f: F) where
    F: FnOnce(Message<&mut [u8], Unset>) -> Message<&mut [u8]>, 
[src]

Fills the payload with a CoAP message

Trait Implementations

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

Auto Trait Implementations

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

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

impl<BUFFER> Sync for UdpPacket<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