Skip to content

refactor(analysis): DTLS's foundation analysis wraps a DTLS protocol method, and the analysis convention is written down #2622

Closed

Description

@JarryShaw

Owner ruling, given in session and paraphrased: pcapkit.foundation.analysis is a public API layer over protocol internals, so each function in it calls a protocol method and holds no parsing of its own. That is how ip_datagram/tcp_datagram work (#2619): they call IPv4/IPv6/TCP.analyze. The owner asked that the same rule apply to DTLS, and that the convention be recorded.

On main, foundation.analysis.dtls._read_handshake holds the logic itself: it rebuilds the message from the reassembled header and body, calls DTLS.read_handshake, and falls back to a raw DTLSHandshake on ProtocolError. The reassembly Deferred calls it too.

Plan:

  • Move that logic into a classmethod on the DTLS protocol. dtls_handshake and the Deferred then call it. Signatures and outputs stay the same.
  • Write the convention onto reassembly-integration.rst: the protocol class does the parsing; foundation.analysis and the reassembly Deferred call it; protocol code never imports foundation to do its own work.

Activity

  1. added this to the PyPCAPKit v1.6 milestone on Nov 2, 2026
  2. added
    refactorRestructuring for its own sake — neither a fix nor a new capability (refactor: prefix)
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Nov 2, 2026
  3. JarryShaw commented on Nov 2, 2026

    @JarryShaw
    OwnerAuthor

    A worker is on it. The DTLS classmethod is placed by member order, dtls_handshake and the reassembly Deferred call it, and output is byte-identical, including pickle round trips. The convention goes onto reassembly-integration.rst, cited as ruled on this issue.

  4. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorRestructuring for its own sake — neither a fix nor a new capability (refactor: prefix)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions