P2PNSTestApp Class Reference

A simple test application for the P2PNS layer. More...

#include <P2PNSTestApp.h>

Inheritance diagram for P2PNSTestApp:
BaseApp BaseRpc RpcListener

List of all members.

Public Member Functions

virtual ~P2PNSTestApp ()
 virtual destructor

Protected Member Functions

void initializeApp (int stage)
 initializes derived class-attributes
void finishApp ()
 collects statistical data of derived app
virtual void handlePutResponse (DHTputCAPIResponse *msg)
 processes put responses
virtual void handleTimerEvent (cMessage *msg)
virtual void handleTraceMessage (cMessage *msg)
 handleTraceMessage gets called of handleMessage(cMessage* msg) if a message arrives at trace_in.
void handleRpcResponse (BaseResponseMessage *msg, cPolymorphic *context, int rpcId, simtime_t rtt)
 This method is called if an RPC response has been received.

Protected Attributes

UnderlayConfiguratorunderlayConfigurator
 pointer to UnderlayConfigurator in this node
GlobalNodeListglobalNodeList
 pointer to GlobalNodeList in this node
GlobalStatisticsglobalStatistics
 pointer to GlobalStatistics module in this node
bool debugOutput
 debug output yes/no?
double mean
 mean time interval between sending test messages
double deviation
 deviation of time interval
bool activeNetwInitPhase
 is app active in network init phase?
int numSent
 number of sent packets

Detailed Description

A simple test application for the P2PNS layer.

Author:
Ingmar Baumgart

Definition at line 46 of file P2PNSTestApp.h.


Constructor & Destructor Documentation

virtual P2PNSTestApp::~P2PNSTestApp (  )  [inline, virtual]

virtual destructor

Definition at line 92 of file P2PNSTestApp.h.

00092 {};


Member Function Documentation

void P2PNSTestApp::finishApp (  )  [protected, virtual]

collects statistical data of derived app

Reimplemented from BaseApp.

Definition at line 107 of file P2PNSTestApp.cc.

00108 {
00109     globalStatistics->addStdDev("P2PNSTestApp: Sent Messages", numSent);
00110 }

void P2PNSTestApp::handlePutResponse ( DHTputCAPIResponse *  msg  )  [protected, virtual]

processes put responses

method to handle put responses should be overwritten in derived application if needed

Parameters:
msg put response message

Definition at line 79 of file P2PNSTestApp.cc.

Referenced by handleRpcResponse().

00080 {
00081     EV << "[P2PNSTestApp::handlePutResponse()]\n"
00082        << "   Received Put response!"
00083        << endl;
00084 }

void P2PNSTestApp::handleRpcResponse ( BaseResponseMessage *  msg,
cPolymorphic *  context,
int  rpcId,
simtime_t  rtt 
) [protected, virtual]

This method is called if an RPC response has been received.

Parameters:
msg The response message.
context Pointer to an optional state object. The object has to be handled/deleted by the handleRpcResponse() code
rpcId The RPC id.
rtt The Round-Trip-Time of this RPC

Reimplemented from RpcListener.

Definition at line 62 of file P2PNSTestApp.cc.

00066 {
00067     RPC_SWITCH_START(msg)
00068     RPC_ON_RESPONSE( DHTputCAPI ) {
00069         handlePutResponse(_DHTputCAPIResponse);
00070         EV << "[P2PNSTestApp::handleRpcResponse()]\n"
00071            << "   DHT Put RPC Response received: id=" << rpcId
00072            << " msg=" << *_DHTputCAPIResponse << " rtt=" << rtt
00073            << endl;
00074         break;
00075     }
00076     RPC_SWITCH_END( )
00077 }

void P2PNSTestApp::handleTimerEvent ( cMessage *  msg  )  [protected, virtual]

Reimplemented from BaseRpc.

Definition at line 94 of file P2PNSTestApp.cc.

00095 {
00096     if (msg->isName("p2pnstest_timer")) {
00097 
00098     } else {
00099         throw cRuntimeError("P2PNSTestApp::handleTimerEvent(): "
00100                              "Unknown event!");
00101     }
00102 
00103 }

void P2PNSTestApp::handleTraceMessage ( cMessage *  msg  )  [protected, virtual]

handleTraceMessage gets called of handleMessage(cMessage* msg) if a message arrives at trace_in.

The command included in this message should be parsed and handled.

Parameters:
msg the command message to handle

Reimplemented from BaseApp.

Definition at line 87 of file P2PNSTestApp.cc.

00088 {
00089         throw cRuntimeError("P2PNSTestApp::handleTraceMessage(): Not implemented!");
00090 
00091         delete msg;
00092 }

void P2PNSTestApp::initializeApp ( int  stage  )  [protected, virtual]

initializes derived class-attributes

Parameters:
stage the init stage

Reimplemented from BaseApp.

Definition at line 32 of file P2PNSTestApp.cc.

00033 {
00034     if (stage != MIN_STAGE_APP)
00035         return;
00036 
00037     // fetch parameters
00038     debugOutput = par("debugOutput");
00039     activeNetwInitPhase = par("activeNetwInitPhase");
00040 
00041     mean = par("messageDelay");
00042     deviation = mean / 10;
00043 
00044     underlayConfigurator = UnderlayConfiguratorAccess().get();
00045     globalStatistics = GlobalStatisticsAccess().get();
00046 
00047     // statistics
00048     numSent = 0;
00049 
00050     initRpcs();
00051     WATCH(numSent);
00052 
00053     // initiate test message emision
00054     //cMessage* p2pnstest_timer = new cMessage("p2pnstest_timer");
00055 
00056     //if (mean > 0) {
00057         //scheduleAt(simTime() + truncnormal(mean, deviation),
00058           //         p2pnstest_timer);
00059     //}
00060 }


Member Data Documentation

is app active in network init phase?

Definition at line 82 of file P2PNSTestApp.h.

Referenced by initializeApp().

bool P2PNSTestApp::debugOutput [protected]

debug output yes/no?

Reimplemented from BaseApp.

Definition at line 79 of file P2PNSTestApp.h.

Referenced by initializeApp().

double P2PNSTestApp::deviation [protected]

deviation of time interval

Definition at line 81 of file P2PNSTestApp.h.

Referenced by initializeApp().

pointer to GlobalNodeList in this node

Reimplemented from BaseApp.

Definition at line 74 of file P2PNSTestApp.h.

pointer to GlobalStatistics module in this node

Reimplemented from BaseApp.

Definition at line 76 of file P2PNSTestApp.h.

Referenced by finishApp(), and initializeApp().

double P2PNSTestApp::mean [protected]

mean time interval between sending test messages

Definition at line 80 of file P2PNSTestApp.h.

Referenced by initializeApp().

int P2PNSTestApp::numSent [protected]

number of sent packets

Definition at line 85 of file P2PNSTestApp.h.

Referenced by finishApp(), and initializeApp().

pointer to UnderlayConfigurator in this node

Reimplemented from BaseApp.

Definition at line 72 of file P2PNSTestApp.h.

Referenced by initializeApp().


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