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.

00099 {
00100     struct timeval now, diff;
00101     gettimeofday(&now, NULL);
00102     timersub(&now, &initFinishedTime, &diff);
00103     printf("Simulation time: %li.%06li\n", diff.tv_sec, diff.tv_usec);
00104 }

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     //add node to bootstrap oracle
00070     PeerInfo* info = new PeerInfo(node->submodule("overlay")->id());
00071     bootstrapOracle->addPeer(addr, info);
00072 
00073     if ( strlen(par("bootstrapIP")) > 0 ) {
00074         PeerInfo* bootstrapInfo = new PeerInfo(-1);
00075         bootstrapOracle->addPeer(IPAddress(par("bootstrapIP").stringValue()),
00076                                  bootstrapInfo);
00077 
00078         bootstrapOracle->registerPeer(NodeHandle(OverlayKey::ONE,
00079           IPAddress(par("bootstrapIP").stringValue()), par("bootstrapPort")));
00080     }
00081 
00082     // update display
00083     setDisplayString();
00084 
00085 }

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.

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


The documentation for this class was generated from the following files:
Generated on Fri May 11 14:52:41 2007 for ITM OverSim by  doxygen 1.4.7