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
15 changes: 15 additions & 0 deletions docs/source/pcapkit/const/ftp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ companion :class:`~pcapkit.const.ftp.command.FEATCode` enumeration it also decla
the ``FEAT`` response keywords the ``FEAT code`` column of the same IANA registry
names, c.f., :rfc:`5797#section-3`.

.. versionchanged:: 1.5.0

Neither ``Command._missing_`` nor ``Command.get()`` mints a member
(:issue:`860`): only IANA-registered values are members, and a new one is
created through :meth:`~pcapkit.const.ftp.command.Command.register`, which
can supply the ``feat``, ``desc``, ``type`` and ``conf`` a bare wire command
word carries none of. A minted member had each of them at its default.

``Command.get()`` refuses a non-:class:`str` ``key`` with
:exc:`~pcapkit.utilities.exceptions.EnumValueError`, with or without
``default`` (:issue:`1824`). ``get(42)`` and ``get(None)`` raised
:exc:`AttributeError` from ``key.upper()``, and ``get(b'ABOR')`` returned an
unregistered member whose name and value were both the :class:`bytes`
object.

.. autoclass:: pcapkit.const.ftp.command.Command
:members:
:undoc-members:
Expand Down
15 changes: 15 additions & 0 deletions docs/source/pcapkit/const/http.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ HTTP Method
This module contains the constant enumeration for **HTTP Method**,
which is automatically generated from :class:`pcapkit.vendor.http.method.Method`.

.. versionchanged:: 1.5.0

Neither ``Method._missing_`` nor ``Method.get()`` mints a member
(:issue:`860`): only IANA-registered values are members, and a new one is
created through :meth:`~pcapkit.corekit.enum.EnumRegistry.register`, which
can supply the ``safe`` and ``idempotent`` a bare wire method verb carries
neither of. A member's :class:`str` payload is its value, so
``Method.GET == 'GET'`` (:issue:`870`).

``Method.get()`` matches ``key`` case-sensitively, as :rfc:`9110` makes the
method token (:issue:`896`), and checks it against member values as well as
names (:issue:`908`). A non-:class:`str` ``key`` raises :exc:`ValueError`
(:issue:`908`): ``get(42)`` and ``get(None)`` raised :exc:`AttributeError`
from ``key.upper()``, and ``get(b'GET')`` raised :exc:`TypeError`.

.. autoclass:: pcapkit.const.http.method.Method
:members:
:undoc-members:
Expand Down
5 changes: 5 additions & 0 deletions docs/source/pcapkit/const/ipv6.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ IPv6 Extension Header Types
This module contains the constant enumeration for **IPv6 Extension Header Types**,
which is automatically generated from :class:`pcapkit.vendor.ipv6.extension_header.ExtensionHeader`.

.. versionchanged:: 1.5.0

Generated from IANA's *IPv6 Extension Header Types* registry, where it was
generated from the protocol-numbers registry (:issue:`925`).

.. autoclass:: pcapkit.const.ipv6.extension_header.ExtensionHeader
:members:
:undoc-members:
Expand Down
9 changes: 9 additions & 0 deletions docs/source/pcapkit/const/pcapng.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ Option Types
This module contains the constant enumeration for **Option Types**,
which is automatically generated from :class:`pcapkit.vendor.pcapng.option_type.OptionType`.

.. versionchanged:: 1.1.0

A member converts with :class:`int` to its option code, and compares,
orders and hashes as that code.

.. autoclass:: pcapkit.const.pcapng.option_type.OptionType
:members:
:undoc-members:
Expand Down Expand Up @@ -126,6 +131,10 @@ TLS Key Log Labels
This module contains the constant enumeration for **TLS Key Log Labels**,
which is automatically generated from :class:`pcapkit.vendor.pcapng.tls_key_label.TLSKeyLabel`.

.. versionadded:: 1.5.0

Moved here from ``pcapkit.protocols.misc.pcapng`` (:issue:`886`).

