Matter::Transport::MessageCounter
Inherits Reference < Object
Manages message IDs and deduplication
Matter protocol uses 32-bit message counters for:
- Ensuring message ordering
- Detecting duplicate messages
- Replay attack protection
Constants
WINDOW_SIZE = 64
Rolling window size for duplicate detection (spec recommends at least 32)
Constructors
new(counter : UInt32 = 0_u32)
SourceInstance methods
check(message_id : UInt32) : CheckResult
Check whether a received message ID is accepted, a duplicate, or stale.
This allows reliability layers to treat duplicates as valid retransmissions (e.g. re-send a cached response) while still rejecting stale replays.
counter
Sourcemark_received(message_id : UInt32) : Nil
Mark a message ID as received (for testing/manual tracking)
valid?(message_id : UInt32) : Bool
Check if a received message ID is valid (not a duplicate or replay) Returns true if message should be accepted