[−][src]Struct jnet::sixlowpan::nhc::UdpPacket
LOWPAN_NHC compressed UDP packet
Methods
impl<B> UdpPacket<B> where
B: AsSlice<Element = u8>,
[src]
B: AsSlice<Element = u8>,
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]
B: AsMutSlice<Element = u8>,
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]
B: AsMutSlice<Element = u8> + Truncate<u8>,
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]
F: FnOnce(Message<&mut [u8], Unset>) -> Message<&mut [u8]>,
Fills the payload with a CoAP message
Trait Implementations
Auto Trait Implementations
impl<BUFFER> Unpin for UdpPacket<BUFFER> where
BUFFER: Unpin,
BUFFER: Unpin,
impl<BUFFER> Send for UdpPacket<BUFFER> where
BUFFER: Send,
BUFFER: Send,
impl<BUFFER> Sync for UdpPacket<BUFFER> where
BUFFER: Sync,
BUFFER: Sync,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self