Skip to content

refactor(analysis): give IP and TCP reassembly their own foundation.analysis modules #2581

Closed

Description

@JarryShaw

From the owner on #2531: should IP and TCP reassembly also get pcapkit.foundation.analysis modules?

Today, reassembly-integration.rst says point 3 ("a new engine's reassembled outcome needs a new foundation.analysis method") holds for DTLS alone. analysis/dtls.py has dtls_handshake. IP and TCP outcomes are instead parsed by the general Protocol.analyze dispatcher, through reassembly.data.data.Deferred, with no analysis method of their own.

Decision needed:

  1. Add them: analysis/ip.py, for IPv4/IPv6 datagrams, and analysis/tcp.py, for TCP streams. These would be thin public functions over the same machinery: Protocol.analyze for a datagram's upper layer, and Transport.analyze by ports for a stream. Deferred calls them, so the package mirrors foundation.reassembly engine by engine and point 3 holds for every engine.
  2. Leave the asymmetry and keep the page's note.

Recommendation: 1. Callers get a public function to parse a reassembled outcome, the package's shape matches its rule, and behaviour is unchanged (the deferred packet is built the same way).

Blocked: #2531 is changing the same package and page, so this unblocks when #2531's PR merges.

Activity

  1. added
    refactorRestructuring for its own sake — neither a fix nor a new capability (refactor: prefix)
    needs: decisionWaiting on the maintainer to decide — not blocked by other work
    on Nov 1, 2026
  2. JarryShaw commented on Nov 1, 2026

    @JarryShaw
    OwnerAuthor

    Take 1

  3. JarryShaw commented on Nov 1, 2026

    @JarryShaw
    OwnerAuthor

    Owner chose 1, paraphrased: IP and TCP reassembly get their own analysis modules.

    • The modules: foundation/analysis/ip.py parses a reassembled IPv4 or IPv6 datagram's upper layer through Protocol.analyze. foundation/analysis/tcp.py parses a reassembled TCP stream by its ports through Transport.analyze.
    • Wiring: Deferred calls these functions, and they are exported as dtls_handshake is.
    • Docs: reassembly-integration.rst's "Point 3 holds for DTLS alone" becomes true for every engine.
    • Behaviour: unchanged.

    Blocked: #2531 is changing the same package and page, so this unblocks when #2531's PR merges.

  4. added
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    and removed
    needs: decisionWaiting on the maintainer to decide — not blocked by other work
    on Nov 1, 2026
  5. moved this to Blocked in PyPCAPKiton Nov 1, 2026
  6. added this to the PyPCAPKit v1.6 milestone on Nov 2, 2026
  7. JarryShaw commented on Nov 2, 2026

    @JarryShaw
    OwnerAuthor

    #2531's PR (#2605) has merged, so this is unblocked. A worker is adding foundation/analysis/ip.py and tcp.py on the DTLS model, with a differential check that IP and TCP reassembly output is unchanged.

  8. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Nov 2, 2026
  9. moved this from Blocked to WIP in PyPCAPKiton Nov 2, 2026
  10. JarryShaw commented on Nov 2, 2026

    @JarryShaw
    OwnerAuthor

    The implementation is done locally, and a Sonnet review is running. It opens as a PR once the Actions queue drops below 20.

    Needs deciding: the public function names. The worker named them ip_datagram and tcp_datagram, after the reassembly modules' Datagram classes. The issue says "TCP stream".

    1. ip_datagram / tcp_datagram: each call parses one reassembled payload buffer, which is one Datagram.
    2. ip_datagram / tcp_stream: matches the issue's wording.

    Recommendation: 1. A TCP Datagram is one buffer per ACK number, not the whole stream, so tcp_stream would promise more than the function does. The PR goes ahead with option 1 unless you choose otherwise.

  11. added
    needs: decisionWaiting on the maintainer to decide — not blocked by other work
    on Nov 2, 2026
  12. JarryShaw commented on Nov 2, 2026

    @JarryShaw
    OwnerAuthor

    take 1

  13. JarryShaw commented on Nov 2, 2026

    @JarryShaw
    OwnerAuthor

    The owner chose 1, paraphrased: the functions stay ip_datagram and tcp_datagram. The branch already uses those names, so nothing changes. The PR opens once the Actions queue drops below 20, with the Sonnet review's verdict attached.

  14. removed
    needs: decisionWaiting on the maintainer to decide — not blocked by other work
    on Nov 2, 2026
  15. 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