OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
DHTTestApp.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2007 Institut fuer Telematik, Universitaet Karlsruhe (TH)
3
//
4
// This program is free software; you can redistribute it and/or
5
// modify it under the terms of the GNU General Public License
6
// as published by the Free Software Foundation; either version 2
7
// of the License, or (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program; if not, write to the Free Software
16
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
//
18
24
#ifndef __DHTTESTAPP_H_
25
#define __DHTTESTAPP_H_
26
27
#include <omnetpp.h>
28
29
#include <
GlobalNodeList.h
>
30
#include <
GlobalStatistics.h
>
31
#include <
UnderlayConfigurator.h
>
32
#include <
TransportAddress.h
>
33
#include <
OverlayKey.h
>
34
#include <
InitStages.h
>
35
#include <
BinaryValue.h
>
36
#include <
BaseApp.h
>
37
#include <set>
38
#include <sstream>
39
40
class
GlobalDhtTestMap
;
41
50
class
DHTTestApp
:
public
BaseApp
51
{
52
private
:
59
class
DHTStatsContext
:
public
cPolymorphic
60
{
61
public
:
62
bool
measurementPhase
;
63
simtime_t
requestTime
;
64
OverlayKey
key
;
65
BinaryValue
value
;
66
67
DHTStatsContext
(
bool
measurementPhase
,
68
simtime_t
requestTime
,
69
const
OverlayKey
&
key
,
70
const
BinaryValue
&
value
=
BinaryValue::UNSPECIFIED_VALUE
) :
71
measurementPhase(measurementPhase), requestTime(requestTime),
72
key(key),
value
(
value
) {};
73
};
74
75
void
initializeApp
(
int
stage);
76
80
OverlayKey
getRandomKey
();
81
85
BinaryValue
generateRandomValue
();
86
87
void
finishApp
();
88
97
virtual
void
handleGetResponse
(
DHTgetCAPIResponse
* msg,
98
DHTStatsContext* context);
99
108
virtual
void
handlePutResponse
(
DHTputCAPIResponse
* msg,
109
DHTStatsContext* context);
110
118
virtual
void
handleTimerEvent
(cMessage* msg);
119
127
virtual
void
handleTraceMessage
(cMessage* msg);
128
129
virtual
void
handleNodeLeaveNotification
();
130
131
// see RpcListener.h
132
void
handleRpcResponse
(
BaseResponseMessage
* msg,
const
RpcState
& state,
133
simtime_t rtt);
134
135
UnderlayConfigurator
*
underlayConfigurator
;
137
GlobalNodeList
*
globalNodeList
;
139
GlobalStatistics
*
globalStatistics
;
140
GlobalDhtTestMap
*
globalDhtTestMap
;
142
// parameters
143
bool
debugOutput
;
144
double
mean
;
145
double
deviation
;
146
int
ttl
;
147
bool
p2pnsTraffic
;
148
bool
activeNetwInitPhase
;
149
150
// statistics
151
int
numSent
;
152
int
numGetSent
;
153
int
numGetError
;
154
int
numGetSuccess
;
155
int
numPutSent
;
156
int
numPutError
;
157
int
numPutSuccess
;
159
cMessage *
dhttestput_timer
, *
dhttestget_timer
, *
dhttestmod_timer
;
160
bool
nodeIsLeavingSoon
;
161
162
static
const
int
DHTTESTAPP_VALUE_LEN
= 20;
163
164
public
:
165
DHTTestApp
();
166
170
virtual
~DHTTestApp
();
171
172
};
173
174
#endif
src
tier2
dhttestapp
DHTTestApp.h
Generated on Fri Dec 7 2012 13:37:52 for OverSim by
1.8.1.2