IBR-DTNSuite
0.10
Main Page
Namespaces
Classes
Files
File List
File Members
DiscoveryAnnouncement.h
Go to the documentation of this file.
1
/*
2
* DiscoveryAnnouncement.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 DISCOVERYANNOUNCEMENT_H_
23
#define DISCOVERYANNOUNCEMENT_H_
24
25
#include <
ibrdtn/data/SDNV.h
>
26
#include <
ibrdtn/data/EID.h
>
27
#include <
ibrdtn/data/BundleString.h
>
28
#include "
net/DiscoveryService.h
"
29
#include <string>
30
#include <list>
31
32
namespace
dtn
33
{
34
namespace
net
35
{
36
class
DiscoveryAnnouncement
37
{
38
enum
BEACON_FLAGS_V1
39
{
40
BEACON_NO_FLAGS = 0x00,
41
BEACON_SHORT = 0x01
42
};
43
44
enum
BEACON_FLAGS_V2
45
{
46
BEACON_CONTAINS_EID = 0x01,
47
BEACON_SERVICE_BLOCK = 0x02,
48
BEACON_BLOOMFILTER = 0x04
49
};
50
51
public
:
52
enum
DiscoveryVersion
53
{
54
DTND_IPDISCOVERY
= 0x00,
55
DISCO_VERSION_00
= 0x01,
56
DISCO_VERSION_01
= 0x02
57
};
58
59
DiscoveryAnnouncement
(
const
DiscoveryVersion
version =
DISCO_VERSION_00
,
dtn::data::EID
eid =
dtn::data::EID
());
60
61
virtual
~DiscoveryAnnouncement
();
62
63
void
setEID
(
const
dtn::data::EID
&eid);
64
dtn::data::EID
getEID
()
const
;
65
66
const
std::list<DiscoveryService>&
getServices
()
const
;
67
void
clearServices
();
68
void
addService
(
DiscoveryService
service);
69
const
DiscoveryService
&
getService
(
string
name)
const
;
70
71
string
toString
()
const
;
72
73
void
setSequencenumber
(uint16_t sequence);
74
75
bool
isShort
();
76
77
private
:
78
friend
std::ostream &
operator<<
(std::ostream &stream,
const
DiscoveryAnnouncement
&announcement);
79
friend
std::istream &
operator>>
(std::istream &stream,
DiscoveryAnnouncement
&announcement);
80
81
unsigned
int
_version;
82
unsigned
char
_flags;
83
dtn::data::EID
_canonical_eid;
84
uint16_t _sn;
85
dtn::data::BundleString
_bloomfilter;
86
87
std::list<DiscoveryService> _services;
88
};
89
}
90
}
91
92
#endif
/* DISCOVERYANNOUNCEMENT_H_ */
daemon
src
net
DiscoveryAnnouncement.h
Generated on Mon Jul 22 2013 15:15:59 for IBR-DTNSuite by
1.8.3.1