NED File src/EthernetInterfaceThrMtr.ned

Name Description
EthernetInterfaceThrMtr (compound module)

Ethernet Interface with Throughput Meter

Source code:

//
// Copyright (C) 2011 Nikolaos Vastardis; University of Essex, Colchester
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//



package pubsub_sim;

import inet.linklayer.ppp.ThruputMeter;
import inet.linklayer.INetworkInterface;
import inet.networklayer.queue.OutputQueue;
import inet.linklayer.ethernet.*;
import pubsub_sim.ThrPutMeter.ThrPutMeter;


//
// <b> Ethernet Interface with Throughput Meter </b>
//
// Ethernet network interface which supports full-duplex operation only.
// Complements EtherMAC2 and EtherEncap with an output queue for QoS and
// RED support. It also incorporates a throuput meter, but easier recording
// of statistics.
//
// @see EthernetInterface, EthernetInterfaceNoQueue, ThruputMeter.
//
module EthernetInterfaceThrMtr like INetworkInterface
{
    parameters:
        string queueType = default("DropTailQueue");
        @display("i=block/ifcard;bgb=214,341");
    gates:
        input netwIn;
        output netwOut;
        inout phys @labels(EtherFrame);
    submodules:
        queue: <queueType> like OutputQueue {
            parameters:
                @display("p=76,65;q=l2queue");
        }
        mac: EtherMAC2 {
            parameters:
                queueModule = "queue";
                txQueueLimit = 1; // queue sends one packet at a time
                @display("p=129,267");
        }
        encap: EtherEncap {
            parameters:
                @display("p=129,187");
        }
        thruputMeter: ThrPutMeter {
            @display("p=76,125");
        }
    connections:
        netwIn --> queue.in;
        queue.out --> thruputMeter.in;
        netwOut <-- { @display("m=n"); } <-- encap.upperLayerOut;
        encap.lowerLayerOut --> mac.upperLayerIn;
        encap.lowerLayerIn <-- mac.upperLayerOut;
        mac.phys <--> phys;
        thruputMeter.out --> encap.upperLayerIn;
}