IBR-DTNSuite
0.10
Main Page
Namespaces
Classes
Files
File List
File Members
NodeHandshakeExtension.h
Go to the documentation of this file.
1
/*
2
* NodeHandshakeExtension.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 NODEHANDSHAKEEXTENSION_H_
23
#define NODEHANDSHAKEEXTENSION_H_
24
25
#include "
routing/RoutingExtension.h
"
26
#include "
core/AbstractWorker.h
"
27
28
#include <
ibrcommon/thread/Mutex.h
>
29
#include <
ibrcommon/thread/Queue.h
>
30
#include <map>
31
32
namespace
dtn
33
{
34
namespace
routing
35
{
36
class
NodeHandshakeExtension
:
public
RoutingExtension
37
{
38
static
const
std::string TAG;
39
40
public
:
41
NodeHandshakeExtension
();
42
virtual
~NodeHandshakeExtension
();
43
44
void
notify
(
const
dtn::core::Event
*evt)
throw
();
45
void
componentUp
() throw () {}
46
void
componentDown
() throw () {}
47
48
void
doHandshake
(
const
dtn::data::EID
&eid);
49
53
void
requestHandshake
(
const
dtn::data::EID
&destination,
NodeHandshake
&request)
const
;
54
58
void
responseHandshake
(
const
dtn::data::EID
&source,
const
NodeHandshake
&request,
NodeHandshake
&answer);
59
63
void
processHandshake
(
const
dtn::data::EID
&source,
NodeHandshake
&answer);
64
65
protected
:
66
void
processHandshake
(
const
dtn::data::Bundle
&bundle);
67
68
private
:
69
class
HandshakeEndpoint :
public
dtn::core::AbstractWorker
70
{
71
public
:
72
HandshakeEndpoint(
NodeHandshakeExtension
&callback);
73
virtual
~HandshakeEndpoint();
74
75
void
callbackBundleReceived(
const
Bundle
&b);
76
void
query(
const
dtn::data::EID
&eid);
77
78
void
send(
const
dtn::data::Bundle
&b);
79
80
void
removeFromBlacklist(
const
dtn::data::EID
&eid);
81
82
private
:
83
NodeHandshakeExtension
&_callback;
84
std::map<dtn::data::EID, dtn::data::Timestamp> _blacklist;
85
ibrcommon::Mutex
_blacklist_lock;
86
};
87
91
HandshakeEndpoint _endpoint;
92
};
93
}
/* namespace routing */
94
}
/* namespace dtn */
95
#endif
/* NODEHANDSHAKEEXTENSION_H_ */
daemon
src
routing
NodeHandshakeExtension.h
Generated on Mon Jul 22 2013 15:16:00 for IBR-DTNSuite by
1.8.3.1