Skip to content

Add zero-alloc wire-format peek helpers#6

Merged
cvik merged 1 commit intomainfrom
wire-peek-helpers
Mar 17, 2026
Merged

Add zero-alloc wire-format peek helpers#6
cvik merged 1 commit intomainfrom
wire-peek-helpers

Conversation

@cvik
Copy link
Copy Markdown
Owner

@cvik cvik commented Mar 17, 2026

Summary

  • Add Packet.peekKind, peekMsgId, peekOption for extracting header fields and scanning options from raw wire bytes without allocating
  • Add Packet.emptyAck, emptyRst for constructing minimal 4-byte response packets
  • Enables higher-level libraries (coap server/client) to avoid inline bit manipulation for hot-path wire-format access

Test plan

  • All existing tests pass
  • New tests for each helper: peekKind, peekMsgId, peekOption (hit, miss, extended delta, truncated data), emptyAck/emptyRst round-trip through Packet.read

peekKind, peekMsgId, peekOption: extract header fields and
scan for options from raw bytes without allocating.
emptyAck, emptyRst: construct minimal response packets.
@cvik cvik merged commit 935bf76 into main Mar 17, 2026
2 checks passed
@cvik cvik deleted the wire-peek-helpers branch March 17, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant