Sending and receiving UDP messages.

Functions

EmberStatus emberUdpListen (uint16_t port, const uint8_t *address)
This function sets up a listener for UDP messages for a given address.
void emberRemoveUdpListeners (const uint8_t *sourceAddress)
This function removes all listeners for a given address.
EmberStatus emberSendUdp (const uint8_t *destination, uint16_t sourcePort, uint16_t destinationPort, uint8_t *payload, uint16_t payloadLength)
This function sends a UDP message.
EmberStatus emberSendUdpWithOptions (const uint8_t *destination, uint16_t sourcePort, uint16_t destinationPort, uint8_t *payload, uint16_t payloadLength, EmberUdpOptions *options)
This function sends a UDP message with the specified options.
void emberUdpHandler (const uint8_t *destination, const uint8_t *source, uint16_t localPort, uint16_t remotePort, const uint8_t *payload, uint16_t payloadLength)
An application callback for an incoming UDP message.
void emberUdpMulticastHandler (const uint8_t *destination, const uint8_t *source, uint16_t localPort, uint16_t remotePort, const uint8_t *payload, uint16_t payloadLength)
An application callback for an incoming UDP multicast.
EmberUdpOptions * emberGetUdpOptions (void)
This function retrieves the UDP options (like hoplimit) from an incoming UDP message.

Detailed Description

See udp.h for source code.

Function Documentation

EmberUdpOptions * emberGetUdpOptions ( void )
void emberRemoveUdpListeners ( const uint8_t * sourceAddress )
Parameters
address The IPv6 address listened to.
EmberStatus emberSendUdp ( const uint8_t * destination,
uint16_t sourcePort,
uint16_t destinationPort,
uint8_t * payload,
uint16_t payloadLength
)
Parameters
destination IPv6 destination address
sourcePort UDP source port
destinationPort UDP destination port
payload UDP transport payload
payloadLength Payload length, must not exceed EMBER_MAX_UDP_PAYLOAD_LENGTH (1232)
Returns
EMBER_SUCCESS if successful EMBER_NO_BUFFERS if failed to allocate a buffer EMBER_MESSAGE_TOO_LONG if payloadLength exceeds EMBER_MAX_UDP_PAYLOAD_LENGTH (1232) EMBER_ERR_FATAL other fatal failure
EmberStatus emberSendUdpWithOptions ( const uint8_t * destination,
uint16_t sourcePort,
uint16_t destinationPort,
uint8_t * payload,
uint16_t payloadLength,
EmberUdpOptions * options
)

destination IPv6 destination address sourcePort UDP source port destinationPort UDP destination port payload UDP transport payload payloadLength Payload length options Udp Options (hop limit)

return EMBER_SUCCESS if successful EMBER_NO_BUFFERS if failed to allocate a buffer EMBER_ERR_FATAL other fatal failure

void emberUdpHandler ( const uint8_t * destination,
const uint8_t * source,
uint16_t localPort,
uint16_t remotePort,
const uint8_t * payload,
uint16_t payloadLength
)
Parameters
destination IPv6 destination address
source IPv6 source address
localPort UDP source port
remotePort UDP destination port
payload UDP transport payload
payloadLength payload length

An application callback for an incoming UDP message.

Parameters
destination IPV6 destination address
source IPV6 source address
localPort UDP source port
remotePort UDP destination port
payload UDP transport payload
payloadLength payload length

Referenced by emberUdpMulticastHandler() .

EmberStatus emberUdpListen ( uint16_t port,
const uint8_t * address
)
Parameters
port A port to bind the UDP address to
address The IPv6 address listened to.
Returns
EMBER_SUCCESS if successful EMBER_TABLE_FULL if we failed to set up a listener EMBER_ERR_FATAL other fatal failure
void emberUdpMulticastHandler ( const uint8_t * destination,
const uint8_t * source,
uint16_t localPort,
uint16_t remotePort,
const uint8_t * payload,
uint16_t payloadLength
)
Parameters
destination IPv6 destination address
source IPv6 source address
localPort UDP source port
remotePort UDP destination port
payload UDP transport payload
payloadLength payload length

An application callback for an incoming UDP multicast.

Parameters
destination IPV6 destination address
source IPV6 source address
localPort UDP source port
remotePort UDP destination port
payload UDP transport payload
payloadLength payload length

References emberUdpHandler() .