This module includes functions that control UDP communication.
More...
|
otError | otUdpAddReceiver (otInstance *aInstance, otUdpReceiver *aUdpReceiver) |
|
otError | otUdpRemoveReceiver (otInstance *aInstance, otUdpReceiver *aUdpReceiver) |
|
otMessage * | otUdpNewMessage (otInstance *aInstance, const otMessageSettings *aSettings) |
|
otError | otUdpOpen (otInstance *aInstance, otUdpSocket *aSocket, otUdpReceive aCallback, void *aContext) |
|
otError | otUdpClose (otUdpSocket *aSocket) |
|
otError | otUdpBind (otUdpSocket *aSocket, otSockAddr *aSockName) |
|
otError | otUdpConnect (otUdpSocket *aSocket, otSockAddr *aSockName) |
|
otError | otUdpSend (otUdpSocket *aSocket, otMessage *aMessage, const otMessageInfo *aMessageInfo) |
|
This module includes functions that control UDP communication.
This callback allows OpenThread to provide specific handlers for certain UDP messages.
- Return values
-
true | The message is handled by this receiver and should not be further processed. |
false | The message is not handled by this receiver. |
This callback allows OpenThread to inform the application of a received UDP message.
This structure represents a UDP receiver.
This structure represents a UDP socket.
This function adds a UDP receiver.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aUdpReceiver | A pointer to the UDP receiver. |
- Return values
-
OT_ERROR_NONE | The receiver is successfully added. |
OT_ERROR_ALREADY | The UDP receiver was already added. |
Connect a UDP/IPv6 socket.
- Parameters
-
[in] | aSocket | A pointer to a UDP socket structure. |
[in] | aSockName | A pointer to an IPv6 socket address structure. |
- Return values
-
OT_ERROR_NONE | Connect operation was successful. |
- See also
- otUdpNewMessage
-
otUdpOpen
-
otUdpBind
-
otUdpClose
-
otUdpSend
Allocate a new message buffer for sending a UDP message.
- Note
- If
aSettings
is 'NULL', the link layer security is enabled and the message priority is set to OT_MESSAGE_PRIORITY_NORMAL by default.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aSettings | A pointer to the message settings or NULL to set default settings. |
- Returns
- A pointer to the message buffer or NULL if no message buffers are available or parameters are invalid.
- See also
- otMessageFree
Open a UDP/IPv6 socket.
- Parameters
-
[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. |
- Return values
-
OT_ERROR_NONE | Successfully opened the socket. |
OT_ERROR_INVALID_ARGS | Given socket structure was already opened. |
- See also
- otUdpNewMessage
-
otUdpClose
-
otUdpBind
-
otUdpConnect
-
otUdpSend
This function removes a UDP receiver.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aUdpReceiver | A pointer to the UDP receiver. |
- Return values
-
OT_ERROR_NONE | The receiver is successfully removed. |
OT_ERROR_NOT_FOUND | The UDP receiver was not added. |
Send a UDP/IPv6 message.
- Parameters
-
[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.
- Return values
-
OT_ERROR_NONE | The message is successfully scheduled for sending. |
OT_ERROR_INVALID_ARGS | Invalid arguments are given. |
- See also
- otUdpNewMessage
-
otUdpOpen
-
otUdpClose
-
otUdpBind
-
otUdpConnect
-
otUdpSend