Base Protocol¶
pcapkit.protocols.link.link contains Link,
which is a base class for link layer protocols, e.g. ARP/InARP,
Ethernet, L2TP,
OSPF, RARP/DRARP and etc.
- class pcapkit.protocols.link.link.Link(file=None, length=None, **kwargs)[source]¶
Bases:
ProtocolBase[_PT,_ST],Generic[_PT,_ST]Abstract base class for link layer protocol family.
This class currently supports parsing of the following protocols, which are registered in the
self.__proto__attribute:Index
Protocol
0x8137
- classmethod register(code, protocol)[source]¶
Register a new protocol class.
Notes
The full qualified class name of the new protocol class should be as
{protocol.module}.{protocol.name}.- Parameters:
protocol (
ModuleDescriptor[ProtocolBase] |Type[ProtocolBase]) – module descriptor or aProtocolsubclass
- Raises:
pcapkit.utilities.exceptions.RegistryError – If
protocolis not aProtocolsubclass.- Warns:
pcapkit.utilities.warnings.RegistryWarning – If this EtherType is already registered, naming the displaced entry and its replacement so a caller can tell what was lost. Fires only when the incumbent differs from the replacement – see
ProtocolBase.registerfor the guard this shares withregister_protocol.
- __proto__: DefaultDict[int | EtherType, ModuleDescriptor[ProtocolBase] | Type[ProtocolBase]]¶
Protocol index mapping for decoding next layer, c.f.
self._decode_next_layer&self._import_next_layer.- Type:
DefaultDict[int, ModuleDescriptor[ProtocolBase] | Type[ProtocolBase]]