dtn::ForwardingLog Class Reference

#include <ForwardingLog.h>

List of all members.


Detailed Description

Class to maintain a log of informational records as to where and when a bundle has been forwarded.

This state can be (and is) used by the router logic to prevent it from naively forwarding a bundle to the same next hop multiple times. It also is used to store the custody timer spec as supplied by the router so the main forwarding engine knows how to set the appropriate timer.

Although a bundle can be sent over multiple links, and may even be sent over the same link multiple times, the forwarding logic assumes that for a given link and bundle, there is only one active transmission. Thus the accessors below always return / update the last entry in the log for a given link.

Definition at line 71 of file ForwardingLog.h.

Public Types

typedef ForwardingInfo::state_t state_t
typedef std::vector< ForwardingInfoLog
 Typedef for the log itself.

Public Member Functions

 ForwardingLog (oasys::SpinLock *lock)
 Constructor that takes a pointer to the relevant Bundle's lock, used when querying or updating the log.
bool get_latest_entry (Link *link, ForwardingInfo *info) const
 Get the most recent entry for the given link from the log.
state_t get_latest_entry (Link *link) const
 Get the most recent state for the given link from the log.
size_t get_transmission_count (ForwardingInfo::action_t action=ForwardingInfo::INVALID_ACTION, bool include_inflight=false) const
 Return the transmission count of the bundle, optionally including inflight entries as well.
void add_entry (Link *link, ForwardingInfo::action_t action, state_t state, const CustodyTimerSpec &custody_timer)
 Add a new forwarding info entry for the given link.
bool update (Link *link, state_t state)
 Update the state for the latest forwarding info entry for the given link.
size_t get_count (state_t state) const
 Return a count of the number of entries in the given state.
void dump (oasys::StringBuffer *buf) const
 Dump a string representation of the log.

Protected Attributes

Log log_
 The actual log.
oasys::SpinLocklock_
 Copy of the bundle's lock.


Member Typedef Documentation

typedef ForwardingInfo::state_t dtn::ForwardingLog::state_t

Definition at line 73 of file ForwardingLog.h.

typedef std::vector<ForwardingInfo> dtn::ForwardingLog::Log

Typedef for the log itself.

Definition at line 130 of file ForwardingLog.h.


Constructor & Destructor Documentation

dtn::ForwardingLog::ForwardingLog ( oasys::SpinLock lock  ) 

Constructor that takes a pointer to the relevant Bundle's lock, used when querying or updating the log.

Definition at line 48 of file ForwardingLog.cc.


Member Function Documentation

bool dtn::ForwardingLog::get_latest_entry ( Link link,
ForwardingInfo info 
) const

Get the most recent entry for the given link from the log.

Definition at line 55 of file ForwardingLog.cc.

References dtn::Link::clayer(), info, ExamineDump::l, lock_, log_, dtn::ConvergenceLayer::name(), and dtn::Link::nexthop().

Referenced by get_latest_entry(), dtn::BundleDaemon::handle_bundle_transmitted(), dtn::BundleActions::send_bundle(), and dtn::TableBasedRouter::should_fwd().

ForwardingLog::state_t dtn::ForwardingLog::get_latest_entry ( Link link  )  const

Get the most recent state for the given link from the log.

Definition at line 75 of file ForwardingLog.cc.

References get_latest_entry(), info, and dtn::ForwardingInfo::NONE.

size_t dtn::ForwardingLog::get_transmission_count ( ForwardingInfo::action_t  action = ForwardingInfo::INVALID_ACTION,
bool  include_inflight = false 
) const

Return the transmission count of the bundle, optionally including inflight entries as well.

If an action is specified (i.e. not ForwardingInfo::INVALID_ACTION), only count log entries that match the action code.

Definition at line 87 of file ForwardingLog.cc.

References dtn::ForwardingInfo::IN_FLIGHT, dtn::ForwardingInfo::INVALID_ACTION, ExamineDump::l, lock_, log_, and dtn::ForwardingInfo::TRANSMITTED.

Referenced by dtn::Bundle::format_verbose().

void dtn::ForwardingLog::add_entry ( Link link,
ForwardingInfo::action_t  action,
state_t  state,
const CustodyTimerSpec custody_timer 
)

Add a new forwarding info entry for the given link.

Definition at line 156 of file ForwardingLog.cc.

References dtn::Link::clayer(), log_, dtn::ConvergenceLayer::name(), and dtn::Link::nexthop().

Referenced by dtn::BundleDaemon::handle_custody_timeout(), and dtn::BundleActions::send_bundle().

bool dtn::ForwardingLog::update ( Link link,
state_t  state 
)

Update the state for the latest forwarding info entry for the given link.

Returns:
true if the next hop entry was found

Definition at line 167 of file ForwardingLog.cc.

References dtn::Link::clayer(), ExamineDump::l, lock_, log_, dtn::ConvergenceLayer::name(), and dtn::Link::nexthop().

Referenced by dtn::BundleActions::cancel_bundle(), dtn::BundleDaemon::handle_bundle_transmit_failed(), and dtn::BundleDaemon::handle_bundle_transmitted().

size_t dtn::ForwardingLog::get_count ( state_t  state  )  const

Return a count of the number of entries in the given state.

Definition at line 113 of file ForwardingLog.cc.

References ExamineDump::l, lock_, and log_.

Referenced by dtn::BundleDaemon::try_delete_from_pending().

void dtn::ForwardingLog::dump ( oasys::StringBuffer buf  )  const

Dump a string representation of the log.

Definition at line 132 of file ForwardingLog.cc.

References dtn::ForwardingInfo::action_to_str(), oasys::StringBuffer::appendf(), info, ExamineDump::l, lock_, log_, and dtn::ForwardingInfo::state_to_str().


Member Data Documentation

Log dtn::ForwardingLog::log_ [protected]

The actual log.

Definition at line 133 of file ForwardingLog.h.

Referenced by add_entry(), dump(), get_count(), get_latest_entry(), get_transmission_count(), and update().

oasys::SpinLock* dtn::ForwardingLog::lock_ [protected]

Copy of the bundle's lock.

Definition at line 134 of file ForwardingLog.h.

Referenced by dump(), get_count(), get_latest_entry(), get_transmission_count(), and update().


The documentation for this class was generated from the following files:
Generated on Fri Dec 22 14:48:03 2006 for DTN Reference Implementation by  doxygen 1.5.1