IBR-DTNSuite
0.12
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
#include "
core/EventReceiver.h
"
28
29
#include <
ibrcommon/thread/Mutex.h
>
30
#include <
ibrcommon/thread/Queue.h
>
31
#include <map>
32
33
namespace
dtn
34
{
35
namespace
routing
36
{
37
class
NodeHandshakeExtension
:
public
RoutingExtension
,
public
dtn::core::EventReceiver
38
{
39
static
const
std::string TAG;
40
41
public
:
42
NodeHandshakeExtension
();
43
virtual
~NodeHandshakeExtension
();
44
45
void
raiseEvent
(
const
dtn::core::Event
*evt)
throw
();
46
void
componentUp
()
throw
();
47
void
componentDown
()
throw
();
48
49
void
doHandshake
(
const
dtn::data::EID
&eid);
50
54
void
requestHandshake
(
const
dtn::data::EID
&destination,
NodeHandshake
&request)
const
;
55
59
void
responseHandshake
(
const
dtn::data::EID
&source,
const
NodeHandshake
&request,
NodeHandshake
&answer);
60
64
void
processHandshake
(
const
dtn::data::EID
&source,
NodeHandshake
&answer);
65
66
protected
:
67
void
processHandshake
(
const
dtn::data::Bundle
&bundle);
68
69
private
:
70
class
HandshakeEndpoint :
public
dtn::core::AbstractWorker
71
{
72
public
:
73
HandshakeEndpoint(
NodeHandshakeExtension
&callback);
74
virtual
~HandshakeEndpoint();
75
76
void
callbackBundleReceived(
const
Bundle
&b);
77
void
query(
const
dtn::data::EID
&eid);
78
79
void
send(
const
dtn::data::Bundle
&b);
80
81
void
removeFromBlacklist(
const
dtn::data::EID
&eid);
82
83
private
:
84
NodeHandshakeExtension
&_callback;
85
std::map<dtn::data::EID, dtn::data::Timestamp> _blacklist;
86
ibrcommon::Mutex
_blacklist_lock;
87
};
88
92
HandshakeEndpoint _endpoint;
93
};
94
}
/* namespace routing */
95
}
/* namespace dtn */
96
#endif
/* NODEHANDSHAKEEXTENSION_H_ */
daemon
src
routing
NodeHandshakeExtension.h
Generated on Thu Mar 27 2014 09:26:20 for IBR-DTNSuite by
1.8.4