Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 50 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,56 @@
# and *zero* ``py:`` objects (5-8 objects apiece), so no ``:mod:``,
# ``:class:`` or ``:func:`` cross-reference into them could ever resolve.
#
# Those packages are therefore referenced as plain external links instead, the
# ``.. _PyPCAP: https://github.com/pynetwork/pypcap`` style used throughout
# ``pcapkit/foundation/engines/3rdparty.rst``.
# Those packages are therefore linked to their project pages instead, through
# :data:`rst_epilog` below (:issue:`1936`).

#: Every third-party project page the docs link to, defined once for all pages.
#: Sphinx appends this to every source file, and so to every page autodoc
#: assembles from docstrings, so a page or a docstring must not define these
#: names again: a second substitution definition of one name is an error, and a
#: second target of one name warns as soon as the two disagree on the URL.
#:
#: ``|pkg|_`` renders the import name as a literal linked to the project, for a
#: package or module of a package with no ``py:`` objects to cross-reference,
#: and `Name`_ links the project by its own name. Target names are
#: case-insensitive, so `PyShark`_ and ``|pyshark|_`` share one target. A name
#: below a package, such as ``dpkt.dpkt.Packet.data``, stays a plain literal,
#: since it would link to the same project page. ``pcap`` has no substitution:
#: `PyPCAP`_ and `pcap-ct`_ both install that module, so no one project page is
#: the right target for it.
rst_epilog = """
.. |aenum| replace:: ``aenum``
.. _aenum: https://github.com/ethanfurman/aenum
.. |chardet| replace:: ``chardet``
.. _chardet: https://chardet.readthedocs.io
.. |cryptography| replace:: ``cryptography``
.. _cryptography: https://cryptography.io
.. _DictDumper: https://dictdumper.jarryshaw.me
.. |dpkt| replace:: ``dpkt``
.. _DPKT: https://dpkt.readthedocs.io
.. |emoji| replace:: ``emoji``
.. _emoji: https://carpedm20.github.io/emoji/docs/
.. |jspcapy| replace:: ``jspcapy``
.. _jspcapy: https://github.com/JarryShaw/jspcapy
.. |pcap-ct| replace:: ``pcap-ct``
.. _pcap-ct: https://pypi.org/project/pcap-ct/
.. |pcapfile| replace:: ``pcapfile``
.. _pcapfile: https://github.com/kisom/pypcapfile
.. |pycrate| replace:: ``pycrate``
.. _pycrate: https://github.com/pycrate-org/pycrate
.. |pypcap| replace:: ``pypcap``
.. _PyPCAP: https://github.com/pynetwork/pypcap
.. |pypcapfile| replace:: ``pypcapfile``
.. _PyPCAPFile: https://github.com/kisom/pypcapfile
.. |pyshark| replace:: ``pyshark``
.. _PyShark: https://kiminewt.github.io/pyshark
.. |requests| replace:: ``requests``
.. _requests: https://requests.readthedocs.io
.. _Scapy: https://scapy.net
.. |tbtrim| replace:: ``tbtrim``
.. _tbtrim: https://github.com/gousaiyang/tbtrim
.. _Werkzeug: https://werkzeug.palletsprojects.com/
"""

