OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
ChordSuccessorList.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 __CHORDSUCCESSORLIST_H_
25
#define __CHORDSUCCESSORLIST_H_
26
27
#include <map>
28
29
#include <omnetpp.h>
30
31
#include <
InitStages.h
>
32
#include <
NodeHandle.h
>
33
34
class
OverlayKey
;
35
class
NotifyResponse
;
36
37
namespace
oversim {
38
39
class
Chord;
40
41
struct
SuccessorListEntry
42
{
43
NodeHandle
nodeHandle
;
//*< the nodehandle
44
bool
newEntry
;
//*< true, if this entry has just been added
45
};
46
47
std::ostream&
operator<<
(std::ostream& os,
const
SuccessorListEntry
& e);
48
49
58
class
ChordSuccessorList
:
public
cSimpleModule
59
{
60
public
:
61
virtual
int
numInitStages
()
const
62
{
63
return
MAX_STAGE_OVERLAY
+ 1;
64
}
65
virtual
void
initialize
(
int
stage);
66
virtual
void
handleMessage
(cMessage* msg);
67
75
virtual
void
initializeList
(uint32_t size,
NodeHandle
owner,
76
Chord
*
overlay
);
77
83
virtual
uint32_t
getSize
();
84
91
virtual
bool
isEmpty
();
92
99
virtual
const
NodeHandle
&
getSuccessor
(uint32_t pos = 0);
100
111
virtual
void
addSuccessor
(
NodeHandle
successor,
bool
resize =
true
);
112
113
virtual
void
updateList
(
NotifyResponse
* notify);
114
115
bool
handleFailedNode
(
const
TransportAddress
& failed);
116
117
void
display
();
118
119
120
protected
:
121
NodeHandle
thisNode
;
122
std::map<OverlayKey, SuccessorListEntry>
successorMap
;
124
uint32_t
successorListSize
;
126
Chord
*
overlay
;
128
void
removeOldSuccessors
();
129
133
void
updateDisplayString
();
134
138
void
updateTooltip
();
139
};
140
141
};
//namespace
142
#endif
src
overlay
chord
ChordSuccessorList.h
Generated on Fri Dec 7 2012 13:37:52 for OverSim by
1.8.1.2