INET Framework for OMNeT++/OMNEST
|
Utility class that provides tcpdump-like functionality. More...
#include <PacketDump.h>
Public Member Functions | |
PacketDump () | |
Constructor. More... | |
~PacketDump () | |
Destructor. More... | |
void | setOutStream (std::ostream &o) |
Sets the output stream. More... | |
std::ostream & | getOutStream () const |
Returns the output stream. More... | |
void | setVerbose (bool verb) |
Enable/disable verbose output. More... | |
bool | isVerbose () const |
Returns the verbosity flag. More... | |
void | dump (const char *label, const char *msg) |
Writes the given text on the output stream. More... | |
void | dumpPacket (bool l2r, cPacket *packet) |
Dumps info about the given packet. More... | |
void | dumpIPv4 (bool l2r, const char *label, IPv4Datagram *dgram, const char *comment=nullptr) |
Dumps info about the given IPv4 datagram. More... | |
void | dumpARP (bool l2r, const char *label, ARPPacket *dgram, const char *comment=nullptr) |
void | dumpIPv6 (bool l2r, const char *label, IPv6Datagram *dgram, const char *comment=nullptr) |
Dumps info about the given IPv6 datagram. More... | |
void | sctpDump (const char *label, sctp::SCTPMessage *sctpmsg, const std::string &srcAddr, const std::string &destAddr, const char *comment=nullptr) |
Dumps info about the given SCTP message. More... | |
void | tcpDump (bool l2r, const char *label, tcp::TCPSegment *tcpseg, const std::string &srcAddr, const std::string &destAddr, const char *comment=nullptr) |
Dumps info about the given TCP segment. More... | |
void | udpDump (bool l2r, const char *label, UDPPacket *udppkt, const std::string &srcAddr, const std::string &destAddr, const char *comment) |
Dumps info about the given UDP packet. More... | |
Protected Attributes | |
bool | verbose |
std::ostream * | outp |
Utility class that provides tcpdump-like functionality.
It prints information about each packet on the given output stream.
inet::PacketDump::PacketDump | ( | ) |
Constructor.
The output stream initially points to the C++ standard output (std::cout); you probably want to call setOutStream(getEnvir()->getOStream())
to redirect it to EV.
void inet::PacketDump::dump | ( | const char * | label, |
const char * | msg | ||
) |
Writes the given text on the output stream.
Referenced by inet::TCPDump::finish(), and inet::PcapRecorder::finish().
void inet::PacketDump::dumpARP | ( | bool | l2r, |
const char * | label, | ||
ARPPacket * | dgram, | ||
const char * | comment = nullptr |
||
) |
Referenced by dumpPacket().
void inet::PacketDump::dumpIPv4 | ( | bool | l2r, |
const char * | label, | ||
IPv4Datagram * | dgram, | ||
const char * | comment = nullptr |
||
) |
Dumps info about the given IPv4 datagram.
The l2r parameter denotes the direction of the packet.
Referenced by dumpPacket().
void inet::PacketDump::dumpIPv6 | ( | bool | l2r, |
const char * | label, | ||
IPv6Datagram * | dgram, | ||
const char * | comment = nullptr |
||
) |
Dumps info about the given IPv6 datagram.
The l2r parameter denotes the direction of the packet.
Referenced by dumpPacket().
void inet::PacketDump::dumpPacket | ( | bool | l2r, |
cPacket * | packet | ||
) |
Dumps info about the given packet.
It dispatches to the more specific dump functions. The l2r parameter denotes the direction of the packet.
Referenced by inet::TCPDump::handleMessage(), and inet::PcapRecorder::recordPacket().
|
inline |
Returns the output stream.
|
inline |
Returns the verbosity flag.
void inet::PacketDump::sctpDump | ( | const char * | label, |
sctp::SCTPMessage * | sctpmsg, | ||
const std::string & | srcAddr, | ||
const std::string & | destAddr, | ||
const char * | comment = nullptr |
||
) |
Dumps info about the given SCTP message.
Referenced by dumpIPv4(), dumpPacket(), and udpDump().
|
inline |
Sets the output stream.
Referenced by inet::TCPDump::initialize(), and inet::PcapRecorder::initialize().
|
inline |
Enable/disable verbose output.
Referenced by inet::TCPDump::initialize(), and inet::PcapRecorder::initialize().
void inet::PacketDump::tcpDump | ( | bool | l2r, |
const char * | label, | ||
tcp::TCPSegment * | tcpseg, | ||
const std::string & | srcAddr, | ||
const std::string & | destAddr, | ||
const char * | comment = nullptr |
||
) |
Dumps info about the given TCP segment.
Referenced by dumpIPv4(), dumpIPv6(), and dumpPacket().
void inet::PacketDump::udpDump | ( | bool | l2r, |
const char * | label, | ||
UDPPacket * | udppkt, | ||
const std::string & | srcAddr, | ||
const std::string & | destAddr, | ||
const char * | comment | ||
) |
Dumps info about the given UDP packet.
Referenced by dumpIPv4().
|
protected |
Referenced by dump(), dumpARP(), dumpIPv4(), dumpIPv6(), dumpPacket(), PacketDump(), sctpDump(), tcpDump(), and udpDump().
|
protected |
Referenced by PacketDump(), sctpDump(), and tcpDump().