Frame Header¶
pcapkit.protocols.misc.pcap.frame
contains
Frame
only,
which implements extractor for frame headers * of PCAP,
whose structure is described as below:
typedef struct pcaprec_hdr_s {
guint32 ts_sec; /* timestamp seconds */
guint32 ts_usec; /* timestamp microseconds */
guint32 incl_len; /* number of octets of packet saved in file */
guint32 orig_len; /* actual length of packet */
} pcaprec_hdr_t;
- class pcapkit.protocols.misc.pcap.frame.Frame(file=None, length=None, **kwargs)[source]¶
-
Per packet frame header extractor.
This class currently supports parsing of the following protocols, which are registered in the
self.__proto__
attribute:Index
Protocol
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- __post_init__(file: BinaryIO, length: Optional[int] = None, *, num: int, header: DataType_Header, **kwargs: Any) None [source]¶
- __post_init__(*, num: int, header: DataType_Header, **kwargs: Any) None
Initialisation.
- Parameters
See also
For construction argument, please refer to
make()
.- Return type
- classmethod register(code, module, class_)[source]¶
Register a new protocol class.
Notes
The full qualified class name of the new protocol class should be as
{module}.{class_}
.
- index(name)[source]¶
Call
ProtoChain.index
.
- make(*, timestamp=None, ts_sec=None, ts_usec=None, incl_len=None, orig_len=None, packet, nanosecond=False, **kwargs)[source]¶
Make frame packet data.
- Parameters
timestamp (Optional[float | Decimal]) – UNIX-Epoch timestamp
ts_sec (Optional[int]) – timestamp seconds
ts_usec (Optional[int]) – timestamp microseconds
incl_len (Optional[int]) – number of octets of packet saved in file
orig_len (Optional[int]) – actual length of packet
packet (bytes) – raw packet data
nanosecond (bool) – nanosecond-resolution file flag
**kwargs (Any) – Arbitrary keyword arguments.
- Returns
Constructed packet data.
- Return type
Data Structures¶
- class pcapkit.protocols.data.misc.pcap.frame.Frame(frame_info, time, number, time_epoch, time_delta, len, cap_len)[source]¶
Bases:
Info
Frame header of PCAP file.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- time: datetime¶
Timestamp instance.
- time_epoch: Decimal¶
UNIX timestamp.
- class pcapkit.protocols.data.misc.pcap.frame.FrameInfo(ts_sec, ts_usec, incl_len, orig_len)[source]¶
Bases:
Info
Frame metadata information.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type