Module counter

Module counter 

Source
Expand description

The device node’s persisted frame-counter map (device-node plan increment 4).

The MAC’s CounterStore contract is per-context store calls followed by one flush per persistence cycle, already batched to one write per COUNTER_PERSIST_BLOCK_SIZE (128) secured frames. This map is the RAM image behind that contract: store upserts here, and flush serializes the whole map into a single proto record in the firmware’s counter journal. Whole-map records keep the journal machinery identical to the other journals — newest generation wins, one committed record is the entire persisted state — at a size (≤ ~600 bytes) far under the record payload bound.

Contexts are the MAC’s own key formats: the raw 32-byte identity public key for TX boundaries and mac.rx: + public key (39 bytes) for per-peer RX boundaries. The map stores them opaquely.

Structs§

CounterMap
MapFull
The map was full and the context could not be added.

Constants§

ENCODED_MAX
Upper bound of CounterMap::encode’s output.
MAX_ENTRIES
One TX boundary for the device identity plus RX boundaries for MAX_DEV_PEERS (8) peers, with slack for a stale generation of entries surviving until the next journal clear (identity provisioning and CMD_CLEAR both clear the journal).
MAX_KEY_LEN
Longest stored context: mac.rx: (7) + 32-byte key, with headroom.