A transport that communicates over UDP tunnel or multicast group.
More...
#include <udp-transport.hpp>
Inherits ndnph::transport::Transport.
|
enum | { DefaultMtu = 1500 - 20 - 8
} |
|
using | RxCallback = void(*)(void *ctx, const uint8_t *pkt, size_t pktLen, uint64_t endpointId) |
|
|
| UdpTransport (size_t mtu=DefaultMtu) |
| Construct using internal buffer. More...
|
|
| UdpTransport (uint8_t *buffer, size_t capacity) |
| Construct using external buffer. More...
|
|
template<size_t capacity> |
| UdpTransport (std::array< uint8_t, capacity > &buffer) |
| Construct using external buffer. More...
|
|
bool | beginListen (uint16_t localPort=6363, IPAddress localIp=IPAddress()) |
| Listen on a UDP port for packets from any remote endpoint. More...
|
|
bool | beginTunnel (IPAddress remoteIp, uint16_t remotePort=6363, uint16_t localPort=6363) |
| Establish a UDP tunnel to a remote endpoint. More...
|
|
bool | beginMulticast (IPAddress localIp=IPAddress(), uint16_t groupPort=56363) |
| Join a UDP multicast group. More...
|
|
void | end () |
| Disable the transport. More...
|
|
virtual | ~Transport ()=default |
|
bool | isUp () const |
| Determine whether transport is connected. More...
|
|
void | loop () |
| Process periodical events, such as receiving packets. More...
|
|
void | setRxCallback (RxCallback cb, void *ctx) |
| Set incoming packet callback. More...
|
|
bool | send (const uint8_t *pkt, size_t pktLen, uint64_t endpointId=0) |
| Synchronously transmit a packet. More...
|
|
|
void | invokeRxCallback (const uint8_t *pkt, size_t pktLen, uint64_t endpointId=0) |
| Invoke incoming packet callback for a received packet. More...
|
|
A transport that communicates over UDP tunnel or multicast group.
◆ anonymous enum
Enumerator |
---|
DefaultMtu | Default MTU for UDP is Ethernet MTU minus IPv4 and UDP headers.
|
◆ UdpTransport() [1/3]
esp8266ndn::UdpTransport::UdpTransport |
( |
size_t |
mtu = DefaultMtu | ) |
|
|
explicit |
Construct using internal buffer.
- Parameters
-
mtu | maximum packet length. Default is default Ethernet MTU minus IP and UDP headers. |
◆ UdpTransport() [2/3]
esp8266ndn::UdpTransport::UdpTransport |
( |
uint8_t * |
buffer, |
|
|
size_t |
capacity |
|
) |
| |
|
explicit |
Construct using external buffer.
- Parameters
-
buffer | buffer pointer. This must remain valid until transport is destructed. |
capacity | buffer capacity. |
◆ UdpTransport() [3/3]
template<size_t capacity>
esp8266ndn::UdpTransport::UdpTransport |
( |
std::array< uint8_t, capacity > & |
buffer | ) |
|
|
inlineexplicit |
Construct using external buffer.
- Parameters
-
buffer | buffer array. This must remain valid until transport is destructed. |
◆ beginListen()
bool esp8266ndn::UdpTransport::beginListen |
( |
uint16_t |
localPort = 6363 , |
|
|
IPAddress |
localIp = IPAddress() |
|
) |
| |
Listen on a UDP port for packets from any remote endpoint.
- Parameters
-
localPort | local port. |
localIp | local interface address (ESP32 only). |
Up to four simultaneous IPv6 EndpointIds can be tracked.
◆ beginMulticast()
bool esp8266ndn::UdpTransport::beginMulticast |
( |
IPAddress |
localIp = IPAddress() , |
|
|
uint16_t |
groupPort = 56363 |
|
) |
| |
Join a UDP multicast group.
- Parameters
-
localIp | local interface address (ESP8266 only). |
groupPort | group port. |
◆ beginTunnel()
bool esp8266ndn::UdpTransport::beginTunnel |
( |
IPAddress |
remoteIp, |
|
|
uint16_t |
remotePort = 6363 , |
|
|
uint16_t |
localPort = 6363 |
|
) |
| |
Establish a UDP tunnel to a remote endpoint.
- Parameters
-
remoteIp | remote host address. |
remotePort | remote port. |
localPort | local port. |
◆ end()
void esp8266ndn::UdpTransport::end |
( |
| ) |
|
◆ MulticastGroup
const IPAddress esp8266ndn::UdpTransport::MulticastGroup |
|
static |
NDN multicast group "224.0.23.170".
The documentation for this class was generated from the following file: