IBR-DTNSuite
0.10
Main Page
Namespaces
Classes
Files
File List
File Members
IBR-DTNSuite
Namespaces
Classes
Files
File List
daemon
src
api
core
net
routing
epidemic
flooding
prophet
BaseRouter.cpp
BaseRouter.h
NeighborDatabase.cpp
NeighborDatabase.h
NeighborDataset.cpp
NeighborDataset.h
NeighborRoutingExtension.cpp
NeighborRoutingExtension.h
NodeHandshake.cpp
NodeHandshake.h
NodeHandshakeEvent.cpp
NodeHandshakeEvent.h
NodeHandshakeExtension.cpp
NodeHandshakeExtension.h
QueueBundleEvent.cpp
QueueBundleEvent.h
RequeueBundleEvent.cpp
RequeueBundleEvent.h
RetransmissionExtension.cpp
RetransmissionExtension.h
RoutingExtension.cpp
RoutingExtension.h
SchedulingBundleIndex.cpp
SchedulingBundleIndex.h
StaticRegexRoute.cpp
StaticRegexRoute.h
StaticRoute.cpp
StaticRoute.h
StaticRouteChangeEvent.cpp
StaticRouteChangeEvent.h
StaticRoutingExtension.cpp
StaticRoutingExtension.h
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
RoutingExtension.cpp
Go to the documentation of this file.
1
/*
2
* RoutingExtension.cpp
3
*
4
* Copyright (C) 2013 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
#include "
routing/RoutingExtension.h
"
23
#include "
routing/BaseRouter.h
"
24
#include "
core/BundleCore.h
"
25
#include <
ibrcommon/Logger.h
>
26
27
namespace
dtn
28
{
29
namespace
routing
30
{
31
BaseRouter *RoutingExtension::_router = NULL;
32
const
std::string RoutingExtension::TAG =
"RoutingExtension"
;
33
37
RoutingExtension::RoutingExtension
()
38
{ }
39
40
RoutingExtension::~RoutingExtension
()
41
{ }
42
43
BaseRouter
&
RoutingExtension::operator*
()
44
{
45
return
*_router;
46
}
47
53
void
RoutingExtension::transferTo
(
const
dtn::data::EID
&destination,
const
dtn::data::MetaBundle
&meta)
54
{
55
// acquire the transfer of this bundle, could throw already in transit or no resource left exception
56
{
57
// lock the list of neighbors
58
ibrcommon::MutexLock
l(_router->
getNeighborDB
());
59
60
// get the neighbor entry for the next hop
61
NeighborDatabase::NeighborEntry
&entry = _router->
getNeighborDB
().
get
(destination);
62
63
// acquire the transfer, could throw already in transit or no resource left exception
64
entry.
acquireTransfer
(meta);
65
}
66
67
try
{
68
// create a new bundle transfer object
69
dtn::net::BundleTransfer
transfer(destination, meta);
70
71
// transfer the bundle to the next hop
72
dtn::core::BundleCore::getInstance
().
transferTo
(transfer);
73
74
IBRCOMMON_LOGGER_DEBUG_TAG
(RoutingExtension::TAG, 20) <<
"bundle "
<< meta.
toString
() <<
" queued for "
<< destination.
getString
() <<
IBRCOMMON_LOGGER_ENDL
;
75
}
catch
(
const
dtn::core::P2PDialupException
&) {
76
// lock the list of neighbors
77
ibrcommon::MutexLock
l(_router->
getNeighborDB
());
78
79
// get the neighbor entry for the next hop
80
NeighborDatabase::NeighborEntry
&entry = _router->
getNeighborDB
().
get
(destination);
81
82
// release the transfer
83
entry.
releaseTransfer
(meta);
84
85
// and abort the query
86
throw
NeighborDatabase::NeighborNotAvailableException
();
87
}
88
}
89
90
bool
RoutingExtension::isRouting
(
const
dtn::data::EID
&eid)
91
{
92
if
(eid.
getApplication
() ==
"routing"
)
93
{
94
return
true
;
95
}
96
else
if
((eid.
getScheme
() ==
dtn::data::EID::CBHE_SCHEME
) && (eid.
getApplication
() ==
"50"
))
97
{
98
return
true
;
99
}
100
101
return
false
;
102
}
103
104
}
/* namespace routing */
105
}
/* namespace dtn */
daemon
src
routing
RoutingExtension.cpp
Generated on Mon Jul 22 2013 15:16:00 for IBR-DTNSuite by
1.8.3.1