.. autoclass:: pcapkit.const.pcapng.tls_key_label.TLSKeyLabel
:members:
:undoc-members:
Expand Down
25 changes: 25 additions & 0 deletions docs/source/pcapkit/const/reg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,38 @@ Numbers**, which are automatically generated from :mod:`pcapkit.vendor.reg.appty
IANA keys every assignment on a ``(service, port, transport)`` triple, so the
registry is one enumeration per transport protocol sharing a memberless base.

.. versionchanged:: 1.5.0

Split by transport protocol (:issue:`732`): :mod:`pcapkit.const.reg.apptype`
is a package, and every assignment is a member of one of the per-transport
registries rather than of :class:`~pcapkit.const.reg.apptype.apptype.AppType`.
``get()`` raises :exc:`ValueError` for a port outside ``0``-``65535``
(:issue:`758`), and returns an unregistered member rather than minting one
for a port the registry does not assign (:issue:`860`).

.. module:: pcapkit.const.reg.apptype.apptype

.. versionchanged:: 1.5.0

:class:`~pcapkit.const.reg.apptype.apptype.TransportProtocol` is an
``aenum.IntEnum`` rather than an ``aenum.IntFlag`` (:issue:`808`), numbered
sequentially: ``sctp`` is ``3`` and ``dccp`` is ``4``, where they were ``4``
and ``8``, and no :class:`int` is decoded as a ``|`` composite
(:issue:`860`). Its ``get()`` refuses a name no member declares, with
:exc:`~pcapkit.utilities.exceptions.EnumKeyError`, rather than minting a
member for it (:issue:`808`, :issue:`923`).

.. autoclass:: pcapkit.const.reg.apptype.apptype.TransportProtocol
:members:
:undoc-members:
:show-inheritance:

.. versionchanged:: 1.1.1

An :class:`~pcapkit.const.reg.apptype.apptype.AppType` member converts with
:class:`int` to its port number, and compares, orders and hashes as that
port.

.. autoclass:: pcapkit.const.reg.apptype.apptype.AppType
:members:
:undoc-members:
Expand Down
5 changes: 5 additions & 0 deletions docs/source/pcapkit/const/tcp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ TCP Header Flags
This module contains the constant enumeration for **TCP Header Flags**,
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
:mod:`aenum` composed a pseudo-member for any integer.

.. autoclass:: pcapkit.const.tcp.flags.Flags
:members:
:undoc-members:
Expand Down
24 changes: 1 addition & 23 deletions pcapkit/const/ftp/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,20 +264,7 @@ class defines neither ``get`` nor ``_missing_`` of its own to reconcile


class Command(EnumRegistry, StrEnum):
"""[Command] FTP Command

.. versionchanged:: 1.5.0

Neither ``_missing_`` nor ``get()`` mints a member. The owner ruled on
GitHub issue :issue:`860` that ``get`` should not mint: only IANA-registered
values are legitimate members, a new one is properly created through
:meth:`register`, and ``get`` is not given enough information to create
one. Concretely true here -- a bare wire command word carries no
:attr:`feat`/:attr:`desc`/:attr:`type`/:attr:`conf`, so a minted member
had each of them hollowed out to its default; :meth:`register` is the
path that can actually supply them.

"""
"""[Command] FTP Command"""

if TYPE_CHECKING:
#: Feature code. Keyword returned in FEAT response line for this command/extension,
Expand Down Expand Up @@ -589,15 +576,6 @@ def get(cls, key: 'str', default: 'Optional[str]' = None) -> 'Command':
*registered* value. A refused ``key`` therefore raises whatever
``default`` is.

.. versionchanged:: 1.5.0

A non-:class:`str` ``key`` raises
:exc:`~pcapkit.utilities.exceptions.EnumValueError`, with or
without ``default`` (:issue:`1824`). ``get(42)`` and ``get(None)``
raised :exc:`AttributeError` from ``key.upper()``, and
``get(b'ABOR')`` returned an unregistered member whose name and
value were both the :class:`bytes` object.

Args:
key: Key to get enum item. Looked up case-insensitively, as
:rfc:`959#section-5` treats FTP command codes, against member
Expand Down
23 changes: 1 addition & 22 deletions pcapkit/const/http/method.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,7 @@
__all__ = ['Method']

class Method(EnumRegistry, StrEnum):
"""[Method] HTTP Method

.. versionchanged:: 1.5.0

Neither ``_missing_`` nor ``get()`` mints a member, per the owner's
ruling on GitHub issue :issue:`860`: only IANA-registered values are
legitimate members, and a new one is created through :meth:`register`,
which can supply :attr:`safe` and :attr:`idempotent` where a bare wire
method verb carries neither. ``get()`` matches ``key`` case-sensitively,
as :rfc:`9110` makes the method token (:issue:`896`), and checks it
against member values as well as names (:issue:`908`). A member's
:class:`str` payload is its value, so ``Method.GET == 'GET'``
(:issue:`870`).

"""
"""[Method] HTTP Method"""

