5.11.0.0R3
Software Development Kit
 
Loading...
Searching...
No Matches

Data Structures

struct  ltrx_udp_socket_options
 Contains parameters for ltrx_udp_socket_open_with_options(). More...
 

Functions

void ltrx_udp_socket_close (struct ltrx_ip_socket *sock)
 Close socket.
 
bool ltrx_udp_socket_get_received_packet_information (struct ltrx_ip_socket *sock, struct ltrx_ip_address *optRemoteAddress, uint16_t *optRemotePort)
 Get received packet information.
 
bool ltrx_udp_socket_get_received_packet_mac (struct ltrx_ip_socket *sock, uint8_t *mac)
 Get received packet MAC address.
 
bool ltrx_udp_socket_is_active (struct ltrx_ip_socket *sock)
 Check if the UDP socket is active.
 
bool ltrx_udp_socket_multicast_join (uint8_t zeroBasedInterface, struct ltrx_ip_address *groupAddress)
 Multicast join.
 
struct ltrx_ip_socket * ltrx_udp_socket_open (uint8_t zeroBasedInterface, uint16_t optLocalPort)
 Open socket.
 
struct ltrx_ip_socket * ltrx_udp_socket_open_with_options (const struct ltrx_udp_socket_options *luso)
 Open socket with options.
 
bool ltrx_udp_socket_reply (struct ltrx_ip_socket *socket, size_t length)
 Send reply.
 
bool ltrx_udp_socket_send (struct ltrx_ip_socket *sock, const struct ltrx_ip_address *address, uint16_t port, const void *data, size_t length)
 Send data.
 
wiced_result_t wiced_generic_start_dtls_with_ciphers (wiced_dtls_context_t *dtls_context, void *referee, wiced_ip_address_t ip, wiced_dtls_endpoint_type_t type, wiced_dtls_certificate_verification_t verification, const cipher_suite_t *cipher_list[], dtls_transport_protocol_t transport_protocol)
 
wiced_result_t wiced_udp_create_socket (wiced_udp_socket_t *socket, uint16_t port, wiced_interface_t interface)
 
wiced_result_t wiced_udp_delete_socket (wiced_udp_socket_t *socket)
 
wiced_result_t wiced_udp_enable_dtls (wiced_udp_socket_t *socket, void *context)
 
wiced_result_t wiced_udp_packet_get_info (wiced_packet_t *packet, wiced_ip_address_t *address, uint16_t *port)
 
wiced_result_t wiced_udp_packet_get_info_ext (wiced_packet_t *packet, wiced_ip_address_t *src_address, uint16_t *src_port, wiced_ip_address_t *dst_address)
 
wiced_result_t wiced_udp_receive (wiced_udp_socket_t *socket, wiced_packet_t **packet, uint32_t timeout)
 
wiced_result_t wiced_udp_register_callbacks (wiced_udp_socket_t *socket, wiced_udp_socket_callback_t receive_callback, void *arg)
 
wiced_result_t wiced_udp_reply (wiced_udp_socket_t *socket, wiced_packet_t *in_packet, wiced_packet_t *out_packet)
 
wiced_result_t wiced_udp_send (wiced_udp_socket_t *socket, const wiced_ip_address_t *address, uint16_t port, wiced_packet_t *packet)
 
void wiced_udp_set_type_of_service (wiced_udp_socket_t *socket, uint32_t tos)
 
wiced_result_t wiced_udp_start_dtls (wiced_udp_socket_t *socket, wiced_ip_address_t ip, wiced_dtls_endpoint_type_t type, wiced_dtls_certificate_verification_t verification)
 
wiced_result_t wiced_udp_unregister_callbacks (wiced_udp_socket_t *socket)
 
wiced_result_t wiced_udp_update_socket_backlog (wiced_udp_socket_t *socket, uint32_t backlog)
 

Detailed Description

The User Datagram Protocol (UDP) layer provides connectionless best effort data block delivery.

Communication functions for UDP (User Datagram Protocol)

Function Documentation

