#include <CustodyTimer.h>
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 66 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_ |
Default custody timer specification:. |
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 60 of file CustodyTimer.cc.
References dtn::Bundle::expiration_, lifetime_pct_, log_debug, 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 77 of file CustodyTimer.cc.
References oasys::OptParser::addopt(), lifetime_pct_, max_, min_, and oasys::OptParser::parse_and_shift().
Referenced by dtn::RouteEntry::parse_options().
Default custody timer specification:.
min: 30 minutes lifetime percent: 25% max: unlimited
Definition at line 71 of file CustodyTimer.h.
Referenced by dtn::LinkStateRouter::handle_bundle_received(), dtn::BundleDaemon::handle_custody_timeout(), dtn::ParamCommand::ParamCommand(), and dtn::LinkStateRouter::send_announcement().
u_int32_t dtn::CustodyTimerSpec::min_ |
min timer
Definition at line 104 of file CustodyTimer.h.
Referenced by calculate_timeout(), dtn::RouteEntry::dump(), and parse_options().
u_int32_t dtn::CustodyTimerSpec::lifetime_pct_ |
percentage of lifetime
Definition at line 105 of file CustodyTimer.h.
Referenced by calculate_timeout(), dtn::RouteEntry::dump(), and parse_options().
u_int32_t dtn::CustodyTimerSpec::max_ |
upper bound
Definition at line 106 of file CustodyTimer.h.
Referenced by calculate_timeout(), dtn::RouteEntry::dump(), and parse_options().