UDP#
This module includes functions that control UDP communication.
Modules#
Enumerations#
Defines the OpenThread network interface identifiers.
Typedefs#
This callback allows OpenThread to provide specific handlers for certain UDP messages.
Represents a UDP receiver.
This callback allows OpenThread to inform the application of a received UDP message.
Represents a UDP socket.
Defines the OpenThread network interface identifiers.
Functions#
Adds a UDP receiver.
Removes a UDP receiver.
Sends a UDP message without socket.
Allocate a new message buffer for sending a UDP message.
Check if a UDP socket is open.
Close a UDP/IPv6 socket.
Connect a UDP/IPv6 socket.
Gets the head of linked list of UDP Sockets.
Enumeration Documentation#
otNetifIdentifier#
otNetifIdentifier
Defines the OpenThread network interface identifiers.
Enumerator | |
---|---|
OT_NETIF_UNSPECIFIED | Unspecified network interface. |
OT_NETIF_THREAD | The Thread interface. |
OT_NETIF_BACKBONE | The Backbone interface. |
128
of file include/openthread/udp.h
Typedef Documentation#
otUdpHandler#
typedef bool(* otUdpHandler) (void *aContext, const otMessage *aMessage, const otMessageInfo *aMessageInfo) )(void *aContext, const otMessage *aMessage, const otMessageInfo *aMessageInfo)
This callback allows OpenThread to provide specific handlers for certain UDP messages.
60
of file include/openthread/udp.h
otUdpReceiver#
typedef struct otUdpReceiver otUdpReceiver
Represents a UDP receiver.
70
of file include/openthread/udp.h
otUdpReceive#
typedef void(* otUdpReceive) (void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo) )(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
This callback allows OpenThread to inform the application of a received UDP message.
110
of file include/openthread/udp.h
otUdpSocket#
typedef struct otUdpSocket otUdpSocket
Represents a UDP socket.
123
of file include/openthread/udp.h
otNetifIdentifier#
typedef enum otNetifIdentifier otNetifIdentifier
Defines the OpenThread network interface identifiers.
133
of file include/openthread/udp.h
Function Documentation#
otUdpAddReceiver#
otError otUdpAddReceiver (otInstance * aInstance, otUdpReceiver * aUdpReceiver)
Adds a UDP receiver.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aUdpReceiver | A pointer to the UDP receiver. |
81
of file include/openthread/udp.h
otUdpRemoveReceiver#
otError otUdpRemoveReceiver (otInstance * aInstance, otUdpReceiver * aUdpReceiver)
Removes a UDP receiver.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aUdpReceiver | A pointer to the UDP receiver. |
92
of file include/openthread/udp.h
otUdpSendDatagram#
otError otUdpSendDatagram (otInstance * aInstance, otMessage * aMessage, otMessageInfo * aMessageInfo)
Sends a UDP message without socket.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aMessage | A pointer to a message without UDP header. |
[in] | aMessageInfo | A pointer to a message info associated with |
105
of file include/openthread/udp.h
otUdpNewMessage#
otMessage * otUdpNewMessage (otInstance * aInstance, const otMessageSettings * aSettings)
Allocate a new message buffer for sending a UDP message.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aSettings | A pointer to the message settings or NULL to use default settings. |
Note
If
aSettings
is 'NULL', the link layer security is enabled and the message priority is set to OT_MESSAGE_PRIORITY_NORMAL by default.
Returns
A pointer to the message buffer or NULL if no message buffers are available or parameters are invalid.
See Also
148
of file include/openthread/udp.h
otUdpOpen#
otError otUdpOpen (otInstance * aInstance, otUdpSocket * aSocket, otUdpReceive aCallback, void * aContext)
Open a UDP/IPv6 socket.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aSocket | A pointer to a UDP socket structure. |
[in] | aCallback | A pointer to the application callback function. |
[in] | aContext | A pointer to application-specific context. |
161
of file include/openthread/udp.h
otUdpIsOpen#
bool otUdpIsOpen (otInstance * aInstance, const otUdpSocket * aSocket)
Check if a UDP socket is open.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aSocket | A pointer to a UDP socket structure. |
Returns
Whether the UDP socket is open.
171
of file include/openthread/udp.h
otUdpClose#
otError otUdpClose (otInstance * aInstance, otUdpSocket * aSocket)
Close a UDP/IPv6 socket.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aSocket | A pointer to a UDP socket structure. |
182
of file include/openthread/udp.h
otUdpBind#
otError otUdpBind (otInstance * aInstance, otUdpSocket * aSocket, const otSockAddr * aSockName, otNetifIdentifier aNetif)
Bind a UDP/IPv6 socket.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aSocket | A pointer to a UDP socket structure. |
[in] | aSockName | A pointer to an IPv6 socket address structure. |
[in] | aNetif | The network interface to bind. |
195
of file include/openthread/udp.h
otUdpConnect#
otError otUdpConnect (otInstance * aInstance, otUdpSocket * aSocket, const otSockAddr * aSockName)
Connect a UDP/IPv6 socket.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aSocket | A pointer to a UDP socket structure. |
[in] | aSockName | A pointer to an IPv6 socket address structure. |
207
of file include/openthread/udp.h
otUdpSend#
otError otUdpSend (otInstance * aInstance, otUdpSocket * aSocket, otMessage * aMessage, const otMessageInfo * aMessageInfo)
Send a UDP/IPv6 message.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aSocket | A pointer to a UDP socket structure. |
[in] | aMessage | A pointer to a message buffer. |
[in] | aMessageInfo | A pointer to a message info structure. |
If the return value is OT_ERROR_NONE, OpenThread takes ownership of aMessage
, and the caller should no longer reference aMessage
. If the return value is not OT_ERROR_NONE, the caller retains ownership of aMessage
, including freeing aMessage
if the message buffer is no longer needed.
225
of file include/openthread/udp.h
otUdpGetSockets#
otUdpSocket * otUdpGetSockets (otInstance * aInstance)
Gets the head of linked list of UDP Sockets.
[in] | aInstance | A pointer to an OpenThread instance. |
Returns
A pointer to the head of UDP Socket linked list.
234
of file include/openthread/udp.h