24 RCSID(
"$Id: 45d70d64b5b2bc1577ac658f5b55e969cb131a59 $")
26 #include <freeradius-devel/util/retry.h>
27 #include <freeradius-devel/util/rand.h>
28 #include <freeradius-devel/util/uint128.h>
42 memset(r, 0,
sizeof(*r));
82 scale += ((uint64_t) 1) << 32;
83 scale -= ((uint64_t) 1) << 31;
161 scale -= ((uint64_t) 1) << 31;
162 scale += ((uint64_t) 1) << 33;
175 scale -= ((uint64_t) 1) << 31;
176 scale += ((uint64_t) 1) << 32;
static const conf_parser_t config[]
uint32_t fr_rand(void)
Return a 32-bit random number.
static int64_t fr_time_delta_unwrap(fr_time_delta_t time)
static fr_time_delta_t fr_time_delta_from_sec(int64_t sec)
#define fr_time_delta_wrap(_time)
#define fr_time_delta_ispos(_a)
static fr_time_delta_t fr_time_delta_mul(fr_time_delta_t a, int64_t b)
#define fr_time_add(_a, _b)
Add a time/time delta together.
#define fr_time_lt(_a, _b)
#define fr_time_delta_gt(_a, _b)
static int8_t fr_time_cmp(fr_time_t a, fr_time_t b)
Compare two fr_time_t values.
A time delta, a difference in time measured in nanoseconds.
static uint64_t uint128_to_64(uint128_t a)
Returns the low bits of a 128bit integer.
static uint128_t uint128_mul64(uint64_t u, uint64_t v)
Multiply two unsigned 64bit integers to get an unsigned 128bit integer.
static uint128_t uint128_rshift(uint128_t num, uint8_t bits)
Right shift 128 bit integer.
fr_retry_state_t fr_retry_next(fr_retry_t *r, fr_time_t now)
Initialize a retransmission counter.
void fr_retry_init(fr_retry_t *r, fr_time_t now, fr_retry_config_t const *config)
Initialize a retransmission counter.
fr_time_t start
when we started the retransmission
fr_time_delta_t irt
Initial transmission time.
fr_time_delta_t rt
retransmit interval
fr_time_delta_t mrt
Maximum retransmission time.
uint32_t mrc
Maximum retransmission count.
fr_retry_config_t const * config
master configuration
fr_retry_state_t state
so callers can see what state it's in.
@ FR_RETRY_MRC
reached maximum retransmission count
@ FR_RETRY_MRD
reached maximum retransmission duration
uint32_t count
number of sent packets
fr_time_t end
when we will end the retransmissions
fr_time_t updated
last update, really a cached "now".
fr_time_t next
when the next timer should be set