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

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

Data Structures

struct  otSockAddr
 
struct  otUdpSocket
 

Typedefs

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

Functions

otMessageotUdpNewMessage (otInstance *aInstance, bool aLinkSecurityEnabled)
 
ThreadError otUdpOpen (otInstance *aInstance, otUdpSocket *aSocket, otUdpReceive aCallback, void *aContext)
 
ThreadError otUdpClose (otUdpSocket *aSocket)
 
ThreadError otUdpBind (otUdpSocket *aSocket, otSockAddr *aSockName)
 
ThreadError otUdpConnect (otUdpSocket *aSocket, otSockAddr *aSockName)
 
ThreadError otUdpSend (otUdpSocket *aSocket, otMessage *aMessage, const otMessageInfo *aMessageInfo)
 

Detailed Description

This module includes functions that control UDP communication.

Typedef Documentation

typedef struct otSockAddr otSockAddr

This structure represents an IPv6 socket address.

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

ThreadError 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
kThreadErrorNoneBind operation was successful.
See Also
otUdpNewMessage
otUdpOpen
otUdpConnect
otUdpClose
otUdpSend
ThreadError otUdpClose ( otUdpSocket aSocket)

Close a UDP/IPv6 socket.

Parameters
[in]aSocketA pointer to a UDP socket structure.
Return values
kThreadErrorNoneSuccessfully closed the socket.
See Also
otUdpNewMessage
otUdpOpen
otUdpBind
otUdpConnect
otUdpSend
ThreadError 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
kThreadErrorNoneConnect 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
ThreadError 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
kThreadErrorNoneSuccessfully opened the socket.
kThreadErrorInvalidArgsGiven socket structure was already opened.
See Also
otUdpNewMessage
otUdpClose
otUdpBind
otUdpConnect
otUdpSend
ThreadError 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