Source code for pcapkit.protocols.data.misc.pcap.frame
# -*- coding: utf-8 -*-
"""data models for frame header of PCAP file"""
from typing import TYPE_CHECKING
from pcapkit.corekit.infoclass import info_final
from pcapkit.protocols.data.data import Data
from pcapkit.protocols.data.protocol import Protocol
if TYPE_CHECKING:
from datetime import datetime
from decimal import Decimal
__all__ = ['Frame', 'FrameInfo']
[docs]
@info_final
class FrameInfo(Data):
"""Frame metadata information."""
#: Timestamp seconds.
ts_sec: 'int'
#: Timestamp microseconds.
ts_usec: 'int'
#: Number of octets of packet saved in file.
incl_len: 'int'
#: Actual length of packet.
orig_len: 'int'
if TYPE_CHECKING:
def __init__(self, ts_sec: 'int', ts_usec: 'int', incl_len: 'int', orig_len: 'int') -> 'None': ... # pylint: disable=unused-argument,multiple-statements,super-init-not-called
[docs]
@info_final
class Frame(Protocol):
"""Frame header of PCAP file."""
#: Metadata information.
frame_info: 'FrameInfo'
#: Timestamp instance.
time: 'datetime'
#: Frame index.
number: 'int'
#: UNIX timestamp.
time_epoch: 'Decimal'
#: Actual length of the packet as it appeared on the wire, i.e. the record
#: header's ``orig_len``. Larger than :attr:`cap_len` for a frame the
#: snapshot length cut short. Named after Wireshark's ``frame.len``,
#: registered as "Frame length on the wire".
len: 'int'
#: Number of octets of packet data actually captured and saved in the file,
#: i.e. the record header's ``incl_len``, and so the number of octets
#: :attr:`~pcapkit.protocols.data.protocol.Protocol.packet` holds. Named
#: after Wireshark's ``frame.cap_len``, registered as "Frame length stored
#: into the capture file".
cap_len: 'int'
if TYPE_CHECKING:
#: Protocol chain.
protocols: 'str'
def __init__(self, frame_info: 'FrameInfo', time: 'datetime', number: 'int', time_epoch: 'Decimal',
len: 'int', cap_len: 'int') -> 'None': ... # pylint: disable=unused-argument,multiple-statements,super-init-not-called,line-too-long,redefined-builtin