|
INET Framework for OMNeT++/OMNEST
|
Dumps packets into a PCAP file; see the "pcap-savefile" man page or http://www.tcpdump.org/ for details on the file format. More...
#include <PcapWriter.h>
Public Member Functions | |
| PcapWriter () | |
| Constructor. More... | |
| ~PcapWriter () | |
| Destructor. More... | |
| void | open (const char *filename, unsigned int snaplen) override |
| Opens a PCAP file with the given file name. More... | |
| bool | isOpen () const override |
| Returns true if the pcap file is currently open. More... | |
| void | writePacket (simtime_t time, const Packet *packet, Direction direction, NetworkInterface *ie, PcapLinkType linkType) override |
| Records the given packet into the output file if it is open, and throws an exception otherwise. More... | |
| void | close () override |
| Closes the output file if it is open. More... | |
| void | setFlush (bool flush) override |
| Force flushing of pcap dump. More... | |
Public Member Functions inherited from inet::IPcapWriter | |
| virtual | ~IPcapWriter () |
Protected Member Functions | |
| void | writeHeader (PcapLinkType linkType) |
Protected Attributes | |
| std::string | fileName |
| FILE * | dumpfile = nullptr |
| unsigned int | snaplen = 0 |
| PcapLinkType | network = LINKTYPE_INVALID |
| bool | flush = false |
| bool | needHeader = true |
Dumps packets into a PCAP file; see the "pcap-savefile" man page or http://www.tcpdump.org/ for details on the file format.
Note: The file is currently recorded in the "classic" format, not in the "Next Generation" file format also on tcpdump.org.
| inet::PcapWriter::~PcapWriter | ( | ) |
Destructor.
It closes the output file if it is open.
|
overridevirtual |
Closes the output file if it is open.
Implements inet::IPcapWriter.
Referenced by inet::queueing::PcapFilePacketConsumer::finish(), and ~PcapWriter().
|
inlineoverridevirtual |
|
overridevirtual |
Opens a PCAP file with the given file name.
The snaplen parameter is the length that packets will be truncated to. Throws an exception if the file cannot be opened.
Implements inet::IPcapWriter.
Referenced by inet::queueing::PcapFilePacketConsumer::initialize().
|
inlineoverridevirtual |
Force flushing of pcap dump.
Implements inet::IPcapWriter.
Referenced by inet::queueing::PcapFilePacketConsumer::initialize().
|
protected |
Referenced by writePacket().
|
overridevirtual |
Records the given packet into the output file if it is open, and throws an exception otherwise.
Implements inet::IPcapWriter.
Referenced by inet::queueing::PcapFilePacketConsumer::pushPacket().
|
protected |
Referenced by close(), open(), writeHeader(), and writePacket().
|
protected |
Referenced by open(), and writePacket().
|
protected |
Referenced by open(), and writePacket().
|
protected |
Referenced by open(), and writePacket().
|
protected |
Referenced by open(), and writePacket().
|
protected |
Referenced by open(), writeHeader(), and writePacket().