◆ ltrx_udp_socket_close()

void ltrx_udp_socket_close ( struct ltrx_ip_socket * sock)

Close socket.

Parameters
sock[in,out] The socket.

◆ ltrx_udp_socket_get_received_packet_information()

bool ltrx_udp_socket_get_received_packet_information ( struct ltrx_ip_socket * sock,
struct ltrx_ip_address * optRemoteAddress,
uint16_t * optRemotePort )

Get received packet information.

Return values
trueSuccess.
falseFailed.
Parameters
[in]sockThe socket.
[out]optRemoteAddressIf present, gets filled in with the remote IP address. Otherwise, set to NULL.
[out]optRemotePortIf present, gets filled in with the remote IP port. Otherwise, set to NULL.

◆ ltrx_udp_socket_get_received_packet_mac()

bool ltrx_udp_socket_get_received_packet_mac ( struct ltrx_ip_socket * sock,
uint8_t * mac )

Get received packet MAC address.

Return values
trueSuccess.
falseFailed.
Parameters
[in]sockThe socket.
[out]macGets filled in with the remote MAC address if successful.

◆ ltrx_udp_socket_is_active()

bool ltrx_udp_socket_is_active ( struct ltrx_ip_socket * sock)

Check if the UDP socket is active.

Return values
trueYes, it is active.
falseNo, it is not active.
Parameters
[in]sockThe socket.

◆ ltrx_udp_socket_multicast_join()

bool ltrx_udp_socket_multicast_join ( uint8_t zeroBasedInterface,
struct ltrx_ip_address * groupAddress )

Multicast join.

Return values
trueSuccess.
falseFailed.
Parameters
[in]zeroBasedInterfaceIndex for the desired interface.
  • NETS_SOFTAP_START for ap0.
  • NETS_ETHERNET_START for eth0.
  • NETS_WLAN_START for wlan0.
[in]groupAddressThe group address to join.

◆ ltrx_udp_socket_open()

struct ltrx_ip_socket * ltrx_udp_socket_open ( uint8_t zeroBasedInterface,
uint16_t optLocalPort )

Open socket.

Returns
Socket pointer.
Return values
NULLFailed.
Parameters
[in]zeroBasedInterfaceIndex for the desired interface.
  • NETS_SOFTAP_START for ap0.
  • NETS_ETHERNET_START for eth0.
  • NETS_WLAN_START for wlan0.
[in]optLocalPortIf non-zero, specifies the local port. If 0, a random unused UDP port number will be assigned.

◆ ltrx_udp_socket_open_with_options()

struct ltrx_ip_socket * ltrx_udp_socket_open_with_options ( const struct ltrx_udp_socket_options * luso)

Open socket with options.

Returns
Socket pointer.
Return values
NULLFailed.
Parameters
[in]lusoSpecifies the options.

◆ ltrx_udp_socket_reply()

bool ltrx_udp_socket_reply ( struct ltrx_ip_socket * socket,
size_t length )

Send reply.

Prior to this call, user has received a UDP packet via ltrx_ip_socket_receive(), learning the buffer location and receive length. The user modifies the buffer, then calls ltrx_udp_socket_reply() providing the length to send.

The reply may be longer than the received packet, up to the maximum UDP packet length. The user must take care not to write the buffer beyond the maximum length. It is possible to call ltrx_ip_socket_receive() more than once in a single packet if the receive length is limited. To avoid confusion regarding the beginning (and hence the end) of the buffer, it is recommended to call ltrx_ip_socket_receive() exclusively with the maximum length of 0xffffffff on any socket that may call ltrx_udp_socket_reply().

Return values
trueSuccess.
falseFailed.
Parameters
socket[in,out] The socket.
[in]lengthLength of data to send.

◆ ltrx_udp_socket_send()

bool ltrx_udp_socket_send ( struct ltrx_ip_socket * sock,
const struct ltrx_ip_address * address,
uint16_t port,
const void * data,
size_t length )

Send data.

