52 const std::string NeighborRoutingExtension::TAG =
"NeighborRoutingExtension";
78 : _extension(e), _entry(entry)
81 virtual ~BundleFilter() {};
83 virtual dtn::data::Size limit()
const throw () {
return _entry.getFreeTransferSlots(); };
87 return _extension.shouldRouteTo(meta, _entry);
91 const std::string getWhere()
const throw ()
93 return "destination LIKE ?";
96 int bind(sqlite3_stmt *st,
int offset)
const throw ()
98 const std::string d = _entry.eid.getNode().getString() +
"%";
99 sqlite3_bind_text(st, offset, d.c_str(),
static_cast<int>(d.size()), SQLITE_TRANSIENT);
116 Task *t = _taskqueue.getnpop(
true);
117 std::auto_ptr<Task> killer(t);
127 SearchNextBundleTask &task =
dynamic_cast<SearchNextBundleTask&
>(*t);
140 BundleFilter filter(*
this, entry);
144 (**this).getSeeker().get(filter, list);
150 for (std::list<dtn::data::MetaBundle>::const_iterator iter = list.begin(); iter != list.end(); ++iter)
163 }
catch (
const std::bad_cast&) { };
169 const ProcessBundleTask &task =
dynamic_cast<ProcessBundleTask&
>(*t);
177 if (!shouldRouteTo(task.bundle, entry))
191 }
catch (
const std::bad_cast&) { };
192 }
catch (
const std::exception &ex) {
246 for (std::set<dtn::core::Node>::const_iterator iter = nl.begin(); iter != nl.end(); ++iter)
257 }
catch (
const std::bad_cast&) { };
262 _taskqueue.push(
new SearchNextBundleTask( completed.
getPeer() ) );
264 }
catch (
const std::bad_cast&) { };
269 _taskqueue.push(
new SearchNextBundleTask( aborted.
getPeer() ) );
272 }
catch (
const std::bad_cast&) { };
280 _taskqueue.push(
new SearchNextBundleTask( n.
getEID() ) );
284 _taskqueue.push(
new SearchNextBundleTask( n.
getEID() ) );
288 }
catch (
const std::bad_cast&) { };
296 _taskqueue.push(
new SearchNextBundleTask(ce.
peer) );
299 }
catch (
const std::bad_cast&) { };
330 NeighborRoutingExtension::SearchNextBundleTask::SearchNextBundleTask(
const dtn::data::EID &e)
334 NeighborRoutingExtension::SearchNextBundleTask::~SearchNextBundleTask()
337 std::string NeighborRoutingExtension::SearchNextBundleTask::toString()
339 return "SearchNextBundleTask: " + eid.getString();
345 : bundle(meta), origin(o), nexthop(n)
348 NeighborRoutingExtension::ProcessBundleTask::~ProcessBundleTask()
351 std::string NeighborRoutingExtension::ProcessBundleTask::toString()
353 return "ProcessBundleTask: " + bundle.toString();