Registry Management#

This module (pcapkit.foundation.registry) provides the registry management for pcapkit, as the module contains various registry points.

Foundation Registries#

Engine Registries#

pcapkit.foundation.registry.foundation.register_extractor_engine(name, module, class_='(null)')[source]#

Registered a new engine class.

Notes

The full qualified class name of the new engine class should be as {module}.{class_}.

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

Parameters:
Return type:

None

Dumper Registries#

pcapkit.foundation.registry.foundation.register_dumper(format, module, class_='(null)', *, ext)[source]#

Registered a new dumper class.

Notes

The full qualified class name of the new dumper class should be as {module}.{class_}.

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

Parameters:
Return type:

None

pcapkit.foundation.registry.foundation.register_extractor_dumper(format, module, class_='(null)', *, ext)[source]#

Registered a new dumper class.

Notes

The full qualified class name of the new dumper class should be as {module}.{class_}.

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

Parameters:
Return type:

None

pcapkit.foundation.registry.foundation.register_traceflow_dumper(format, module, class_='(null)', *, ext)[source]#

Registered a new dumper class.

Notes

The full qualified class name of the new dumper class should be as {module}.{class_}.

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

Parameters:
Return type:

None

Callback Registries#

pcapkit.foundation.registry.foundation.register_reassembly_ipv4_callback(callback)[source]#

Registered a new callback function.

The function will register the given callback function to the IPv4.__callback_fn__ registry.

Parameters:

callback (Reasm_CallbackFn) – callback function

Return type:

None

pcapkit.foundation.registry.foundation.register_reassembly_ipv6_callback(callback)[source]#

Registered a new callback function.

The function will register the given callback function to the IPv6.__callback_fn__ registry.

Parameters:

callback (Reasm_CallbackFn) – callback function

Return type:

None

pcapkit.foundation.registry.foundation.register_reassembly_tcp_callback(callback)[source]#

Registered a new callback function.

The function will register the given callback function to the TCP.__callback_fn__ registry.

Parameters:

callback (Reasm_CallbackFn) – callback function

Return type:

None

pcapkit.foundation.registry.foundation.register_traceflow_tcp_callback(callback)[source]#

Registered a new callback function.

The function will register the given callback function to the TCP.__callback_fn__ registry.

Parameters:

callback (Trace_CallbackFn) – callback function

Return type:

None

Extractor Registries#

pcapkit.foundation.registry.foundation.register_extractor_reassembly(protocol, module, class_='(null)')[source]#

Registered a new reassembly class.

Notes

The full qualified class name of the new reassembly class should be as {module}.{class_}.

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

Parameters:
Return type:

None

pcapkit.foundation.registry.foundation.register_extractor_traceflow(protocol, module, class_='(null)')[source]#

Registered a new flow tracing class.

Notes

The full qualified class name of the new flow tracing class should be as {module}.{class_}.

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

Parameters:
Return type:

None

Protocol Registries#

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

Registered protocol class.

The protocol class must be a subclass of Protocol, and will be registered to the pcapkit.protocols.__proto__ registry.

Parameters:

protocol (Type[ProtocolBase]) – Protocol class.

Return type:

None

Top-Level Registries#

pcapkit.foundation.registry.protocols.register_linktype(code, module, class_='(null)')[source]#

Register a new protocol class.

Notes

The full qualified class name of the new protocol class should be as {module}.{class_}.

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

Parameters:
Return type:

None

pcapkit.foundation.registry.protocols.register_pcap(code, module, class_='(null)')[source]#

Register a new protocol class.

Notes

The full qualified class name of the new protocol class should be as {module}.{class_}.

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

Parameters:
Return type:

None

pcapkit.foundation.registry.protocols.register_pcapng(code, module, class_='(null)')[source]#

Register a new protocol class.

Notes

The full qualified class name of the new protocol class should be as {module}.{class_}.

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

Parameters:
Return type:

None

Internet Layer Registries#