Return values
trueSuccess.
falseFailed.
Parameters
sock[in,out] The socket.
[in]addressDestination IP address.
[in]portDestination IP port.
[in]dataData to send.
[in]lengthLength of data to send.

◆ wiced_generic_start_dtls_with_ciphers()

wiced_result_t wiced_generic_start_dtls_with_ciphers ( wiced_dtls_context_t * dtls_context,
void * referee,
wiced_ip_address_t ip,
wiced_dtls_endpoint_type_t type,
wiced_dtls_certificate_verification_t verification,
const cipher_suite_t * cipher_list[],
dtls_transport_protocol_t transport_protocol )

Start DTLS on a UDP Connection with a particular set of cipher suites

Start Datagram Transport Layer Security on a UDP Connection

Parameters
[in,out]dtls_context: The tls context to work with
[in,out]referee: Transport reference - e.g. UDP socket
[in]type: Identifies whether the device will be DTLS client or server
[in]verification: Indicates whether to verify the certificate chain against a root server.
[in]cipher_list: a list of cipher suites. Null terminated. e.g. static const cipher_suite_t* my_ciphers[] = { &TLS_RSA_WITH_AES_128_CBC_SHA, &TLS_RSA_WITH_AES_256_CBC_SHA, 0 };
[in]transport_protocol: Which type of transport to use - e.g. TCP, UDP, EAP
Returns
wiced_result_t

◆ wiced_udp_create_socket()

wiced_result_t wiced_udp_create_socket ( wiced_udp_socket_t * socket,
uint16_t port,
wiced_interface_t interface )

Create a new UDP socket

Creates a new UDP socket. If successful, the socket is immediately ready to communicate

Parameters
[out]socket: A pointer to a UDP socket structure which will receive the created socket handle
[in]port: The UDP port number on the local device to use. (must not be in use already)
[in]interface: The interface (AP or STA) for which the socket should be created
Returns
wiced_result_t

◆ wiced_udp_delete_socket()

wiced_result_t wiced_udp_delete_socket ( wiced_udp_socket_t * socket)

Deletes a UDP socket

Deletes a UDP socket that has been created with wiced_udp_create_socket

Parameters
[in,out]socket: A pointer to an open UDP socket handle.
Returns
wiced_result_t

◆ wiced_udp_enable_dtls()

wiced_result_t wiced_udp_enable_dtls ( wiced_udp_socket_t * socket,
void * context )

Add DTLS security to a UDP socket

Parameters
[in]socket: Pointer to UDP socket.
[in]context: A pointer to a wiced_dtls_identity_t object
Returns
wiced_result_t

◆ wiced_udp_packet_get_info()

wiced_result_t wiced_udp_packet_get_info ( wiced_packet_t * packet,
wiced_ip_address_t * address,
uint16_t * port )

Get the remote IP address and UDP port of a received packet

Get the IP address and UDP port number details of the remote host for a received packet

Parameters
[in]packet: The packet handle
[out]address: A pointer to an address structure that will receive the remote IP address
[out]port: A pointer to a variable that will receive the remote UDP port number
Returns
wiced_result_t

◆ wiced_udp_packet_get_info_ext()

wiced_result_t wiced_udp_packet_get_info_ext ( wiced_packet_t * packet,
wiced_ip_address_t * src_address,
uint16_t * src_port,
wiced_ip_address_t * dst_address )

Get the source port, source and destination addresses of a received packet

Get the IP address and UDP port number details of the remote host and also the destination IP address for a received packet

Parameters
[in]packet: The packet handle
[out]src_address: A pointer to an address structure that will receive the remote source IP address
[out]src_port: A pointer to a variable that will receive the remote source UDP port number
[out]dst_address: A pointer to an address structure that will receive the destination IP address
Returns
wiced_result_t

◆ wiced_udp_receive()

wiced_result_t wiced_udp_receive ( wiced_udp_socket_t * socket,
wiced_packet_t ** packet,
uint32_t timeout )

Receives a UDP data packet

Attempts to receive a UDP data packet from the remote host. If a packet is returned successfully, then ownership of it has been transferred to the caller, and it must be released with wiced_packet_delete as soon as it is no longer needed.

