49 #ifdef WITH_BUNDLE_SECURITY
57 const std::string BaseRouter::TAG =
"BaseRouter";
63 : _known_bundles(
"router-known-bundles"), _purged_bundles(
"router-purged-bundles"), _extension_state(false), _next_expiration(0)
85 _extensions.insert(extension);
91 _extensions.erase(extension);
96 return _extensions_mutex;
109 for (extension_list::iterator iter = _extensions.begin(); iter != _extensions.end(); ++iter)
124 for (extension_list::iterator iter = _extensions.begin(); iter != _extensions.end(); ++iter)
130 _extension_state =
true;
137 _extension_state =
false;
140 for (extension_list::iterator iter = _extensions.begin(); iter != _extensions.end(); ++iter)
163 for (BaseRouter::extension_list::const_iterator iter = extensions.begin(); iter != extensions.end(); ++iter)
183 for (BaseRouter::extension_list::const_iterator iter = extensions.begin(); iter != extensions.end(); ++iter)
203 for (BaseRouter::extension_list::const_iterator iter = extensions.begin(); iter != extensions.end(); ++iter)
254 entry.
add(event.getBundle());
258 __eventTransferCompleted(event.getPeer(),
event.getBundle());
261 __eventDataChanged(event.getPeer());
264 }
catch (
const std::bad_cast&) { };
271 __eventBundleQueued(event.origin, event.bundle);
274 }
catch (
const std::bad_cast&) { };
285 getStorage().store(event.bundle);
294 else if (!filterKnown(m))
299 #ifdef WITH_BUNDLE_SECURITY
321 _neighbor_database.get(event.peer).add(m);
325 getStorage().store(bundle);
337 #ifdef WITH_BUNDLE_SECURITY
359 }
catch (
const std::bad_cast&) { };
372 getStorage().store(event.getBundle());
383 }
catch (
const std::bad_cast&) { };
413 __eventDataChanged(event.getPeer());
416 }
catch (
const std::bad_cast&) { };
427 _neighbor_database.create( event.getNode().getEID() );
431 __eventDataChanged(event.getNode().getEID());
436 __eventDataChanged(event.getNode().getEID());
442 _neighbor_database.get( event.getNode().getEID() ).reset();
448 for (std::set<dtn::core::Node>::const_iterator iter = nl.begin(); iter != nl.end(); ++iter)
453 __eventDataChanged( n.
getEID() );
458 }
catch (
const std::bad_cast&) { };
466 __eventDataChanged( event.getNode().getEID() );
469 }
catch (
const std::bad_cast&) { };
478 setPurged(event.bundle);
482 }
catch (
const std::bad_cast&) { }
489 if (expire_time > _next_expiration) {
491 _next_expiration = expire_time + 60;
494 if (expire_time <= 60) expire_time = 0;
495 else expire_time -= 60;
499 _known_bundles.expire(expire_time);
502 _known_bundles.sync();
507 _purged_bundles.expire(expire_time);
510 _purged_bundles.sync();
520 for (std::set<dtn::core::Node>::const_iterator it = neighbors.begin(); it != neighbors.end(); ++it) {
522 _neighbor_database.get( (*it).getEID() );
527 _neighbor_database.expire(event.getTimestamp());
532 }
catch (
const std::bad_cast&) { };
535 void BaseRouter::__eventDataChanged(
const dtn::data::EID &peer)
throw ()
538 if (!_extension_state)
return;
540 _nh_extension.eventDataChanged(peer);
541 _retransmission_extension.eventDataChanged(peer);
544 for (extension_list::const_iterator iter = _extensions.begin(); iter != _extensions.end(); ++iter)
546 (*iter)->eventDataChanged(peer);
553 if (!_extension_state)
return;
555 _nh_extension.eventBundleQueued(peer, meta);
556 _retransmission_extension.eventBundleQueued(peer, meta);
559 for (extension_list::const_iterator iter = _extensions.begin(); iter != _extensions.end(); ++iter)
561 (*iter)->eventBundleQueued(peer, meta);
568 if (!_extension_state)
return;
570 _nh_extension.eventTransferCompleted(peer, meta);
571 _retransmission_extension.eventTransferCompleted(peer, meta);
574 for (extension_list::const_iterator iter = _extensions.begin(); iter != _extensions.end(); ++iter)
576 (*iter)->eventTransferCompleted(peer, meta);
598 return _known_bundles.
add(meta);
605 return _known_bundles.
has(
id);
614 bool ret = _known_bundles.
has(meta);
615 if (!ret) _known_bundles.
add(meta);
623 return _known_bundles;
630 return _purged_bundles.
has(
id);
636 return _purged_bundles.
add(meta);
642 return _purged_bundles;
652 return _neighbor_database;