pub struct UdpCoapListener { /* private fields */ }
Expand description

listener for a UDP socket

Implementations§

source§

impl UdpCoapListener

A listener for UDP packets. This listener can also subscribe to multicast addresses

source

pub fn new<A: ToSocketAddrs>(addr: A) -> Result<Self, Error>

source

pub fn from_socket(socket: UdpSocket) -> Self

source

pub fn join_multicast(&mut self, addr: IpAddr)

join multicast - adds the multicast addresses to the unicast listener

  • IPv4 multicast address range is ‘224.0.0.0/4’
  • IPv6 AllCoAp multicast addresses are ‘ff00::/8’

Parameter segment is used with IPv6 to determine the first octet.

  • It’s value can be between 0x0 and 0xf.
  • To join multiple segments, you have to call enable_discovery for each of the segments.

Some Multicast address scope IPv6 IPv4 equivalent[16] Scope Purpose ffx1::/16 127.0.0.0/8 Interface-local Packets with this destination address may not be sent over any network link, but must remain within the current node; this is the multicast equivalent of the unicast loopback address. ffx2::/16 224.0.0.0/24 Link-local Packets with this destination address may not be routed anywhere. ffx3::/16 239.255.0.0/16 IPv4 local scope ffx4::/16 Admin-local The smallest scope that must be administratively configured. ffx5::/16 Site-local Restricted to the local physical network. ffx8::/16 239.192.0.0/14 Organization-local Restricted to networks used by the organization administering the local network. (For example, these addresses might be used over VPNs; when packets for this group are routed over the public internet (where these addresses are not valid), they would have to be encapsulated in some other protocol.) ffxe::/16 224.0.1.0-238.255.255.255 Global scope Eligible to be routed over the public internet.

Notable addresses: ff02::1 All nodes on the local network segment ff0x::c Simple Service Discovery Protocol ff0x::fb Multicast DNS ff0x::fb Multicast CoAP ff0x::114 Used for experiments

source

pub fn leave_multicast(&mut self, addr: IpAddr)

leave multicast - remove the multicast address from the listener

source

pub fn enable_all_coap(&mut self, segment: u8)

enable AllCoAP multicasts - adds the AllCoap addresses to the listener

  • IPv4 AllCoAP multicast address is ‘224.0.1.187’
  • IPv6 AllCoAp multicast addresses are ‘ff0?::fd’

Parameter segment is used with IPv6 to determine the first octet.

  • It’s value can be between 0x0 and 0xf.
  • To join multiple segments, you have to call enable_discovery for each of the segments.

For further details see method join_multicast

source§

impl UdpCoapListener

source

pub async fn receive_loop(self, sender: TransportRequestSender) -> Result<()>

Trait Implementations§

source§

impl Listener for UdpCoapListener

source§

fn listen<'async_trait>( self: Box<Self>, sender: TransportRequestSender ) -> Pin<Box<dyn Future<Output = Result<JoinHandle<Result<()>>>> + Send + 'async_trait>>
where Self: 'async_trait,

Auto Trait Implementations§

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

source§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

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

§

type Output = T

Should always be Self
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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V