OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
Vast.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 __VAST_H_
25
#define __VAST_H_
26
27
#include <omnetpp.h>
28
#include <
BaseOverlay.h
>
29
#include <float.h>
30
#include <
VastDefs.h
>
31
#include <
Vast_m.h
>
32
//#include <IPvXAddress.h>
33
//#include <NodeHandle.h>
34
//#include <NeighborsList.h>
35
37
41
class
Vast
:
public
BaseOverlay
42
{
43
public
:
44
// OMNeT++
45
~Vast
();
46
void
initializeOverlay
(
int
stage);
47
void
finishOverlay
();
48
void
handleUDPMessage
(
BaseOverlayMessage
* msg);
49
void
handleTimerEvent
(cMessage* msg);
50
void
handleAppMessage
(cMessage* msg);
51
void
handleNodeLeaveNotification
();
52
void
handleNodeGracefulLeaveNotification
();
53
54
double
getAOI
();
55
Vector2D
getPosition
();
56
NodeHandle
getHandle
();
57
double
getAreaDimension
();
58
59
SiteMap
Sites
;
60
Site
thisSite
;
61
62
protected
:
63
// node references
64
double
AOI_size
;
65
double
areaDimension
;
66
PositionSet
Positions
;
67
StockList
Stock
;
68
69
// statistics
70
long
joinRequestBytesSent
;
71
long
joinAcknowledgeBytesSent
;
72
long
nodeMoveBytesSent
;
73
long
newNeighborsBytesSent
;
74
long
nodeLeaveBytesSent
;
75
long
enclosingNeighborsRequestBytesSent
;
76
long
pingBytesSent
;
77
long
pongBytesSent
;
78
long
discardNodeBytesSent
;
79
long
backupBytesSent
;
80
81
long
maxBytesPerSecondSent
,
averageBytesPerSecondSent
,
bytesPerSecond
;
82
unsigned
int
secTimerCount
;
83
84
// parameters
85
bool
debugVoronoiOutput
;
86
simtime_t
joinTimeout
,
pingTimeout
,
discoveryIntervall
,
checkCriticalIntervall
;
87
double
criticalThreshold
;
88
unsigned
long
stockListSize
;
89
90
// Voronoi parameters
91
Geometry
geom
;
92
EdgeList
edgelist
;
93
HeapPQ
heap
;
94
95
void
addNode
(
Vector2D
p,
NodeHandle
node,
int
NeighborCount = 0);
96
void
addNodeToStock
(
NodeHandle
node);
97
void
removeNode
(
NodeHandle
node);
98
void
buildVoronoi
();
99
void
buildVoronoi
(
Vector2D
old_pos,
Vector2D
new_pos,
NodeHandle
enclosingCheck =
NodeHandle::UNSPECIFIED_NODE
);
100
void
removeNeighbors
();
101
102
// timers
103
cMessage*
join_timer
;
104
cMessage*
ping_timer
;
105
cMessage*
discovery_timer
;
106
cMessage*
checkcritical_timer
;
107
cMessage*
sec_timer
;
108
109
void
sendToApp
(cMessage* msg);
110
void
sendMessage
(
VastMessage
* vastMsg,
NodeHandle
destAddr);
111
void
setBootstrapedIcon
();
112
void
changeState
(
int
state
);
113
114
// timer processing
115
void
processJoinTimer
();
116
void
processPingTimer
();
117
void
processSecTimer
();
118
void
processCheckCriticalTimer
();
119
void
processDiscoveryTimer
();
120
121
// app handlers
122
void
handleJoin
(
GameAPIPositionMessage
* sgcMsg);
123
void
handleMove
(
GameAPIPositionMessage
* sgcMsg);
124
void
handleEvent
(
GameAPIMessage
* msg);
125
126
// overlay handlers
127
void
handleJoinRequest
(
VastMessage
*vastMsg);
128
void
handleJoinAcknowledge
(
VastListMessage
*vastListMsg);
129
void
handleNodeMove
(
VastMoveMessage
*vastMoveMsg);
130
void
handleNewNeighbors
(
VastListMessage
*vastListMsg);
131
void
handleNodeLeave
(
VastListMessage
*vastListMsg);
132
void
handleEnclosingNeighborsRequest
(
VastMessage
*vastMsg);
133
void
handleBackupNeighbors
(
VastListMessage
*vastListMsg);
134
void
handlePing
(
VastMessage
*vastMsg);
135
void
handlePong
(
VastMessage
*vastMsg);
136
void
handleDiscardNode
(
VastDiscardMessage
*vastMsg);
137
void
sendDiscardNode
(
VastMessage
*vastMsg);
138
void
synchronizeApp
(
VastMoveMessage
*vastMoveMsg = NULL);
139
};
140
141
#endif
src
overlay
vast
Vast.h
Generated on Fri Dec 7 2012 13:37:53 for OverSim by
1.8.1.2