Raw Packet Data
pcapkit.protocols.misc.raw
contains
Raw
only, which implements
extractor for unknown protocol, and constructs a
Protocol
like object.
-
class pcapkit.protocols.misc.raw.Raw(file=None, length=None, **kwargs)[source]
Bases: Protocol
[Raw
]
This class implements universal unknown protocol.
- Parameters
-
- Return type
Protocol[PT]
-
__post_init__(file: BinaryIO, length: Optional[int] = None, **kwargs: Any) → None[source]
-
__post_init__(**kwargs: Any) → None
Post initialisation hook.
Would pcapkit
encounter malformed packets, the original parsing
error instance will be provided as in error
.
- Parameters
file (Optional
[BinaryIO
]) – Source packet stream.
length (Optional
[int
]) – Length of packet data.
error (Optional[Exception]) – Parsing errors if any (for parsing).
alias (Optional[int]) – Original enumeration of the unknown protocol.
**kwargs (Any
) – Arbitrary keyword arguments.
See also
For construction argument, please refer to make()
.
- Return type
None
-
classmethod __index__()[source]
Numeral registry index of the protocol.
- Raises
UnsupportedCall – This protocol has no registry entry.
- Return type
NoReturn
-
property name: Literal['Unknown']
Name of current protocol.
- Return type
Literal
[‘Unknown’]
-
property length: Literal[0]
Header length of current protocol.
- Return type
Literal
[0]
-
property protocol: NoReturn
Name of next layer protocol.
- Raises
UnsupportedCall – This protocol doesn’t support protocol
.
- Return type
NoReturn
-
read(length=None, *, error=None, alias=None, **kwargs)[source]
Read raw packet data.
- Parameters
length (Optional
[int
]) – Length of packet data.
error (Optional
[Exception
]) – Parsing errors if any.
alias (Optional
[int
]) – Original enumeration of the unknown protocol.
**kwargs (Any
) – Arbitrary keyword arguments.
- Return type
Raw
- Returns
The parsed packet data.
-
make(**kwargs)[source]
Make raw packet data.
- Parameters
-
- Return type
bytes
- Returns
Constructed packet data.
Data Structures
-
class pcapkit.protocols.data.misc.raw.Raw(protocol, packet, error)[source]
Bases: Info
Raw packet is an unknown protocol.
- Parameters
-
- Return type
Info
-
protocol: Optional[int]
Original enumeration of this protocol.
-
packet: bytes
packet data
-
error: Optional[Exception]
error instance when parsing packet data