4#ifndef PROTOCORE_WISUN_H
5#define PROTOCORE_WISUN_H
38#define WISUN_COAP_CON 0
39#define WISUN_COAP_NON 1
40#define WISUN_COAP_GET 1
41#define WISUN_COAP_PUT 3
65 size_t (*build_coap)(uint8_t *, uint8_t, uint8_t, uint16_t,
const uint8_t *, uint8_t,
const char *,
const uint8_t *,
66 size_t, uint8_t *, size_t);
70 size_t (*joined_count)(uint8_t *,
const WisunFan *);
71 size_t (*nodes_json)(uint8_t *,
const WisunFan *,
char *, size_t);
91 uint8_t tkl,
const char *uri_path,
const uint8_t *payload,
size_t plen, uint8_t *out,
Layer 3 (Network) - a family-tagged IP address (IPv4 or IPv6) with RFC-faithful text parsing,...
#define PROTOCORE_NS_LAYOUT(T,...)
Pin every dispatch slot of a table that is nothing but function pointers.
#define PROTOCORE_NS
Storage for a dispatch table. The const is load bearing.
The FAN connector state over a caller-owned node table.
protocore_ip border_router
the border router / devboard address.
One FAN mesh node behind the border router.
proto_bool joined
true once the node has joined the FAN.
uint32_t last_seen
tick of the last contact.
protocore_ip addr
the node's IPv6 address on the mesh.
Dispatch table. Addressed by offset, so the layout is asserted below.
size_t(* build_coap)(uint8_t *, uint8_t, uint8_t, uint16_t, const uint8_t *, uint8_t, const char *, const uint8_t *, size_t, uint8_t *, size_t)
A v4 or v6 address in network (big-endian) byte order.
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
_Bool proto_bool
The truth value.
#define PROTOCORE_END_DECLS
proto_bool protocore_wisun_node_find(uint8_t *work, const WisunFan *fan, const protocore_ip *addr, size_t *idx)
Find a node by address. idx (may be null) receives the index. found.
void protocore_wisun_init(uint8_t *work, WisunFan *fan, const protocore_ip *border_router, WisunNode *storage, size_t cap)
Initialize the connector over caller storage.
PROTOCORE_NS WisunNs Wisun PROTOCORE_UNUSED
Module namespace.
int protocore_wisun_node_register(uint8_t *work, WisunFan *fan, const protocore_ip *addr, uint32_t now)
Register (or refresh) a node by address; sets joined + last_seen.
size_t protocore_wisun_joined_count(uint8_t *work, const WisunFan *fan)
Number of joined nodes.
size_t protocore_wisun_nodes_json(uint8_t *work, const WisunFan *fan, char *out, size_t cap)
Serialize the node table as [{"addr":"..","joined":bool},...] for .
size_t protocore_wisun_build_coap(uint8_t *work, uint8_t type, uint8_t code, uint16_t msg_id, const uint8_t *token, uint8_t tkl, const char *uri_path, const uint8_t *payload, size_t plen, uint8_t *out, size_t cap)
Build a CoAP client request: header + Uri-Path options (one per / .