Base Protocol¶
pcapkit.protocols.application.application contains only
Application,
which is a base class for application layer protocols, eg.
HTTP/1.*,
HTTP/2
and etc.
Changed in version 1.5.0: _decode_next_layer()
and
_import_next_layer()
accept the -1 sentinel, so an application layer protocol can carry the
rest of its packet undissected as its payload; every call raised
UnsupportedCall (#719).
- class pcapkit.protocols.application.application.Application(file=None, length=None, **kwargs)[source]¶
Bases:
ProtocolBase[_PT,_ST],Generic[_PT,_ST]Abstract base class for application layer protocol family.
An application layer protocol has no further protocol layer above it, so
_decode_next_layer()and_import_next_layer()refuse to dispatch on a protocol number. What they do permit is the-1sentinel, which asks for the rest of the packet undissected and resolves toRaw– trailing bytes are not a further protocol layer – or toNoPayloadwhen nothing remains.- _decode_next_layer(dict_, proto=None, length=None, *, packet=None)[source]¶
Decode next layer protocol.
- Parameters:
- Return type:
TypeVar(_PT, bound= Data)- Returns:
Current protocol with the undissected remainder as payload.
- Raises:
UnsupportedCall –
protois anything but-1, i.e. a real protocol dispatch, which this protocol doesn’t support.
- _import_next_layer(proto, length=None, *, packet=None)[source]¶
Import next layer extractor.
- Parameters:
- Return type:
- Returns:
- Raises:
UnsupportedCall –
protois anything but-1, i.e. a real protocol dispatch, which this protocol doesn’t support.
- __post_init__(file=None, length=None, **kwargs)[source]¶
Post initialisation hook.
- Overloads:
self, file (IO[bytes] | bytes), length (Optional[int]), kwargs (Any) → None
self, kwargs (Any) → None
- Parameters:
See also
For construction arguments, please refer to
self.make.
- classmethod __index__()[source]¶
Numeral registry index of the protocol.
- Raises:
IntError – This protocol doesn’t support
__index__().- Return type: