The transport interface that the CoAP depends on for sending and receiving CoAP messages.
More...
The transport interface that the CoAP depends on for sending and receiving CoAP messages.
While the interface is well defined and should not be altered, the implementation of the interface depends on the choice of IP stack. The only exception to this is the coap_transport_read API. This API is implemented in the CoAP, and the transport layer is expected to call this function when data is received on one of the CoAP ports.
Initializes the transport layer to have the data ports set up for CoAP.
- Parameters
-
[in] | p_param | Port count and port numbers. |
- Return values
-
NRF_SUCCESS | If initialization was successful. Otherwise, an error code that indicates the reason for the failure is returned. |
uint32_t coap_transport_read |
( |
const coap_port_t * |
p_port, |
|
|
const coap_remote_t * |
p_remote, |
|
|
uint32_t |
result, |
|
|
const uint8_t * |
p_data, |
|
|
uint16_t |
datalen |
|
) |
| |
Handles data received on a CoAP endpoint or port.
This API is not implemented by the transport layer, but assumed to exist. This approach avoids unnecessary registering of callback and remembering it in the transport layer.
- Parameters
-
[in] | p_port | Port on which the data is to be sent. |
[in] | p_remote | Remote endpoint to which the data is targeted. |
[in] | result | Indicates if the data was processed successfully by lower layers. Possible failures could be NRF_SUCCES, UDP_BAD_CHECKSUM, UDP_TRUNCATED_PACKET, or UDP_MALFORMED_PACKET. |
[in] | p_data | Pointer to the data to be sent. |
[in] | datalen | Length of the data to be sent. |
- Return values
-
NRF_SUCCESS | If the data was handled successfully. Otherwise, an error code that indicates the reason for the failure is returned. |
uint32_t coap_transport_write |
( |
const coap_port_t * |
p_port, |
|
|
const coap_remote_t * |
p_remote, |
|
|
const uint8_t * |
p_data, |
|
|
uint16_t |
datalen |
|
) |
| |
Sends data on a CoAP endpoint or port.
- Parameters
-
[in] | p_port | Port on which the data is to be sent. |
[in] | p_remote | Remote endpoint to which the data is targeted. |
[in] | p_data | Pointer to the data to be sent. |
[in] | datalen | Length of the data to be sent. |
- Return values
-
NRF_SUCCESS | If the data was sent successfully. Otherwise, an error code that indicates the reason for the failure is returned. |