Base Protocol¶
pcapkit.protocols.transport.transport
contains
Transport
,
which is a base class for transport layer protocols, eg.
TCP
and
UDP
.
- class pcapkit.protocols.transport.transport.Transport(file=None, length=None, **kwargs)[source]¶
Bases:
Protocol
[PT
],Generic
[PT
]Abstract base class for transport layer protocol family.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- classmethod register(code, module, class_)[source]¶
Register a new protocol class.
Important
This method must be called from a non-abstract class, as the protocol map should be associated directly with specific transport layer protocol type.
- Parameters
- Return type
None
Notes
The full qualified class name of the new protocol class should be as
{module}.{class_}
.
- _decode_next_layer(dict_, ports, length=None)[source]¶
Decode next layer protocol.
The method will check if the next layer protocol is supported based on the source and destination port numbers. We will use the lower port number from both ports as the primary key to lookup the next layer.
- __layer__: Optional[Literal['Link', 'Internet', 'Transport', 'Application']] = 'Transport'¶
Layer of protocol.
- __proto__: DefaultDict[int, tuple[str, str]]¶
Protocol index mapping for decoding next layer, c.f.
self._decode_next_layer
&self._import_next_layer
.Important
The attribute must be defined and maintained in subclass.