0.01.00

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

Classes

struct  otUdpSocket
 This structure represents a UDP socket. More...
 

Typedefs

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.
 

Functions

otMessageotUdpNewMessage (otInstance *aInstance, bool aLinkSecurityEnabled)
 Allocate a new message buffer for sending a UDP message. More...
 
otError otUdpOpen (otInstance *aInstance, otUdpSocket *aSocket, otUdpReceive aCallback, void *aContext)
 Open a UDP/IPv6 socket. More...
 
otError otUdpClose (otUdpSocket *aSocket)
 Close a UDP/IPv6 socket. More...
 
otError otUdpBind (otUdpSocket *aSocket, otSockAddr *aSockName)
 Bind a UDP/IPv6 socket. More...
 
otError otUdpConnect (otUdpSocket *aSocket, otSockAddr *aSockName)
 Connect a UDP/IPv6 socket. More...
 
otError otUdpSend (otUdpSocket *aSocket, otMessage *aMessage, const otMessageInfo *aMessageInfo)
 Send a UDP/IPv6 message. More...
 

Detailed Description

This module includes functions that control UDP communication.

Function Documentation

§ otUdpBind()

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

§ otUdpClose()

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

§ otUdpConnect()

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

§ otUdpNewMessage()

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

§ otUdpOpen()

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

§ 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