Skip to content

protocols(mh): make NTPTimestamp and PMIPv6Timestamp Info classes #1886

Closed

Description

@JarryShaw

Following the owner's ruling on #1869: NTPTimestamp and PMIPv6Timestamp (pcapkit/protocols/internet/mh.py:538, :549) become Info classes, as other nested values in the data models already are. VersionInfo, ModuleDescriptor and TCPSegment stay named tuples.

Breaking. NTPTimestamp has shipped as a tuple since 1.0.1.post2, through every 1.4.x release. PMIPv6Timestamp is beta-only (#437). Once they are Info classes, both lose indexing, unpacking, equality with a plain tuple, hashing, ordering and _replace/_asdict. Attribute access (.seconds, .fraction) and pickling still work. The dumpers will write {"seconds": …, "fraction": …} where they now write {"type": "NTPTimestamp", "value": [s, f]}.

Work:

  • Convert both classes. Model them on an existing small Info such as hip.Lifetime (protocols/data/internet/hip.py:559).
  • Rewrite mh.py:8985 (seconds, fraction = option.pmip_timestamp) to use attribute access, and update the tests that unpack or tuple() these values (tests/protocols/internet/test_mh_unit.py:2184, :2190).
  • Add .. versionchanged:: 1.5.0 on both classes and on docs/source/pcapkit/protocols/internet/mh.rst.
  • Correct docs/source/changelog/1.5.0.rst:384-386, which says no NamedTuple remains in the package. TCPSegment (toolkit/pcap.py:45) is one.
  • Test the new behaviour, and the dumper output for both classes.

Activity

  1. added
    fixPull requests that fix a defect (fix: subject prefix)
    breakingBreaks public-facing behaviour or API (apply alongside the type label)
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 17, 2026
  2. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 17, 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

    breakingBreaks public-facing behaviour or API (apply alongside the type label)fixPull requests that fix a defect (fix: subject prefix)

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions