Skip to content

Commit ef889e9

Browse files
committed
feat(internet): implement ICMP and ICMPv6, sharing a thin dispatch base
Closes #2436. ICMP (RFC 792) and ICMPv6 (RFC 4443) had no implementation at all -- Internet.__proto__ had no entry for either protocol number, so a packet carrying one fell back to Raw with only the protocol number as a hint. - Add ICMP_Family between Internet and ICMP/ICMPv6, following the IP/IPsec precedent: nothing but id(). The base's own name is "_Family"-suffixed (matching IPv6_Route, IPv6_Ext) because, unlike IP/IPsec, the family's generic name collides with one of its own members (ICMP). - ICMP: Echo/Echo Reply, Destination Unreachable, Time Exceeded, Parameter Problem, plus a raw fallback for any other type. Own type registry (__type__, register_type), own schema. Both classes construct with no arguments (default body is the minimum valid length) and compute/verify their own checksum via a new shared pcapkit.utilities.checksum.inet_checksum (RFC 1071): ICMP sums the message alone, ICMPv6 additionally sums the IPv6 pseudo-header (RFC 2460 Section 8.1) when the enclosing IPv6 addresses are known; a bad checksum warns rather than raises. - ICMPv6: Destination Unreachable, Packet Too Big, Time Exceeded, Parameter Problem, Echo Request/Reply, plus the same raw fallback. Neighbor Discovery (RFC 4861) and MLD (RFC 9777, which obsoletes RFC 3810) are explicitly out of scope and not yet tracked by an issue of their own. - New const/vendor registries: icmp.type and its three code registries, and the icmpv6 counterparts, as real IANA CSV crawlers (not hand-typed data), so a vendor-cron run picks up registry changes the way every other protocol's constants do. - Wire ICMP/IPv6_ICMP into Internet.__proto__, and delete the two 0-byte NotImplemented stubs. - docs/source/contributing/pep.rst: correct the ICMP/ICMPv6 follow-up prose (MLD's RFC citation, the Neighbor Discovery/NDP cross-reference, and a stale "wave 2 deliverable" claim about MLD elsewhere in the same file). - Update every registry-shape test the new entries touch: the const enum sweep-size pins, the dispatch registry's case count and PINNED_TARGETS, the package re-export and public-API surface checks, the vendor reachability and missing-body sweeps, and the handful of runtime/ integration tests whose protochain string literally said "IPv6_ICMP" where it now says "ICMPv6". Also moved an unrelated test fixture off IGMP's protocol number, which #2439 is about to register. - Cross-review round: checksum verification used to warn on genuinely valid traffic -- a first IP/IPv6 fragment, a short-snaplen capture, and an IPv6 Routing Header with Segments Left set -- by summing a slice of the message against a checksum computed over the whole thing; all three now skip verification instead of warning. ICMPv6 reached over IPv4 (protocol 58) used to crash the layer to Raw (IPv4Address fed to IPv6Address); it now skips verification the same way. inet_checksum's end-around-carry fold was hardcoded to two rounds, wrong for inputs around 131078+ octets; it now loops until no carry remains, per RFC 1071. Three docstrings claiming the checksum is never verified/computed are corrected, and icmpv6.py's MLD citation is brought in line with pep.rst's own RFC 9777 correction. - Cross-review round 3: a Mobile IPv6 node (RFC 6275 Section 11.3.1) checksums against its home address, not the wire-visible care-of address in ipv6.src; IPv6._decode_next_layer now threads the Destination Options Home Address option through __packet__['home_address'] for ICMPv6.read to use in its place. A malformed Routing header (wrong Hdr Ext Len) falls back to the generic IPv6_Ext parser, whose info has no seg_left key; info.get('seg_left', 0) silently read that as zero instead of "unknown", letting a non-zero Segments Left through unflagged. Segments Left is now read from the header's raw 4th octet whenever the structured parse did not leave it behind. - Cross-review round 6: two more instances of the same root cause, each found by a payload that reaches ICMP/ICMPv6 through a path the earlier flags never covered. (A) IP reassembly's Deferred(self.protocol.analyze, ...) threaded no packet context at all, so a reasm_strict=False datagram -- a zero-filled hole or a truncated prefix -- reached ICMP/ICMPv6 looking exactly like a complete message, including through a tunnel (4-in-4, 6-in-6) whose inner layer's own fresh parse has no way to know the outer datagram might be incomplete. (B) A malformed sibling option (e.g. a wrong-length Tunnel Encapsulation Limit) knocks IPv6_Opts into its generic IPv6_Ext fallback, whose info carries no options at all, silently losing a genuine Home Address option the same way round 3's Routing header bug lost Segments Left. Rather than add a sixth ad-hoc __packet__ key, the five this grew across five rounds (mf, route_seg_left, home_address, and two unnamed checks) are replaced by one ChecksumContext (pcapkit/protocols/internet/icmp_family.py): `incomplete` (sticky across tunnel nesting -- a fragment or a reassembly dispatch), `misrouted` (scoped to one layer -- a Routing header; keeping it separate from `incomplete` is what a regression caught mid-round -- conflating the two let an outer Routing header silence a genuinely corrupt inner checksum), and `src`/`dst` (never inherited by a nested layer, and may name ADDRESS_UNKNOWN when an address override was due but could not be recovered, as opposed to "no override is due"). ICMP and ICMPv6 now call the same verifiable_for_icmp()/verifiable_for_icmpv6() rather than reading ad-hoc flags apiece; fail-closed by construction and documented in one docstring instead of five scattered ones. Deferred gained an optional packet= parameter, purely additive (every existing call site omits it and sees no change) and still picklable under every protocol (#2423/#2425/#2435), so IP.submit can seed every reassembly dispatch already `incomplete`, unconditionally: that second parse never verifies a checksum of its own, complete datagram or not, since whichever fragments needed checking were already checked, with real context, on their own first pass through the frame. IPv6._home_address recovers a Destination Options Home Address by walking the raw option TLVs directly when the dedicated parser's fallback info has none -- the same move round 3 made for a Routing header's Segments Left -- and reports ADDRESS_UNKNOWN rather than guessing "no Home Address here" when the walk cannot complete cleanly. - Cross-review round 7: round 6's own ChecksumContext fix had three further gaps, plus one unrelated pickling regression it introduced. (A) Eight extension-header parsers (AH, IPv6_Opts, IPv6_Route, HOPOPT, IPv6_Frag, MH, HIP, IPv6_Ext) dispatch to their own next layer with no packet= of their own whenever they are the outermost protocol rather than a header IPv6._decode_next_layer is itself walking, silently dropping ChecksumContext and leaving ICMP/ICMPv6 with a fresh, never-populated one -- reproduced by an AH-protected first IP fragment losing the fragment's own `incomplete` flag and warning on a checksum that only ever covered part of the message. Fixed structurally rather than at each of the eight sites: a new ambient `_checksum_context` contextvars.ContextVar (the same pattern `_frame_depth` already uses) is set by IPv4.read, IPv6.read and Deferred.__call__ around their own dispatch, and ChecksumContext.from_packet falls back to it whenever __packet__ carries no context of its own -- so any intervening layer, these eight or one written later with no knowledge of this feature at all, is covered without a fix of its own. (B) IP.submit seeded every reassembly dispatch's ChecksumContext as unconditionally `incomplete`, which went too far: a genuinely corrupt checksum spread across multiple fragments became unreachable everywhere, never checked on any non-first fragment's own pass (there isn't one) and no longer checked on the reassembled pass either, complete or not. It is now `incomplete` only while reassembly itself is still incomplete, or when at most one fragment contributed (already checked on its own direct first pass) -- a multi-fragment datagram that reassembled in whole is finally verified, on the only pass that was ever going to see the whole thing. (C) IPv6._home_address's raw-byte-scan fallback treated a Home Address option of any length other than 16 the same as no option at all, letting ICMPv6 verify against the wire source as if Mobile IPv6 were not in play; a present-but-wrong-length option now reports ADDRESS_UNKNOWN, same as the framing breaks it already handled. (D) Deferred.__call__ read self.packet directly, so a Deferred pickled before round 6's packet= parameter existed raised AttributeError on call despite that parameter's "purely additive" versionchanged note; it now reads packet through getattr with a None default. - Cross-review round 10: round 9 confirmed the design closes every reachable path; mutation testing found Deferred.__call__'s own _checksum_context.set() -- unlike the equivalent set() in IPv4.read and IPv6.read -- had no regression test. Pinned with a new extract()-driven case: AH riding directly on IPv4 (no IPv6) wrapping a corrupt-checksum ICMP, reassembled as a single fragment -- the one reachable shape where AH's own _decode_next_layer drops packet= on its way to ICMP, making the Deferred's ambient-context seed the ICMP layer's only source of context. Confirmed to actually depend on the fix: temporarily removing the .set() call makes the new test catch the corrupt checksum twice instead of once. Build: the round's own command -- coverage run -m pytest over the ICMP/ ICMPv6/checksum unit tests, tests/foundation/reassembly, tests/const, tests/vendor and tests/integration -- passes clean (915 passed, 27918 subtests, zero "invalid checksum" warnings on genuinely valid traffic, and a genuinely corrupt reassembled checksum now warns). The full tests/protocols/internet (623 passed, 12530 subtests) and tests/foundation (580 passed, 17 skipped, 1858 subtests) directories, covering every prior round's own regression test by name, pass clean as well. Round 10's own command -- coverage run -m pytest over tests/foundation/reassembly, the ICMP/ICMPv6 roundtrip suites and the checksum unit tests -- passes clean as well (244 passed, 910 subtests).
1 parent e1efee7 commit ef889e9

