OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
BootstrapNodeHandle.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2008 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 __BOOTSTRAP_NODE_HANDLE_H
25
#define __BOOTSTRAP_NODE_HANDLE_H
26
27
enum
BootstrapNodePrioType
{
28
DNSSD
= 0,
29
MDNS
= 1,
30
CACHE
= 2,
31
};
32
33
class
BootstrapNodeHandle
:
public
NodeHandle
{
34
35
private
:
36
BootstrapNodePrioType
nodePrio
;
//1: uDNS, 2: mDNS, 3: saved nodes from last run
37
simtime_t
lastPing
;
38
39
public
:
40
BootstrapNodeHandle
() :
NodeHandle
()
41
{
42
/* lowest priority */
43
nodePrio
=
CACHE
;
44
}
45
46
BootstrapNodeHandle
(
const
BootstrapNodeHandle
&handle) :
NodeHandle
(handle)
47
{
48
nodePrio
= handle.
nodePrio
;
49
}
50
51
BootstrapNodeHandle
(
const
NodeHandle
&handle,
52
BootstrapNodePrioType
prio =
CACHE
)
53
{
54
this->
ip
= handle.
getIp
();
55
this->
port
= handle.
getPort
();
56
this->
key
= handle.
getKey
();
57
nodePrio
= prio;
58
}
59
60
BootstrapNodeHandle
(
const
OverlayKey
&
key
,
61
const
IPvXAddress &
ip
,
62
int
port
,
63
BootstrapNodePrioType
prio =
CACHE
)
64
:
NodeHandle
(key, ip, port) {
65
nodePrio
= prio;
66
}
67
68
inline
BootstrapNodePrioType
getNodePrio
()
const
{
69
return
nodePrio
;
70
}
71
72
inline
void
setNodePrio
(
BootstrapNodePrioType
nodePrio
) {
73
this->nodePrio =
nodePrio
;
74
}
75
76
inline
simtime_t
getLastPing
()
const
{
77
return
lastPing
;
78
}
79
80
inline
void
setLastPing
(simtime_t
lastPing
) {
81
this->lastPing =
lastPing
;
82
}
83
};
84
#endif
src
common
BootstrapNodeHandle.h
Generated on Fri Dec 7 2012 13:37:52 for OverSim by
1.8.1.2