#include <FloodBundleRouter.h>
The implementation is very simple: The class maintains an internal BundleList in which all bundles are kept until their expiration time. This prevents the main daemon logic from opportunistically deleting bundles when they've been transmitted.
Whenever a new link arrives, we add a wildcard route to the table. Then when a bundle arrives, we can stick it on the all_bundles list and just call the base class fwd_to_matching function. The core base class logic then makes sure that a copy of the bundle is forwarded exactly once to each neighbor.
XXX/demmer This should be extended to avoid forwarding a bundle back to the node from which it arrived. With the upcoming bidirectional link changes, this should be able to be done easily.
Definition at line 42 of file FloodBundleRouter.h.
Public Member Functions | |
FloodBundleRouter () | |
Constructor. | |
void | handle_bundle_received (BundleReceivedEvent *event) |
Event handler for new bundle arrivals. | |
void | handle_link_created (LinkCreatedEvent *event) |
When a link is created, add a new route for it. | |
void | handle_bundle_expired (BundleExpiredEvent *event) |
Default event handler when bundles expire. | |
Protected Attributes | |
BundleList | all_bundles_ |
To ensure bundles aren't deleted by the system just after they are forwarded, we hold them all in this separate list. | |
EndpointIDPattern | all_eids_ |
Wildcard pattern to match all bundles. |
dtn::FloodBundleRouter::FloodBundleRouter | ( | ) |
Constructor.
Definition at line 33 of file FloodBundleRouter.cc.
References all_eids_, ASSERT, log_info, and dtn::EndpointID::valid().
void dtn::FloodBundleRouter::handle_bundle_received | ( | BundleReceivedEvent * | event | ) | [virtual] |
Event handler for new bundle arrivals.
Queue the bundle on the pending delivery list, and then searches through the route table to find any matching next contacts, filling in the action list with forwarding decisions.
Reimplemented from dtn::TableBasedRouter.
Definition at line 44 of file FloodBundleRouter.cc.
References all_bundles_, dtn::TableBasedRouter::fwd_to_matching(), log_debug, and dtn::BundleList::push_back().
void dtn::FloodBundleRouter::handle_link_created | ( | LinkCreatedEvent * | event | ) | [virtual] |
When a link is created, add a new route for it.
Reimplemented from dtn::TableBasedRouter.
Definition at line 54 of file FloodBundleRouter.cc.
References dtn::RouteEntry::action_, dtn::TableBasedRouter::add_route(), all_eids_, ASSERT, dtn::ForwardingInfo::COPY_ACTION, and log_debug.
void dtn::FloodBundleRouter::handle_bundle_expired | ( | BundleExpiredEvent * | event | ) | [virtual] |
Default event handler when bundles expire.
Reimplemented from dtn::BundleEventHandler.
Definition at line 70 of file FloodBundleRouter.cc.
References all_bundles_, dtn::BundleList::erase(), and log_debug.
BundleList dtn::FloodBundleRouter::all_bundles_ [protected] |
To ensure bundles aren't deleted by the system just after they are forwarded, we hold them all in this separate list.
Definition at line 71 of file FloodBundleRouter.h.
Referenced by handle_bundle_expired(), and handle_bundle_received().
EndpointIDPattern dtn::FloodBundleRouter::all_eids_ [protected] |
Wildcard pattern to match all bundles.
Definition at line 74 of file FloodBundleRouter.h.
Referenced by FloodBundleRouter(), and handle_link_created().