if TYPE_CHECKING:
#: Safe method.
Expand Down Expand Up @@ -246,13 +232,6 @@ def get(cls, key: 'str', default: 'Optional[str]' = None) -> 'Method':
this override's ``default`` supplies the *value* of the
unregistered member it builds on a miss.

.. versionchanged:: 1.5.0

A non-:class:`str` ``key`` raises :exc:`ValueError`
(:issue:`908`). ``get(42)`` and ``get(None)`` raised
:exc:`AttributeError` from ``key.upper()``, and ``get(b'GET')``
raised :exc:`TypeError`.

Args:
key: Key to get enum item. Looked up case-**sensitively**,
per :rfc:`9110#section-9.1` -- the method token is
Expand Down
9 changes: 1 addition & 8 deletions pcapkit/const/ipv6/extension_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,7 @@


class ExtensionHeader(EnumRegistry, IntEnum):
"""[ExtensionHeader] IPv6 Extension Header Types

.. versionchanged:: 1.5.0

Generated from IANA's *IPv6 Extension Header Types* registry, where it
was generated from the protocol-numbers registry (:issue:`925`).

"""
"""[ExtensionHeader] IPv6 Extension Header Types"""

#: HOPOPT, IPv6 Hop-by-Hop Option [:rfc:`8200`]
HOPOPT = 0
Expand Down
9 changes: 1 addition & 8 deletions pcapkit/const/pcapng/option_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,7 @@


class OptionType(EnumRegistry, StrEnum):
"""[OptionType] Option Types

.. versionchanged:: 1.1.0

A member converts with :class:`int` to its option code, and compares,
orders and hashes as that code.

"""
"""[OptionType] Option Types"""

if TYPE_CHECKING:
#: Short name of the option type.
Expand Down
8 changes: 1 addition & 7 deletions pcapkit/const/pcapng/tls_key_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@


class TLSKeyLabel(EnumRegistry, StrEnum):
"""[TLSKeyLabel] TLS Key Log Labels

.. versionadded:: 1.5.0

Moved here from ``pcapkit.protocols.misc.pcapng`` (:issue:`886`).

"""
"""[TLSKeyLabel] TLS Key Log Labels"""

#: NSS-historical: not a registered label of :rfc:`9850#section-4.2`'s "TLS
#: SSLKEYLOGFILE Labels" registry. Defined by the Mozilla NSS
Expand Down
27 changes: 1 addition & 26 deletions pcapkit/const/reg/apptype/apptype.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,7 @@


class TransportProtocol(EnumLookup, IntEnum):
"""Transport layer protocol.

.. versionchanged:: 1.5.0

An ``aenum.IntEnum`` rather than an ``aenum.IntFlag`` (:issue:`808`),
numbered sequentially: ``sctp`` is ``3`` and ``dccp`` is ``4``, where
they were ``4`` and ``8``, and no :class:`int` is decoded as a ``|``
composite (:issue:`860`). :meth:`get` refuses a name no member
declares, with :exc:`~pcapkit.utilities.exceptions.EnumKeyError`,
rather than minting a member for it (:issue:`808`, :issue:`923`).

"""
"""Transport layer protocol."""

# mypy has no aenum plugin, so this class is a plain class to it: every
# member below is cast rather than left as a bare auto()-valued one --
Expand Down Expand Up @@ -234,20 +223,6 @@ class AppType(EnumRegistry, StrEnum):
makes it subclassable at all, since :mod:`aenum` refuses to extend an
enumeration that already has members.

.. versionchanged:: 1.1.1

A member converts with :class:`int` to its port number, and compares,
orders and hashes as that port.

.. versionchanged:: 1.5.0

Split by transport protocol (:issue:`732`): :mod:`pcapkit.const.reg.apptype`
is a package, and every assignment is a member of one of the per-transport
registries rather than of this class. ``get()`` raises
:exc:`ValueError` for a port outside ``0``-``65535`` (:issue:`758`), and
returns an unregistered member rather than minting one for a port the
registry does not assign (:issue:`860`).

