OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
Chord.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 __CHORD_H_
25
#define __CHORD_H_
26
27
#include <
BaseOverlay.h
>
28
#include <
NeighborCache.h
>
29
30
#include "
ChordMessage_m.h
"
31
32
namespace
oversim {
33
34
class
ChordSuccessorList;
35
class
ChordFingerTable;
36
47
class
Chord
:
public
BaseOverlay
,
public
ProxListener
48
{
49
public
:
50
Chord
();
51
virtual
~Chord
();
52
53
// see BaseOverlay.h
54
virtual
void
initializeOverlay
(
int
stage);
55
56
// see BaseOverlay.h
57
virtual
void
handleTimerEvent
(cMessage* msg);
58
59
// see BaseOverlay.h
60
virtual
void
handleUDPMessage
(
BaseOverlayMessage
* msg);
61
62
// see BaseOverlay.h
63
virtual
void
recordOverlaySentStats
(
BaseOverlayMessage
* msg);
64
65
// see BaseOverlay.h
66
virtual
void
finishOverlay
();
67
68
// see BaseOverlay.h
69
OverlayKey
distance
(
const
OverlayKey
& x,
70
const
OverlayKey
& y,
71
bool
useAlternative =
false
)
const
;
72
76
virtual
void
updateTooltip
();
77
78
void
proxCallback
(
const
TransportAddress
&node,
int
rpcId,
79
cPolymorphic *contextPointer,
Prox
prox);
80
81
protected
:
82
int
joinRetry
;
83
int
stabilizeRetry
;
84
double
joinDelay
;
85
double
stabilizeDelay
;
86
double
fixfingersDelay
;
87
double
checkPredecessorDelay
;
88
int
successorListSize
;
89
bool
aggressiveJoinMode
;
90
bool
extendedFingerTable
;
91
unsigned
int
numFingerCandidates
;
92
bool
proximityRouting
;
93
bool
memorizeFailedSuccessor
;
94
bool
newChordFingerTable
;
95
bool
mergeOptimizationL1
;
96
bool
mergeOptimizationL2
;
97
bool
mergeOptimizationL3
;
98
bool
mergeOptimizationL4
;
99
100
101
// timer messages
102
cMessage*
join_timer
;
103
cMessage*
stabilize_timer
;
104
cMessage*
fixfingers_timer
;
105
cMessage*
checkPredecessor_timer
;
106
107
// statistics
108
int
joinCount
;
109
int
stabilizeCount
;
110
int
fixfingersCount
;
111
int
notifyCount
;
112
int
newsuccessorhintCount
;
113
int
joinBytesSent
;
114
int
stabilizeBytesSent
;
115
int
notifyBytesSent
;
116
int
fixfingersBytesSent
;
117
int
newsuccessorhintBytesSent
;
119
int
keyLength
;
120
int
missingPredecessorStabRequests
;
127
virtual
void
changeState
(
int
toState);
128
129
// node references
130
NodeHandle
predecessorNode
;
131
TransportAddress
bootstrapNode
;
133
// module references
134
ChordFingerTable
*
fingerTable
;
135
ChordSuccessorList
*
successorList
;
137
// chord routines
138
144
virtual
void
handleJoinTimerExpired
(cMessage* msg);
145
151
virtual
void
handleStabilizeTimerExpired
(cMessage* msg);
152
158
virtual
void
handleFixFingersTimerExpired
(cMessage* msg);
159
165
virtual
void
handleNewSuccessorHint
(
ChordMessage
* chordMsg);
166
173
virtual
NodeVector
*
closestPreceedingNode
(
const
OverlayKey
& key);
174
175
179
virtual
void
findFriendModules
();
180
184
virtual
void
initializeFriendModules
();
185
186
// see BaseOverlay.h
187
virtual
bool
handleRpcCall
(
BaseCallMessage
* msg);
188
189
// see BaseOverlay.h
190
NodeVector
*
findNode
(
const
OverlayKey
& key,
191
int
numRedundantNodes,
192
int
numSiblings,
193
BaseOverlayMessage
* msg);
194
195
// see BaseOverlay.h
196
virtual
void
joinOverlay
();
197
198
// see BaseOverlay.h
199
virtual
void
joinForeignPartition
(
const
NodeHandle
&node);
200
201
// see BaseOverlay.h
202
virtual
bool
isSiblingFor
(
const
NodeHandle
& node,
203
const
OverlayKey
& key,
204
int
numSiblings,
bool
* err);
205
206
// see BaseOverlay.h
207
int
getMaxNumSiblings
();
208
209
// see BaseOverlay.h
210
int
getMaxNumRedundantNodes
();
211
217
void
rpcFixfingers
(
FixfingersCall
* call);
218
224
virtual
void
rpcJoin
(
JoinCall
* call);
225
231
virtual
void
rpcNotify
(
NotifyCall
* call);
232
238
void
rpcStabilize
(
StabilizeCall
* call);
239
240
// see BaseOverlay.h
241
virtual
void
handleRpcResponse
(
BaseResponseMessage
* msg,
242
cPolymorphic* context,
int
rpcId,
243
simtime_t rtt);
244
245
// see BaseOverlay.h
246
virtual
void
handleRpcTimeout
(
BaseCallMessage
* msg,
247
const
TransportAddress
& dest,
248
cPolymorphic* context,
249
int
rpcId,
const
OverlayKey
& destKey);
250
251
// see BaseRpc.h
252
virtual
void
pingResponse
(
PingResponse
*
pingResponse
,
253
cPolymorphic* context,
int
rpcId,
254
simtime_t rtt);
255
256
// see BaseRpc.h
257
virtual
void
pingTimeout
(
PingCall
* pingCall,
258
const
TransportAddress
& dest,
259
cPolymorphic* context,
260
int
rpcId);
261
262
virtual
void
handleRpcJoinResponse
(
JoinResponse
* joinResponse);
263
virtual
void
handleRpcNotifyResponse
(
NotifyResponse
* notifyResponse);
264
virtual
void
handleRpcStabilizeResponse
(
StabilizeResponse
* stabilizeResponse);
265
virtual
void
handleRpcFixfingersResponse
(
FixfingersResponse
* fixfingersResponse,
266
double
rtt = -1);
267
268
virtual
bool
handleFailedNode
(
const
TransportAddress
& failed);
269
270
friend
class
ChordSuccessorList
;
271
friend
class
ChordFingerTable
;
272
273
private
:
274
TransportAddress
failedSuccessor
;
275
};
276
277
};
//namespace
278
279
#endif
src
overlay
chord
Chord.h
Generated on Fri Dec 7 2012 13:37:52 for OverSim by
1.8.1.2