SingleHostConfigurator Class Reference

#include <SingleHostConfigurator.h>

Inheritance diagram for SingleHostConfigurator:

UnderlayConfigurator List of all members.

Protected Member Functions

void initializeUnderlay (int stage)
 Init method for derived underlay configurators.
void finish ()
 Cleans up configurator.
void setDisplayString ()
 Sets display string.
int createRandomNode (bool initialize)
 Creates an overlay node.
void killRandomNode ()
 Removes randomly chosen overlay nodes from a randomly chosen access net.
void migrateRandomNode ()
 Migrates randomly chosen overlay nodes from on access net to another.

Member Function Documentation

int SingleHostConfigurator::createRandomNode ( bool  initialize  )  [inline, protected, virtual]

Creates an overlay node.

Parameters:
initialize 

Implements UnderlayConfigurator.

00037 {error("createRandomNode can't be used with singleHostUnderlay!"); return 0;}

void SingleHostConfigurator::finish (  )  [protected, virtual]

Cleans up configurator.

Implements UnderlayConfigurator.

00095 {
00096     struct timeval now, diff;
00097     gettimeofday(&now, NULL);
00098     timersub(&now, &initFinishedTime, &diff);
00099     printf("Simulation time: %li.%06li\n", diff.tv_sec, diff.tv_usec);
00100 }

void SingleHostConfigurator::initializeUnderlay ( int  stage  )  [protected, virtual]

Init method for derived underlay configurators.

Implements UnderlayConfigurator.

00040 {
00041     if(stage != MAX_STAGE_UNDERLAY)
00042         return;
00043 
00044     overlayTerminalCount = 1;
00045     // flag indicating simulation initialization phase (true)
00046     // vs. normal mode (false)
00047     init = true;
00048 
00049     // Set IP, Routes, etc
00050     cModule* node = parentModule()->submodule("singleHost", 0);
00051     IPvXAddress addr = IPAddress(par("nodeIP").stringValue());
00052     IPvXAddress gw = IPAddress(par("gatewayIP").stringValue());
00053     InterfaceEntry* ifEntry = IPAddressResolver().interfaceTableOf(node)->
00054             interfaceByName("tunDev");
00055     RoutingTable* rTable = (RoutingTable*) node->submodule("routingTable", 0);
00056     ifEntry->ipv4()->setInetAddress(addr.get4());
00057     ifEntry->ipv4()->setNetmask(IPAddress::ALLONES_ADDRESS);
00058 
00059     RoutingEntry* te = new RoutingEntry();
00060     te->host = IPAddress::UNSPECIFIED_ADDRESS;
00061     te->netmask = IPAddress::UNSPECIFIED_ADDRESS;
00062     te->gateway = gw.get4();
00063     te->interfaceName = "tunDev";
00064     te->interfacePtr = ifEntry;
00065     te->type = RoutingEntry::REMOTE;
00066     te->source = RoutingEntry::MANUAL;
00067     rTable->addRoutingEntry(te);
00068 
00069     if ( strlen(par("bootstrapIP")) > 0 ) {
00070         NodeHandle bootstrapNode(OverlayKey::ONE, 
00071                 IPAddress(par("bootstrapIP").stringValue()), 
00072                 par("bootstrapPort"),
00073                 0);
00074         BootstrapOracleAccess a;
00075         a.get()->registerPeer(bootstrapNode);
00076     }
00077 
00078     // update display
00079     setDisplayString();
00080 
00081 }

void SingleHostConfigurator::killRandomNode (  )  [inline, protected, virtual]

Removes randomly chosen overlay nodes from a randomly chosen access net.

Implements UnderlayConfigurator.

00038 {error("killRandomNode can't be used with singleHostUnderlay!");}

void SingleHostConfigurator::migrateRandomNode (  )  [inline, protected, virtual]

Migrates randomly chosen overlay nodes from on access net to another.

Implements UnderlayConfigurator.

00039 {error("migrateRandomNode can't be used with singleHostUnderlay!");}

void SingleHostConfigurator::setDisplayString (  )  [protected, virtual]

Sets display string.

Implements UnderlayConfigurator.

00084 {
00085     //
00086     // Updates the statistics display string.
00087     //
00088 
00089     char buf[80];
00090     sprintf(buf, "%i overlay clients", overlayTerminalCount);
00091     displayString().setTagArg("t", 0, buf);
00092 }


The documentation for this class was generated from the following files:
Generated on Wed Apr 4 13:37:06 2007 for ITM OverSim by  doxygen 1.4.7