NED File src/PSRouter.ned

Name Description
PSRouter (compound module)

The Publish-Subscribe Router

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 pubsub_sim.LinkMon.LinkMon;
import pubsub_sim.ForwTable.FwTable;
import pubsub_sim.EthernetInterfaceThrMtr;
import inet.mobility.NullMobility;
import pubsub_sim.Forwarder.Forwarder;
import inet.nodes.inet.NetworkLayer;
import inet.base.NotificationBoard;
import inet.linklayer.ethernet.EthernetInterface2;
import inet.linklayer.ppp.PPPInterface;
import inet.networklayer.common.InterfaceTable;
import inet.networklayer.ipv4.RoutingTable;
import inet.util.NAMTraceWriter;


//
// <b> The Publish-Subscribe Router </b>
//
// The PSRouter, may support any number of Ethernet interfaces, which
// on the other hand, all have to be connected to the Forwarder. There
// is no other protocol able to operate in the PSRouter, apart from the
// Publish-Subscribe scheme. 
//
// @see Forwarder, FwTable, LinkMon.
//
// @author Nikolaos Vastardis
//
module PSRouter
{
    parameters:
        @node();
        @labels(node,ethernet-node);
        @display("i=abstract/router;bgb=538,330");
        string routingFile = default("");
        int numIf = 0;
    gates:
        inout pppg[] @labels(PPPFrame-conn);
        inout ethg[] @labels(EtherFrame-conn);
    submodules:
        notificationBoard: NotificationBoard {
            parameters:
                @display("p=60,60");
        }
        interfaceTable: InterfaceTable {
            parameters:
                @display("p=257,60");
        }
        eth[sizeof(ethg)]: EthernetInterfaceThrMtr {
            parameters:
                @display("p=57,277,row;q=l2queue");
        }
        forwarder: Forwarder {
            parameters:
                @display("p=257,143;i=block/fork");
            gates:
                ifIn[sizeof(ethg)];
                ifOut[sizeof(ethg)];
        }
        fwTable: FwTable {
            @display("p=447,60");
        }
        linkMon: LinkMon {
            @display("p=60,149");
        }
    connections allowunconnected:
        for i=0..sizeof(ethg)-1 {
            ethg[i] <--> eth[i].phys;
            eth[i].netwOut --> forwarder.ifIn[i];
            eth[i].netwIn <-- forwarder.ifOut[i];
        }
}