Loading...
Searching...
No Matches

Use CoAP over the UDP transport protocol, with optional reliability. More...

Detailed Description

Use CoAP over the UDP transport protocol, with optional reliability.

Module. Specify USEMODULE += unicoap_driver_udp in your application's Makefile.

To change the UDP port unicoap is listening on, modify CONFIG_UNICOAP_UDP_PORT. The CoAP over UDP driver uses the same socket both for client and server functionality.

See also
UNICOAP_PROTO_UDP
unicoap_rfc7252_message_type_t

This is the dependency graph of this driver:

unicoap_driver_udp
├── unicoap_driver_rfc7252_common
│ ├── unicoap_driver_rfc7252_common_messaging
│ └── unicoap_driver_rfc7252_common_pdu
├── unicoap_sock_support
│ ├── sock_async
│ ├── sock_async_event
│ ├── sock_aux_local
│ └── sock_util
└── ... (operating system networking module)

Sockets

sock_udp_tunicoap_transport_udp_get_socket (void)
 Returns the internal UDP socket.
 
int unicoap_transport_udp_add_socket (sock_udp_t *socket, sock_udp_ep_t *local)
 Adds UDP socket for client and server functionality.
 
int unicoap_transport_udp_remove_socket (sock_udp_t *socket)
 Removes UDP socket previously added manually.
 
sock_dtls_tunicoap_transport_dtls_get_socket (void)
 Returns the internal DTLS socket.
 
int unicoap_transport_dtls_add_socket (sock_dtls_t *socket, sock_udp_t *base_socket, sock_udp_ep_t *local)
 Adds DTLS socket for client and server functionality.
 
int unicoap_transport_dtls_remove_socket (sock_dtls_t *socket)
 Removes DTLS socket previously added manually.
 

Ports

#define CONFIG_UNICOAP_UDP_PORT   UNICOAP_DEFAULT_COAP_PORT
 UDP port.
 

Macro Definition Documentation

◆ CONFIG_UNICOAP_UDP_PORT

#define CONFIG_UNICOAP_UDP_PORT   UNICOAP_DEFAULT_COAP_PORT

UDP port.

Definition at line 97 of file config.h.

Function Documentation

◆ unicoap_transport_dtls_add_socket()

int unicoap_transport_dtls_add_socket ( sock_dtls_t * socket,
sock_udp_t * base_socket,
sock_udp_ep_t * local )

Adds DTLS socket for client and server functionality.

Precondition
Sockets must be pre-allocated and must remain allocated until the DTLS driver has been deinitialized or the socket is closed by you.
Parameters
[in,out]socketPre-allocated socket to use
[in,out]base_socketPre-allocated UDP base socket to use
[in]localInitialized endpoint, does not need to outlive this function call

You can call this function at any time after unicoap has been initialized.

Returns
0 on success or negative error value otherwise. The error value depends on the DTLS implementation.

◆ unicoap_transport_dtls_remove_socket()

int unicoap_transport_dtls_remove_socket ( sock_dtls_t * socket)

Removes DTLS socket previously added manually.

Parameters
[in,out]socketThe socket pointer you have previously passed to unicoap_transport_dtls_add_socket
Returns
0, indicating a success. Future versions of this API may return a negative error.

◆ unicoap_transport_udp_add_socket()

int unicoap_transport_udp_add_socket ( sock_udp_t * socket,
sock_udp_ep_t * local )

Adds UDP socket for client and server functionality.

Precondition
socket must be pre-allocated and must remain allocated until the UDP driver has been deinitialized or the socket is closed by you.
Parameters
[in,out]socketPre-allocated socket to use
[in]localInitialized endpoint, does not need to outlive this function call

You can call this function at any time after unicoap has been initialized.

Returns
0 on success or negative error value otherwise.

◆ unicoap_transport_udp_remove_socket()

int unicoap_transport_udp_remove_socket ( sock_udp_t * socket)

Removes UDP socket previously added manually.

Parameters
[in,out]socketThe socket pointer you have previously passed to unicoap_transport_udp_add_socket
Returns
0, indicating a success. Future versions of this API may return a negative error.