Parameters
[in,out]socket: A pointer to an open UDP socket handle.
[in]packet: A pointer to a packet pointer which will be filled with the received packet.
[in]timeout: Timeout value in milliseconds or WICED_NEVER_TIMEOUT
Returns
wiced_result_t

◆ wiced_udp_register_callbacks()

wiced_result_t wiced_udp_register_callbacks ( wiced_udp_socket_t * socket,
wiced_udp_socket_callback_t receive_callback,
void * arg )

Registers a callback function with the indicated UDP socket

Parameters
[in,out]socket: A pointer to a TCP socket handle that has been previously created with wiced_udp_create_socket
[in]receive_callback: The callback function that will be called when a UDP packet is received
[in]arg: The argument that will be passed to the callback
Returns
wiced_result_t

◆ wiced_udp_reply()

wiced_result_t wiced_udp_reply ( wiced_udp_socket_t * socket,
wiced_packet_t * in_packet,
wiced_packet_t * out_packet )

Replies to a UDP received data packet

Sends a UDP packet to the host IP address and UDP port from which a previous packet was received. Ownership of the received packet does not change. Ownership of the packet being sent is transferred to the IP stack.

Parameters
[in,out]socket: A pointer to an open UDP socket handle.
[in]in_packet: Pointer to a packet previously received with wiced_udp_receive
[in]out_packet: A packet pointer for the UDP packet to be sent
Returns
wiced_result_t

◆ wiced_udp_send()

wiced_result_t wiced_udp_send ( wiced_udp_socket_t * socket,
const wiced_ip_address_t * address,
uint16_t port,
wiced_packet_t * packet )

Send a UDP data packet

Sends a UDP packet to a remote host. Once this function is called, the caller must not use the packet pointer again, since ownership has been transferred to the IP stack.

Parameters
[in,out]socket: A pointer to an open UDP socket handle.
[in]address: The IP address of the remote host
[in]port: The UDP port number on the remote host
[in]packet: A pointer to the packet to be sent.
Returns
wiced_result_t

◆ wiced_udp_set_type_of_service()

void wiced_udp_set_type_of_service ( wiced_udp_socket_t * socket,
uint32_t tos )

Sets the type of service for the indicated UDP socket

Parameters
[in,out]socket: A pointer to a UDP socket handle that has been previously created with wiced_udp_create_socket
[in]tos: The type of service, where 0x00 or 0xC0 = Best effort, 0x40 or 0x80 = Background, 0x20 or 0xA0 = Video, 0x60 or 0xE0 = Voice
Returns
void

◆ wiced_udp_start_dtls()

wiced_result_t wiced_udp_start_dtls ( wiced_udp_socket_t * socket,
wiced_ip_address_t ip,
wiced_dtls_endpoint_type_t type,
wiced_dtls_certificate_verification_t verification )

Start DTLS on a UDP Connection

Start Datagram Transport Layer Security on a UDP Connection

Parameters
[in,out]socket: The UDP socket to use for DTLS
[in]type: Identifies whether the device will be DTLS client or server
[in]verification: Indicates whether to verify the certificate chain against a root server.
Returns
wiced_result_t

◆ wiced_udp_unregister_callbacks()

wiced_result_t wiced_udp_unregister_callbacks ( wiced_udp_socket_t * socket)

Un-registers all callback functions associated with the indicated UDP socket

Parameters
[in,out]socket: A pointer to a UDP socket handle that has been previously created with wiced_udp_create_socket
Returns
wiced_result_t

◆ wiced_udp_update_socket_backlog()

wiced_result_t wiced_udp_update_socket_backlog ( wiced_udp_socket_t * socket,
uint32_t backlog )

Update the backlog on an existing UDP socket

Update the backlog on an existing UDP socket If successful, the socket backlog is updated

Parameters
[out]socket: A pointer to a UDP socket
[in]backlog: Number of UDP packets the socket should be able to queue up
Returns
wiced_result_t