OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
GlobalViewBuilder.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2010 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 GLOBALVIEWBUILDER_H_
25
#define GLOBALVIEWBUILDER_H_
26
27
#include <string>
28
#include <
NeighborCache.h
>
29
30
#include <
OverlayAccess.h
>
31
32
#include <
TreeManagement.h
>
33
#include <
SendStrategyFactory.h
>
34
#include <
StrategySendAll.h
>
35
#include <
RpcListener.h
>
36
#include <
TreeManagementMessage_m.h
>
37
#include <
CoordBasedRouting.h
>
38
39
class
BaseOverlay
;
40
class
TreeManagement
;
41
class
NeighborCache
;
42
class
NodeHandle
;
43
44
45
class
AbstractTreeMsgClient
:
public
RpcListener
46
{
47
public
:
48
virtual
bool
handleRpcCall
(
BaseCallMessage
* msg) = 0;
49
50
virtual
void
newParent
() { };
51
52
virtual
void
newChild
(
const
TransportAddress
& child =
53
TransportAddress::UNSPECIFIED_NODE
) { };
54
};
55
56
57
class
GlobalViewBuilder
:
public
AbstractTreeMsgClient
58
{
59
private
:
60
double
meanCoordSendInterval
;
61
double
deviation
;
62
63
cMessage*
coordSendTimer
;
64
cMessage*
spreadCapTimer
;
65
66
std::string
activeStrategy
;
67
bool
onlyAcceptCompleteCCD
;
68
69
SendStrategyFactory
sendStrategyFactory
;
70
71
AP
cap
;
72
bool
capReady
;
73
uint32_t
oldCcdSize
;
74
75
protected
:
76
NeighborCache
*
neighborCache
;
77
TreeManagement
*
treeManager
;
78
AbstractSendStrategy
*
sendStrategy
;
79
80
BaseOverlay
*
overlay
;
// TODO baseoverlay is only needed to fulfill a dependency in the AUTHBLOCK_L Macro
81
85
void
spreadGlobalView
();
86
87
88
bool
checkOverlayReady
();
89
90
public
:
91
GlobalViewBuilder
() {
92
sendStrategy
= NULL;
93
coordSendTimer
= NULL;
94
spreadCapTimer
= NULL;
95
};
96
97
virtual
~GlobalViewBuilder
() {
98
delete
sendStrategy
;
99
neighborCache
->cancelAndDelete(
coordSendTimer
);
100
neighborCache
->cancelAndDelete(
spreadCapTimer
);
101
};
102
103
void
initializeViewBuilder
(
NeighborCache
*
neighborCache
,
BaseOverlay
*
overlay
);
104
105
void
start
();
106
107
void
cleanup
();
108
109
void
handleTimerEvent
(cMessage* msg);
110
111
void
handleCoordSendTimer
(cMessage* msg);
112
113
void
handleCoordinateRpcCall
(
GlobalViewBuilderCall
* globalViewBuilderCall);
114
void
handleCapReqRpcCall
(
CapReqCall
* call);
115
116
void
sendCapRequest
(
const
TransportAddress
& node);
117
118
bool
handleRpcCall
(
BaseCallMessage
* msg);
119
void
handleRpcResponse
(
BaseResponseMessage
* msg,
120
cPolymorphic* context,
121
int
rpcId, simtime_t rtt);
122
void
handleRpcTimeout
(
BaseCallMessage
* msg,
123
const
TransportAddress
& dest,
124
cPolymorphic* context,
int
rpcId,
125
const
OverlayKey
& destKey);
126
127
cPar&
parProxy
(
const
char
*parname);
128
129
void
newParent
();
130
131
bool
isCapReady
() {
return
capReady
; };
132
bool
isCapValid
() {
return
(
cap
.size() > 0); };
133
const
AP
*
getCAP
() {
return
&
cap
; };
134
};
135
136
#endif
/* GLOBALVIEWBUILDER_H_ */
src
common
cbr
GlobalViewBuilder.h
Generated on Fri Dec 7 2012 13:37:52 for OverSim by
1.8.1.2