Registry Management

pcapkit.foundation.registry holds the registration functions for pcapkit’s engines, dumpers, callbacks and protocols.

A code the shipped enumerations do not define can still be registered: most constant enumerations return a member-like object for an in-range unknown value rather than rejecting it (see Unrecognised Values), so a newly assigned number needs no regeneration.

Foundation Registries

Changed in version 1.5.0: NULL, the default of every class_ argument here, is now the pcapkit.corekit.sentinels.NULL sentinel; in 1.4.x it was the string '(null)' (#833).

Changed in version 1.7.0: Each registrar takes the one entry its classmethod takes, under that classmethod’s parameter name, where it took module and class_, with no shim (#2838).

Engine Registries

pcapkit.foundation.registry.foundation.register_extractor_engine(name, engine)[source]

Register a new engine class.

The function will register the given engine class to the pcapkit.foundation.extraction.Extractor.__engine__ registry.

Parameters:
  • name (str) – engine name, stored lower-cased

  • engine (ModuleDescriptor[Engine] | Type[Engine]) – module descriptor or an Engine subclass (a class deriving only from EngineBase is refused: that is the base for pcapkit’s own engines, unless it is the engine name shipped with, which restores it)

Raises:

RegistryError – If name is not a str, or engine is refused as above.

Changed in version 1.3.0: The engine name, which was engine, is name, with no alias.

Changed in version 1.7.0: engine is the class, where module and class_ named it (#2838), and name is stored lower-cased (#2879).

Dumper Registries

pcapkit.foundation.registry.foundation.register_dumper(format, dumper, *, ext)[source]

Register a new dumper class.

The function will register the given dumper class to the pcapkit.foundation.traceflow.traceflow.TraceFlow.__output__ and pcapkit.foundation.extraction.Extractor.__output__ registries.

Parameters:
Return type:

None

Changed in version 1.3.0: ext is keyword-only.

Changed in version 1.7.0: dumper is the class, where module and class_ named it (#2838).

pcapkit.foundation.registry.foundation.register_extractor_dumper(format, dumper, *, ext)[source]

Register a new dumper class.

The function will register the given dumper class to the pcapkit.foundation.extraction.Extractor.__output__ registry.

Parameters:
Return type:

None

Changed in version 1.3.0: ext is keyword-only.

Changed in version 1.7.0: dumper is the class, where module and class_ named it (#2838).

pcapkit.foundation.registry.foundation.register_traceflow_dumper(format, dumper, *, ext)[source]

Register a new dumper class.

The function will register the given dumper class to the pcapkit.foundation.traceflow.traceflow.TraceFlow.__output__ registry.

Parameters:
Return type:

None

Changed in version 1.3.0: ext is keyword-only.

Changed in version 1.7.0: dumper is the class, where module and class_ named it (#2838).

Callback Registries

pcapkit.foundation.registry.foundation.register_reassembly_callback(protocol, callback, *, index=None)[source]

Register a callback function of a reassembler.

The function will register the given callback function to the __callback_fn__ list of the reassembly class registered under protocol in pcapkit.foundation.extraction.Extractor.__reassembly__, through its register_callback(). It reaches DTLS and a reassembler registered with register_extractor_reassembly() as it reaches IPv4, IPv6 and TCP.

Parameters:
  • protocol (str) – name the reassembler is registered by, case-insensitively, such as 'ipv4' or 'dtls'

  • callback (Callable[[List[_DT]], None]) – callback function, which will be called when reassembled datagram is obtained, with the list of reassembled datagrams as its only argument

  • index (int | None) – index to be inserted in the callback list; by default, the callback will be appended to the end of the list

Raises:

RegistryError – If protocol is not a str or names no registered reassembler, or if callback is not callable.

Return type:

None

Added in version 1.7.0.

pcapkit.foundation.registry.foundation.register_traceflow_callback(protocol, callback, *, index=None)[source]

Register a callback function of a flow tracer.

The function will register the given callback function to the __callback_fn__ list of the flow tracing class registered under protocol in pcapkit.foundation.extraction.Extractor.__traceflow__, through its register_callback().

Parameters:
  • protocol (str) – name the flow tracer is registered by, case-insensitively, such as 'tcp'

  • callback (Callable[[_IT], None]) – callback function, which will be called when a traced flow is finalised, with the flow’s index entry as its only argument

  • index (int | None) – index to be inserted in the callback list; by default, the callback will be appended to the end of the list

Raises:

RegistryError – If protocol is not a str or names no registered flow tracer, or if callback is not callable.

Return type:

None

Added in version 1.7.0.

Removed in version 1.7.0: register_reassembly_ipv4_callback, register_reassembly_ipv6_callback, register_reassembly_tcp_callback and register_traceflow_tcp_callback, which register_reassembly_callback() and register_traceflow_callback() replace with no alias (#2838).

Extractor Registries

pcapkit.foundation.registry.foundation.register_extractor_reassembly(protocol, reassembly)[source]

Register a new reassembly class.

The function will register the given reassembly class to the pcapkit.foundation.extraction.Extractor.__reassembly__ registry.

Parameters:
Raises:

RegistryError – If protocol is not a str, or reassembly is refused as above.

Changed in version 1.7.0: reassembly is the class, where module and class_ named it (#2838), and protocol is stored lower-cased, one that is not a str raising RegistryError (#2879).

pcapkit.foundation.registry.foundation.register_engine_reassembly(engine, protocol, adapter)[source]

Register a new reassembly adapter of an engine.

The function will register the given pcapkit.toolkit adapter to the EngineBase.__reassembly__ registry of engine, which then feeds the reassembler registered under protocol from its frames.

Parameters:
Raises:

RegistryError – If engine names no registered engine, or is not an EngineBase subclass.

Added in version 1.7.0.

pcapkit.foundation.registry.foundation.register_extractor_traceflow(protocol, traceflow)[source]

Register a new flow tracing class.

The function will register the given flow tracing class to the pcapkit.foundation.extraction.Extractor.__traceflow__ registry.

Parameters:
  • protocol (str) – protocol name, stored lower-cased

  • traceflow (ModuleDescriptor[TraceFlow] | Type[TraceFlow]) – module descriptor or a TraceFlow subclass (a class deriving only from TraceFlowBase is refused: that is the base for pcapkit’s own classes, unless it is the class protocol shipped with, which restores it)

Raises:

RegistryError – If protocol is not a str, or traceflow is refused as above.

Changed in version 1.7.0: traceflow is the class, where module and class_ named it (#2838), and protocol is stored lower-cased, one that is not a str raising RegistryError (#2879).

pcapkit.foundation.registry.foundation.register_engine_traceflow(engine, protocol, adapter)[source]

Register a new flow tracing adapter of an engine.

The function will register the given pcapkit.toolkit adapter to the EngineBase.__traceflow__ registry of engine, which then feeds the flow tracer registered under protocol from its frames.

Parameters:
Raises:

RegistryError – If engine names no registered engine, or is not an EngineBase subclass.

Added in version 1.7.0.

Protocol Registries

pcapkit.foundation.registry.protocols is a package of one submodule per layer of pcapkit.protocols, beside protocol for the registries the others build on. Every function below is exported by the package, and by pcapkit.foundation.registry, as well as by its own submodule.

Changed in version 1.5.0: NULL, the default of every class_ argument here, is now the pcapkit.corekit.sentinels.NULL sentinel; in 1.4.x it was the string '(null)' (#833).

Changed in version 1.6.0: A package of per-layer submodules rather than a single module (#2578).

Changed in version 1.7.0: Each registrar takes the one entry its classmethod takes, under that classmethod’s parameter name, where it took module and class_; one taking meth refuses a pair that is not two callables (#2838).

pcapkit.foundation.registry.protocols.protocol.register_protocol(protocol)[source]

Register a protocol class.

The protocol class must be a subclass of ProtocolBase, and will be registered to the by-name registry ProtocolBase.__registry__ through ProtocolBase.register_protocol, replacing the entry its name holds.

The registry is keyed on protocol.__name__.upper(), which nothing makes unique: two protocol classes of the same name, such as a user’s class named after a shipped one, compete for one key. Defining the second as a Protocol subclass keeps the first, and registering it here replaces whichever was there, and the replacement is observable through every reader of the registry, e.g. Protocol.expand_comp, which resolves a bare protocol name through it. Per #675 the overwrite is reported, matching Protocol.register and the other overwrite-warning registries.

The guard reads “key present and incumbent is a different class” – presence alone is not enough. This registry’s key is derived from the class rather than supplied by a caller, and this function is the funnel every wrapper registrar calls – register_tcp(), register_udp(), register_apptype(), register_linktype() and the rest all end by calling it with their class, and registering their code back undoes that call’s write (#1505). So registering one class under two codes, a supported and documented thing to do, reaches this function twice with the same class and nothing at stake; a presence-only guard would warn about an overwrite that overwrote nothing. Warning on the harmless case is not free: it teaches a caller to filter RegistryWarning wholesale, and that filter would then hide the name collision this warning exists to surface. The sibling register methods across the package, each keyed on a caller-supplied code, apply the same identity criterion (#718). A built-in’s ModuleDescriptor entry is the class it names for that criterion.

Making the key itself unique would resolve the collision rather than merely reporting it, but it is a registry-format change that the bare-name readers outside this module cannot absorb on their own – the registry is a documented public attribute, and its readers look a bare name up and then degrade silently on a miss rather than raising, so a re-keying would not announce itself either. Protocol.expand_comp falls back to the name as a plain string, and the protocol properties on ReassemblyMeta and TraceFlowMeta fall back to Raw. The registry redesign of #514 keeps this key, and its thread records the shared namespace as a risk that design does not resolve, so the collision is reported here rather than fixed.

Parameters:

protocol (Type[ProtocolBase]) – Protocol class.

Raises:

pcapkit.utilities.exceptions.RegistryError – If protocol is not a ProtocolBase subclass.

Warns:

pcapkit.utilities.warnings.RegistryWarning – If the registry already holds a different class under this protocol’s name, i.e. the registration displaced another protocol class. Re-registering the same class under the same name is silent.

Changed in version 1.6.0: The HTTP member classes are named HTTPv1 and HTTPv2, so registering one keeps its own key and no longer displaces HTTP under 'HTTP' (#2529). The registry is ProtocolBase.__registry__, written by ProtocolBase.register_protocol, where it was pcapkit.protocols.__proto__ (#2763).

pcapkit.foundation.registry.protocols.protocol.register_protocol_code(protocol, code)[source]

Register protocol into the next-layer dispatch registry (or registries) named by code.

This is what backs the code class keyword of ProtocolBase subclasses; it can also be called directly to register a class that declined at class-definition time.

code is normalised into a flat sequence of targets, where each item is either:

or an iterable of either, to register protocol into several registries from one call – e.g. a L2TP subclass reachable both by its IP protocol number and by a UDP port:

register_protocol_code(L2TPv3, [TransType.L2TP, {UDP: 1701}])

The explicit mapping form is accepted for any key, even one whose type could be inferred – being more explicit than required is never an error.

Note

That example names L2TPv3, which this package does not implement, rather than L2TPv2. It is v3 that is genuinely reachable both ways: RFC 3931 §4.1.1 puts it directly over IP on protocol 115 and §4.1.2 puts it over UDP on port 1701. L2TPv2 answers on port 1701 only, and registering it at TransType.L2TP would point the RFC 2661 parser at a v3-over-IP header – see L2TP and GitHub issue #548 for what that produced when measured.

Parameters:
  • protocol (Type[ProtocolBase]) – Protocol class to register.

  • code (Any) – Registration key(s); see above.

Raises:

RegistryError – If a bare int (or any other non-enum, non-mapping value) is given without an explicit destination, or if an enum member’s type declares no __proto_dest__ – inference refuses rather than guesses; or if a key is not of the type its destination’s registry is keyed by, as its typed registrar would reject it, e.g. {Frame: TransType.ICMP}. What a registry is keyed by is read from the __proto_key__ declared by the class owning it, so a destination sharing another’s registry is checked as its owner is, and one whose owner declares no pairing is not checked. Every target is checked before any is registered, so a rejected code leaves every registry as it was (#2268).

Top-Level Registries

These are in misc with the PCAP-NG registries below, as Frame and PCAPNG are in pcapkit.protocols.misc.

pcapkit.foundation.registry.protocols.misc.register_linktype(code, protocol)[source]

Register a new protocol class.

The function will register the given protocol class to the following registries:

Parameters:
Raises:

RegistryError – If code is not a LinkType member, e.g. a member of another enum, or protocol is not a ProtocolBase subclass.

pcapkit.foundation.registry.protocols.misc.register_pcap(code, protocol)[source]

Register a new protocol class.

The function will register the given protocol class to the pcapkit.protocols.misc.pcap.frame.protocol.Frame.__proto__ registry.

Parameters:
Raises:

RegistryError – If code is not a LinkType member, e.g. a member of another enum, or protocol is not a ProtocolBase subclass.

pcapkit.foundation.registry.protocols.misc.register_pcapng(code, protocol)[source]

Register a new protocol class.

The function will register the given protocol class to the pcapkit.protocols.misc.pcapng.protocol.PCAPNG.__proto__ registry.

Parameters:
Raises:

RegistryError – If code is not a LinkType member, e.g. a member of another enum, or protocol is not a ProtocolBase subclass.

Internet Layer Registries

pcapkit.foundation.registry.protocols.internet.register_transtype(code, protocol)[source]

Register a new protocol class.

The function will register the given protocol class to the pcapkit.protocols.internet.internet.Internet.__proto__ registry.

Parameters:
Raises:

RegistryError – If code is not a TransType member, e.g. a member of another enum, or protocol is not a ProtocolBase subclass.

pcapkit.foundation.registry.protocols.internet.register_ipx(code, protocol)[source]

Register a new protocol class.

The function will register the given protocol class to the pcapkit.protocols.internet.ipx.protocol.IPX.__proto__ registry.

Parameters:

Important

Unlike register_transtype(), code is an IPX Packet Type, not an IP protocol number: IPX keeps a registry of its own (#2169).

Raises:

RegistryError – If code is neither an int (a bool is not accepted, even though it is one) nor a Packet member, e.g. a TransType member, or protocol is not a ProtocolBase subclass.

Added in version 1.6.0.

pcapkit.foundation.registry.protocols.internet.register_ipv4_option(code, meth, *, schema=None)[source]

Register an option parser.

The function will register the given option parser to the pcapkit.protocols.internet.ipv4.protocol.IPv4.__option__ registry.

Parameters:
Raises:

RegistryError – If code is not a OptionNumber member, e.g. a member of another enum, or meth is a name with no matching _read_opt_* method, or neither a name nor a pair of two callables.

Return type:

None

pcapkit.foundation.registry.protocols.internet.register_icmp_type(code, meth)[source]

Register a message body parser.

The function will register the given message body parser to the __type__ registry when code is an ICMPv4 type, or to __type__ when it is an ICMPv6 type. Each registry is written by that class’s own register_type() classmethod.

Parameters:
  • code (Type | Type) – ICMP type as in Type or Type.

  • meth (str | tuple[Callable[..., Any], Callable[..., Any]]) – Method name, or a (parser, constructor) pair of callables, to parse and construct the message body. A name names the _read_data_type_* and _make_data_type_* methods of the protocol, and has to name an existing _read_data_type_* one.

Raises:

RegistryError – If code is not a member of either ICMP type enum, or meth is a name with no matching _read_data_type_* method, or neither a name nor a pair of two callables.

pcapkit.foundation.registry.protocols.internet.register_hip_parameter(code, meth, *, schema=None)[source]

Register a parameter parser.

The function will register the given parameter parser to the pcapkit.protocols.internet.hip.protocol.HIP.__parameter__ registry.

Parameters:
Raises:

RegistryError – If code is not a Parameter member, e.g. a member of another enum, or meth is a name with no matching _read_param_* method, or neither a name nor a pair of two callables.

Return type:

None

pcapkit.foundation.registry.protocols.internet.register_hopopt_option(code, meth, *, schema=None)[source]

Register an option parser.

The function will register the given option parser to the pcapkit.protocols.internet.hopopt.protocol.HOPOPT.__option__ registry.

Parameters:
Raises:

RegistryError – If code is not a Option member, e.g. a member of another enum, or meth is a name with no matching _read_opt_* method, or neither a name nor a pair of two callables.

Return type:

None

pcapkit.foundation.registry.protocols.internet.register_ipv6_opts_option(code, meth, *, schema=None)[source]

Register an option parser.

The function will register the given option parser to the pcapkit.protocols.internet.ipv6_opts.protocol.IPv6_Opts.__option__ registry.

Parameters:
Raises:

RegistryError – If code is not a Option member, e.g. a member of another enum, or meth is a name with no matching _read_opt_* method, or neither a name nor a pair of two callables.

Return type:

None

pcapkit.foundation.registry.protocols.internet.register_ipv6_route_routing(code, meth, *, schema=None)[source]

Register a routing data parser.

The function will register the given routing data parser to the pcapkit.protocols.internet.ipv6_route.protocol.IPv6_Route.__routing__ registry.

Parameters:
Raises:

RegistryError – If code is not a Routing member, e.g. a member of another enum, or meth is a name with no matching _read_data_type_* method, or neither a name nor a pair of two callables.

Return type:

None

pcapkit.foundation.registry.protocols.internet.register_mh_message(code, meth, *, schema=None)[source]

Register an MH message type parser.

The function will register the given message type parser to the pcapkit.protocols.internet.mh.protocol.MH.__message__ registry.

Parameters:
Raises:

RegistryError – If code is not a Packet member, e.g. a member of another enum, or meth is a name with no matching _read_msg_* method, or neither a name nor a pair of two callables.

Return type:

None

pcapkit.foundation.registry.protocols.internet.register_mh_option(code, meth, *, schema=None)[source]

Register an MH option parser.

The function will register the given option parser to the pcapkit.protocols.internet.mh.protocol.MH.__option__ registry.

Parameters:
Raises:

RegistryError – If code is not a Option member, e.g. a member of another enum, or meth is a name with no matching _read_opt_* method, or neither a name nor a pair of two callables.

Return type:

None

pcapkit.foundation.registry.protocols.internet.register_mh_extension(code, meth, *, schema=None)[source]

Register a CGA extension parser.

The function will register the given CGA extension parser to the pcapkit.protocols.internet.mh.protocol.MH.__extension__ registry.

Parameters:
Raises:

RegistryError – If code is not a CGAExtension member, e.g. a member of another enum, or meth is a name with no matching _read_ext_* method, or neither a name nor a pair of two callables.

Return type:

None

Changed in version 1.5.0: schema is keyword-only, as in the other register_* functions that take one (#516).

Transport Layer Registries

pcapkit.foundation.registry.protocols.transport.register_apptype(code, protocol, *, transport=None)[source]

Register a new protocol class.

The function will register the given protocol class to the pcapkit.protocols.transport.tcp.protocol.TCP.__proto__ and/or pcapkit.protocols.transport.udp.protocol.UDP.__proto__ registry.

Parameters:
Raises:

pcapkit.utilities.exceptions.RegistryError – If code is neither an int (a bool is not accepted, even though it is one) nor an AppType member, e.g. a member of another enum; if no transport protocol is given for a bare int; if one of those given (member or name) names no port-keyed registry; or if a str matches no TransportProtocol member’s name. A composite such as tcp | udp, or its string form 'tcp|udp', names two and is refused for the same reason: each item names one transport protocol.

Return type:

None

Important

SCTP is deliberately not one of the registries this writes to, so naming sctp here is an error rather than a no-op. Its __proto__ registry is keyed by the DATA or I-DATA chunk’s payload protocol identifier rather than by port number, so writing a port number into it would dispatch on a number from the wrong registry. Use pcapkit.foundation.registry.protocols.transport.register_sctp() instead.

Removed in version 1.3.1: register_port, which this replaces with no alias.

Changed in version 1.5.0: The keyword-only proto is replaced by *transport, one transport protocol per argument, with no alias (#806).

Changed in version 1.7.0: protocol replaces module and class_, and the keyword-only transport replaces *transport, with no shim (#2838).

pcapkit.foundation.registry.protocols.transport.register_tcp(code, protocol)[source]

Register a new protocol class.

The function will register the given protocol class to the pcapkit.protocols.transport.tcp.protocol.TCP.__proto__ registry.

Parameters:
Raises:

RegistryError – If code is neither an int (a bool is not accepted, even though it is one) nor an AppType member, e.g. a member of another enum.

pcapkit.foundation.registry.protocols.transport.register_tcp_option(code, meth, *, schema=None)[source]

Register an option parser.

The function will register the given option parser to the pcapkit.protocols.transport.tcp.protocol.TCP.__option__ registry.

Parameters:
Raises:

RegistryError – If code is not a Option member, e.g. a member of another enum, or meth is a name with no matching _read_mode_* method, or neither a name nor a pair of two callables.

Return type:

None

pcapkit.foundation.registry.protocols.transport.register_tcp_mp_option(code, meth, *, schema=None)[source]

Register an MPTCP option parser.

The function will register the given option parser to the pcapkit.protocols.transport.tcp.protocol.TCP.__mp_option__ registry.

Parameters:
Raises:

RegistryError – If code is not a MPTCPOption member, e.g. a member of another enum, or meth is a name with no matching _read_mptcp_* method, or neither a name nor a pair of two callables.

Return type:

None

pcapkit.foundation.registry.protocols.transport.register_udp(code, protocol)[source]

Register a new protocol class.

The function will register the given protocol class to the pcapkit.protocols.transport.udp.protocol.UDP.__proto__ registry.

Parameters:
Raises:

RegistryError – If code is neither an int (a bool is not accepted, even though it is one) nor an AppType member, e.g. a member of another enum.

pcapkit.foundation.registry.protocols.transport.register_sctp(code, protocol)[source]

Register a new protocol class.

The function will register the given protocol class to the pcapkit.protocols.transport.sctp.protocol.SCTP.__proto__ registry.

Parameters:

Important

Unlike register_tcp() and register_udp(), code is a payload protocol identifier taken from the DATA or I-DATA chunk, not a port number: SCTP names its upper layer per chunk rather than per association. See RFC 9260 Section 3.3.1 and RFC 8260 Section 2.1.

Raises:

RegistryError – If code is neither an int (a bool is not accepted, even though it is one) nor a PayloadProtocolIdentifier member, e.g. a member of the SCTP port enum.

pcapkit.foundation.registry.protocols.transport.register_sctp_chunk(code, meth, *, schema=None)[source]

Register a chunk parser.

The function will register the given chunk parser to the pcapkit.protocols.transport.sctp.protocol.SCTP.__chunk__ registry.

Parameters:
Raises:

RegistryError – If code is not a Chunk member, e.g. a member of another enum, or meth is a name with no matching _read_chunk_* method, or neither a name nor a pair of two callables.

Return type:

None

Added in version 1.6.0.

pcapkit.foundation.registry.protocols.transport.register_sctp_parameter(code, meth, *, schema=None)[source]

Register a chunk parameter parser.

The function will register the given chunk parameter parser to the pcapkit.protocols.transport.sctp.protocol.SCTP.__parameter__ registry.

Parameters:
Raises:

RegistryError – If code is not a Parameter member, e.g. a member of another enum, or meth is a name with no matching _read_param_* method, or neither a name nor a pair of two callables.

Return type:

None

Added in version 1.6.0.

pcapkit.foundation.registry.protocols.transport.register_sctp_cause(code, meth, *, schema=None)[source]

Register an error cause parser.

The function will register the given error cause parser to the pcapkit.protocols.transport.sctp.protocol.SCTP.__cause__ registry.

Parameters:
Raises:

RegistryError – If code is not a CauseCode member, e.g. a member of another enum, or meth is a name with no matching _read_cause_* method, or neither a name nor a pair of two callables.

Return type:

None

Added in version 1.6.0.

pcapkit.foundation.registry.protocols.transport.register_dccp(code, protocol)[source]

Register a new protocol class.

The function will register the given protocol class to the pcapkit.protocols.transport.dccp.protocol.DCCP.__proto__ registry.

Parameters:
Raises:

RegistryError – If code is neither an int (a bool is not accepted, even though it is one) nor an AppType member, e.g. a member of another enum.

Added in version 1.6.0.

pcapkit.foundation.registry.protocols.transport.register_dccp_option(code, meth, *, schema=None)[source]

Register an option parser.

The function will register the given option parser to the pcapkit.protocols.transport.dccp.protocol.DCCP.__option__ registry.

Parameters:
Raises:

RegistryError – If code is not a Option member, e.g. a member of another enum, or meth is a name with no matching _read_opt_* method, or neither a name nor a pair of two callables.

Return type:

None

Added in version 1.6.0.

Application Layer Registries

pcapkit.foundation.registry.protocols.application.register_dns_rdata(code, meth)[source]

Register an RDATA parser.

The function will register the given RDATA parser to the pcapkit.protocols.application.dns.protocol.DNS.__rdata__ registry.

Parameters:
Raises:

RegistryError – If code is not an RRType member, e.g. a member of another enum, or meth is a name with no matching _read_rdata_* method, or neither a name nor a pair of two callables.

Added in version 1.7.0.

pcapkit.foundation.registry.protocols.application.register_dns_option(code, meth)[source]

Register an EDNS(0) option parser.

The function will register the given option parser to the pcapkit.protocols.application.dns.protocol.DNS.__option__ registry.

Parameters:
Raises:

RegistryError – If code is not an Option member, e.g. a member of another enum, or meth is a name with no matching _read_opt_* method, or neither a name nor a pair of two callables.

Added in version 1.7.0.

pcapkit.foundation.registry.protocols.application.register_http_frame(code, meth, *, schema=None)[source]

Register a frame parser.

The function will register the given frame parser to the pcapkit.protocols.application.httpv2.protocol.HTTPv2.__frame__ registry.

Parameters:
Raises:

RegistryError – If code is not a Frame member, e.g. a member of another enum, or meth is a name with no matching _read_http_* method, or neither a name nor a pair of two callables.

Return type:

None

pcapkit.foundation.registry.protocols.application.register_tls_extension(code, meth, *, schema=None)[source]

Register an extension parser.

The function will register the given extension parser to the pcapkit.protocols.application.ssl.protocol.SSL.__extension__ registry, which TLS and DTLS share.

Parameters:
Raises:

RegistryError – If code is not an ExtensionType member, e.g. a member of another enum, or meth is a name with no matching _read_ext_* method, or neither a name nor a pair of two callables.

Return type:

None

Added in version 1.6.0.

Changed in version 1.7.0: Takes schema. The parser is handed the extension_data unpacked by that schema, and the constructor returns one, rather than octets (#2833).

Miscellaneous Protocol Registries

pcapkit.foundation.registry.protocols.misc.register_pcapng_block(code, meth, *, schema=None)[source]

Register a block parser.

The function will register the given block parser to the pcapkit.protocols.misc.pcapng.protocol.PCAPNG.__block__ registry.

Parameters:
Raises:

RegistryError – If code is not a BlockType member, e.g. a member of another enum, or meth is a name with no matching _read_block_* method, or neither a name nor a pair of two callables.

Return type:

None

pcapkit.foundation.registry.protocols.misc.register_pcapng_option(code, meth, *, schema=None)[source]

Register an option parser.

The function will register the given option parser to the pcapkit.protocols.misc.pcapng.protocol.PCAPNG.__option__ registry.

Parameters:
Raises:

RegistryError – If code is not a OptionType member, e.g. a member of another enum, or meth is a name with no matching _read_option_* method, or neither a name nor a pair of two callables.

Return type:

None

pcapkit.foundation.registry.protocols.misc.register_pcapng_record(code, meth, *, schema=None)[source]

Register a name resolution record parser.

The function will register the given name resolution record parser to the pcapkit.protocols.misc.pcapng.protocol.PCAPNG.__record__ registry.

Parameters:
Raises:

RegistryError – If code is not a RecordType member, e.g. a member of another enum, or meth is a name with no matching _read_record_* method, or neither a name nor a pair of two callables.

Return type:

None

pcapkit.foundation.registry.protocols.misc.register_pcapng_secrets(code, meth, *, schema=None)[source]

Register a decryption secrets parser.

The function will register the given decryption secrets parser to the pcapkit.protocols.misc.pcapng.protocol.PCAPNG.__secrets__ registry.

Parameters:
Raises:

RegistryError – If code is not a SecretsType member, e.g. a member of another enum, or meth is a name with no matching _read_secrets_* method, or neither a name nor a pair of two callables.

Return type:

None