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 finishUnderlay ()
 Cleans up concrete underlay configurator.
void setDisplayString ()
 Sets display string.
TransportAddresscreateNode (NodeType type, bool initialize)
 Creates an overlay node.
void preKillNode (NodeType type, TransportAddress *addr=NULL)
 Notifies and schedules overlay nodes for removal.
void migrateNode (NodeType type, TransportAddress *addr=NULL)
 Migrates overlay nodes from one access net to another.
void handleMessage (cMessage *msg)
 Node mobility simulation.


Member Function Documentation

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 
00046     // Set IP, Routes, etc
00047     cModule* node = parentModule()->submodule("singleHost", 0);
00048     IPvXAddress addr = IPAddress(par("nodeIP").stringValue());
00049     IPvXAddress gw = IPAddress(par("gatewayIP").stringValue());
00050     InterfaceEntry* ifEntry = IPAddressResolver().interfaceTableOf(node)->
00051             interfaceByName("outDev");
00052     RoutingTable* rTable = (RoutingTable*) node->submodule("routingTable", 0);
00053     ifEntry->ipv4()->setInetAddress(addr.get4());
00054     ifEntry->ipv4()->setNetmask(IPAddress::ALLONES_ADDRESS);
00055 
00056     RoutingEntry* te = new RoutingEntry();
00057     te->host = IPAddress::UNSPECIFIED_ADDRESS;
00058     te->netmask = IPAddress::UNSPECIFIED_ADDRESS;
00059     te->gateway = gw.get4();
00060     te->interfaceName = "outDev";
00061     te->interfacePtr = ifEntry;
00062     te->type = RoutingEntry::REMOTE;
00063     te->source = RoutingEntry::MANUAL;
00064     rTable->addRoutingEntry(te);
00065 
00066     //add node to bootstrap oracle
00067     PeerInfo* info = new PeerInfo(1, node->id());
00068     bootstrapOracle->addPeer(addr, info);
00069 
00070     if ( strlen(par("bootstrapIP")) > 0 ) {
00071         PeerInfo* bootstrapInfo = new PeerInfo(0, -1);
00072         bootstrapOracle->addPeer(IPAddress(par("bootstrapIP").stringValue()),
00073                                  bootstrapInfo);
00074 
00075         bootstrapOracle->registerPeer(NodeHandle(OverlayKey::ONE,
00076           IPAddress(par("bootstrapIP").stringValue()), par("bootstrapPort")));
00077     }
00078 
00079     // update display
00080     setDisplayString();
00081 
00082 }

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

Cleans up concrete underlay configurator.

Reimplemented from UnderlayConfigurator.

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

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

Sets display string.

Implements UnderlayConfigurator.

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

TransportAddress* SingleHostConfigurator::createNode ( NodeType  type,
bool  initialize 
) [inline, protected, virtual]

Creates an overlay node.

Parameters:
type NodeType of the node to create
initialize are we in init phase?

Implements UnderlayConfigurator.

00044 {error("createNode can't be used with singleHostUnderlay!"); return NULL;}

void SingleHostConfigurator::preKillNode ( NodeType  type,
TransportAddress addr = NULL 
) [inline, protected, virtual]

Notifies and schedules overlay nodes for removal.

Parameters:
type NodeType of the node to remove
addr NULL for random node

Implements UnderlayConfigurator.

00045 {error("preKillNode can't be used with singleHostUnderlay!");}

void SingleHostConfigurator::migrateNode ( NodeType  type,
TransportAddress addr = NULL 
) [inline, protected, virtual]

Migrates overlay nodes from one access net to another.

Parameters:
type NodeType of the node to migrate
addr NULL for random node

Implements UnderlayConfigurator.

00046 {error("migrateNode can't be used with singleHostUnderlay!");}

void SingleHostConfigurator::handleMessage ( cMessage *  msg  )  [inline, protected]

Node mobility simulation.

Parameters:
msg timer-message

Reimplemented from UnderlayConfigurator.

00047 {error("handleMessage can't be used with singleHostUnderlay!");}


The documentation for this class was generated from the following files:
Generated on Thu Apr 17 13:19:30 2008 for ITM OverSim by  doxygen 1.5.3