PingApp

Package: inet.applications.pingapp

PingApp

simple module

To disable send, specify empty destAddr.

Every ping request is sent out with a sequence number, and replies are expected to arrive in the same order. Whenever there's a jump in the in the received ping responses' sequence number (e.g. 1, 2, 3, 5), then the missing pings (number 4 in this example) is counted as lost. Then if it still arrives later (that is, a reply with a sequence number smaller than the largest one received so far) it will be counted as out-of-sequence arrival. So the number of really lost pings will be "lost" minus "out-of-order" (assuming there's no duplicate or bogus reply).

Uses PingPayload as payload for the ICMP(v6) Echo Request/Reply packets.

See also: PingPayload, ICMP, ICMPv6

Inheritance diagram

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

Parameters

Name Type Default value Description
destAddr string ""

destination address(es), separated by spaces, "*" means all IPv4/IPv6 interfaces in entire simulation

srcAddr string ""

source address (useful with multi-homing)

packetSize int 56B

of ping payload, in bytes

sendInterval double 1s

time to wait between pings (can be random)

hopLimit int 32

TTL or hopLimit for IP packets

count int -1

number of pings requests sent to a single destination address, -1 means continuously (only first address will be used from destAddr)

startTime double uniform(0s, this.sleepDuration + this.sendInterval)

send first ping at startTime

stopTime double -1s

time to finish sending, negative values mean forever

sleepDuration double 0s

time spent in sleep between switching destinations

continuous bool false

whether to continuously ping the destinations in a round-robin fashion

printPing bool false

log to stdout

Properties

Name Value Description
display i=block/app

Gates

Name Direction Size Description
pingIn input
pingOut output

Signals

Name Type Unit
pingRxSeq long
numLost long
rtt simtime_t
numOutOfOrderArrivals long
pingTxSeq long

Statistics

Name Title Source Record Unit Interpolation Mode
pingRxSeq ping rx seq count, vector none
numLost pings lost last, vector none
rtt ping round-trip time histogram, vector s none
numOutOfOrderArrivals ping out-of-order arrivals last, vector none
pingTxSeq ping tx seq count, vector none

Source code

// To disable send, specify empty destAddr.
//
// Every ping request is sent out with a sequence number, and replies are
// expected to arrive in the same order. Whenever there's a jump in the
// in the received ping responses' sequence number (e.g. 1, 2, 3, 5), then
// the missing pings (number 4 in this example) is counted as lost.
// Then if it still arrives later (that is, a reply with a sequence number
// smaller than the largest one received so far) it will be counted as
// out-of-sequence arrival. So the number of really lost pings will be
// "lost" minus "out-of-order" (assuming there's no duplicate or bogus reply).
//
// Uses ~PingPayload as payload for the ICMP(v6) Echo Request/Reply packets.
//
// @see ~PingPayload, ~ICMP, ~ICMPv6
//
simple PingApp like IPingApp
{
    parameters:
        string destAddr = default(""); // destination address(es), separated by spaces, "*" means all IPv4/IPv6 interfaces in entire simulation
        string srcAddr = default(""); // source address (useful with multi-homing)
        int packetSize @unit("B") = default(56B); // of ping payload, in bytes
        volatile double sendInterval @unit("s") = default(1s); // time to wait between pings (can be random)
        int hopLimit = default(32); // TTL or hopLimit for IP packets
        int count = default(-1); // number of pings requests sent to a single destination address, -1 means continuously (only first address will be used from destAddr)
        double startTime @unit("s") = default(uniform(0s, this.sleepDuration + this.sendInterval)); // send first ping at startTime
        double stopTime @unit("s") = default(-1s); // time to finish sending, negative values mean forever
        volatile double sleepDuration @unit(s) = default(0s); // time spent in sleep between switching destinations
        bool continuous = default(false);  // whether to continuously ping the destinations in a round-robin fashion
        bool printPing = default(false); // log to stdout
        @display("i=block/app");
        @signal[rtt](type=simtime_t);
        @signal[numLost](type=long);
        @signal[numOutOfOrderArrivals](type=long);
        @signal[pingTxSeq](type=long);
        @signal[pingRxSeq](type=long);
        @statistic[rtt](title="ping round-trip time"; unit=s; record=histogram,vector; interpolationmode=none);
        @statistic[numLost](title="pings lost"; record=last,vector; interpolationmode=none);
        @statistic[numOutOfOrderArrivals](title="ping out-of-order arrivals"; record=last,vector; interpolationmode=none);
        @statistic[pingTxSeq](title="ping tx seq"; record=count,vector; interpolationmode=none);
        @statistic[pingRxSeq](title="ping rx seq"; record=count,vector; interpolationmode=none);
    gates:
        input pingIn @labels(PingPayload/up);
        output pingOut @labels(PingPayload/down);
}

File: src/inet/applications/pingapp/PingApp.ned