51 const std::string NeighborRoutingExtension::TAG =
"NeighborRoutingExtension";
77 : _extension(e), _entry(entry)
80 virtual ~BundleFilter() {};
82 virtual dtn::data::Size limit()
const throw () {
return _entry.getFreeTransferSlots(); };
86 return _extension.shouldRouteTo(meta, _entry);
90 const std::string getWhere()
const throw ()
92 return "destination LIKE ?";
95 int bind(sqlite3_stmt *st,
int offset)
const throw ()
97 const std::string d = _entry.eid.getNode().getString() +
"%";
98 sqlite3_bind_text(st, offset, d.c_str(),
static_cast<int>(d.size()), SQLITE_TRANSIENT);
115 Task *t = _taskqueue.getnpop(
true);
116 std::auto_ptr<Task> killer(t);
126 SearchNextBundleTask &task =
dynamic_cast<SearchNextBundleTask&
>(*t);
139 BundleFilter filter(*
this, entry);
143 (**this).getSeeker().get(filter, list);
149 for (std::list<dtn::data::MetaBundle>::const_iterator iter = list.begin(); iter != list.end(); ++iter)
162 }
catch (
const std::bad_cast&) { };
168 const ProcessBundleTask &task =
dynamic_cast<ProcessBundleTask&
>(*t);
176 if (!shouldRouteTo(task.bundle, entry))
190 }
catch (
const std::bad_cast&) { };
191 }
catch (
const std::exception &ex) {
240 _taskqueue.push(
new SearchNextBundleTask( peer ) );
248 for (std::set<dtn::core::Node>::const_iterator iter = nl.begin(); iter != nl.end(); ++iter)
254 _taskqueue.push(
new ProcessBundleTask(meta, peer, n.
getEID()) );
287 NeighborRoutingExtension::SearchNextBundleTask::SearchNextBundleTask(
const dtn::data::EID &e)
291 NeighborRoutingExtension::SearchNextBundleTask::~SearchNextBundleTask()
294 std::string NeighborRoutingExtension::SearchNextBundleTask::toString()
296 return "SearchNextBundleTask: " + eid.getString();
302 : bundle(meta), origin(o), nexthop(n)
305 NeighborRoutingExtension::ProcessBundleTask::~ProcessBundleTask()
308 std::string NeighborRoutingExtension::ProcessBundleTask::toString()
310 return "ProcessBundleTask: " + bundle.toString();