dtn::ForwardingLog Class Reference

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

#include <ForwardingLog.h>

List of all members.

Public Types

typedef ForwardingInfo::state_t state_t
typedef std::vector
< ForwardingInfo
Log
 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 (const LinkRef &link, ForwardingInfo *info) const
 Get the most recent entry for the given link from the log.
state_t get_latest_entry (const LinkRef &link) const
 Get the most recent state for the given link from the log.
bool get_latest_entry (const Registration *reg, ForwardingInfo *info) const
 Get the most recent entry for the given registration from the log.
state_t get_latest_entry (const Registration *reg) const
 Get the most recent state for the given registration from the log.
bool get_latest_entry (state_t state, ForwardingInfo *info) const
 Get the most recent entry for the given state from the log.
size_t get_count (unsigned int states=ForwardingInfo::ANY_STATE, unsigned int actions=ForwardingInfo::ANY_ACTION) const
 Return the count of matching entries.
size_t get_count (const EndpointID &eid, unsigned int states=ForwardingInfo::ANY_STATE, unsigned int actions=ForwardingInfo::ANY_ACTION) const
 Return the count of matching entries for the given remote endpoint id.
void add_entry (const LinkRef &link, ForwardingInfo::action_t action, state_t state, const CustodyTimerSpec &custody_timer)
 Add a new forwarding info entry for the given link.
void add_entry (const LinkRef &link, ForwardingInfo::action_t action, state_t state)
 Add a new forwarding info entry for the given link using the default custody timer info.
void add_entry (const Registration *reg, ForwardingInfo::action_t action, state_t state)
 Add a new forwarding info entry for the given registration.
void add_entry (const EndpointID &eid, ForwardingInfo::action_t action, state_t state)
 Add a new forwarding info entry for the remote EID without a specific link or registration.
bool update (const LinkRef &link, state_t state)
 Update the state for the latest forwarding info entry for the given link.
void update_all (state_t old_state, state_t new_state)
 Update all entries in the given state to the new state.
void dump (oasys::StringBuffer *buf) const
 Dump a string representation of the log.
void clear ()
 Clear the log (used for testing).

Protected Attributes

Log log_
 The actual log.
oasys::SpinLock * lock_
 Copy of the bundle's lock.


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 52 of file ForwardingLog.h.


Member Typedef Documentation

Typedef for the log itself.

Definition at line 167 of file ForwardingLog.h.

Definition at line 54 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 30 of file ForwardingLog.cc.


Member Function Documentation

void dtn::ForwardingLog::add_entry ( const EndpointID eid,
ForwardingInfo::action_t  action,
state_t  state 
)

Add a new forwarding info entry for the remote EID without a specific link or registration.

(used for session management).

Also, if the EID is "*:*" and the state is SUPPRESSED, then the bundle can be prevented from being forwarded to any other nodes.

Definition at line 242 of file ForwardingLog.cc.

References dtn::EndpointID::c_str(), lock_, and log_.

void dtn::ForwardingLog::add_entry ( const Registration reg,
ForwardingInfo::action_t  action,
state_t  state 
)

Add a new forwarding info entry for the given registration.

Definition at line 227 of file ForwardingLog.cc.

References dtn::Registration::endpoint(), lock_, log_, and dtn::Registration::regid().

void dtn::ForwardingLog::add_entry ( const LinkRef link,
ForwardingInfo::action_t  action,
state_t  state 
)

Add a new forwarding info entry for the given link using the default custody timer info.

Used for states other than TRANSMITTED for which the custody timer is irrelevant.

Definition at line 217 of file ForwardingLog.cc.

References add_entry().

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

void dtn::ForwardingLog::clear (  ) 

Clear the log (used for testing).

Definition at line 297 of file ForwardingLog.cc.

References lock_, and log_.

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

size_t dtn::ForwardingLog::get_count ( const EndpointID eid,
unsigned int  states = ForwardingInfo::ANY_STATE,
unsigned int  actions = ForwardingInfo::ANY_ACTION 
) const

Return the count of matching entries for the given remote endpoint id.

The states and actions parameters should contain a concatenation of the requested states/actions to filter the count.

Definition at line 155 of file ForwardingLog.cc.

References lock_, log_, and dtn::EndpointIDPattern::WILDCARD_EID().

size_t dtn::ForwardingLog::get_count ( unsigned int  states = ForwardingInfo::ANY_STATE,
unsigned int  actions = ForwardingInfo::ANY_ACTION 
) const

Return the count of matching entries.

The states and actions parameters should contain a concatenation of the requested states/actions to filter the count.

Definition at line 133 of file ForwardingLog.cc.

References lock_, and log_.

Referenced by dtn::TableBasedRouter::route_bundle(), and dtn::BundleRouter::should_fwd().

bool dtn::ForwardingLog::get_latest_entry ( state_t  state,
ForwardingInfo info 
) const

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

Definition at line 113 of file ForwardingLog.cc.

References lock_, and log_.

ForwardingLog::state_t dtn::ForwardingLog::get_latest_entry ( const Registration reg  )  const

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

Definition at line 101 of file ForwardingLog.cc.

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

bool dtn::ForwardingLog::get_latest_entry ( const Registration reg,
ForwardingInfo info 
) const

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

Definition at line 74 of file ForwardingLog.cc.

References ASSERT, dtn::Registration::endpoint(), lock_, log_, dtn::EndpointID::NULL_EID(), and dtn::Registration::regid().

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

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

Definition at line 62 of file ForwardingLog.cc.

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

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

bool dtn::ForwardingLog::update ( const LinkRef 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 257 of file ForwardingLog.cc.

References ASSERT, lock_, log_, and dtn::EndpointID::NULL_EID().

Referenced by dtn::BundleDaemon::handle_bundle_cancelled(), dtn::BundleDaemon::handle_bundle_transmitted(), and dtn::BundleDaemon::handle_custody_timeout().

void dtn::ForwardingLog::update_all ( state_t  old_state,
state_t  new_state 
)

Update all entries in the given state to the new state.

Definition at line 281 of file ForwardingLog.cc.

References lock_, and log_.


Member Data Documentation

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

Copy of the bundle's lock.

Definition at line 171 of file ForwardingLog.h.

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

The actual log.

Definition at line 170 of file ForwardingLog.h.

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


The documentation for this class was generated from the following files:

Generated on Fri Jan 30 09:43:13 2009 for DTN Reference Implementation by  doxygen 1.5.8