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 <PcapDump.h>
Public Member Functions | |
PcapDump () | |
Constructor. More... | |
~PcapDump () | |
Destructor. More... | |
void | openPcap (const char *filename, unsigned int snaplen) |
Opens a PCAP file with the given file name. More... | |
bool | isOpen () const |
Returns true if the pcap file is currently open. More... | |
void | writeFrame (simtime_t time, const IPv4Datagram *ipPacket) |
Records the given packet into the output file if it is open, and throws an exception otherwise. More... | |
void | writeIPv6Frame (simtime_t stime, const IPv6Datagram *ipPacket) |
void | closePcap () |
Closes the output file if it is open. More... | |
void | setFlushParameter (bool doFlush) |
Force flushing of pcap dump. More... | |
Protected Attributes | |
FILE * | dumpfile = nullptr |
unsigned int | snaplen = 0 |
bool | flush = false |
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::PcapDump::~PcapDump | ( | ) |
Destructor.
It closes the output file if it is open.
void inet::PcapDump::closePcap | ( | ) |
Closes the output file if it is open.
Referenced by inet::TCPDump::finish(), and inet::PcapRecorder::finish().
|
inline |
Returns true if the pcap file is currently open.
Referenced by inet::TCPDump::handleMessage(), and inet::PcapRecorder::recordPacket().
void inet::PcapDump::openPcap | ( | const char * | filename, |
unsigned int | snaplen | ||
) |
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.
Referenced by inet::TCPDump::initialize(), and inet::PcapRecorder::initialize().
|
inline |
void inet::PcapDump::writeFrame | ( | simtime_t | time, |
const IPv4Datagram * | ipPacket | ||
) |
Records the given packet into the output file if it is open, and throws an exception otherwise.
Referenced by inet::TCPDump::handleMessage(), and inet::PcapRecorder::recordPacket().
void inet::PcapDump::writeIPv6Frame | ( | simtime_t | stime, |
const IPv6Datagram * | ipPacket | ||
) |
Referenced by inet::PcapRecorder::recordPacket().
|
protected |
|
protected |
|
protected |