A simple test application for the P2PNS layer. More...
#include <P2PNSTestApp.h>
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 | |
UnderlayConfigurator * | underlayConfigurator |
pointer to UnderlayConfigurator in this node | |
GlobalNodeList * | globalNodeList |
pointer to GlobalNodeList in this node | |
GlobalStatistics * | globalStatistics |
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 |
A simple test application for the P2PNS layer.
Definition at line 46 of file P2PNSTestApp.h.
virtual P2PNSTestApp::~P2PNSTestApp | ( | ) | [inline, virtual] |
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
msg | put response message |
Definition at line 79 of file P2PNSTestApp.cc.
Referenced by handleRpcResponse().
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.
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.
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.
msg | the command message to handle |
Reimplemented from BaseApp.
Definition at line 87 of file P2PNSTestApp.cc.
void P2PNSTestApp::initializeApp | ( | int | stage | ) | [protected, virtual] |
initializes derived class-attributes
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 }
bool P2PNSTestApp::activeNetwInitPhase [protected] |
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().
GlobalNodeList* P2PNSTestApp::globalNodeList [protected] |
pointer to GlobalNodeList in this node
Reimplemented from BaseApp.
Definition at line 74 of file P2PNSTestApp.h.
GlobalStatistics* P2PNSTestApp::globalStatistics [protected] |
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().
UnderlayConfigurator* P2PNSTestApp::underlayConfigurator [protected] |
pointer to UnderlayConfigurator in this node
Reimplemented from BaseApp.
Definition at line 72 of file P2PNSTestApp.h.
Referenced by initializeApp().