82 files changed

Lines changed: 7451 additions & 86 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Pipfile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ chardet = "*"
99
dictdumper = ">=0.8.5"
1010
emoji = "*"
1111
tbtrim = "~=0.3.1"
12+
requests = "*"
1213

1314
[dev-packages]
1415
pypcapkit = {editable = true,path = "."}

‎docs/source/contributing/conventions/sentinel-convention.rst‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ derives from it mechanically -- title-case each underscore-separated word and ap
3535
* - ``ABSENT``
3636
- :class:`~pcapkit.corekit.sentinels.AbsentType`
3737
- :mod:`pcapkit.corekit.sentinels`
38+
* - ``ADDRESS_UNKNOWN``
39+
- :class:`~pcapkit.corekit.sentinels.AddressUnknownType`
40+
- :mod:`pcapkit.corekit.sentinels`
3841

3942
GitHub issue :issue:`911`'s housing ruling -- one module for all of them -- is why the table
4043
names a single defining module, and it is the only import path. The modules that *use* a

‎docs/source/contributing/pep.rst‎

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,27 @@ one. Grouped by each TCP/IP layer and ordered by protocol name alphabetically,
4141
the ones outstanding are,
4242

4343
* Link Layer: DSL, EAPOL, FDDI, ISDN, LINUX_SLL, LINUX_SLL2, NDP, PPP
44-
* Internet Layer: ECN, ICMP, ICMPv6, IGMP, Shim6
44+
* Internet Layer: ECN, IGMP, Shim6
4545
* Transport Layer: DCCP, RSVP
4646
* Application Layer: BGP, DHCP, DHCPv6, DNS, DTLS, IMAP, LDAP, MQTT, NNTP,
4747
NTP, ONC/RPC, POP, QUIC, RIP, RTP, SIP, SMTP, SNMP, SSH, Telnet, TLS/SSL,
4848
XMPP
4949

