IBR-DTNSuite
0.12
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
NTService.cpp
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
const
std::string RoutingExtension::TAG =
"RoutingExtension"
;
32
36
RoutingExtension::RoutingExtension
()
37
{ }
38
39
RoutingExtension::~RoutingExtension
()
40
{ }
41
42
BaseRouter
&
RoutingExtension::operator*
()
43
{
44
return
dtn::core::BundleCore::getInstance
().
getRouter
();
45
}
46
52
void
RoutingExtension::transferTo
(
const
dtn::data::EID
&destination,
const
dtn::data::MetaBundle
&meta)
53
{
54
// acquire the transfer of this bundle, could throw already in transit or no resource left exception
55
{
56
// lock the list of neighbors
57
ibrcommon::MutexLock
l((**this).getNeighborDB());
58
59
// get the neighbor entry for the next hop
60
NeighborDatabase::NeighborEntry
&entry = (**this).getNeighborDB().get(destination,
true
);
61
62
// acquire the transfer, could throw already in transit or no resource left exception
63
entry.
acquireTransfer
(meta);
64
}
65
66
try
{
67
// create a new bundle transfer object
68
dtn::net::BundleTransfer
transfer(destination, meta);
69
70
// transfer the bundle to the next hop
71
dtn::core::BundleCore::getInstance
().
getConnectionManager
().
queue
(transfer);
72
73
IBRCOMMON_LOGGER_DEBUG_TAG
(RoutingExtension::TAG, 20) <<
"bundle "
<< meta.
toString
() <<
" queued for "
<< destination.
getString
() <<
IBRCOMMON_LOGGER_ENDL
;
74
}
catch
(
const
dtn::core::P2PDialupException
&) {
75
// the bundle transfer queues the bundle for retransmission, thus abort the query here
76
throw
NeighborDatabase::NeighborNotAvailableException
();
77
}
catch
(
const
ibrcommon::Exception
&e) {
78
// ignore any other error
79
}
80
}
81
82
}
/* namespace routing */
83
}
/* namespace dtn */
daemon
src
routing
RoutingExtension.cpp
Generated on Thu Mar 27 2014 09:26:20 for IBR-DTNSuite by
1.8.4