Note:
The rows below are the registry entries whose **transport protocol column
is empty**. A blank transport is not an assignment to anything, so there
Expand Down
9 changes: 1 addition & 8 deletions pcapkit/const/tcp/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,7 @@
__all__ = ['Flags']

class Flags(EnumRegistry, IntFlag):
"""[Flags] TCP Header Flags

.. versionchanged:: 1.5.0

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

"""
"""[Flags] TCP Header Flags"""

#: Reserved for future use [:rfc:`9293`]
Reserved_4 = 1 << 4
Expand Down
24 changes: 1 addition & 23 deletions pcapkit/vendor/ftp/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,20 +276,7 @@ class defines neither ``get`` nor ``_missing_`` of its own to reconcile


class {NAME}(EnumRegistry, StrEnum):
"""[{NAME}] {DOCS}

.. versionchanged:: 1.5.0

Neither ``_missing_`` nor ``get()`` mints a member. The owner ruled on
GitHub issue :issue:`860` that ``get`` should not mint: only IANA-registered
values are legitimate members, a new one is properly created through
:meth:`register`, and ``get`` is not given enough information to create
one. Concretely true here -- a bare wire command word carries no
:attr:`feat`/:attr:`desc`/:attr:`type`/:attr:`conf`, so a minted member
had each of them hollowed out to its default; :meth:`register` is the
path that can actually supply them.

"""
"""[{NAME}] {DOCS}"""

if TYPE_CHECKING:
#: Feature code. Keyword returned in FEAT response line for this command/extension,
Expand Down Expand Up @@ -423,15 +410,6 @@ def get(cls, key: 'str', default: 'Optional[str]' = None) -> '{NAME}':
*registered* value. A refused ``key`` therefore raises whatever
``default`` is.

.. versionchanged:: 1.5.0

A non-:class:`str` ``key`` raises
:exc:`~pcapkit.utilities.exceptions.EnumValueError`, with or
without ``default`` (:issue:`1824`). ``get(42)`` and ``get(None)``
raised :exc:`AttributeError` from ``key.upper()``, and
``get(b'ABOR')`` returned an unregistered member whose name and
value were both the :class:`bytes` object.

Args:
key: Key to get enum item. Looked up case-insensitively, as
:rfc:`959#section-5` treats FTP command codes, against member
Expand Down
23 changes: 1 addition & 22 deletions pcapkit/vendor/http/method.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,7 @@
__all__ = ['{NAME}']

class {NAME}(EnumRegistry, StrEnum):
"""[{NAME}] {DOCS}

.. versionchanged:: 1.5.0

Neither ``_missing_`` nor ``get()`` mints a member, per the owner's
ruling on GitHub issue :issue:`860`: only IANA-registered values are
legitimate members, and a new one is created through :meth:`register`,
which can supply :attr:`safe` and :attr:`idempotent` where a bare wire
method verb carries neither. ``get()`` matches ``key`` case-sensitively,
as :rfc:`9110` makes the method token (:issue:`896`), and checks it
against member values as well as names (:issue:`908`). A member's
:class:`str` payload is its value, so ``Method.GET == 'GET'``
(:issue:`870`).

"""
"""[{NAME}] {DOCS}"""

if TYPE_CHECKING:
#: Safe method.
Expand Down Expand Up @@ -151,13 +137,6 @@ def get(cls, key: 'str', default: 'Optional[str]' = None) -> '{NAME}':
this override's ``default`` supplies the *value* of the
unregistered member it builds on a miss.

.. versionchanged:: 1.5.0

A non-:class:`str` ``key`` raises :exc:`ValueError`
(:issue:`908`). ``get(42)`` and ``get(None)`` raised
:exc:`AttributeError` from ``key.upper()``, and ``get(b'GET')``
raised :exc:`TypeError`.

Args:
key: Key to get enum item. Looked up case-**sensitively**,
per :rfc:`9110#section-9.1` -- the method token is
Expand Down
9 changes: 1 addition & 8 deletions pcapkit/vendor/ipv6/extension_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,7 @@


class {NAME}(EnumRegistry, IntEnum):
"""[{NAME}] {DOCS}

.. versionchanged:: 1.5.0

Generated from IANA's *IPv6 Extension Header Types* registry, where it
was generated from the protocol-numbers registry (:issue:`925`).

"""
"""[{NAME}] {DOCS}"""

{ENUM}

Expand Down
Loading
Loading