50-
Several of these come in pairs that want a shared abstract base rather than two
51-
independent implementations, in the way
52-
:class:`~pcapkit.protocols.internet.ip.IP` already covers its family: ICMP with
53-
ICMPv6, TLS/SSL with DTLS, and ``LINUX_SLL`` with ``LINUX_SLL2``.
50+
ICMP and ICMPv6 landed following the same shared-base pattern
51+
:class:`~pcapkit.protocols.internet.ip.IP` already set for IPv4/IPv6 and
52+
:class:`~pcapkit.protocols.internet.ipsec.IPsec` for AH/ESP (GitHub issue
53+
:issue:`2436`):
54+
:class:`~pcapkit.protocols.internet.icmp_family.ICMP_Family` between
55+
:class:`~pcapkit.protocols.internet.internet.Internet` and
56+
:class:`~pcapkit.protocols.internet.icmp.ICMP` /
57+
:class:`~pcapkit.protocols.internet.icmpv6.ICMPv6`. Neighbor Discovery
58+
(:rfc:`4861`) and Multicast Listener Discovery (:rfc:`9777`, which obsoletes
59+
:rfc:`3810`; :rfc:`2710` for MLDv1), both of which ride in ICMPv6, are not
60+
part of this issue. Neighbor Discovery is the ``NDP`` already listed under
61+
Link Layer above, with a stub waiting at
62+
``pcapkit/protocols/link/NotImplemented/ndp.py``; MLD has neither a stub nor
63+
an open issue of its own yet. TLS/SSL with DTLS and ``LINUX_SLL`` with
64+
``LINUX_SLL2`` still want the shared-base treatment.
5465
:class:`~pcapkit.protocols.link.vlan.VLAN` is the closer precedent for a pair
5566
whose *layout* is identical -- it holds the whole of the tag, and
5667
:class:`~pcapkit.protocols.link.c_tag.C_Tag` and
@@ -349,10 +360,10 @@ Follow-ups to the bindings above:
349360
port number. That depends on the proxy identifying the version positively
350361
instead of guessing, since a guess path is wrong on non-HTTP input.
351362

