Registry Management

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

Auxiliary Methods

pcapkit.foundation.registry.register_output(format, module, class_, 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.__output__ and pcapkit.foundation.extraction.Extractor.__output__ registry.

Parameters
  • format (str) – format name

  • module (str) – module name

  • class_ (str) – class name

  • ext (str) – file extension

Return type

None

pcapkit.foundation.registry.register_linktype(code, module, class_)[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.register_port(proto, code, module, class_)[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
  • proto (Literal["tcp", "udp"]) – protocol name (must be tcp or udp)

  • code (int) – port number

  • module (str) – module name

  • class_ (str) – class name

Return type

None

Dumper Registries

pcapkit.foundation.registry.register_extractor(format, module, class_, 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
  • format (str) – format name

  • module (str) – module name

  • class_ (str) – class name

  • ext (str) – file extension

Return type

None

pcapkit.foundation.registry.register_traceflow(format, module, class_, 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.__output__ registry.

Parameters
  • format (str) – format name

  • module (str) – module name

  • class_ (str) – class name

  • ext (str) – file extension

Return type

None

Protocol Registries

pcapkit.foundation.registry.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[Protocol]) – Protocol class.

Return type

None

pcapkit.foundation.registry.register_pcap(code, module, class_)[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

Internet Layer Registries

pcapkit.foundation.registry.register_transtype(code, module, class_)[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.register_hopopt(code, meth)[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 | HOPOPT_OptionParser) – Method name or callable to parse the option.

Return type

None

pcapkit.foundation.registry.register_ipv6_opts(code, meth)[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 | IPv6_Opts_OptionParser) – Method name or callable to parse the option.

Return type

None

pcapkit.foundation.registry.register_ipv6_route(code, meth)[source]

Register an routing data parser.

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

Parameters
  • code (IPv6_Routing) – IPv6-Route data type code as in Routing.

  • meth (str | IPv6_Route_TypeParser) – Method name or callable to parse the data.

Return type

None

Transport Layer Registries

pcapkit.foundation.registry.register_tcp_port(code, module, class_)[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
  • code (int) – port number

  • module (str) – module name

  • class_ (str) – class name

Return type

None

pcapkit.foundation.registry.register_tcp(code, meth)[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 | TCP_OptionParser) – Method name or callable to parse the option.

Return type

None

pcapkit.foundation.registry.register_mptcp(code, meth)[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 | TCP_MPOptionParser) – Method name or callable to parse the option.

Return type

None

pcapkit.foundation.registry.register_udp_port(code, module, class_)[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
  • code (int) – port number

  • module (str) – module name

  • class_ (str) – class name

Return type

None

Application Layer Registries

pcapkit.foundation.registry.register_http(code, meth)[source]

registered a frame parser.

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

Parameters
  • code (HTTP_Frame) – HTTP/2 frame type code as in Frame.

  • meth (str | HTTP_FrameParser) – Method name or callable to parse the frame.

Return type

None