Dump Utilities¶
pcapkit.dumpkit
is the collection of dumpers for
pcapkit
implementation, which is alike those described
in dictdumper
.
PCAP Dumper¶
-
class
pcapkit.dumpkit.
PCAP
(fname, *, protocol, byteorder='little', nanosecond=False, **kwargs)[source]¶ Bases:
dictdumper.dumper.Dumper
PCAP file dumper.
-
__call__
(value, name=None)[source]¶ Dump a new frame.
- Parameters
value (Info[DataType_Frame]) – content to be dumped
name (
Optional[str]
) – name of current content block
- Returns
the dumper class itself (to support chain calling)
- Return type
-
__init__
(fname, *, protocol, byteorder='little', nanosecond=False, **kwargs)[source]¶ Initialise dumper.
- Parameters
fname (str) – output file name
- Keyword Arguments
protocol (Union[pcapkit.const.reg.linktype.LinkType, enum.IntEnum, str, int]) – data link type
byteorder (Literal['little', 'big']) – header byte order
nanosecond (bool) – nanosecond-resolution file flag
**kwargs – arbitrary keyword arguments
-
_append_value
(value, file, name)[source]¶ Call this function to write contents.
- Parameters
value (Info[DataType_Frame]) – content to be dumped
file (io.BufferedReader) – output file
name (str) – name of current content block
-
_dump_header
(*, protocol, byteorder='little', nanosecond=False, **kwargs)[source]¶ Initially dump file heads and tails.
- Keyword Arguments
protocol (Union[pcapkit.const.reg.linktype.LinkType, enum.IntEnum, str, int]) – data link type
byteorder (Literal['little', 'big']) – header byte order
nanosecond (bool) – nanosecond-resolution file flag
**kwargs – arbitrary keyword arguments
-
_link
= None¶ Data link type.
- Type
Union[pcapkit.const.reg.linktype.LinkType, enum.IntEnum, str, int]
-
property
kind
¶ File format of current dumper.
- Return type
Literal[‘pcap’]
-
Undefined Dumper¶
-
class
pcapkit.dumpkit.
NotImplementedIO
(fname, **kwargs)[source]¶ Bases:
dictdumper.dumper.Dumper
Unspecified output format.
-
__call__
(value, name=None)[source]¶ Dump a new frame.
- Parameters
value (
Dict[str, Any]
) – content to be dumpedname (
Optional[str]
) – name of current content block
- Returns
the dumper class itself (to support chain calling)
- Return type
-
_append_value
(value, file, name)[source]¶ Call this function to write contents.
- Parameters
value (Dict[str, Any]) – content to be dumped
file (io.TextIOWrapper) – output file
name (str) – name of current content block
-
_dump_header
(**kwargs)[source]¶ Initially dump file heads and tails.
- Keyword Arguments
**kwargs – arbitrary keyword arguments
-
property
kind
¶ File format of current dumper.
- Return type
Literal[NotImplemented]
-