autodoc_default_options = {
# 'members': True,
Expand Down
6 changes: 3 additions & 3 deletions docs/source/contributing/conventions/mint-criterion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ a style preference**:
does not grow, and a second lookup of the same value builds an equal but distinct
object rather than handing back the first.

``super()._missing_(value)`` -- *hand back to* ``aenum``
Neither of the above. For an ``aenum`` flag base this composes a pseudo-member and
``super()._missing_(value)`` -- *hand back to* |aenum|_
Neither of the above. For an |aenum|_ flag base this composes a pseudo-member and
caches it in ``_value2member_map_`` only, so ``__members__`` and iteration are
unchanged but a second lookup returns the same object. For a plain enum it
returns ``None`` and the lookup raises :exc:`ValueError`; the measured case is
Expand Down Expand Up @@ -61,7 +61,7 @@ Measured against the tree, by class:
no unassigned value is left for ``super()._missing_`` (the line after the check is
unreachable).

Note that these are ``aenum`` classes: ``issubclass(Flags, enum.IntFlag)`` is ``False``
Note that these are |aenum|_ classes: ``issubclass(Flags, enum.IntFlag)`` is ``False``
against the standard library and ``True`` against ``aenum.IntFlag``, so a probe against
``enum`` answers about the wrong hierarchy.

Expand Down
4 changes: 2 additions & 2 deletions docs/source/contributing/conventions/process.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ back to the default engine rather than raising when a requested engine is absent

.. note::

mypy types the engine packages that ship no types -- ``dpkt``, ``pyshark``,
``pcap`` and ``pcapfile`` -- from local stubs under :file:`typings/`, which
mypy types the engine packages that ship no types -- |dpkt|_, |pyshark|_,
``pcap`` and |pcapfile|_ -- from local stubs under :file:`typings/`, which
:file:`mypy.ini` registers through ``mypy_path`` and which ship in neither the
wheel nor the sdist (:issue:`1878`). ``scapy`` ships its own. A stub declares only
what :mod:`pcapkit` uses and cites the version it was written against, so a name
Expand Down
8 changes: 4 additions & 4 deletions docs/source/contributing/conventions/registry-protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ What is easy to get wrong about it:
With **no usable** ``default``, the rejection reaches the caller **unwrapped**.
``get`` re-raises a :exc:`ValueError` that is already a
:exc:`~pcapkit.utilities.exceptions.BaseError` exactly as the override raised it,
and converts only ``aenum``'s and :mod:`enum`'s own "no member carries this
and converts only |aenum|_'s and :mod:`enum`'s own "no member carries this
value". The consequence is the point of the discrimination rather than a side
effect: the override's **own message** survives to the caller instead of being
replaced by the base's. So an override should say in its message what it rejected
Expand All @@ -120,7 +120,7 @@ What is easy to get wrong about it:
:class:`~pcapkit.corekit.enum.EnumLookup` was **phase 2** of
:issue:`877`, and it is **complete**: the phase landed for every non-registry
enumeration. **No enumeration remains outside the hierarchy**, measured by a
runtime walk over both the :mod:`enum` and ``aenum`` flavours.
runtime walk over both the :mod:`enum` and |aenum|_ flavours.

Failed-Lookup Exceptions
~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -189,7 +189,7 @@ installed, the interpreter's own unless an earlier loud error installed
``cls(key)`` in a block declaring that it catches :exc:`ValueError` itself, so the
loud :exc:`~pcapkit.utilities.exceptions.EnumValueError` a generated override
raises is constructed quietly without the override passing ``quiet=True``, and
the error ``get`` converts from ``aenum``'s own is raised quiet as well. An error
the error ``get`` converts from |aenum|_'s own is raised quiet as well. An error
of any other class is not a lookup miss, and stays loud.
* :meth:`~pcapkit.corekit.enum.EnumRegistry.register` **stays loud**, even when
reached from inside such a block: refusing a mint the caller explicitly asked for
Expand Down Expand Up @@ -400,7 +400,7 @@ The population it covers is every :class:`~pcapkit.corekit.enum.EnumRegistry`
subclass, every one of them under :mod:`pcapkit.const` and each either
:class:`int`-valued (the flag registries among them) or ``aenum.StrEnum``-valued,
plus every non-registry enumeration a runtime walk over both the :mod:`enum` and
``aenum`` flavours finds, nested classes included -- such as ``FrameType.Flags`` in
|aenum|_ flavours finds, nested classes included -- such as ``FrameType.Flags`` in
:mod:`pcapkit.protocols.schema.application.httpv2` and its concrete per-frame
subclasses.

Expand Down
7 changes: 2 additions & 5 deletions docs/source/contributing/pep.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ that is not an HMAC needs more than a row --
:class:`~pcapkit.protocols.internet.esp.IntegritySuite` records the digest as
the name of a :mod:`hashlib` constructor, which AES-XCBC and AES-CMAC are not.
And :func:`~pcapkit.protocols.internet.esp.load_cryptography` imports only the
``ciphers`` submodules of ``cryptography``, so the AEAD and CMAC primitives
``ciphers`` submodules of |cryptography|_, so the AEAD and CMAC primitives
have to be added there before a cipher suite can reach them. Unsupported
algorithms are refused loudly, when the Security Association is constructed
rather than when a packet is read, so nothing decodes wrongly in the meantime.
Expand Down Expand Up @@ -582,9 +582,6 @@ and :meth:`~pcapkit.foundation.engines.engine.EngineBase.read_frame`; passing th
still apply is the unified auxiliary tools in :mod:`pcapkit.toolkit`, where
each engine has a matching module.

.. _pypcap: https://github.com/pynetwork/pypcap
.. _pypcapfile: https://github.com/kisom/pypcapfile

Test Cases
----------

Expand Down Expand Up @@ -831,7 +828,7 @@ the SCTP packet alone. Note also that SCTP's CRC32c is a hand-rolled lookup tabl
in :mod:`pcapkit.protocols.transport.sctp`, not a library call, so it is not
precedent for a dependency either.

**The cryptographic integrity checks** are where the ``cryptography``
**The cryptographic integrity checks** are where the |cryptography|_
dependency — introduced for ESP — genuinely buys something new, and half of that
is already done. :class:`~pcapkit.protocols.internet.esp.ESP` **already verifies
its ICV** when a Security Association is supplied, and deliberately reports a
Expand Down
7 changes: 0 additions & 7 deletions docs/source/ext.rst
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,6 @@ The available engines and the file formats they read:
which is why both exist. See
:doc:`pcapkit/foundation/engines/index` for which to pick.

.. _Scapy: https://scapy.net
.. _DPKT: https://dpkt.readthedocs.io
.. _PyShark: https://kiminewt.github.io/pyshark
.. _PyPCAP: https://github.com/pynetwork/pypcap
.. _pcap-ct: https://pypi.org/project/pcap-ct/
.. _PyPCAPFile: https://github.com/kisom/pypcapfile

Samples
~~~~~~~

Expand Down
19 changes: 5 additions & 14 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ About
There is a project called |jspcapy|_ that works on :mod:`pcapkit`, which is
a command line tool for PCAP extraction.

.. |jspcapy| replace:: ``jspcapy``
.. _jspcapy: https://github.com/JarryShaw/jspcapy

.. deprecated:: 0.8.0

The |jspcapy|_ project is deprecated and has been merged into the
Expand Down Expand Up @@ -190,7 +187,7 @@ Engine 3.10 3.11 3.12 3.13 3.14 3.15 [*]_
================== ======== ======== ======== =========== ======== ===========

.. [*] Inferred rather than measured: no 3.15 interpreter was available.
.. [*] ``pyshark`` also needs Wireshark's :program:`tshark`, which was absent here,
.. [*] |pyshark|_ also needs Wireshark's :program:`tshark`, which was absent here,
so only the interpreter half of each verdict in this row was verified.

``pypcap`` and ``pypcapfile`` stop at 3.11, and ``pyshark`` at 3.13, for the
Expand Down Expand Up @@ -382,17 +379,17 @@ preflight described under `Engine Comparison`_.
cleanly and then fails when used.

- Drives Wireshark's :program:`tshark` binary. It need not be on ``PATH``:
``pyshark`` looks at ``tshark_path`` in its :file:`config.ini` first, then
|pyshark|_ looks at ``tshark_path`` in its :file:`config.ini` first, then
``PATH`` on POSIX, both Program Files directories on Windows, and
:file:`/Applications/Wireshark.app` on macOS. Install Wireshark (or just
:program:`tshark`) from your platform's package manager.
- Requires Python **3.13 or older**. ``pyshark`` 0.6 builds its event loop
- Requires Python **3.13 or older**. |pyshark|_ 0.6 builds its event loop
with ``asyncio.get_event_loop_policy().get_event_loop()``, and from Python
**3.14** :func:`asyncio.get_event_loop` raises :exc:`RuntimeError` when there
is no current event loop instead of quietly creating one. Measured: a loop is
returned silently on 3.10 and 3.11, returned with a
:exc:`DeprecationWarning` on 3.12, and refused on 3.14. 3.13 sits on the
deprecated-but-functional side of that change, and ``pyshark`` extracted a
deprecated-but-functional side of that change, and |pyshark|_ extracted a
capture there.

:class:`~pcapkit.foundation.engines.pypcap.PyPCAP`
Expand Down Expand Up @@ -457,7 +454,7 @@ preflight described under `Engine Comparison`_.

Only the engines above carry extra constraints. :mod:`pcapkit` itself and
its ``default``, ``dpkt`` and ``scapy`` engines need nothing beyond their
``pip install`` -- ``dpkt`` 1.9.8 and ``scapy`` 2.7.0 were both measured
``pip install`` -- |dpkt|_ 1.9.8 and ``scapy`` 2.7.0 were both measured
reading a capture on Python 3.14. The ``scapy`` engine needs **scapy 2.6.0 or
newer**, which the ``Scapy`` extra requires: 2.5.0 can drop a PCAP-NG
interface's timestamp resolution, reading nanoseconds as microseconds
Expand All @@ -480,10 +477,4 @@ Indices and Tables
* :ref:`search`

.. _PCAP: https://en.wikipedia.org/wiki/Pcap
.. _Scapy: https://scapy.net
.. _DPKT: https://dpkt.readthedocs.io
.. _PyShark: https://kiminewt.github.io/pyshark
.. _PyPCAP: https://github.com/pynetwork/pypcap
.. _pcap-ct: https://pypi.org/project/pcap-ct/
.. _PyPCAPFile: https://github.com/kisom/pypcapfile
.. _libpcap: https://www.tcpdump.org
2 changes: 1 addition & 1 deletion docs/source/pcapkit/const/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Some behave otherwise, and :ref:`mint-criterion` gives the full split:
* :class:`~pcapkit.const.tcp.flags.Flags` and the Mobility Header flag
registries, such as
:class:`~pcapkit.const.mh.binding_ack_flag.BindingACKFlag`, hand back to
``aenum``'s flag base, which caches the composed object in the value lookup
|aenum|_'s flag base, which caches the composed object in the value lookup
table only: a second lookup returns the same object, while ``__members__``
and iteration are unchanged.
* :class:`~pcapkit.const.hip.transport.Transport`,
Expand Down
3 changes: 0 additions & 3 deletions docs/source/pcapkit/const/ngap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,3 @@ which is automatically generated from :class:`pcapkit.vendor.ngap.protocol_ie.Pr

.. [*] 3GPP TS 38.413
.. [*] 3GPP TS 38.413

.. |pycrate| replace:: ``pycrate``
.. _pycrate: https://github.com/pycrate-org/pycrate
2 changes: 1 addition & 1 deletion docs/source/pcapkit/const/tcp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ which is automatically generated from :class:`pcapkit.vendor.tcp.flags.Flags`.
.. versionchanged:: 1.5.0

A value outside the 16-bit field raises :exc:`ValueError`, where
``aenum`` composed a pseudo-member for any integer.
|aenum|_ composed a pseudo-member for any integer.

.. autoclass:: pcapkit.const.tcp.flags.Flags
:members:
Expand Down
2 changes: 0 additions & 2 deletions docs/source/pcapkit/corekit/multidict.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ Multi-Mapping Dictionary
:mod:`pcapkit.corekit.multidict` contains dictionaries that store multiple
values per key, based on the `Werkzeug`_ project.

.. _Werkzeug: https://werkzeug.palletsprojects.com/

.. autoclass:: pcapkit.corekit.multidict.MultiDict
:no-members:
:no-special-members: __init__
Expand Down
21 changes: 5 additions & 16 deletions docs/source/pcapkit/foundation/engines/3rdparty.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ Scapy Support
This module contains the implementation for `Scapy`_ engine
support, as is used by :class:`pcapkit.foundation.extraction.Extractor`.

.. _Scapy: https://scapy.net

.. note::

Constructing this engine imports ``scapy.all``, which populates `Scapy`_'s
Expand All @@ -28,7 +26,7 @@ support, as is used by :class:`pcapkit.foundation.extraction.Extractor`.

One side effect: ``scapy.all`` loads :mod:`scapy.layers.dcerpc`, which
reaches `Scapy`_'s TLS layer and there triggers a
``CryptographyDeprecationWarning`` from ``cryptography`` about
``CryptographyDeprecationWarning`` from |cryptography|_ about
finite-field Diffie-Hellman. It concerns a key-exchange code path
:mod:`pcapkit` never executes, but it subclasses :exc:`UserWarning` rather
than :exc:`DeprecationWarning`, so Python's default filters show it.
Expand Down Expand Up @@ -65,8 +63,6 @@ DPKT Support
This module contains the implementation for `DPKT`_ engine
support, as is used by :class:`pcapkit.foundation.extraction.Extractor`.

.. _DPKT: https://dpkt.readthedocs.io

.. note::

``dpkt.pcapng.Reader`` reads only the **first** Interface Description Block
Expand Down Expand Up @@ -106,8 +102,6 @@ PyShark Support
This module contains the implementation for `PyShark`_ engine
support, as is used by :class:`pcapkit.foundation.extraction.Extractor`.

.. _PyShark: https://kiminewt.github.io/pyshark

.. important::

`PyShark`_ has requirements beyond installing it, and none is
Expand All @@ -116,20 +110,20 @@ support, as is used by :class:`pcapkit.foundation.extraction.Extractor`.
:meth:`~pcapkit.foundation.engines.pyshark.PyShark.unsupported_reason` checks
both up front.

**Python 3.13 or older.** ``pyshark`` 0.6 builds its event loop with
**Python 3.13 or older.** |pyshark|_ 0.6 builds its event loop with
``asyncio.get_event_loop_policy().get_event_loop()``. With no running loop,
3.10 and 3.11 return a loop silently, 3.12 returns one with a
:exc:`DeprecationWarning`, and **3.14 raises**
``RuntimeError: There is no current event loop in thread 'MainThread'``. Python
3.13 is unchecked and expected to work, being on the deprecated-but-functional
side of that change.

**Wireshark's** :program:`tshark` **binary.** ``pyshark`` shells out to it and
parses nothing itself. It need not be on :envvar:`PATH`: ``pyshark`` consults
**Wireshark's** :program:`tshark` **binary.** |pyshark|_ shells out to it and
parses nothing itself. It need not be on :envvar:`PATH`: |pyshark|_ consults
``tshark_path`` in its :file:`config.ini` first, then :envvar:`PATH` on POSIX,
both Program Files directories on Windows, and
:file:`/Applications/Wireshark.app` on macOS. The check delegates to
``pyshark``'s own resolver for exactly that reason, so a correctly configured
|pyshark|_'s own resolver for exactly that reason, so a correctly configured
install off :envvar:`PATH` is not refused.

.. autoclass:: pcapkit.foundation.engines.pyshark.PyShark
Expand Down Expand Up @@ -157,8 +151,6 @@ PyPCAP Support
This module contains the implementation for `PyPCAP`_ engine
support, as is used by :class:`pcapkit.foundation.extraction.Extractor`.

.. _PyPCAP: https://github.com/pynetwork/pypcap

.. important::

`PyPCAP`_ publishes no wheels, so installing it compiles a C extension and
Expand Down Expand Up @@ -247,7 +239,6 @@ pcap-ct Support
This module contains the implementation for `pcap-ct`_ engine
support, as is used by :class:`pcapkit.foundation.extraction.Extractor`.

.. _pcap-ct: https://pypi.org/project/pcap-ct/
.. _libpcap: https://pypi.org/project/libpcap/

.. important::
Expand Down Expand Up @@ -393,8 +384,6 @@ PyPCAPFile Support
This module contains the implementation for `PyPCAPFile`_ engine
support, as is used by :class:`pcapkit.foundation.extraction.Extractor`.

.. _PyPCAPFile: https://github.com/kisom/pypcapfile

.. important::

`PyPCAPFile`_ is a pure Python savefile reader that decodes Ethernet, IPv4,
Expand Down
11 changes: 2 additions & 9 deletions docs/source/pcapkit/foundation/engines/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ parser -- but the extraction then does not use the engine requested.
| :class:`~pcapkit.foundation.engines.scapy.Scapy` | overrides ``unsupported_reason()`` |
+-----------------------------------------------------------------+---------------------------------------------------------------+
| :class:`~pcapkit.foundation.engines.pyshark.PyShark` | Wireshark's :program:`tshark` binary -- on ``PATH``, or |
| | wherever ``pyshark``'s :file:`config.ini` points -- **and** |
| | Python **3.13 or older**: ``pyshark`` 0.6 builds its event |
| | wherever |pyshark|_'s :file:`config.ini` points -- **and** |
| | Python **3.13 or older**: |pyshark|_ 0.6 builds its event |
| | loop with :func:`asyncio.get_event_loop`, which raises from |
| | 3.14 |
+-----------------------------------------------------------------+---------------------------------------------------------------+
Expand Down Expand Up @@ -240,10 +240,3 @@ actually got, via

.. _PCAP-NG: https://wiki.wireshark.org/Development/PcapNg
.. _libpcap: https://pypi.org/project/libpcap/

.. _Scapy: https://scapy.net
.. _DPKT: https://dpkt.readthedocs.io
.. _PyShark: https://kiminewt.github.io/pyshark
.. _PyPCAP: https://github.com/pynetwork/pypcap
.. _pcap-ct: https://pypi.org/project/pcap-ct/
.. _PyPCAPFile: https://github.com/kisom/pypcapfile
7 changes: 0 additions & 7 deletions docs/source/pcapkit/foundation/extraction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,3 @@ Type Variables
:type: typing.Any

Frame type the extractor yields, as read by its engine.

.. |pypcap| replace:: ``pypcap``
.. _pypcap: https://github.com/pynetwork/pypcap
.. |pcap-ct| replace:: ``pcap-ct``
.. _pcap-ct: https://pypi.org/project/pcap-ct/
.. |pypcapfile| replace:: ``pypcapfile``
.. _pypcapfile: https://github.com/kisom/pypcapfile
Loading
Loading