IBR-DTNSuite
0.10
Main Page
Namespaces
Classes
Files
File List
File Members
IBR-DTNSuite
Namespaces
Classes
Files
File List
daemon
src
api
core
AbstractWorker.cpp
AbstractWorker.h
BundleCore.cpp
BundleCore.h
BundleEvent.cpp
BundleEvent.h
BundleExpiredEvent.cpp
BundleExpiredEvent.h
BundleGeneratedEvent.cpp
BundleGeneratedEvent.h
BundlePurgeEvent.cpp
BundlePurgeEvent.h
CustodyEvent.cpp
CustodyEvent.h
Event.cpp
Event.h
EventDebugger.cpp
EventDebugger.h
EventDispatcher.h
EventReceiver.cpp
EventReceiver.h
EventSwitch.cpp
EventSwitch.h
FragmentManager.cpp
FragmentManager.h
GlobalEvent.cpp
GlobalEvent.h
Node.cpp
Node.h
NodeEvent.cpp
NodeEvent.h
StatusReportGenerator.cpp
StatusReportGenerator.h
TimeAdjustmentEvent.cpp
TimeAdjustmentEvent.h
TimeEvent.cpp
TimeEvent.h
WallClock.cpp
WallClock.h
net
routing
security
storage
CapsuleWorker.cpp
CapsuleWorker.h
Component.cpp
Component.h
config.h
Configuration.cpp
Configuration.h
Debugger.cpp
Debugger.h
DevNull.cpp
DevNull.h
DTNTPWorker.cpp
DTNTPWorker.h
EchoWorker.cpp
EchoWorker.h
Main.cpp
NativeDaemon.cpp
NativeDaemon.h
ibrcommon
ibrdtn
tools
File Members
Node.h
Go to the documentation of this file.
1
/*
2
* Node.h
3
*
4
* Copyright (C) 2011 IBR, TU Braunschweig
5
*
6
* Written-by: Johannes Morgenroth <morgenroth@ibr.cs.tu-bs.de>
7
*
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at
11
*
12
* http://www.apache.org/licenses/LICENSE-2.0
13
*
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
19
*
20
*/
21
22
#ifndef IBRDTN_DAEMON_NODE_H_
23
#define IBRDTN_DAEMON_NODE_H_
24
25
#include <string>
26
#include <
ibrdtn/data/EID.h
>
27
#include <set>
28
#include <list>
29
#include <iostream>
30
31
namespace
dtn
32
{
33
namespace
net
34
{
35
class
ConvergenceLayer
;
36
}
37
38
namespace
core
39
{
43
class
Node
44
{
45
public
:
46
enum
Protocol
47
{
48
CONN_UNSUPPORTED
= -1,
49
CONN_UNDEFINED
= 0,
50
CONN_TCPIP
= 1,
51
CONN_UDPIP
= 2,
52
CONN_LOWPAN
= 3,
53
CONN_BLUETOOTH
= 4,
54
CONN_HTTP
= 5,
55
CONN_FILE
= 6,
56
CONN_DGRAM_UDP
= 7,
57
CONN_DGRAM_LOWPAN
= 8,
58
CONN_DGRAM_ETHERNET
= 9,
59
CONN_P2P_WIFI
= 10,
60
CONN_P2P_BT
= 11
61
};
62
69
enum
Type
70
{
71
NODE_UNAVAILABLE
= 0,
72
NODE_CONNECTED
= 1,
73
NODE_DISCOVERED
= 2,
74
NODE_STATIC_GLOBAL
= 3,
75
NODE_STATIC_LOCAL
= 4,
76
NODE_DHT_DISCOVERED
= 5,
77
NODE_P2P_DIALUP
= 6
78
};
79
80
class
URI
81
{
82
public
:
83
URI
(
const
Type
t,
const
Protocol
proto,
const
std::string &uri,
const
dtn::data::Number
&timeout = 0,
const
int
priority
= 0);
84
~URI
();
85
86
const
Type
type
;
87
const
Protocol
protocol
;
88
const
std::string
value
;
89
const
dtn::data::Timestamp
expire
;
90
const
int
priority
;
91
92
void
decode
(std::string &address,
unsigned
int
&port)
const
;
93
94
bool
operator<
(
const
URI
&other)
const
;
95
bool
operator==
(
const
URI
&other)
const
;
96
97
bool
operator==
(
const
Node::Protocol
&p)
const
;
98
bool
operator==
(
const
Node::Type
&t)
const
;
99
100
friend
std::ostream&
operator<<
(std::ostream&,
const
Node::URI
&);
101
};
102
103
class
Attribute
104
{
105
public
:
106
Attribute
(
const
Type
t,
const
std::string &
name
,
const
std::string &
value
,
const
dtn::data::Number
&timeout = 0,
const
int
priority
= 0);
107
~Attribute
();
108
109
const
Type
type
;
110
const
std::string
name
;
111
const
std::string
value
;
112
const
dtn::data::Timestamp
expire
;
113
const
int
priority
;
114
115
bool
operator<
(
const
Attribute
&other)
const
;
116
bool
operator==
(
const
Attribute
&other)
const
;
117
118
bool
operator==
(
const
std::string &name)
const
;
119
120
friend
std::ostream&
operator<<
(std::ostream&,
const
Node::Attribute
&);
121
};
122
123
static
std::string
toString
(
const
Node::Type
type);
124
static
std::string
toString
(
const
Node::Protocol
proto);
125
static
Node::Protocol
fromProtocolString
(
const
std::string &protocol);
126
132
Node
(
const
dtn::data::EID
&
id
);
133
Node
();
134
138
virtual
~Node
();
139
145
bool
has
(
Node::Protocol
proto)
const
;
146
bool
has
(
const
std::string &name)
const
;
147
152
void
add
(
const
URI
&u);
153
void
add
(
const
Attribute
&attr);
154
159
void
remove
(
const
URI
&u);
160
void
remove
(
const
Attribute
&attr);
161
165
void
clear
();
166
170
dtn::data::Size
size
()
const
;
171
177
std::list<URI>
get
(
Node::Protocol
proto)
const
;
178
std::list<URI>
get
(
Node::Type
type)
const
;
179
std::list<URI>
get
(
Node::Type
type,
Node::Protocol
proto)
const
;
180
184
std::list<Node::URI>
getAll
()
const
;
185
189
std::set<Node::Type>
getTypes
()
const
;
190
196
std::list<Attribute>
get
(
const
std::string &name)
const
;
197
202
const
dtn::data::EID
&
getEID
()
const
;
203
207
bool
expire
();
208
215
bool
operator==
(
const
Node
&other)
const
;
216
bool
operator<
(
const
Node
&other)
const
;
217
218
bool
operator==
(
const
dtn::data::EID
&other)
const
;
219
220
const
Node
&
operator+=
(
const
Node
&other);
221
const
Node
&
operator-=
(
const
Node
&other);
222
223
std::string
toString
()
const
;
224
225
bool
doConnectImmediately
()
const
;
226
void
setConnectImmediately
(
bool
val);
227
231
bool
hasDialup
()
const
;
232
236
bool
isAvailable
()
const
;
237
241
bool
isAnnounced
()
const
;
242
246
void
setAnnounced
(
bool
val);
247
248
friend
std::ostream&
operator<<
(std::ostream&,
const
Node
&);
249
250
private
:
251
bool
isAvailable
(
const
Node::URI
&uri)
const
;
252
253
bool
_connect_immediately;
254
dtn::data::EID
_id;
255
256
std::set<URI> _uri_list;
257
std::set<Attribute> _attr_list;
258
259
bool
_announced_mark;
260
};
261
}
262
}
263
264
#endif
/*IBRDTN_DAEMON_NODE_H_*/
daemon
src
core
Node.h
Generated on Mon Jul 22 2013 15:15:59 for IBR-DTNSuite by
1.8.3.1