Public Member Functions | Public Attributes

nodeInfoRL Struct Reference

Structure that contains all information about a router-level node. More...

#include <RUNetworkConfigurator.h>

List of all members.

Public Member Functions

 nodeInfoRL ()
 nodeInfoRL (cTopology::Node *node)

Public Attributes

bool isIPNode
IInterfaceTable * ift
InterfaceEntry * defaultRouteIE
int asId
int asType
int routerType
int moduleId
IRoutingTable * rt
IPAddress addr
bool usesDefaultRoute
cModule * module
cTopology::Node * node

Detailed Description

Structure that contains all information about a router-level node.

During initialization all necessary information is extraced of the given node: Does it belong to Stub or Transit AS, ID, router type. In addition, default interfaces are determined for gateway, edge, and host routers. Core routers do not have any default routes.

Definition at line 72 of file RUNetworkConfigurator.h.


Constructor & Destructor Documentation

nodeInfoRL::nodeInfoRL (  )  [inline]

Definition at line 84 of file RUNetworkConfigurator.h.

{};

nodeInfoRL::nodeInfoRL ( cTopology::Node *  node  )  [inline]

Definition at line 85 of file RUNetworkConfigurator.h.

    {
        this->node = node;
        module = node->getModule();
        moduleId = module->getId();
        ift = IPAddressResolver().findInterfaceTableOf(module);
        rt = IPAddressResolver().findRoutingTableOf(module);
        isIPNode = (rt != NULL);
        int index = 0;
        string fullPath = module->getFullPath();

        // check if stubstring "sas" (StubAS) or "tas" (TransitAS)
        // is contained in fullPath
        if ( (index = fullPath.find("sas")) != -1 )
            asType = STUB_AS;
        else if ( (index = fullPath.find("tas")) != -1 )
            asType = TRANSIT_AS;
        else if ( (index = fullPath.find("ReaSEUnderlayNetwork")) != -1)
            asType = UNSPECIFIED;
        else {
            cerr << "found module that doesn't belong to Transit AS (tas) or Stub AS (sas): "<< fullPath<<endl;
            opp_error("found module that doesn't belong to Transit AS (tas) or Stub AS (sas)");
        }

        // set index to char position after substring "sas/tas"
        if (asType == STUB_AS || asType == TRANSIT_AS) {
            index += 3;
            string currentId;
            while (isdigit(fullPath[index]) && (index < (int) fullPath.length()))
                currentId += fullPath[index++];
            asId = atoi(currentId.data());
        }

        if (module->getProperties()->get("CoreRouter"))
            routerType = CORE;
        else if (module->getProperties()->get("GatewayRouter"))
            routerType = GW;
        else if (module->getProperties()->get("EdgeRouter"))
            routerType = EDGE;
        else if (module->getProperties()->get("Host"))
            routerType = ENDSYS;
        else {
            cerr<<"found module without valid type: "<<fullPath<<endl;
            opp_error("found module without valid type");
        }
        //
        // determine default interface
        //
        if (routerType == CORE) {
            // find last interface that is not loopback
            for (int i=0; i<ift->getNumInterfaces(); i++)
                if (!ift->getInterface(i)->isLoopback())
                    addr = ift->getInterface(i)->ipv4Data()->getIPAddress();
            defaultRouteIE = NULL;
        }
        else {
            for (int i=0; i<ift->getNumInterfaces(); i++) {
                if (!ift->getInterface(i)->isLoopback()) {
                    // find first interface that is not loopback and is connected to
                    // a higher level node. Then, create default route
                    addr = ift->getInterface(i)->ipv4Data()->getIPAddress();
                    if (routerType == GW) {
                        if (module->gate(ift->getInterface(i)->getNodeOutputGateId())\
                            ->getNextGate()->getOwnerModule()->getProperties()->get("CoreRouter")) {
                            defaultRouteIE = ift->getInterface(i);
                            break;
                        }
                    }
                    else if (routerType == EDGE) {
                        if (module->gate(ift->getInterface(i)->getNodeOutputGateId())\
                            ->getNextGate()->getOwnerModule()->getProperties()->get("GatewayRouter")) {
                            defaultRouteIE = ift->getInterface(i);
                            break;
                        }
                    }else if (routerType == ENDSYS) {
                        if (module->gate(ift->getInterface(i)->getNodeOutputGateId())\
                            ->getNextGate()->getOwnerModule()->getProperties()->get("EdgeRouter")) {
                            defaultRouteIE = ift->getInterface(i);
                            break;
                        }
                    }
                }
            }
        }
    };


Member Data Documentation

IPAddress nodeInfoRL::addr

Definition at line 79 of file RUNetworkConfigurator.h.

Referenced by nodeInfoRL(), and RUNetworkConfigurator::setIntraASRoutes().

Definition at line 77 of file RUNetworkConfigurator.h.

Referenced by RUNetworkConfigurator::disableStubLinks(), and nodeInfoRL().

Definition at line 77 of file RUNetworkConfigurator.h.

Referenced by nodeInfoRL().

InterfaceEntry* nodeInfoRL::defaultRouteIE

Definition at line 76 of file RUNetworkConfigurator.h.

Referenced by nodeInfoRL(), and RUNetworkConfigurator::setIntraASRoutes().

IInterfaceTable* nodeInfoRL::ift

Definition at line 75 of file RUNetworkConfigurator.h.

Referenced by nodeInfoRL(), and RUNetworkConfigurator::setIntraASRoutes().

Definition at line 74 of file RUNetworkConfigurator.h.

Referenced by nodeInfoRL().

Definition at line 81 of file RUNetworkConfigurator.h.

Referenced by nodeInfoRL(), and RUNetworkConfigurator::setIntraASRoutes().

Definition at line 77 of file RUNetworkConfigurator.h.

Referenced by RUNetworkConfigurator::initialize(), and nodeInfoRL().

cTopology::Node* nodeInfoRL::node

Definition at line 82 of file RUNetworkConfigurator.h.

Referenced by RUNetworkConfigurator::setIntraASRoutes().

Definition at line 77 of file RUNetworkConfigurator.h.

Referenced by nodeInfoRL(), and RUNetworkConfigurator::setIntraASRoutes().

IRoutingTable* nodeInfoRL::rt

Definition at line 78 of file RUNetworkConfigurator.h.

Referenced by nodeInfoRL(), and RUNetworkConfigurator::setIntraASRoutes().

Definition at line 80 of file RUNetworkConfigurator.h.


The documentation for this struct was generated from the following file: