Skip to content

Add QUIC v1 layer serialization - #2335

Merged
seladb merged 3 commits into
seladb:devfrom
anyingiit:quic-layer-serialization
Nov 20, 2026
Merged

seladb merged 3 commits into
seladb:devfrom
anyingiit:quic-layer-serialization

Conversation

@anyingiit

Copy link
Copy Markdown
Contributor

Description

Adds serializeLayer() and SerializedFields for the QUIC v1 layers, as part of the serialization rollout tracked in #2278 (QuicLayer had no PR listed there yet).

The fields follow the class hierarchy, each level calling its parent's serializeLayer() and continuing its field IDs (same scheme as GreLayer / GREv0Layer, with a MaxID on every struct):

Class Fields
QuicV1Layer packetType (same names as toString(): Initial, 0-RTT, Handshake, Retry, Version Negotiation, 1-RTT), headerForm (Long/Short), fixedBit
QuicV1LongHeaderLayer version (hex), destinationConnectionId, sourceConnectionId (hex strings)
QuicV1EstablishmentLayer (Initial, 0-RTT, Handshake) payloadLength (the Length field; named so it doesn't clash with the common length)
QuicV1InitialLayer token (hex string)
QuicV1RetryLayer retryToken, retryIntegrityTag (hex strings)
QuicV1VersionNegotiationLayer supportedVersions (array of hex values)
QuicV1OneRttLayer spinBit, keyPhaseBit (booleans)

The packet-type names are moved from toString() into a small static helper so both use the same strings; toString() output is unchanged. Everything is read through the existing getters, which already return empty values for truncated packets.

Tests (Tests/Packet++Test/Tests/QuicTests.cpp): JSON output for each packet type in QuicV1ParsingTest (Initial, Handshake, 0-RTT, Retry, Version Negotiation, 1-RTT), and all() size plus gap-free IDs for all nine classes. Without the source change the parsing test fails (only the common fields are written).

Motivation / disclosure: I had some spare AI-assistant quota (Claude Code) and am using it to try to help projects with open good-first-issues. The change was prepared with Claude Code and verified as listed below. If it doesn't fit, isn't up to your bar, or you'd simply rather not take it, please feel free to close it, no hard feelings at all 🙂

Related issue

Part of #2278 (QuicLayer)

Checklist

  • Tests pass locally on Linux (GCC 13): Packet++Test -t quic → 2/2 passed; full Packet++Test → 280/280 passed. Built with -DPCAPPP_BUILD_PCAPPP=OFF -DPCAPPP_USE_PCAP=OFF -DPCAPPP_BUILD_EXAMPLES=OFF (no libpcap in my environment), so Pcap++Test and examples were not run (this change only touches Packet++)
  • Formatted with clang-format 19.1.6
  • cppcheck pre-commit hook not run locally (not installed)
  • New public API documented with Doxygen

@anyingiit
anyingiit requested a review from seladb as a code owner October 22, 2026 20:30
@seladb seladb mentioned this pull request Oct 23, 2026
46 of 49 tasks
@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.90%. Comparing base (4c3f7e5) to head (f26c652).
⚠️ Report is 36 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #2335      +/-   ##
==========================================
+ Coverage   82.77%   82.90%   +0.12%     
==========================================
  Files         343      350       +7     
  Lines       66095    69020    +2925     
  Branches    13582    14352     +770     
==========================================
+ Hits        54713    57219    +2506     
- Misses      10020    10898     +878     
+ Partials     1362      903     -459     
Flag Coverage Δ
23.11.6 6.57% <0.00%> (-0.03%) ⬇️
24.11.5 6.61% <0.00%> (+0.04%) ⬆️
25.11.1 6.61% <0.00%> (+<0.01%) ⬆️
alpine320 77.26% <100.00%> (+0.72%) ⬆️
fedora42 76.79% <100.00%> (+0.74%) ⬆️
macos-15 83.11% <98.64%> (+0.37%) ⬆️
macos-26 83.11% <98.64%> (+0.37%) ⬆️
macos-26-intel 83.05% <98.64%> (+0.37%) ⬆️
mingw32 71.81% <100.00%> (+0.37%) ⬆️
mingw64 69.72% <100.00%> (+0.30%) ⬆️
npcap ?
rhel94 76.65% <100.00%> (+0.79%) ⬆️
ubuntu2204 76.70% <100.00%> (+0.80%) ⬆️
ubuntu2404 76.93% <100.00%> (+0.75%) ⬆️
ubuntu2604 76.85% <100.00%> (+0.73%) ⬆️
ubuntu2604-arm64 76.78% <100.00%> (+0.73%) ⬆️
ubuntu2604-icpx 58.06% <49.20%> (-0.17%) ⬇️
unittest 82.90% <100.00%> (+0.12%) ⬆️
windows-2022 85.71% <100.00%> (+0.38%) ⬆️
windows-2025 84.47% <100.00%> (-0.40%) ⬇️
winpcap 85.07% <100.00%> (+0.02%) ⬆️
xdp 56.41% <100.00%> (+1.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread Packet++/src/QuicLayer.cpp Resolved
Comment thread Packet++/src/QuicLayer.cpp Resolved
Comment thread Tests/Packet++Test/Tests/QuicTests.cpp Resolved
Comment thread Packet++/src/QuicLayer.cpp Resolved
Comment thread Packet++/src/QuicLayer.cpp Resolved
@way-wei96

Copy link
Copy Markdown

Hi @anyingiit — thanks for the QUIC serialization work (and for noting it's fine to close if it doesn't fit).

I addressed @seladb's review comments locally on top of your PR:
constexpr const char* packet-type names, fixedBit as bool, version/supportedVersions as integers, and removed the redundant field-ID test. Packet++Test -t quic passes.

Branch: https://github.com/way-wei96/PcapPlusPlus/tree/quic-layer-serialization-review

Happy to either open a small follow-up PR (crediting this one), or have you pull the changes here — whichever you prefer. If I don't hear back in a few days, I'll go with the follow-up PR so the review can keep moving.

@seladb

seladb commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Hi @anyingiit — thanks for the QUIC serialization work (and for noting it's fine to close if it doesn't fit).

I addressed @seladb's review comments locally on top of your PR: constexpr const char* packet-type names, fixedBit as bool, version/supportedVersions as integers, and removed the redundant field-ID test. Packet++Test -t quic passes.

Branch: https://github.com/way-wei96/PcapPlusPlus/tree/quic-layer-serialization-review

Happy to either open a small follow-up PR (crediting this one), or have you pull the changes here — whichever you prefer. If I don't hear back in a few days, I'll go with the follow-up PR so the review can keep moving.

Thank you @way-wei96 ! I'll try to apply your changes to this PR so we can get it merged

seladb and others added 2 commits November 20, 2026 00:03
OSS-Fuzz migrated pcapplusplus to base_os_version ubuntu-24-04. The
pinned CIFuzz action (April 2024) ran the bad-build check in the Ubuntu
20.04 runner, so fuzzers linked against glibc 2.38 failed to start.
Newer CIFuzz reads base_os_version and pivots to the 24.04 runner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@seladb
seladb merged commit c214e85 into seladb:dev Nov 20, 2026
45 checks passed
@seladb

seladb commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Thank you @anyingiit for working on this PR and @way-wei96 for addressing the comments 🙏

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.

3 participants