OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
KBRTestApp.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2006 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 __KBRTESTAPP_H_
25
#define __KBRTESTAPP_H_
26
27
#include <omnetpp.h>
28
29
#include <
OverlayKey.h
>
30
31
#include "
BaseApp.h
"
32
33
class
KBRTestMessage
;
34
class
KbrTestCall
;
35
class
UnderlayTestCall
;
36
44
class
KBRTestApp
:
public
BaseApp
45
{
46
public
:
47
KBRTestApp
();
48
~KBRTestApp
();
49
50
private
:
51
56
struct
MsgHandle
57
{
58
OverlayKey
key
;
59
int
seqNum
;
60
61
MsgHandle
(
void
) :
62
key
(
OverlayKey
::UNSPECIFIED_KEY),
seqNum
(-1) {};
63
MsgHandle
(
const
OverlayKey
&
key
,
int
seqNum
) :
64
key(key), seqNum(seqNum) {};
65
bool
operator==
(
const
MsgHandle
& rhs)
const
{
66
return
((
key
== rhs.
key
) && (
seqNum
== rhs.
seqNum
));
67
};
68
MsgHandle
&
operator=
(
const
MsgHandle
& rhs) {
69
key
= rhs.
key
;
70
seqNum
= rhs.
seqNum
;
71
return
(*
this
);
72
};
73
};
74
typedef
std::vector<MsgHandle>
MsgHandleBuf
;
75
76
void
initializeApp
(
int
stage);
77
void
finishApp
();
78
void
handleTimerEvent
(cMessage* msg);
79
80
void
deliver
(
OverlayKey
& key, cMessage* msg);
81
82
void
forward
(
OverlayKey
* key, cPacket** msg,
NodeHandle
* nextHopNode);
83
93
bool
checkSeen
(
const
OverlayKey
& key,
int
seqNum);
94
105
void
evaluateData
(simtime_t timeDelay,
int
hopCount,
long
int
bytes);
106
107
bool
handleRpcCall
(
BaseCallMessage
* msg);
108
void
kbrTestCall
(
KbrTestCall
* call);
109
void
underlayTestCall
(
UnderlayTestCall
* call);
110
111
void
handleRpcResponse
(
BaseResponseMessage
* msg, cPolymorphic* context,
112
int
rpcId, simtime_t rtt);
113
114
void
handleRpcTimeout
(
BaseCallMessage
* msg,
115
const
TransportAddress
& dest,
116
cPolymorphic* context,
int
rpcId,
117
const
OverlayKey
& destKey);
118
119
void
handleLookupResponse
(
LookupResponse
* msg,
120
cObject* context, simtime_t latency);
121
122
void
pingResponse
(
PingResponse
* response, cPolymorphic* context,
123
int
rpcId, simtime_t rtt);
124
125
// see BaseApp.h
126
virtual
void
handleNodeLeaveNotification
();
127
128
std::pair<OverlayKey, TransportAddress>
createDestKey
();
129
130
bool
kbrOneWayTest
;
131
bool
kbrRpcTest
;
132
bool
kbrLookupTest
;
133
bool
underlayTest
;
134
135
int
testMsgSize
;
136
double
mean
;
137
double
deviation
;
138
bool
activeNetwInitPhase
;
139
bool
lookupNodeIds
;
140
bool
nodeIsLeavingSoon
;
141
bool
onlyLookupInoffensiveNodes
;
142
143
//simtime_t rpcTimeout;
144
int
rpcRetries
;
145
146
uint32_t
numSent
;
147
uint32_t
bytesSent
;
148
uint32_t
numDelivered
;
149
uint32_t
bytesDelivered
;
150
uint32_t
numDropped
;
151
uint32_t
bytesDropped
;
152
153
uint32_t
numRpcSent
;
154
uint32_t
bytesRpcSent
;
155
uint32_t
numRpcDelivered
;
156
uint32_t
bytesRpcDelivered
;
157
uint32_t
numRpcDropped
;
158
uint32_t
bytesRpcDropped
;
159
160
simtime_t
rpcSuccLatencySum
;
161
uint32_t
rpcSuccLatencyCount
;
162
163
simtime_t
rpcTotalLatencySum
;
164
uint32_t
rpcTotalLatencyCount
;
165
166
uint32_t
numLookupSent
;
167
uint32_t
numLookupSuccess
;
168
uint32_t
numLookupFailed
;
169
170
uint32_t
numUnderlaySent
;
171
uint32_t
bytesUnderlaySent
;
172
uint32_t
numUnderlayDelivered
;
173
uint32_t
bytesUnderlayDelivered
;
174
175
// TODO lookup stats
176
177
cMessage*
onewayTimer
;
178
cMessage*
rpcTimer
;
179
cMessage*
lookupTimer
;
180
cMessage*
underlayTimer
;
181
182
simtime_t
failureLatency
;
184
uint32_t
sequenceNumber
;
185
int
msgHandleBufSize
;
186
MsgHandleBuf
mhBuf
;
187
MsgHandleBuf::iterator
mhBufBegin
;
188
MsgHandleBuf::iterator
mhBufNext
;
189
MsgHandleBuf::iterator
mhBufEnd
;
190
};
191
192
#endif
src
applications
kbrtestapp
KBRTestApp.h
Generated on Fri Dec 7 2012 13:37:52 for OverSim by
1.8.1.2