prf::coap::Server class final

Minimal CoAP server and router.

The server parses one datagram, resolves endpoint from static descriptor table, invokes callback, and encodes CoAP reply. Transport I/O is handled outside this class.

Constructors, destructors, conversion operators

Server(std::span<const EndpointDescriptor> endpoints) explicit
Constructs server with static endpoint table.
Server(std::span<const EndpointTableView> endpoint_tables) explicit
Constructs server with multiple static endpoint tables.

Public functions

auto handle_datagram_into(std::span<const uint8_t> datagram, std::span<uint8_t> response_buffer, std::span<uint8_t> scratch_buffer, std::span<char> path_buffer, std::span<const uint8_t>* out_response) const -> bool
Handles one request datagram and writes one response datagram into caller buffers.

Function documentation

prf::coap::Server::Server(std::span<const EndpointTableView> endpoint_tables) explicit

Constructs server with multiple static endpoint tables.

The server does not copy endpoint descriptors. All referenced tables must stay valid for the whole server lifetime.