UDP Forward

This module includes functions for UDP forward feature.

Summary

The functions in this module are available when udp-forward feature (OPENTHREAD_ENABLE_UDP_FORWARD) is enabled.

Typedefs

otUdpForwarder)(otMessage *aMessage, uint16_t aPeerPort, otIp6Address *aPeerAddr, uint16_t aSockPort, void *aContext) typedef
void(*
This function pointer delivers the UDP packet to host and host should send the packet through its own network stack.

Functions

otUdpForwardReceive(otInstance *aInstance, otMessage *aMessage, uint16_t aPeerPort, const otIp6Address *aPeerAddr, uint16_t aSockPort)
void
Handle a UDP packet received from host.
otUdpForwardSetForwarder(otInstance *aInstance, otUdpForwarder aForwarder, void *aContext)
void
Set UDP forward callback to deliever UDP packets to host.
otUdpGetSockets(otInstance *aInstance)
This function gets the existing UDP Sockets.

Typedefs

otUdpForwarder

void(* otUdpForwarder)(otMessage *aMessage, uint16_t aPeerPort, otIp6Address *aPeerAddr, uint16_t aSockPort, void *aContext)

This function pointer delivers the UDP packet to host and host should send the packet through its own network stack.

Details
Parameters
[in] aMessage
A pointer to the UDP Message.
[in] aPeerPort
The destination UDP port.
[in] aPeerAddr
A pointer to the destination IPv6 address.
[in] aSockPort
The source UDP port.
[in] aContext
A pointer to application-specific context.

Functions

otUdpForwardReceive

void otUdpForwardReceive(
  otInstance *aInstance,
  otMessage *aMessage,
  uint16_t aPeerPort,
  const otIp6Address *aPeerAddr,
  uint16_t aSockPort
)

Handle a UDP packet received from host.

No matter the call success or fail, the message is freed.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aMessage
A pointer to the UDP Message.
[in] aPeerPort
The source UDP port.
[in] aPeerAddr
A pointer to the source address.
[in] aSockPort
The destination UDP port.

otUdpForwardSetForwarder

void otUdpForwardSetForwarder(
  otInstance *aInstance,
  otUdpForwarder aForwarder,
  void *aContext
)

Set UDP forward callback to deliever UDP packets to host.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aForwarder
A pointer to a function called to forward UDP packet to host.
[in] aContext
A pointer to application-specific context.

otUdpGetSockets

otUdpSocket * otUdpGetSockets(
  otInstance *aInstance
)

This function gets the existing UDP Sockets.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
A pointer to the first UDP Socket.