Compound Module PacketDrillHost

Package: inet.node.packetdrill
File: src/inet/node/packetdrill/PacketDrillHost.ned

IPv4 host with SCTP, TCP, UDP layers and a packetdrill application. The application has a direct connection to the TunInterface.

NodeStatus IEnergyStorage IEnergyManagement IEnergyGenerator IMobility INetworkLayer IRoutingTable InterfaceTable PcapRecorder LoopbackInterface IWirelessNic IWiredNic IWiredNic IExternalNic ITunNic PacketDrillApp ITCP IUDP ISCTP

Usage diagram:

The following diagram shows usage relationships between types. Unresolved types are missing from the diagram.

Inheritance diagram:

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

Extends:

Name Type Description
NodeBase compound module

Contains the common lower layers (linklayer and networklayer) of Router, StandardHost, WirelessHost etc.

Parameters:

Name Type Default value Description
hasStatus bool false
numExtInterfaces int 0
numRadios int 0

the number of radios in the router. by default no wireless

numPcapRecorders int 0

no of PcapRecorders.

numTunInterfaces int 0
osgModel string ""

3D model for OSG visualization, no 3D model by default

osgModelColor string ""

tint color, no colorization by default

mobilityType string numRadios > 0 ? "StationaryMobility" : ""
networkLayerType string "IPv4NetworkLayer"
routingTableType string "IPv4RoutingTable"
forwarding bool true
multicastForwarding bool false
energyStorageType string ""
energyManagementType string ""
energyGeneratorType string ""
numTcpTunApps int 0

no of TCP packetdrill apps.

numUdpTunApps int 0

no of UDP packetdrill apps.

numSctpTunApps int 0

no of SCTP packetdrill apps.

hasTcpTun bool numTcpTunApps>0
hasUdpTun bool numUdpTunApps>0
hasSctpTun bool numSctpTunApps>0
tcpType string firstAvailableOrEmpty("TCP", "TCP_lwIP", "TCP_NSC")

tcp implementation (e.g. TCP, TCP_lwIP, TCP_NSC) or TCPSpoof

udpType string firstAvailableOrEmpty("UDP")
sctpType string firstAvailableOrEmpty("SCTP")

Properties:

Name Value Description
display i=device/pc2;bgl=4;bgb=588,447
networkNode
labels node

Gates:

Name Direction Size Description
radioIn [ ] input numRadios
pppg [ ] inout
ethg [ ] inout

Unassigned submodule parameters:

Name Type Default value Description
status.initialStatus string "UP"

TODO @signal, @statistic

routingTable.forwarding bool
routingTable.multicastForwarding bool
interfaceTable.displayAddresses bool false

whether to display IP addresses on links

pcapRecorder.verbose bool false

whether to log packets on the module output

pcapRecorder.pcapFile string ""

the PCAP file to be written

pcapRecorder.snaplen int 65535

maximum number of bytes to record per packet

pcapRecorder.dumpBadFrames bool true

enable dump of frames with hasBitError

pcapRecorder.moduleNamePatterns string "wlan[*] eth[*] ppp[*] ext[*]"

space-separated list of sibling module names to listen on

pcapRecorder.sendingSignalNames string "packetSentToLower"

space-separated list of outbound packet signals to subscribe to

pcapRecorder.receivingSignalNames string "packetReceivedFromLower"

space-separated list of inbound packet signals to subscribe to

pcapRecorder.alwaysFlush bool false

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

lo0.lo.interfaceTableModule string

The path to the InterfaceTable module

lo0.lo.mtu int 4470B
tunApp.scriptFile string
tunApp.startTime double 0s
tunApp.localPort int

port number of the initiator

tunApp.remotePort int
tunApp.localAddress string
tunApp.remoteAddress string
tunApp.inboundStreams int 20
tunApp.outboundStreams int 20
tunApp.streamReset int 0
tunApp.dataTransferMode string "bytecount"
tunApp.latency double 0s

Source code:

//
// IPv4 host with SCTP, TCP, UDP layers and a packetdrill application.
// The application has a direct connection to the TunInterface.
//
module PacketDrillHost extends NodeBase
{
    parameters:
        @display("i=device/pc2;bgl=4;bgb=588,447");
        int numTcpTunApps = default(0);    // no of TCP packetdrill apps.
        int numUdpTunApps = default(0);    // no of UDP packetdrill apps.
        int numSctpTunApps = default(0);   // no of SCTP packetdrill apps.
        bool hasTcpTun = default(numTcpTunApps>0);
        bool hasUdpTun = default(numUdpTunApps>0);
        bool hasSctpTun = default(numSctpTunApps>0);
        string tcpType = default(firstAvailableOrEmpty("TCP", "TCP_lwIP", "TCP_NSC"));  // tcp implementation (e.g. ~TCP, ~TCP_lwIP, ~TCP_NSC) or ~TCPSpoof
        string udpType = default(firstAvailableOrEmpty("UDP"));
        string sctpType = default(firstAvailableOrEmpty("SCTP"));
    submodules:
        tunApp[numTunInterfaces]: PacketDrillApp {
            parameters:
                @display("p=280,40");
        }
        tcp: <tcpType> like ITCP if hasTcpTun {
            parameters:
                @display("p=230,140");
        }
        udp: <udpType> like IUDP if hasUdpTun {
            parameters:
                @display("p=330,140");
        }
        sctp: <sctpType> like ISCTP if hasSctpTun {
            parameters:
                @display("p=430,140");
        }

    connections allowunconnected:
        for i=0..numTcpTunApps-1 {
            tunApp[i].tcpOut --> tcp.appIn++;
            tunApp[i].tcpIn <-- tcp.appOut++;
        }

        tcp.ipOut --> networkLayer.transportIn++ if hasTcpTun;
        tcp.ipIn <-- networkLayer.transportOut++ if hasTcpTun;

        for i=0..numUdpTunApps-1 {
            tunApp[numTcpTunApps+i].udpOut --> udp.appIn++ if hasUdpTun;
            tunApp[numTcpTunApps+i].udpIn <-- udp.appOut++ if hasUdpTun;
        }

        udp.ipOut --> networkLayer.transportIn++ if hasUdpTun;
        udp.ipIn <-- networkLayer.transportOut++ if hasUdpTun;

        for i=0..numSctpTunApps-1 {
            tunApp[numTcpTunApps+numUdpTunApps+i].sctpOut --> sctp.from_appl++ if hasSctpTun;
            tunApp[numTcpTunApps+numUdpTunApps+i].sctpIn <-- sctp.to_appl++ if hasSctpTun;
        }

        sctp.to_ip --> networkLayer.transportIn++ if hasSctpTun;
        sctp.from_ip <-- networkLayer.transportOut++ if hasSctpTun;

        for i=0..numTunInterfaces-1 {
            tunApp[i].tunOut --> tun[i].appIn;
            tunApp[i].tunIn <-- tun[i].appOut;
        }
}