32#ifndef PROTOCORE_COAPS_SERVER_H
33#define PROTOCORE_COAPS_SERVER_H
37#if PC_ENABLE_DTLS && PC_ENABLE_COAP
42#ifndef PC_COAPS_MAX_CONNS
43#define PC_COAPS_MAX_CONNS 2
45#ifndef PC_COAPS_INGEST_RING
46#define PC_COAPS_INGEST_RING 6
49#define PC_COAPS_PORT 5684
51#ifndef PC_COAPS_IDLE_MS
52#define PC_COAPS_IDLE_MS 60000
64struct CoapsServerConfig
66 const uint8_t *cert_der;
68 uint8_t ed25519_seed[32];
69 uint8_t cookie_key[32];
70 void (*rng)(uint8_t *out,
size_t len);
81bool pc_coaps_server_begin(uint16_t port,
const CoapsServerConfig *cfg);
89void pc_coaps_server_poll();
92uint8_t pc_coaps_server_active_conns();
95void pc_coaps_server_stop();
102using CoapsServerOutFn = void (*)(
void *ctx,
const uint8_t *datagram,
size_t len,
const char *ip, uint16_t port);
105void pc_coaps_server_set_out_sink_cb(CoapsServerOutFn fn,
void *ctx);
111bool pc_coaps_server_ingest(
const uint8_t *datagram,
size_t len,
const char *ip, uint16_t port);
User-facing configuration for ProtoCore.