35#ifndef BACKOFF_ALGORITHM_H_
36#define BACKOFF_ALGORITHM_H_
51#define BACKOFF_ALGORITHM_RETRY_FOREVER ( UINT32_MAX )
57typedef enum BackoffAlgorithmStatus
68typedef struct BackoffAlgorithmContext
108 uint16_t backOffBase,
110 uint32_t maxAttempts );
137 uint32_t randomValue,
138 uint16_t * pNextBackOff );
void BackoffAlgorithm_InitializeParams(BackoffAlgorithmContext_t *pContext, uint16_t backOffBase, uint16_t maxBackOff, uint32_t maxAttempts)
Initializes the context for using backoff algorithm. The parameters are required for calculating the ...
Definition: backoff_algorithm.c:86
BackoffAlgorithmStatus_t BackoffAlgorithm_GetNextBackoff(BackoffAlgorithmContext_t *pRetryContext, uint32_t randomValue, uint16_t *pNextBackOff)
Simple exponential backoff and jitter function that provides the delay value for the next retry attem...
Definition: backoff_algorithm.c:40
BackoffAlgorithmStatus_t
Status for BackoffAlgorithm_GetNextBackoff.
Definition: backoff_algorithm.h:58
@ BackoffAlgorithmRetriesExhausted
The function exhausted all retry attempts.
Definition: backoff_algorithm.h:60
@ BackoffAlgorithmSuccess
The function successfully calculated the next back-off value.
Definition: backoff_algorithm.h:59
Represents parameters required for calculating the back-off delay for the next retry attempt.
Definition: backoff_algorithm.h:69
uint32_t maxRetryAttempts
The maximum number of retry attempts.
Definition: backoff_algorithm.h:89
uint16_t maxBackoffDelay
The maximum backoff delay (in milliseconds) between consecutive retry attempts.
Definition: backoff_algorithm.h:73
uint16_t nextJitterMax
The maximum backoff value (in milliseconds) for the next retry attempt.
Definition: backoff_algorithm.h:84
uint32_t attemptsDone
The total number of retry attempts completed. This value is incremented on every call to BackoffAlgor...
Definition: backoff_algorithm.h:79