OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
PastryStateObject.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
25
#ifndef __PASTRYSTATEOBJECT_H
26
#define __PASTRYSTATEOBJECT_H
27
28
29
#include <vector>
30
31
#include <omnetpp.h>
32
33
#include <
NodeHandle.h
>
34
#include <
NodeVector.h
>
35
36
#include "
PastryTypes.h
"
37
#include "
PastryMessage_m.h
"
38
48
class
PastryStateObject
:
public
cSimpleModule
49
{
50
public
:
51
52
void
handleMessage
(cMessage* msg);
53
54
int
numInitStages
(
void
)
const
;
55
56
void
initialize
(
int
stage);
57
65
virtual
const
NodeHandle
&
getDestinationNode
(
const
OverlayKey
& destination);
66
78
virtual
const
NodeHandle
&
findCloserNode
(
const
OverlayKey
& destination,
79
bool
optimize =
false
) = 0;
80
81
virtual
void
findCloserNodes
(
const
OverlayKey
& destination,
82
NodeVector
* nodes) = 0;
83
90
virtual
const
TransportAddress
&
failedNode
(
const
TransportAddress
& failed) = 0;
91
100
virtual
const
TransportAddress
&
repair
(
const
PastryStateMessage
* msg,
101
const
PastryStateMsgProximity
& prox);
102
108
virtual
void
dumpToStateMessage
(
PastryStateMessage
* msg)
const
= 0;
109
117
virtual
bool
mergeState
(
const
PastryStateMessage
* msg,
118
const
PastryStateMsgProximity
* prox);
119
126
virtual
void
dumpToVector
(std::vector<TransportAddress>& affected)
127
const
= 0;
128
137
bool
isCloser
(
const
NodeHandle
& test,
const
OverlayKey
& destination,
138
const
NodeHandle
& reference =
139
NodeHandle::UNSPECIFIED_NODE
)
const
;
140
153
bool
specialCloserCondition
(
const
NodeHandle
& test,
154
const
OverlayKey
& destination,
155
const
NodeHandle
& reference =
156
NodeHandle::UNSPECIFIED_NODE
)
const
;
157
158
protected
:
159
164
NodeHandle
owner
;
165
166
uint32_t
bitsPerDigit
;
167
171
private
:
172
static
const
PastryExtendedNode
*
_unspecNode
;
173
174
protected
:
175
static
const
PastryExtendedNode
&
unspecNode
()
176
{
177
if
(
_unspecNode
== NULL)
178
_unspecNode
=
new
PastryExtendedNode
();
179
return
*
_unspecNode
;
180
}
181
182
private
:
183
187
virtual
void
earlyInit
(
void
) = 0;
188
196
virtual
bool
mergeNode
(
const
NodeHandle
& node, simtime_t prox) = 0;
197
205
const
OverlayKey
*
keyDist
(
const
OverlayKey
& a,
const
OverlayKey
& b)
const
;
206
};
207
208
209
#endif
src
overlay
pastry
PastryStateObject.h
Generated on Fri Dec 7 2012 13:37:53 for OverSim by
1.8.1.2