Constant Enumerations

This module contains all constant enumerations of pcapkit, which are automatically generated from the pcapkit.vendor module.

Unrecognised Values

Nearly every registry below departs from enum in one deliberate way, and it is the behaviour to know about before using any of them: looking one up by a value it does not define does not raise. Its _missing_ override returns a member-like object for a value inside the registry’s valid range, named for the unassigned or reserved band it falls in. Only a value outside that range, or of the wrong type, raises ValueError.

In almost every registry that object is not installed: the registry does not grow, and a second lookup of the same value returns an equal but distinct object. A handful behave otherwise, and Minting an Unrecognised Value gives the full split:

  • CGAType installs a permanent member, so __members__ and iteration grow.

  • Flags and the four Mobility Header flag registries, such as BindingACKFlag, hand back to 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.

  • Transport, ExtensionHeader, TLSKeyLabel and the memberless AppType base raise ValueError for any unknown value.

That is what makes the enumerations usable against live capture data, where a protocol number assigned after this release was generated is a routine occurrence rather than an error. It also means an enumeration member is not a closed set: an unassigned value resolves to a member that is, apart from CGAType, absent from iteration and __members__, and whether a repeat lookup returns the same object varies by registry, so compare such members by value, not identity.

The common form of the override is generated – see pcapkit.vendor.default, whose template emits it – while the valid range and the names of the unassigned bands are per-registry, taken from that registry’s own IANA data. The individual overrides are therefore not documented per class.

See also

Registry Management covers the other half of extending a registry: once a code exists, registering a parser class, schema or engine against it.

Protocol Numbers

Internet Layer

Transport Layer

Application Layer

Miscellaneous