OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
Pastry.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2012 Institute of Telematics, Karlsruhe Institute of Technology (KIT)
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 __PASTRY_H_
25
#define __PASTRY_H_
26
27
#include <vector>
28
#include <map>
29
#include <queue>
30
#include <algorithm>
31
32
#include <omnetpp.h>
33
#include <IPvXAddress.h>
34
35
#include <
OverlayKey.h
>
36
#include <
NodeHandle.h
>
37
#include <
BaseOverlay.h
>
38
#include <
BasePastry.h
>
39
40
#include "
PastryTypes.h
"
41
#include "
PastryMessage_m.h
"
42
#include "
PastryRoutingTable.h
"
43
#include "
PastryLeafSet.h
"
44
#include "
PastryNeighborhoodSet.h
"
45
46
53
class
Pastry
:
public
BasePastry
54
{
55
public
:
56
virtual
~Pastry
();
57
58
// see BaseOverlay.h
59
virtual
void
initializeOverlay
(
int
stage);
60
61
// see BaseOverlay.h
62
virtual
void
handleTimerEvent
(cMessage* msg);
63
64
// see BaseOverlay.h
65
virtual
void
handleUDPMessage
(
BaseOverlayMessage
* msg);
66
67
void
handleStateMessage
(
PastryStateMessage
* msg);
68
69
virtual
void
pingResponse
(
PingResponse
*
pingResponse
,
70
cPolymorphic* context,
int
rpcId,
71
simtime_t rtt);
72
73
protected
:
74
75
virtual
void
purgeVectors
(
void
);
76
77
bool
handleRpcCall
(
BaseCallMessage
* msg);
78
79
void
handlePastryJoinCall
(
PastryJoinCall
* call);
80
81
void
handleRequestStateCall
(
RequestStateCall
* call);
82
83
void
handleRequestRepairCall
(
RequestRepairCall
* call);
84
85
void
handleRpcResponse
(
BaseResponseMessage
* msg,
86
cPolymorphic* context,
int
rpcId,
87
simtime_t rtt);
88
89
void
handlePastryJoinResponse
(
PastryJoinResponse
* response);
90
91
void
handleRequestStateResponse
(
RequestStateResponse
* response);
92
93
void
handleRequestRepairResponse
(
RequestRepairResponse
* response);
94
95
void
handleRequestLeafSetResponse
(
RequestLeafSetResponse
* response);
96
97
void
handleRequestRoutingRowResponse
(
RequestRoutingRowResponse
* response);
98
99
void
handleRpcTimeout
(
BaseCallMessage
* call,
100
const
TransportAddress
& dest,
101
cPolymorphic* context,
int
rpcId,
102
const
OverlayKey
& key);
103
109
virtual
void
changeState
(
int
toState);
110
111
112
virtual
bool
recursiveRoutingHook
(
const
TransportAddress
& dest,
113
BaseRouteMessage
* msg);
114
115
void
iterativeJoinHook
(
BaseOverlayMessage
* msg,
bool
incrHopCount);
119
std::vector<PastryStateMsgHandle>
stReceived
;
120
std::vector<PastryStateMsgHandle>::iterator
stReceivedPos
;
121
125
std::vector<TransportAddress>
notifyList
;
126
127
std::vector<PastrySendState*>
sendStateWait
;
128
129
private
:
130
131
void
clearVectors
();
132
133
simtime_t
secondStageInterval
;
134
simtime_t
routingTableMaintenanceInterval
;
135
simtime_t
discoveryTimeoutAmount
;
136
bool
partialJoinPath
;
137
138
uint16_t
discoveryModeProbedNodes
;
139
int
depth
;
140
141
int
updateCounter
;
142
143
bool
minimalJoinState
;
144
bool
useDiscovery
;
145
bool
useSecondStage
;
146
bool
useRoutingTableMaintenance
;
147
bool
sendStateAtLeafsetRepair
;
148
bool
pingBeforeSecondStage
;
149
150
bool
overrideOldPastry
;
151
bool
overrideNewPastry
;
152
153
cMessage*
secondStageWait
;
154
cMessage*
ringCheck
;
155
cMessage*
discoveryTimeout
;
156
cMessage*
repairTaskTimeout
;
157
161
void
doSecondStage
(
void
);
162
163
169
void
doRoutingTableMaintenance
();
170
179
bool
handleFailedNode
(
const
TransportAddress
& failed);
180
185
void
checkProxCache
(
void
);
186
187
void
processState
(
void
);
188
189
bool
mergeState
(
void
);
190
191
void
endProcessingState
(
void
);
192
196
void
doJoinUpdate
(
void
);
197
198
// see BaseOverlay.h
199
200
virtual
void
joinOverlay
();
201
207
void
sendStateDelayed
(
const
TransportAddress
& destination);
208
};
209
210
211
#endif
src
overlay
pastry
Pastry.h
Generated on Fri Dec 7 2012 13:37:53 for OverSim by
1.8.1.2