class
Matter::Transport::MessageCounter
- Matter::Transport::MessageCounter
- Reference
- Object
Overview
Manages message IDs and deduplication
Matter protocol uses 32-bit message counters for:
- Ensuring message ordering
- Detecting duplicate messages
- Replay attack protection
Defined in:
matter/transport/message_counter.crConstant Summary
-
WINDOW_SIZE =
64 -
Rolling window size for duplicate detection (spec recommends at least 32)
Constructors
Instance Method Summary
-
#check(message_id : UInt32) : CheckResult
Check whether a received message ID is accepted, a duplicate, or stale.
- #counter : UInt32
-
#mark_received(message_id : UInt32) : Nil
Mark a message ID as received (for testing/manual tracking)
-
#next : UInt32
Get next message ID to send
-
#reset(value : UInt32 = 0_u32) : Nil
Reset counter (used when establishing new session)
-
#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
Constructor Detail
Instance Method Detail
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.
Mark a message ID as received (for testing/manual tracking)
Check if a received message ID is valid (not a duplicate or replay) Returns true if message should be accepted