OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
Quon.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 __QUON_H_
26
#define __QUON_H_
27
28
#include <
BaseOverlay.h
>
29
#include <
GlobalNodeList.h
>
30
#include <
GlobalStatistics.h
>
31
#include <float.h>
32
33
#include <
Quon_m.h
>
34
#include <
QuonHelper.h
>
35
#include "
LoginCache.h
"
36
42
class
Quon
:
public
BaseOverlay
43
{
44
public
:
45
// OMNeT++
46
~Quon
();
47
void
initializeOverlay
(
int
stage);
48
void
finishOverlay
();
49
void
handleUDPMessage
(
BaseOverlayMessage
* msg);
50
void
handleTimerEvent
(cMessage* msg);
51
void
handleAppMessage
(cMessage* msg);
52
void
handleNodeGracefulLeaveNotification
();
53
54
QState
getState
();
55
double
getAOI
();
56
Vector2D
getPosition
();
57
double
getAreaDimension
();
58
OverlayKey
getKey
();
59
long
getSoftNeighborCount
();
60
61
QuonSiteMap
Sites
;
62
63
private
:
64
// parameters
65
simtime_t
joinTimeout
;
66
simtime_t
deleteTimeout
;
67
simtime_t
aliveTimeout
;
68
double
AOIWidth
;
69
double
minAOI
;
70
double
maxAOI
;
71
unsigned
int
connectionLimit
;
72
double
areaDimension
;
73
simtime_t
backupIntervall
;
74
bool
useDynamicAOI
;
75
bool
useSquareMetric
;
76
77
bool
linearAdaption
;
78
double
adaptionSensitivity
;
79
double
gossipSensitivity
;
80
bool
nnOnlyBinding
;
81
82
// timers
83
cMessage*
join_timer
;
84
cMessage*
sec_timer
;
85
cMessage*
alive_timer
;
86
cMessage*
backup_timer
;
87
88
void
sendToApp
(cMessage* msg);
89
void
sendMessage
(
QuonMessage
* quonMsg,
NodeHandle
destination);
90
void
setBootstrapedIcon
();
91
void
changeState
(
QState
qstate
);
92
93
// timer processing
94
void
processJoinTimer
();
95
void
processSecTimer
();
96
void
processDeleteTimer
(cMessage* msg);
97
void
processAliveTimer
();
98
void
processBackupTimer
();
99
100
// app handlers
101
void
handleJoin
(
GameAPIPositionMessage
* gameMsg);
102
void
handleMove
(
GameAPIPositionMessage
* gameMsg);
103
void
handleEvent
(
GameAPIMessage
* msg);
104
105
// overlay handlers
106
void
handleJoinRequest
(
QuonMessage
* quonMsg);
107
void
handleJoinAcknowledge
(
QuonListMessage
* quonListMsg);
108
void
handleNodeMove
(
QuonMoveMessage
* quonMoveMsg);
109
void
handleNewNeighbors
(
QuonListMessage
* quonListMsg);
110
void
handleNodeLeave
(
QuonListMessage
* quonListMsg);
111
void
handleInvalidNode
(
QuonListMessage
* quonListMsg);
112
113
// app<->overlay synchronisation
114
void
synchronizeAppNeighbors
(
QPurgeType
purgeSoftSites =
QKEEPSOFT
);
115
void
deleteAppNeighbor
(
NodeHandle
node);
116
117
// statistics
118
double
joinRequestBytesSend
;
119
double
joinAcknowledgeBytesSend
;
120
double
nodeMoveBytesSend
;
121
double
newNeighborsBytesSend
;
122
double
nodeLeaveBytesSend
;
123
double
maxBytesPerSecondSend
;
124
double
averageBytesPerSecondSend
;
125
double
bytesPerSecond
;
126
long
softConnections
;
127
long
softNeighborCount
;
128
long
bindingNeighborCount
;
129
long
directNeighborCount
;
130
unsigned
int
secTimerCount
;
131
long
rejoinCount
;
132
unsigned
long
avgAOI
;
133
simtime_t
joinTime
;
134
135
// quon functions
136
bool
addSite
(
Vector2D
p,
NodeHandle
node,
double
AOI,
bool
isSoft =
false
,
QUpdateType
update =
QFOREIGN
);
137
void
updateThisSite
(
Vector2D
p);
138
void
classifySites
();
139
bool
deleteSite
(
NodeHandle
node);
140
int
purgeSites
(
QPurgeType
purgeSoftSites =
QKEEPSOFT
);
141
void
adaptAoI
();
142
143
// node references
144
QuonSite
*
thisSite
;
145
QDeleteMap
deletedSites
;
146
NodeHandle
(*
bindingBackup
)[4];
147
int
numBackups
;
148
149
// node state
150
QState
qstate
;
151
bool
aloneInOverlay
;
152
153
// login cache
154
LoginCache
*
loginCache
;
155
int
cacheInterval
;
156
int
timeSinceCache
;
157
};
158
159
#endif
src
overlay
quon
Quon.h
Generated on Fri Dec 7 2012 13:37:53 for OverSim by
1.8.1.2