TCPDump

Package: inet.common.packet

TCPDump

simple module

Provides tcpdump-like functionality: dumps packet contents on the module output, and optionally records them into a PCAP file. This module has to be placed into the packet's path, and connected both sides.

This module is deprecated: consider using PcapRecorder, which can be inserted into compound modules non-intrusively (it receives packet data via signals, so existing modules don't need to be reconnected.)

How to use it: The module handles IPv4 packets (IPv4Datagram class), so it should be placed between the IP module and network interfaces (NICs); see description of gates in comments. Other packets are ignored and let through.

Parameters

Name Type Default value Description
dumpFile string ""
snaplen int 65535
verbose bool false
dumpBadFrames bool true

write bad frames to pcap file

dropBadFrames bool false

drop frame when frame has bit error.

Gates

Name Direction Size Description
ifIn [ ] input

input from lower layer

hlIn [ ] input

input from higher layer

ifOut [ ] output

output to lower layer

hlOut [ ] output

output to higher layer

Source code

//
// Provides tcpdump-like functionality: dumps packet contents on the
// module output, and optionally records them into a PCAP file.
// This module has to be placed into the packet's path, and connected
// both sides.
//
// This module is deprecated: consider using PcapRecorder, which
// can be inserted into compound modules non-intrusively (it receives
// packet data via signals, so existing modules don't need to be reconnected.)
//
// <b>How to use it:</b> The module handles IPv4 packets (IPv4Datagram class),
// so it should be placed between the IP module and network interfaces (NICs);
// see description of gates in comments. Other packets are ignored and let
// through.
//
simple TCPDump
{
    parameters:
        string dumpFile = default("");
        int snaplen = default(65535);
        bool verbose = default(false);
        bool dumpBadFrames = default(true); // write bad frames to pcap file
        bool dropBadFrames = default(false); // drop frame when frame has bit error.
    gates:
        input ifIn[];   // input from lower layer
        input hlIn[];   // input from higher layer
        output ifOut[];   // output to lower layer
        output hlOut[];   // output to higher layer
}
File: src/inet/common/packet/TCPDump.ned