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
- property layer: Literal['Link']¶
Protocol layer.
- 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 (
Union
[ModuleDescriptor
[ProtocolBase
],Type
[ProtocolBase
]]) – module descriptor or aProtocol
subclass
- Return type:
- __layer__: Optional[Literal["Link", "Internet", "Transport", "Application"]] = 'Link'¶
Layer of protocol.
- __proto__: DefaultDict[int, 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[Protocol] | Type[Protocol]]