PcapFilePacketConsumer

Package: inet.queueing.sink

PcapFilePacketConsumer

simple module

This module is a passive packet sink which is pushed with packets by the connected packet producer. All pushed packets are written to a PCAP file.

PcapFilePacketConsumer

Inheritance diagram

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.

Extends

Name Type Description
PacketSinkBase simple module

This is a base module for various packet sink modules.

Parameters

Name Type Default value Description
displayStringTextFormat string "dropped %p pk (%l)"

determines the text that is written on top of the submodule

filename string

the PCAP file to be written

networkType int

the network type header field in the PCAP file, see http://www.tcpdump.org/linktypes.html (1=ethernet, 204=ppp, 105=IEEE 802.11, ...)

snaplen int 65535

maximum number of bytes to record per packet

alwaysFlush bool false

flush the PCAP file after each write to ensure that all packets are captured in case of a crash

Properties

Name Value Description
display i=block/sink
class PcapFilePacketConsumer

Gates

Name Direction Size Description
in input

Signals

Name Type Unit
packetPushed inet::Packet

Statistics

Name Title Source Record Unit Interpolation Mode
packetPushed packets pushed count, sum(packetBytes), vector(packetBytes) none

Source code

//
// This module is a passive packet sink which is pushed with packets by the
// connected packet producer. All pushed packets are written to a PCAP file.
//
simple PcapFilePacketConsumer extends PacketSinkBase like IPassivePacketSink
{
    parameters:
        string filename; // the PCAP file to be written
        int networkType; // the network type header field in the PCAP file, see http://www.tcpdump.org/linktypes.html (1=ethernet, 204=ppp, 105=IEEE 802.11, ...)
        int snaplen = default(65535);  // maximum number of bytes to record per packet
        bool alwaysFlush = default(false); // flush the PCAP file after each write to ensure that all packets are captured in case of a crash
        @class(PcapFilePacketConsumer);
        @signal[packetPushed](type=inet::Packet);
        @statistic[packetPushed](title="packets pushed"; record=count,sum(packetBytes),vector(packetBytes); interpolationmode=none);
    gates:
        input in @labels(push);
}

File: src/inet/queueing/sink/PcapFilePacketConsumer.ned