pcapkit.foundation.registry.protocols.register_transtype(code, module, class_='(null)')[source]#

Register a new protocol class.

Notes

The full qualified class name of the new protocol class should be as {module}.{class_}.

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

Parameters:
Return type:

None

pcapkit.foundation.registry.protocols.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.internet.IPv4 internal registry.

Parameters:
  • code (IPv4_OptionNumber) – IPv4 option code as in OptionNumber.

  • meth (str | tuple[IPv4_OptionParser, IPv4_OptionConstructor]) – Method name or callable to parse and/or construct the option.

  • schema (Optional[Type[Schema_IPv4_Option]]) – Schema class for the option. It should be a subclass of pcapkit.protocols.schema.internet.ipv4.Option.

Return type:

None

pcapkit.foundation.registry.protocols.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.HIP internal registry.

Parameters:
  • code (HIP_Parameter) – HIP parameter code as in Parameter.

  • meth (str | tuple[HIP_ParameterParser, HIP_ParameterConstructor]) – Method name or callable to parse and/or construct the parameter.

  • schema (Optional[Type[Schema_HIP_Parameter]]) – Schema class for the parameter. It should be a subclass of pcapkit.protocols.schema.internet.hip.Parameter.

Return type:

None

pcapkit.foundation.registry.protocols.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.HOPOPT.__option__ registry.

Parameters:
  • code (IPv6_Option) – HOPOPT option code as in Option.

  • meth (str | tuple[HOPOPT_OptionParser, HOPOPT_OptionConstructor]) – Method name or callable to parse and/or construct the option.

  • schema (Optional[Type[Schema_HOPOPT_Option]]) – Schema class for the option. It should be a subclass of pcapkit.protocols.schema.internet.hopopt.Option.

Return type:

None

pcapkit.foundation.registry.protocols.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.IPv6_Opts.__option__ registry.

Parameters:
  • code (IPv6_Option) – IPv6-Opts option code as in Option.

  • meth (str | tuple[IPv6_Opts_OptionParser, IPv6_Opts_OptionConstructor]) – Method name or callable to parse and/or construct the option.

  • schema (Optional[Type[Schema_IPv6_Opts_Option]]) – Schema class for the option. It should be a subclass of pcapkit.protocols.schema.internet.ipv6_opts.Option.

Return type:

None

pcapkit.foundation.registry.protocols.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.IPv6_Route.__routing__ registry.

Parameters:
Return type:

None

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

Register a MH message type parser.

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

Parameters:
  • code (MH_Packet) – MH> data type code as in Packet.

  • meth (str | tuple[MH_PacketParser, MH_PacketConstructor]) – Method name or callable to parse and/or construct the data.

  • schema (Optional[Type[Schema_MH_Packet]]) – Schema class for the message type. It should be a subclass of pcapkit.protocols.schema.internet.mh.Packet.

Return type:

None

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

Register a MH option parser.

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

Parameters:
  • code (MH_Option) – MH> data type code as in Option.

  • meth (str | tuple[MH_OptionParser, MH_OptionConstructor]) – Method name or callable to parse and/or construct the data.

  • schema (Optional[Type[Schema_MH_Option]]) – Schema class for the message type. It should be a subclass of pcapkit.protocols.schema.internet.mh.Option.

Return type:

None

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

Register a CGA extension parser.

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

Parameters:
  • code (MH_CGAExtension) – MH> data type code as in CGAExtension.

  • meth (str | tuple[MH_ExtensionParser, MH_ExtensionConstructor]) – Method name or callable to parse and/or construct the data.

  • schema (Optional[Type[Schema_MH_CGAExtension]]) – Schema class for the message type. It should be a subclass of pcapkit.protocols.schema.internet.mh.CGAExtension.

Return type:

None

Transport Layer Registries#

pcapkit.foundation.registry.protocols.register_apptype(code, module, class_='(null)', *, proto='(null)')[source]#

Register a new protocol class.

