dtn::CustodyTimerSpec Class Reference

#include <CustodyTimer.h>

List of all members.


Detailed Description

Utility class to abstract out various parameters that can be used to calculate custody retransmission timers.

This means that future extensions that take into account other parameters or factors can simply extend this class and modify the calculate_timeout() function to add new features.

The current basic scheme calculates the timer as: timer = min((min_ + (lifetime_pct_ * bundle->lifetime_ / 100)), max_)

In other words, this class allows a retransmisison to be specified according to a minimum timer (min_), a multiplying factor based on the bundle's lifetime (lifetime_pct_), and a maximum bound (max_). All values are in seconds.

Definition at line 45 of file CustodyTimer.h.


Public Member Functions

 CustodyTimerSpec (u_int32_t min, u_int32_t lifetime_pct, u_int32_t max)
 Constructor.
 CustodyTimerSpec ()
 Default Constructor.
u_int32_t calculate_timeout (const Bundle *bundle) const
 Calculate the appropriate timeout for the given bundle.
int parse_options (int argc, const char *argv[], const char **invalidp=NULL)
 Parse options to set the fields of the custody timer.

Public Attributes

u_int32_t min_
 min timer
u_int32_t lifetime_pct_
 percentage of lifetime
u_int32_t max_
 upper bound

Static Public Attributes

static CustodyTimerSpec defaults_
 Custody timer defaults, values set in the static initializer.

Constructor & Destructor Documentation

dtn::CustodyTimerSpec::CustodyTimerSpec ( u_int32_t  min,
u_int32_t  lifetime_pct,
u_int32_t  max 
) [inline]

Constructor.

Definition at line 55 of file CustodyTimer.h.

dtn::CustodyTimerSpec::CustodyTimerSpec (  )  [inline]

Default Constructor.

Definition at line 63 of file CustodyTimer.h.


Member Function Documentation

u_int32_t dtn::CustodyTimerSpec::calculate_timeout ( const Bundle bundle  )  const

Calculate the appropriate timeout for the given bundle.

Definition at line 39 of file CustodyTimer.cc.

References dtn::Bundle::expiration_, lifetime_pct_, log_debug_p, max_, and min_.

Referenced by dtn::CustodyTimer::CustodyTimer().

int dtn::CustodyTimerSpec::parse_options ( int  argc,
const char *  argv[],
const char **  invalidp = NULL 
)

Parse options to set the fields of the custody timer.

Shifts any non-matching options to the beginning of the vector by using OptParser::parse_and_shift.

Returns:
the number of parsed options

Definition at line 56 of file CustodyTimer.cc.

References oasys::OptParser::addopt(), lifetime_pct_, max_, min_, and oasys::OptParser::parse_and_shift().

Referenced by dtn::RouteEntry::parse_options().


Member Data Documentation

CustodyTimerSpec dtn::CustodyTimerSpec::defaults_ [static]

Custody timer defaults, values set in the static initializer.

Default custody timer specification:.

min: 30 minutes lifetime percent: 25% max: unlimited

Definition at line 50 of file CustodyTimer.h.

Referenced by dtn::BundleDaemon::handle_bundle_inject(), dtn::LinkStateRouter::handle_bundle_received(), dtn::BundleDaemon::handle_bundle_send(), dtn::ParamCommand::ParamCommand(), and dtn::LinkStateRouter::send_announcement().

u_int32_t dtn::CustodyTimerSpec::min_

min timer

Definition at line 83 of file CustodyTimer.h.

Referenced by calculate_timeout(), dtn::RouteEntry::dump(), dtn::ForwardingLog::dump(), and parse_options().

u_int32_t dtn::CustodyTimerSpec::lifetime_pct_

percentage of lifetime

Definition at line 84 of file CustodyTimer.h.

Referenced by calculate_timeout(), dtn::RouteEntry::dump(), dtn::ForwardingLog::dump(), and parse_options().

u_int32_t dtn::CustodyTimerSpec::max_

upper bound

Definition at line 85 of file CustodyTimer.h.

Referenced by calculate_timeout(), dtn::RouteEntry::dump(), dtn::ForwardingLog::dump(), and parse_options().


The documentation for this class was generated from the following files:
Generated on Sat Sep 8 08:36:21 2007 for DTN Reference Implementation by  doxygen 1.5.3