PcapFilePacketConsumer

Package: inet.queueing.sink

simple module PcapFilePacketConsumer

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

inet.queueing.sink.PcapFilePacketConsumerPcapFilePacketConsumersimple

Inheritance diagram

Extends

Name

Type

Description

PassivePacketSinkBase

simple module

Base module for various active packet sink modules.

Parameters

Name

Type

Default value

Description

displayStringTextFormat

string

“received %p pk (%l)”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

fileFormat

string

“pcap”

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

timePrecision

int

6

Time precision in recorded file. pcap supports only 6 (usec) or 9 (nanosec), pcapng supports more values (see ‘if_tsresol’ option in pcapng file format).

outbound

bool

Direction flag

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

class

PcapFilePacketConsumer

display

i=block/sink

Gates

Name

Direction

Size

Description

in

input

Signals

Name

Type

Unit

Description

packetDropped

inet::Packet

packetPushed

inet::Packet

Statistics

Name

Title

Source

Record

Unit

Interpolation Mode

Description

bitLifeTime

bit life time

weightTimes(lengthWeightedValuePerRegion(lifeTimePerRegion(packetPushed)))

histogram?

s

none

the statistical value is the time difference of the current simulation time and the creation time of the bit

dataRate

data rate

throughput(packetPushed)

vector

bps

linear

the statistical value is the data rate of the packets

droppedDataRate

dropped data rate

throughput(packetDropped)

vector

bps

linear

the statistical value is the data rate of the dropped packets

droppedPacketLengths

dropped packet lengths

packetLength(packetDropped)

sum,histogram,vector

b

none

the statistical value is the length of the dropped packet

droppedPackets

dropped packets

packetDropped

count

pk

the statistical value is the dropped packet

duplicatePacketLengths

duplicate packet lengths

packetLength(duplicatePacket(packetPushed))

vector?

b

none

the statistical value is the length of the packet, packet name must have an index suffix (e.g. Foo-42)

duplicatePackets

duplicate packets

duplicatePacket(packetPushed)

count?

pk

the statistical value is the packet, packet name must have an index suffix (e.g. Foo-42)

meanBitLifeTimePerPacket

mean bit life time per packet

weightedMeanPerGroup(groupRegionsPerPacket(lifeTimePerRegion(packetPushed)))

vector,histogram

s

none

the statistical value is the time difference of the current simulation time and the creation time of any bit in the region

missingPacketIndices

missing packet indices

missingPacketIndex(packetPushed)

count?

pk

the statistical value is the packet index, packet name must have an index suffix (e.g. Foo-42)

outOfOrderPacketLengths

out of order packet lenghts

packetLength(outOfOrderPacket(packetPushed))

vector?

b

none

the statistical value is the length of the packet, packet name must have an index suffix (e.g. Foo-42)

outOfOrderPackets

out of order packets

outOfOrderPacket(packetPushed)

count?

pk

the statistical value is the packet, packet name must have an index suffix (e.g. Foo-42)

packetDelayDifferenceToMean

packet delay difference to mean

differenceToMean(weightedMeanPerGroup(groupRegionsPerPacket(lifeTimePerRegion(packetPushed))))

vector,histogram

s

none

the statistical value is the difference of the current and the mean bit elapsed time per packet

packetDelayVariation

packet delay variation

stddev(weightedMeanPerGroup(groupRegionsPerPacket(lifeTimePerRegion(packetPushed))))

vector,histogram

s

the statistical value is the variation of the mean bit elapsed time per packet

packetJitter

packet jitter

jitter(weightedMeanPerGroup(groupRegionsPerPacket(lifeTimePerRegion(packetPushed))))

vector,histogram

s

none

the statistical value is the difference of subsequent values of the mean bit elapsed time per packet

packetLengths

packet lengths

packetLength(packetPushed)

sum,histogram,vector

b

none

the statistical value is the length of the packet

packetLifeTime

packet life time

packetLifeTime(packetPushed)

vector,histogram

s

none

the statistical value is the time difference of the current simulation time and the creation time of the whole packet data, nan if not all bits have the same value

packets

packets

packetPushed

count

pk

the statistical value is the packet

Source code

//
// 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 PassivePacketSinkBase like IPassivePacketSink
{
    parameters:
        string fileFormat @enum("pcap", "pcapng") = default("pcap");
        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
        int timePrecision = default(6); // Time precision in recorded file. pcap supports only 6 (usec) or 9 (nanosec), pcapng supports more values (see 'if_tsresol' option in pcapng file format).
        bool outbound;  // Direction flag
        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);
    gates:
        input in @labels(push);
}

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