I3Anycast Class Reference

Random ping test application for I3. More...

Inheritance diagram for I3Anycast:
I3BaseApp

List of all members.

Public Member Functions

void initializeApp (int stage)
 App initialization - should be overwritten by application.
void initializeI3 ()
 Application I3 initialize - should be overwritten by application.
void deliver (I3Trigger &trigger, I3IdentifierStack &stack, cPacket *msg)
 Delivers packets coming from I3 - should be overwritten by application.
void handleTimerEvent (cMessage *msg)
 Handles timers - should be overwritten by application.

Public Attributes

int myIndex
cMessage * sendPacketTimer

Static Private Attributes

static int index = 0

Detailed Description

Random ping test application for I3.

First, all nodes insert a trigger in which the identifier has a constant prefix but a random postfix. Then the first node sends a message with an identifier that has the previous prefix, but a different random suffix. That makes that, when the packet is matched within I3 and sent to the closest match, it will land each time on a random node. The fact that it retains the same prefix guarantees that a match will always exist and the packet won't be dropped. After arrival in each node, the process is repeated.

Definition at line 34 of file I3Anycast.cc.


Member Function Documentation

void I3Anycast::deliver ( I3Trigger trigger,
I3IdentifierStack stack,
cPacket *  msg 
) [virtual]

Delivers packets coming from I3 - should be overwritten by application.

Parameters:
trigger Application trigger to which the packet was sent
stack Identifier stack passed from I3
msg Arriving message

Reimplemented from I3BaseApp.

Definition at line 81 of file I3Anycast.cc.

00082 {
00083     // after arrival, repeat the same process
00084     I3Identifier id("I3 Anycast test"); // create an identifier with the previously used hash as prefix
00085     id.createRandomSuffix(); // and a random suffix
00086 
00087     getParentModule()->bubble("Got message - sending back!");
00088     sendPacket(id, msg); // and send back to I3
00089 }

void I3Anycast::handleTimerEvent ( cMessage *  msg  )  [virtual]

Handles timers - should be overwritten by application.

Parameters:
msg Timer to be handled

Reimplemented from I3BaseApp.

Definition at line 66 of file I3Anycast.cc.

00067 {
00068     if (myIndex == 0) { // only the first node
00069         cPacket *cmsg = new cPacket("woot");
00070 
00071         I3Identifier id("I3 Anycast test"); // create an identifier with the previously used hash as prefix
00072         id.createRandomSuffix(); // and a random suffix
00073 
00074         //cout << "Send message!" << endl;
00075         getParentModule()->bubble("Sending message!");
00076         sendPacket(id, cmsg); // send the first message with that identifier
00077     }
00078     delete msg;
00079 }

void I3Anycast::initializeApp ( int  stage  )  [virtual]

App initialization - should be overwritten by application.

I3 related commands should go in initializeI3.

Parameters:
stage Initialization stage passed from initialize()

Reimplemented from I3BaseApp.

Definition at line 50 of file I3Anycast.cc.

00050                                        {
00051     myIndex = index++;
00052 }

void I3Anycast::initializeI3 (  )  [virtual]

Application I3 initialize - should be overwritten by application.

Reimplemented from I3BaseApp.

Definition at line 55 of file I3Anycast.cc.

00056 {
00057     sendPacketTimer = new cMessage("packet timer");
00058     scheduleAt(simTime() + 20, sendPacketTimer);
00059 
00060     I3Identifier identifier("I3 Anycast test"); // create an identifier with the given string hash as prefix
00061     identifier.createRandomSuffix(); // set the suffix as random
00062     insertTrigger(identifier); // and insert a trigger with that id
00063 
00064 }


Member Data Documentation

int I3Anycast::index = 0 [static, private]

Definition at line 37 of file I3Anycast.cc.

Referenced by initializeApp().

Definition at line 39 of file I3Anycast.cc.

Referenced by handleTimerEvent(), and initializeApp().

Definition at line 40 of file I3Anycast.cc.

Referenced by initializeI3().


The documentation for this class was generated from the following file:
Generated on Wed May 26 16:21:17 2010 for OverSim by  doxygen 1.6.3