352-
Beyond those, the gaps most likely to be met in a real capture are ICMP (1),
353-
ICMPv6 (58) and IGMP (2) on the internet layer, each of which has a stub;
354-
and ``LINUX_SLL`` and ``LINUX_SLL2`` at the link layer, which every
355-
``tcpdump -i any`` capture uses and which have no stub.
363+
Beyond those, with ICMP (1) and ICMPv6 (58) now implemented, the gap most
364+
likely to be met in a real capture is IGMP (2) on the internet layer, which
365+
still has a stub; and ``LINUX_SLL`` and ``LINUX_SLL2`` at the link layer,
366+
which every ``tcpdump -i any`` capture uses and which have no stub.
356367

357368
PCAPNG Support
358369
--------------
@@ -1071,12 +1082,12 @@ post-wave-1 consistency sweep described under `Release Plan — 1.5.0 in Two
10711082
Steps`_ above.
10721083

10731084
**Wave 2 — the protocol pairs that want a shared abstract base**, per `More
1074-
Protocols, More!!!`_ above: **ICMP with ICMPv6**, **TLS/SSL with DTLS**, and
1075-
``LINUX_SLL`` with ``LINUX_SLL2``, plus **IGMP** on its own. These are grouped
1076-
because the shared-base question is the design work and doing either half of a
1077-
pair alone would answer it twice. ``LINUX_SLL`` matters out of proportion to its
1078-
size: every ``tcpdump -i any`` capture uses it, and neither variant has even a
1079-
stub.
1085+
Protocols, More!!!`_ above: **ICMP with ICMPv6** (done, :issue:`2436`),
1086+
**TLS/SSL with DTLS**, and ``LINUX_SLL`` with ``LINUX_SLL2``, plus **IGMP**
1087+
on its own. These are grouped because the shared-base question is the design
1088+
work and doing either half of a pair alone would answer it twice.
1089+
``LINUX_SLL`` matters out of proportion to its size: every ``tcpdump -i any``
1090+
capture uses it, and neither variant has even a stub.
10801091

10811092
**Done ahead of wave 2 — handlers for the** ``DLT_NULL`` **and** ``DLT_RAW``
10821093
**link types.** Both are genuine DLTs that a capture can legitimately be rooted
@@ -1104,8 +1115,11 @@ above, which describes the payloads in question and why a registry of their own
11041115
is wanted instead of
11051116
:meth:`~pcapkit.protocols.protocol.Protocol._decode_next_layer`. It is
11061117
sequenced *after* wave 2 rather than by preference: the multicast options embed
1107-
:rfc:`3810` MLD, which rides in **ICMPv6**, and :rfc:`3376` **IGMP** records —
1108-
both wave 2 deliverables. Landing the registry first would give a dispatch table
1118+
:rfc:`9777` MLD (which obsoletes :rfc:`3810`; :rfc:`2710` for MLDv1), which
1119+
rides in **ICMPv6**, and :rfc:`3376` **IGMP** records. Only the IGMP side is a
1120+
wave 2 deliverable -- MLD itself is a follow-up to ICMPv6 (see `More
1121+
Protocols, More!!!`_ above), not part of wave 2's own scope. Landing the
1122+
registry first would give a dispatch table
11091123
with nothing but :class:`~pcapkit.protocols.misc.raw.Raw` to register. The
11101124
counter-argument is real though, and worth weighing rather than dismissing: changing the
11111125
parsed shape from :obj:`bytes` to :class:`~pcapkit.protocols.misc.raw.Raw` is the

‎docs/source/pcapkit/const/icmp.rst‎

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
=====================================================================
2+
:class:`~pcapkit.protocols.internet.icmp.ICMP` Constant Enumerations
3+
=====================================================================
4+
5+
.. module:: pcapkit.const.icmp
6+
7+
This module contains all constant enumerations of
8+
:class:`~pcapkit.protocols.internet.icmp.ICMP` implementations. Available
9+
enumerations include:
10+
11+
.. list-table::
12+
13+
* - :class:`ICMP_Type <pcapkit.const.icmp.type.Type>`
14+
- ICMP Type Numbers [*]_
15+
* - :class:`ICMP_DestinationUnreachableCode <pcapkit.const.icmp.destination_unreachable_code.DestinationUnreachableCode>`
16+
- ICMP Destination Unreachable Codes [*]_
17+
* - :class:`ICMP_TimeExceededCode <pcapkit.const.icmp.time_exceeded_code.TimeExceededCode>`
18+
- ICMP Time Exceeded Codes [*]_
19+
* - :class:`ICMP_ParameterProblemCode <pcapkit.const.icmp.parameter_problem_code.ParameterProblemCode>`
20+
- ICMP Parameter Problem Codes [*]_
21+
22+
ICMP Type Numbers
23+
=================
24+
25+
.. module:: pcapkit.const.icmp.type
26+
27+
This module contains the constant enumeration for **ICMP Type Numbers**,
28+
which is automatically generated from :class:`pcapkit.vendor.icmp.type.Type`.
29+
30+
.. autoclass:: pcapkit.const.icmp.type.Type
31+
:members:
32+
:undoc-members:
33+
:show-inheritance:
34+
35+
ICMP Destination Unreachable Codes
36+
===================================
37+
38+
.. module:: pcapkit.const.icmp.destination_unreachable_code
39+
40+
This module contains the constant enumeration for **ICMP Destination
41+
Unreachable Codes**, which is automatically generated from
42+
:class:`pcapkit.vendor.icmp.destination_unreachable_code.DestinationUnreachableCode`.
43+
44+
.. autoclass:: pcapkit.const.icmp.destination_unreachable_code.DestinationUnreachableCode
45+
:members:
46+
:undoc-members:
47+
:show-inheritance:
48+
49+
ICMP Time Exceeded Codes
50+
=========================
51+
52+
.. module:: pcapkit.const.icmp.time_exceeded_code
53+
54+
This module contains the constant enumeration for **ICMP Time Exceeded
55+
Codes**, which is automatically generated from
56+
:class:`pcapkit.vendor.icmp.time_exceeded_code.TimeExceededCode`.
57+
58+
.. autoclass:: pcapkit.const.icmp.time_exceeded_code.TimeExceededCode
59+
:members:
60+
:undoc-members:
61+
:show-inheritance:
62+
63+
ICMP Parameter Problem Codes
64+
==============================
65+
66+
.. module:: pcapkit.const.icmp.parameter_problem_code
67+
68+
This module contains the constant enumeration for **ICMP Parameter Problem
69+
Codes**, which is automatically generated from
70+
:class:`pcapkit.vendor.icmp.parameter_problem_code.ParameterProblemCode`.
71+
72+
.. autoclass:: pcapkit.const.icmp.parameter_problem_code.ParameterProblemCode
73+
:members:
74+
:undoc-members:
75+
:show-inheritance:
76+
77+
.. rubric:: Footnotes
78+
79+
.. [*] https://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml#icmp-parameters-types
80+
.. [*] https://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml#icmp-parameters-codes
81+
.. [*] https://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml#icmp-parameters-codes
82+
.. [*] https://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml#icmp-parameters-codes
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
=========================================================================
2+
:class:`~pcapkit.protocols.internet.icmpv6.ICMPv6` Constant Enumerations
3+
=========================================================================
4+
5+
.. module:: pcapkit.const.icmpv6
6+
7+
This module contains all constant enumerations of
8+
:class:`~pcapkit.protocols.internet.icmpv6.ICMPv6` implementations. Available
9+
enumerations include:
10+
11+
.. list-table::
12+
13+
* - :class:`ICMPv6_Type <pcapkit.const.icmpv6.type.Type>`
14+
- ICMPv6 Type Numbers [*]_
15+
* - :class:`ICMPv6_DestinationUnreachableCode <pcapkit.const.icmpv6.destination_unreachable_code.DestinationUnreachableCode>`
16+
- ICMPv6 Destination Unreachable Codes [*]_
17+
* - :class:`ICMPv6_TimeExceededCode <pcapkit.const.icmpv6.time_exceeded_code.TimeExceededCode>`
18+
- ICMPv6 Time Exceeded Codes [*]_
19+
* - :class:`ICMPv6_ParameterProblemCode <pcapkit.const.icmpv6.parameter_problem_code.ParameterProblemCode>`
20+
- ICMPv6 Parameter Problem Codes [*]_
21+
22+
ICMPv6 Type Numbers
23+
====================
24+
25+
.. module:: pcapkit.const.icmpv6.type
26+
27+
This module contains the constant enumeration for **ICMPv6 Type Numbers**,
28+
which is automatically generated from :class:`pcapkit.vendor.icmpv6.type.Type`.
29+
30+
.. autoclass:: pcapkit.const.icmpv6.type.Type
31+
:members:
32+
:undoc-members:
33+
:show-inheritance:
34+
35+
ICMPv6 Destination Unreachable Codes
36+
======================================
37+
38+
.. module:: pcapkit.const.icmpv6.destination_unreachable_code
39+
40+
This module contains the constant enumeration for **ICMPv6 Destination
41+
Unreachable Codes**, which is automatically generated from
42+
:class:`pcapkit.vendor.icmpv6.destination_unreachable_code.DestinationUnreachableCode`.
43+
44+
.. autoclass:: pcapkit.const.icmpv6.destination_unreachable_code.DestinationUnreachableCode
45+
:members:
46+
:undoc-members:
47+
:show-inheritance:
48+
49+
ICMPv6 Time Exceeded Codes
50+
============================
51+
52+
.. module:: pcapkit.const.icmpv6.time_exceeded_code
53+
54+
This module contains the constant enumeration for **ICMPv6 Time Exceeded
55+
Codes**, which is automatically generated from
56+
:class:`pcapkit.vendor.icmpv6.time_exceeded_code.TimeExceededCode`.
57+
58+
.. autoclass:: pcapkit.const.icmpv6.time_exceeded_code.TimeExceededCode
59+
:members:
60+
:undoc-members:
61+
:show-inheritance:
62+
63+
ICMPv6 Parameter Problem Codes
64+
================================
65+
66+
.. module:: pcapkit.const.icmpv6.parameter_problem_code
67+
68+
This module contains the constant enumeration for **ICMPv6 Parameter
69+
Problem Codes**, which is automatically generated from
70+
:class:`pcapkit.vendor.icmpv6.parameter_problem_code.ParameterProblemCode`.
71+
72+
.. autoclass:: pcapkit.const.icmpv6.parameter_problem_code.ParameterProblemCode
73+
:members:
74+
:undoc-members:
75+
:show-inheritance:
76+
77+
.. rubric:: Footnotes
78+
79+
.. [*] https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml#icmpv6-parameters-types
80+
.. [*] https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml#icmpv6-parameters-type-1
81+
.. [*] https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml#icmpv6-parameters-type-3
82+
.. [*] https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml#icmpv6-parameters-type-4

‎docs/source/pcapkit/const/index.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ Internet Layer
8080

8181
esp
8282
hip
83+
icmp
84+
icmpv6
8385
ipv4
8486
ipv6
8587
ipx
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
ICMP - Internet Control Message Protocol
2+
===========================================
3+
4+
.. module:: pcapkit.protocols.internet.icmp
5+
6+
:mod:`pcapkit.protocols.internet.icmp` contains
7+
:class:`~pcapkit.protocols.internet.icmp.ICMP` only,
8+
which implements extractor for Internet Control
9+
Message Protocol (ICMP) [*]_, whose structure is
10+
described as below:
11+
12+
======= ========= ======================= ===================================
13+
Octets Bits Name Description
14+
======= ========= ======================= ===================================
15+
0 0 ``icmp.type`` Type
16+
1 8 ``icmp.code`` Code
17+
2 16 ``icmp.checksum`` Checksum
18+
4 32 ``icmp.data`` Message Body
19+
======= ========= ======================= ===================================
20+
21+
.. autoclass:: pcapkit.protocols.internet.icmp.ICMP
22+
:no-members:
23+
:show-inheritance:
24+
25+
.. autoproperty:: name
26+
.. autoproperty:: alias
27+
.. autoproperty:: length
28+
29+
.. automethod:: id
30+
.. automethod:: register_type
31+
32+
.. automethod:: read
33+
.. automethod:: make
34+
35+
.. automethod:: _make_data
36+
37+
.. automethod:: _read_data_type_none
38+
.. automethod:: _read_data_type_echo
39+
.. automethod:: _read_data_type_destination_unreachable
40+
.. automethod:: _read_data_type_time_exceeded
41+
.. automethod:: _read_data_type_parameter_problem
42+
43+
.. automethod:: _make_data_type_none
44+
.. automethod:: _make_data_type_echo
45+
.. automethod:: _make_data_type_destination_unreachable
46+
.. automethod:: _make_data_type_time_exceeded
47+
.. automethod:: _make_data_type_parameter_problem
48+
49+
.. autoattribute:: __type__
50+
:no-value:
51+
52+
.. automethod:: __length_hint__
53+
.. automethod:: __index__
54+
55+
Header Schemas
56+
--------------
57+
58+
.. module:: pcapkit.protocols.schema.internet.icmp
59+
60+
.. autoclass:: pcapkit.protocols.schema.internet.icmp.ICMP
61+
:members:
62+
:show-inheritance:
63+
64+
.. autoclass:: pcapkit.protocols.schema.internet.icmp.ICMPType
65+
:members:
66+
:show-inheritance:
67+
68+
.. autoclass:: pcapkit.protocols.schema.internet.icmp.Unknown
69+
:members:
70+
:show-inheritance:
71+
72+
.. autoclass:: pcapkit.protocols.schema.internet.icmp.Echo
73+
:members:
74+
:show-inheritance:
75+
76+
.. autoclass:: pcapkit.protocols.schema.internet.icmp.DestinationUnreachable
77+
:members:
78+
:show-inheritance:
79+
80+
.. autoclass:: pcapkit.protocols.schema.internet.icmp.TimeExceeded
81+
:members:
82+
:show-inheritance:
83+
84+
.. autoclass:: pcapkit.protocols.schema.internet.icmp.ParameterProblem
85+
:members:
86+
:show-inheritance:
87+
88+
Auxiliary Functions
89+
~~~~~~~~~~~~~~~~~~~~
90+
91+
.. autofunction:: pcapkit.protocols.schema.internet.icmp.icmp_data_selector
92+
93+
Data Models
94+
-----------
95+
96+
.. module:: pcapkit.protocols.data.internet.icmp
97+
98+
.. autoclass:: pcapkit.protocols.data.internet.icmp.ICMP
99+
:members:
100+
:show-inheritance:
101+
102+
.. autoclass:: pcapkit.protocols.data.internet.icmp.Unknown
103+
:members:
104+
:show-inheritance:
105+
106+
.. autoclass:: pcapkit.protocols.data.internet.icmp.Echo
107+
:members:
108+
:show-inheritance:
109+
110+
.. autoclass:: pcapkit.protocols.data.internet.icmp.DestinationUnreachable
111+
:members:
112+
:show-inheritance:
113+
114+
.. autoclass:: pcapkit.protocols.data.internet.icmp.TimeExceeded
115+
:members:
116+
:show-inheritance:
117+
118+
.. autoclass:: pcapkit.protocols.data.internet.icmp.ParameterProblem
119+
:members:
120+
:show-inheritance:
121+
122+
.. rubric:: Footnotes
123+
124+
.. [*] https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol

0 commit comments

Comments
 (0)