ProsecCoAP 🥂
 
Loading...
Searching...
No Matches
Coap::Detail Namespace Reference

Internal details of the library. Not for public use. More...

Classes

struct  RetransmissionEntry
 An entry in the retransmission queue.
 
class  RetransmissionQueue
 Class to track outgoing confirmable messages.
 
class  UriRegistry
 Internal URI registry for mapping paths to callbacks.
 

Functions

ErrorCode sendUdp (UDP *udp, const uint8_t *data, size_t length, IPAddress ip, uint16_t port)
 Wrapper around low level function to send raw UDP data.
 
unsigned long getRandomTimeout ()
 Get a random timeout value for retransmissions.
 
size_t getMinOptionBytes (uint32_t value)
 Return the minimum number of bytes needed to represent the given value.
 

Detailed Description

Internal details of the library. Not for public use.

Function Documentation

◆ getMinOptionBytes()

size_t Coap::Detail::getMinOptionBytes ( uint32_t value)

Return the minimum number of bytes needed to represent the given value.

Note that 0 is represented with 0 bytes, as per CoAP option encoding rules.

See also
https://datatracker.ietf.org/doc/html/rfc7252#section-3.2
Parameters
valueThe value to evaluate.
Returns
The minimum number of bytes required to represent the value.

◆ getRandomTimeout()

unsigned long Coap::Detail::getRandomTimeout ( )

Get a random timeout value for retransmissions.

Returns a random timeout value between COAP_ACK_MIN_TIMEOUT_MS and COAP_ACK_MAX_TIMEOUT_MS as per RFC 7252, Section 4.8.

Returns
A random timeout value in milliseconds.

◆ sendUdp()

ErrorCode Coap::Detail::sendUdp ( UDP * udp,
const uint8_t * data,
size_t length,
IPAddress ip,
uint16_t port )

Wrapper around low level function to send raw UDP data.

Parameters
udpThe UDP instance to use for sending data.
dataPointer to the data to send.
lengthLength of the data in bytes.
ipDestination IP address.
portDestination port number.
Returns
An error code indicating success or failure.