dtn::CustodyTimerSpec Class Reference

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

#include <CustodyTimer.h>

List of all members.

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.
void serialize (oasys::SerializeAction *a)

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.


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 47 of file CustodyTimer.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 57 of file CustodyTimer.h.

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

Default Constructor.

Definition at line 65 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 42 of file CustodyTimer.cc.

References dtn::Bundle::expiration(), lifetime_pct_, 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 59 of file CustodyTimer.cc.

References lifetime_pct_, max_, and min_.

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

void dtn::CustodyTimerSpec::serialize ( oasys::SerializeAction *  a  ) 

Definition at line 71 of file CustodyTimer.cc.

References lifetime_pct_, max_, and min_.


Member Data Documentation

Custody timer defaults, values set in the static initializer.

Default custody timer specification:.

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

Definition at line 52 of file CustodyTimer.h.

Referenced by dtn::BundleDaemon::handle_bundle_send(), and dtn::ParamCommand::ParamCommand().

percentage of lifetime

Definition at line 88 of file CustodyTimer.h.

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

upper bound

Definition at line 89 of file CustodyTimer.h.

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

min timer

Definition at line 87 of file CustodyTimer.h.

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


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

Generated on Fri Jan 30 09:27:03 2009 for DTN Reference Implementation by  doxygen 1.5.8