#include <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. | |
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. |
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.
dtn::CustodyTimerSpec::CustodyTimerSpec | ( | u_int32_t | min, | |
u_int32_t | lifetime_pct, | |||
u_int32_t | max | |||
) | [inline] |
dtn::CustodyTimerSpec::CustodyTimerSpec | ( | ) | [inline] |
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.
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 | ) |
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().
u_int32_t dtn::CustodyTimerSpec::lifetime_pct_ |
percentage of lifetime
Definition at line 88 of file CustodyTimer.h.
Referenced by calculate_timeout(), dtn::ForwardingLog::dump(), parse_options(), and serialize().
u_int32_t dtn::CustodyTimerSpec::max_ |
upper bound
Definition at line 89 of file CustodyTimer.h.
Referenced by calculate_timeout(), dtn::ForwardingLog::dump(), parse_options(), and serialize().
u_int32_t dtn::CustodyTimerSpec::min_ |
min timer
Definition at line 87 of file CustodyTimer.h.
Referenced by calculate_timeout(), dtn::ForwardingLog::dump(), parse_options(), and serialize().