nRF5 SDK for Thread v0.11.0
Data Structures | Typedefs | Functions

This module includes functions that control UDP communication. More...

Data Structures

struct  otUdpSocket
 

Typedefs

typedef void(* otUdpReceive )(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
 
typedef struct otUdpSocket otUdpSocket
 

Functions

otMessageotUdpNewMessage (otInstance *aInstance, bool aLinkSecurityEnabled)
 
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)
 

Detailed Description

This module includes functions that control UDP communication.

Typedef Documentation

typedef void(* otUdpReceive)(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)

This callback allows OpenThread to inform the application of a received UDP message.

typedef struct otUdpSocket otUdpSocket

This structure represents a UDP socket.

Function Documentation

otError otUdpBind ( otUdpSocket aSocket,
otSockAddr aSockName 
)

Bind a UDP/IPv6 socket.

Parameters
[in]aSocketA pointer to a UDP socket structure.
[in]aSockNameA pointer to an IPv6 socket address structure.
Return values
OT_ERROR_NONEBind operation was successful.
See Also
otUdpNewMessage
otUdpOpen
otUdpConnect
otUdpClose
otUdpSend
otError otUdpClose ( otUdpSocket aSocket)

Close a UDP/IPv6 socket.

Parameters
[in]aSocketA pointer to a UDP socket structure.
Return values
OT_ERROR_NONESuccessfully closed the socket.
See Also
otUdpNewMessage
otUdpOpen
otUdpBind
otUdpConnect
otUdpSend
otError otUdpConnect ( otUdpSocket aSocket,
otSockAddr aSockName 
)

Connect a UDP/IPv6 socket.

Parameters
[in]aSocketA pointer to a UDP socket structure.
[in]aSockNameA pointer to an IPv6 socket address structure.
Return values
OT_ERROR_NONEConnect operation was successful.
See Also
otUdpNewMessage
otUdpOpen
otUdpBind
otUdpClose
otUdpSend
otMessage* otUdpNewMessage ( otInstance aInstance,
bool  aLinkSecurityEnabled 
)

Allocate a new message buffer for sending a UDP message.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aLinkSecurityEnabledTRUE if the message should be secured at Layer 2.
Returns
A pointer to the message buffer or NULL if no message buffers are available.
See Also
otFreeMessage
otError otUdpOpen ( otInstance aInstance,
otUdpSocket aSocket,
otUdpReceive  aCallback,
void *  aContext 
)

Open a UDP/IPv6 socket.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aSocketA pointer to a UDP socket structure.
[in]aCallbackA pointer to the application callback function.
[in]aContextA pointer to application-specific context.
Return values
OT_ERROR_NONESuccessfully opened the socket.
OT_ERROR_INVALID_ARGSGiven socket structure was already opened.
See Also
otUdpNewMessage
otUdpClose
otUdpBind
otUdpConnect
otUdpSend
otError otUdpSend ( otUdpSocket aSocket,
otMessage aMessage,
const otMessageInfo aMessageInfo 
)

Send a UDP/IPv6 message.

Parameters
[in]aSocketA pointer to a UDP socket structure.
[in]aMessageA pointer to a message buffer.
[in]aMessageInfoA pointer to a message info structure.
See Also
otUdpNewMessage
otUdpOpen
otUdpClose
otUdpBind
otUdpConnect
otUdpSend

Documentation feedback | Developer Zone | Subscribe | Updated