forest-net
an overlay networks for large-scale virtual worlds
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Monitor.h
Go to the documentation of this file.
1
9
#ifndef MONITOR_H
10
#define MONITOR_H
11
12
#include <set>
13
#include <list>
14
#include "
Forest.h
"
15
#include "
Packet.h
"
16
#include "
CtlPkt.h
"
17
#include "
NetBuffer.h
"
18
#include "PacketStore.h"
19
#include "UiHashTbl.h"
20
#include "
Avatar.h
"
21
22
namespace
forest {
23
24
29
class
Monitor
{
30
public
:
31
Monitor
(ipa_t, ipa_t ,
int
);
32
~
Monitor
();
33
34
bool
init
(
const
string
&,
const
string
&);
35
void
run
(uint32_t);
36
private
:
37
const
static
short
MON_PORT
= 30124;
38
const
static
int
NUMITEMS
= 9;
39
const
static
int
GRID
= 10000;
40
const
static
int
MAX_AVATARS
= 1000;
41
const
static
int
MAX_WORLD
= 30000;
42
const
static
int
MAX_VIEW
= 1000;
43
const
static
int
UPDATE_PERIOD
= 50;
44
int
worldSize
;
45
46
fAdr_t
myAdr
;
47
ipa_t
myIp
;
48
fAdr_t
rtrAdr
;
49
ipa_t
rtrIp
;
50
ipp_t
rtrPort
;
51
ipa_t
cmIp
;
52
fAdr_t
ccAdr
;
53
54
uint64_t
nonce
;
55
56
int
dgSock
;
57
int
listenSock
;
58
int
connSock
;
59
60
int
cornerX
;
61
int
cornerY;
62
int
viewSize
;
63
64
65
set<int> *
mySubs
;
66
67
PacketStore
*
ps
;
68
69
// data for managing signalling interactions with ComtCtl
70
const
static
uint32_t
SWITCH_TIMEOUT
= 500000;
71
const
static
bool
RETRY
=
true
;
72
enum
STATE {
73
IDLE, JOINING, LEAVING
74
};
75
STATE
switchState
;
76
uint32_t
switchTimer
;
77
int
switchCnt
;
78
comt_t
nextComt
;
79
comt_t
comt
;
80
int
seqNum
;
81
82
// private helper methods
83
bool
login
(
const
string
&,
const
string
&);
84
int
groupNum
(
int
,
int
);
85
86
bool
connect
();
87
bool
disconnect
();
88
89
comt_t
check4command
();
90
91
void
sendToRouter
(
int
);
92
int
receiveFromRouter
();
93
void
forwardReport
(
int
,
int
);
94
95
void
startComtSwitch
(
comt_t
, uint32_t);
96
bool
completeComtSwitch
(pktx, uint32_t);
97
void
send2comtCtl
(
CtlPkt::CpType
,
bool
=
false
);
98
99
void
switchComtrees
(
int
);
100
void
updateSubs
();
101
void
subscribeAll
();
102
void
unsubscribeAll
();
103
void
subscribe
(list<int>&);
104
void
unsubscribe
(list<int>&);
105
};
106
107
}
// ends namespace
108
109
#endif
forest-net
cpp
include
Monitor.h
Generated on Mon Aug 4 2014 11:13:35 for forest-net by
1.8.4