OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
Gia.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 __GIA_H_
25
#define __GIA_H_
26
27
28
#include <vector>
29
30
#include <omnetpp.h>
31
32
#include <UDPAppBase.h>
33
#include <IPvXAddress.h>
34
35
#include <
GlobalNodeList.h
>
36
#include <
UnderlayConfigurator.h
>
37
#include <
OverlayKey.h
>
38
#include <
NodeHandle.h
>
39
#include <
CommonMessages_m.h
>
40
#include <
BaseOverlay.h
>
41
42
#include "
GiaMessage_m.h
"
43
#include "
GiaKeyListModule.h
"
44
#include "
GiaKeyList.h
"
45
#include "
GiaNeighbors.h
"
46
#include "
GiaTokenFactory.h
"
47
#include "
GiaNode.h
"
48
#include "
GiaNeighborCandidateList.h
"
49
#include "
GiaMessageBookkeeping.h
"
50
51
61
class
Gia
:
public
BaseOverlay
62
{
63
public
:
69
void
initializeOverlay
(
int
stage);
70
74
void
finishOverlay
();
75
80
virtual
void
changeState
(
int
toStage);
81
85
void
updateTooltip
();
86
//virtual void setBootstrapedIcon();
87
88
// Gia
92
~Gia
();
93
94
void
handleTimerEvent
(cMessage* msg);
95
96
void
handleUDPMessage
(
BaseOverlayMessage
* msg);
97
98
// API for structured P2P overlays
99
100
virtual
void
getRoute
(
const
OverlayKey
& key,
CompType
destComp,
101
CompType
srcComp, cPacket* msg,
102
const
std::vector<TransportAddress>& sourceRoute
103
=
TransportAddress::UNSPECIFIED_NODES
,
104
RoutingType
routingType =
DEFAULT_ROUTING
);
105
106
void
handleAppMessage
(cMessage* msg);
107
108
void
sendToken
(
const
GiaNode
& dst);
109
110
protected
:
111
// parameters from OMNeT.ini
112
uint32_t
maxNeighbors
;
113
uint32_t
minNeighbors
;
114
uint32_t
maxTopAdaptionInterval
;
115
uint32_t
topAdaptionAggressiveness
;
116
double
maxLevelOfSatisfaction
;
117
double
updateDelay
;
118
uint32_t
maxHopCount
;
119
uint32_t
messageTimeout
;
120
uint32_t
neighborTimeout
;
121
uint32_t
sendTokenTimeout
;
122
uint32_t
tokenWaitTime
;
123
double
keyListDelay
;
124
bool
outputNodeDetails
;
125
bool
optimizeReversePath
;
127
double
levelOfSatisfaction
;
128
unsigned
int
connectionDegree
;
129
unsigned
int
receivedTokens
;
130
unsigned
int
sentTokens
;
131
132
// node references
133
GiaNode
thisGiaNode
;
134
NodeHandle
bootstrapNode
;
135
GiaMessageBookkeeping
*
msgBookkeepingList
;
137
// statistics
138
uint32_t
stat_joinCount
;
139
uint32_t
stat_joinBytesSent
;
140
uint32_t
stat_joinREQ
;
141
uint32_t
stat_joinREQBytesSent
;
142
uint32_t
stat_joinRSP
;
143
uint32_t
stat_joinRSPBytesSent
;
144
uint32_t
stat_joinACK
;
145
uint32_t
stat_joinACKBytesSent
;
146
uint32_t
stat_joinDNY
;
147
uint32_t
stat_joinDNYBytesSent
;
148
uint32_t
stat_disconnectMessages
;
149
uint32_t
stat_disconnectMessagesBytesSent
;
150
uint32_t
stat_updateMessages
;
151
uint32_t
stat_updateMessagesBytesSent
;
152
uint32_t
stat_tokenMessages
;
153
uint32_t
stat_tokenMessagesBytesSent
;
154
uint32_t
stat_keyListMessages
;
155
uint32_t
stat_keyListMessagesBytesSent
;
156
uint32_t
stat_routeMessages
;
157
uint32_t
stat_routeMessagesBytesSent
;
158
uint32_t
stat_maxNeighbors
;
159
uint32_t
stat_addedNeighbors
;
160
uint32_t
stat_removedNeighbors
;
161
uint32_t
stat_numSatisfactionMessages
;
162
double
stat_sumLevelOfSatisfaction
;
163
double
stat_maxLevelOfSatisfaction
;
165
// self-messages
166
cMessage*
satisfaction_timer
;
167
cMessage*
update_timer
;
168
cMessage*
timedoutMessages_timer
;
169
cMessage*
timedoutNeighbors_timer
;
170
cMessage*
sendKeyList_timer
;
171
cMessage*
sendToken_timer
;
173
// module references
174
GiaKeyListModule
*
keyListModule
;
175
GiaNeighbors
*
neighbors
;
176
GiaTokenFactory
*
tokenFactory
;
178
// internal
179
GiaNeighborCandidateList
neighCand
;
180
GiaNeighborCandidateList
knownNodes
;
181
GiaKeyList
keyList
;
183
// internal methodes
184
185
void
joinOverlay
();
186
193
bool
acceptNode
(
const
GiaNode
& newNode,
unsigned
int
degree);
194
200
void
addNeighbor
(
GiaNode
& newNode,
unsigned
int
degree);
201
206
void
removeNeighbor
(
const
GiaNode
& newNode);
207
212
double
calculateLevelOfSatisfaction
();
213
218
void
sendMessage_JOIN_REQ
(
const
NodeHandle
& dst);
219
224
void
sendMessage_JOIN_RSP
(
const
NodeHandle
& dst);
225
230
void
sendMessage_JOIN_ACK
(
const
NodeHandle
& dst);
231
236
void
sendMessage_JOIN_DNY
(
const
NodeHandle
& dst);
237
242
void
sendMessage_DISCONNECT
(
const
NodeHandle
& dst);
243
248
void
sendMessage_UPDATE
(
const
NodeHandle
& dst);
249
254
void
sendKeyListToNeighbor
(
const
NodeHandle
& dst);
255
261
void
updateNeighborList
(
GiaMessage
* msg);
262
267
void
forwardSearchResponseMessage
(
SearchResponseMessage
* msg);
268
274
void
forwardMessage
(
GiaIDMessage
* msg,
bool
fromApplication);
275
282
void
processSearchMessage
(
SearchMessage
* msg,
bool
fromApplication);
283
289
void
sendSearchResponseMessage
(
const
GiaNode
& srcNode,
SearchMessage
* msg);
290
295
void
deliverSearchResult
(
SearchResponseMessage
* msg);
296
};
297
298
#endif
src
overlay
gia
Gia.h
Generated on Fri Dec 7 2012 13:37:52 for OverSim by
1.8.1.2