33#ifndef BACKOFF_ALGORITHM_H_
34#define BACKOFF_ALGORITHM_H_
43#define BACKOFF_ALGORITHM_RETRY_FOREVER ( 0U )
49typedef enum BackoffAlgorithmStatus
60typedef struct BackoffAlgorithmContext
100 uint16_t backOffBase,
102 uint32_t maxAttempts );
129 uint32_t randomValue,
130 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:84
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:38
BackoffAlgorithmStatus_t
Status for BackoffAlgorithm_GetNextBackoff.
Definition: backoff_algorithm.h:50
@ BackoffAlgorithmRetriesExhausted
The function exhausted all retry attempts.
Definition: backoff_algorithm.h:52
@ BackoffAlgorithmSuccess
The function successfully calculated the next back-off value.
Definition: backoff_algorithm.h:51
Represents parameters required for calculating the back-off delay for the next retry attempt.
Definition: backoff_algorithm.h:61
uint32_t maxRetryAttempts
The maximum number of retry attempts.
Definition: backoff_algorithm.h:81
uint16_t maxBackoffDelay
The maximum backoff delay (in milliseconds) between consecutive retry attempts.
Definition: backoff_algorithm.h:65
uint16_t nextJitterMax
The maximum backoff value (in milliseconds) for the next retry attempt.
Definition: backoff_algorithm.h:76
uint32_t attemptsDone
The total number of retry attempts completed. This value is incremented on every call to BackoffAlgor...
Definition: backoff_algorithm.h:71