CoAP endpoint, resource identifiers, and schemes. More...
CoAP endpoint, resource identifiers, and schemes.
Files | |
| file | transport.h |
| CoAP transport protocol abstraction layer. | |
Data Structures | |
| struct | unicoap_endpoint_t |
| A CoAP endpoint. More... | |
Endpoints | |
| enum | unicoap_proto_t { UNICOAP_PROTO_UDP = 1 << 1 , UNICOAP_PROTO_DTLS = 2 << 1 } |
| Transport protocol CoAP is used over. More... | |
| static bool | unicoap_transport_is_reliable (unicoap_proto_t proto) |
| Determines whether the given transport protocol is reliable. | |
| static bool | unicoap_transport_uses_sock_tl_ep (unicoap_proto_t proto) |
| Determines whether the given transport driver uses a transport layer socket in RIOT. | |
| static sock_udp_ep_t * | unicoap_endpoint_t::unicoap_endpoint_get_udp (unicoap_endpoint_t *endpoint) |
| Retrieves UDP endpoint from CoAP endpoint. | |
| static sock_udp_ep_t * | unicoap_endpoint_t::unicoap_endpoint_get_dtls (unicoap_endpoint_t *endpoint) |
| Retrieves DTLS endpoint from CoAP endpoint. | |
| #define | UNICOAP_PROTO_UNSPECIFIED (0) |
| Unspecified protocol number. | |
| #define | UNICOAP_PROTO_FLAG_RELIABLE_TRANSPORT (1) |
| Protocol number flag indicating the transport is considered reliable on its own. | |
Conversions and Tools | |
| const char * | unicoap_string_from_proto (unicoap_proto_t proto) |
| Returns scheme from protocol number. | |
| bool | unicoap_endpoint_is_equal (const unicoap_endpoint_t *source, const unicoap_endpoint_t *destination) |
| Compares two endpoints. | |
| bool | unicoap_endpoint_is_multicast (const unicoap_endpoint_t *endpoint) |
| Determines whether the given endpoint is a multicast endpoint. | |
| void | unicoap_print_sock_tl_ep (const struct _sock_tl_ep *ep) |
| Prints the given transport layer endpoint. | |
| void | unicoap_print_endpoint (const unicoap_endpoint_t *endpoint) |
| Prints the given CoAP endpoint. | |
CoAP URI schemes | |
The goal for CoAP is to have | |
| #define | UNICOAP_SCHEME "coap" |
| Default CoAP URI scheme. | |
| #define | UNICOAP_SCHEME_UDP "coap" |
| URI scheme for CoAP over UDP. | |
| #define | UNICOAP_SCHEME_DTLS "coaps" |
| URI scheme for CoAP over DTLS. | |
| #define | UNICOAP_SCHEME_TCP "coap+tcp" |
| URI scheme for CoAP over TCP. | |
| #define | UNICOAP_SCHEME_TLS "coaps+tcp" |
| URI scheme for CoAP over TLS. | |
| #define | UNICOAP_SCHEME_WEBSOCKET "coap+ws" |
| URI scheme for CoAP over WebSockets. | |
| #define | UNICOAP_SCHEME_WEBSOCKET_TLS "coaps+ws" |
| URI scheme for CoAP over secure WebSockets (over TLS) | |
| #define | UNICOAP_SCHEME_BLE_GATT "coap" |
| URI scheme for CoAP over GATT over Bluetooth Low Energy (BLE) | |
| #define | UNICOAP_DOMAIN_BLE ".ble.arpa" |
| Domain for for CoAP over GATT over Bluetooth Low Energy (BLE) | |
| #define UNICOAP_DOMAIN_BLE ".ble.arpa" |
Domain for for CoAP over GATT over Bluetooth Low Energy (BLE)
Example URI: coap://001122334455.ble.arpa/.well-known/core, with 001122334455 being the MAC address of the BLE device.
Definition at line 105 of file transport.h.
| #define UNICOAP_PROTO_FLAG_RELIABLE_TRANSPORT (1) |
Protocol number flag indicating the transport is considered reliable on its own.
Definition at line 125 of file transport.h.
| #define UNICOAP_PROTO_UNSPECIFIED (0) |
Unspecified protocol number.
Use this protocol number to mark endpoints uninitialized.
Definition at line 120 of file transport.h.
| #define UNICOAP_SCHEME "coap" |
Default CoAP URI scheme.
Definition at line 62 of file transport.h.
| #define UNICOAP_SCHEME_BLE_GATT "coap" |
URI scheme for CoAP over GATT over Bluetooth Low Energy (BLE)
Definition at line 97 of file transport.h.
| #define UNICOAP_SCHEME_DTLS "coaps" |
URI scheme for CoAP over DTLS.
Definition at line 72 of file transport.h.
| #define UNICOAP_SCHEME_TCP "coap+tcp" |
URI scheme for CoAP over TCP.
Definition at line 77 of file transport.h.
| #define UNICOAP_SCHEME_TLS "coaps+tcp" |
URI scheme for CoAP over TLS.
Definition at line 82 of file transport.h.
| #define UNICOAP_SCHEME_UDP "coap" |
URI scheme for CoAP over UDP.
Definition at line 67 of file transport.h.
| #define UNICOAP_SCHEME_WEBSOCKET "coap+ws" |
URI scheme for CoAP over WebSockets.
Definition at line 87 of file transport.h.
| #define UNICOAP_SCHEME_WEBSOCKET_TLS "coaps+ws" |
URI scheme for CoAP over secure WebSockets (over TLS)
Definition at line 92 of file transport.h.
| enum unicoap_proto_t |
Transport protocol CoAP is used over.
| Enumerator | |
|---|---|
| UNICOAP_PROTO_UDP | CoAP over UDP endpoint. |
| UNICOAP_PROTO_DTLS | CoAP over DTLS over UDP endpoint. |
Definition at line 130 of file transport.h.
|
inlinestatic |
Retrieves DTLS endpoint from CoAP endpoint.
endpoint is a CoAP over DTLS endpoint (proto == UNICOAP_PROTO_DTLS)| [in,out] | endpoint | CoAP over DTLS endpoint |
Definition at line 232 of file transport.h.
|
inlinestatic |
Retrieves UDP endpoint from CoAP endpoint.
endpoint is a CoAP over UDP endpoint (proto == UNICOAP_PROTO_UDP)| [in,out] | endpoint | CoAP over UDP endpoint |
Definition at line 217 of file transport.h.
| bool unicoap_endpoint_is_equal | ( | const unicoap_endpoint_t * | source, |
| const unicoap_endpoint_t * | destination ) |
Compares two endpoints.
| [in] | source | Endpoint 1 |
| [in] | destination | Endpoint 2 |
| bool unicoap_endpoint_is_multicast | ( | const unicoap_endpoint_t * | endpoint | ) |
Determines whether the given endpoint is a multicast endpoint.
| [in] | endpoint | Endpoint to check |
| void unicoap_print_endpoint | ( | const unicoap_endpoint_t * | endpoint | ) |
Prints the given CoAP endpoint.
| [in] | endpoint | Endpoint |
| void unicoap_print_sock_tl_ep | ( | const struct _sock_tl_ep * | ep | ) |
Prints the given transport layer endpoint.
| [in] | ep | Transport layer endpoint |
| const char * unicoap_string_from_proto | ( | unicoap_proto_t | proto | ) |
Returns scheme from protocol number.
| proto | Protocol number |
NULL if there is no such protocol number
|
inlinestatic |
Determines whether the given transport protocol is reliable.
Used for enabling the Block-wise Extension for Reliable Transports (BERT).
| proto | Protocol number for transport |
Definition at line 150 of file transport.h.
|
inlinestatic |
Determines whether the given transport driver uses a transport layer socket in RIOT.
| proto | Protocol number for transport |
Used when parsing URIs and when printing an endpoint. If true, the socket endpoint can be casted to struct _sock_tl_ep*.
Definition at line 170 of file transport.h.