Notes

The full qualified class name of the new protocol class should be as {module}.{class_}.

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

Parameters:
Return type:

None

See also

  • pcapkit.foundation.registry.register_tcp()

  • pcapkit.foundation.registry.register_udp()

pcapkit.foundation.registry.protocols.register_tcp(code, module, class_='(null)')[source]#

Register a new protocol class.

Notes

The full qualified class name of the new protocol class should be as {module}.{class_}.

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

Parameters:
Return type:

None

pcapkit.foundation.registry.protocols.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.TCP.__option__ registry.

Parameters:
  • code (TCP_Option) – TCP option code as in Option.

  • meth (str | tuple[TCP_OptionParser, TCP_OptionConstructor]) – Method name or callable to parse and/or construct the option.

  • schema (Optional[Type[Schema_TCP_Option]]) – Schema class for the option. It should be a subclass of pcapkit.protocols.schema.transport.tcp.Option.

Return type:

None

pcapkit.foundation.registry.protocols.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.TCP.__mp_option__ registry.

Parameters:
  • code (TCP_MPTCPOption) – Multipath TCP option code as in MPTCPOption.

  • meth (str | tuple[TCP_MPOptionParser, TCP_MPOptionConstructor]) – Method name or callable to parse and/or construct the option.

  • schema (Optional[Type[Schema_TCP_MPTCP]]) – Schema class for the option. It should be a subclass of pcapkit.protocols.schema.transport.tcp.MPTCP.

Return type:

None

pcapkit.foundation.registry.protocols.register_udp(code, module, class_='(null)')[source]#

Register a new protocol class.

Notes

The full qualified class name of the new protocol class should be as {module}.{class_}.

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

Parameters:
Return type:

None

Application Layer Registries#

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

Registered a frame parser.

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

Parameters:
Return type:

None

Miscellaneous Protocol Registries#

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

Registered a block parser.

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

Parameters:
  • code (PCAPNG_BlockType) – HTTP/2 block type code as in BlockType.

  • meth (str | tuple[PCAPNG_BlockParser, PCAPNG_BlockConstructor]) – Method name or callable to parse and/or construct the block.

  • schema (Optional[Type[Schema_PCAPNG_BlockType]]) – Schema class for the block. It should be a subclass of pcapkit.protocols.schema.misc.pcapng.BlockType.

Return type:

None

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

Registered a option parser.

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

Parameters:
  • code (PCAPNG_OptionType) – PCAPNG option type code as in OptionType.

  • meth (str | tuple[PCAPNG_OptionParser, PCAPNG_OptionConstructor]) – Method name or callable to parse and/or construct the option.

  • schema (Optional[Type[Schema_PCAPNG_Option]]) – Schema class for the option. It should be a subclass of pcapkit.protocols.schema.misc.pcapng.Option.

Return type:

None

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

Registered a name resolution record parser.

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

Parameters:
  • code (PCAPNG_RecordType) – PCAPNG name resolution record type code as in RecordType.

  • meth (str | tuple[PCAPNG_RecordParser, PCAPNG_RecordConstructor]) – Method name or callable to parse and/or construct the name resolution record.

  • schema (Optional[Type[Schema_PCAPNG_NameResolutionRecord]]) – Schema class for the name resolution record. It should be a subclass of pcapkit.protocols.schema.misc.pcapng.NameResolutionRecord.

Return type:

None

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

Registered a decryption secrets parser.

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

Parameters:
  • code (PCAPNG_SecretsType) – PCAPNG decryption secrets type code as in SecretsType.

  • meth (str | tuple[PCAPNG_SecretsParser, PCAPNG_SecretsConstructor]) – Method name or callable to parse and/or construct the decryption secrets.

  • schema (Optional[Type[Schema_PCAPNG_DSBSecrets]]) – Schema class for the decryption secrets. It should be a subclass of pcapkit.protocols.schema.misc.pcapng.DSBSecrets.

Return type:

None