33#ifndef BACKOFF_ALGORITHM_H_
34#define BACKOFF_ALGORITHM_H_
49#define BACKOFF_ALGORITHM_RETRY_FOREVER ( UINT32_MAX )
55typedef enum BackoffAlgorithmStatus
66typedef struct BackoffAlgorithmContext
106 uint16_t backOffBase,
108 uint32_t maxAttempts );
135 uint32_t randomValue,
136 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:56
@ BackoffAlgorithmRetriesExhausted
The function exhausted all retry attempts.
Definition: backoff_algorithm.h:58
@ BackoffAlgorithmSuccess
The function successfully calculated the next back-off value.
Definition: backoff_algorithm.h:57
Represents parameters required for calculating the back-off delay for the next retry attempt.
Definition: backoff_algorithm.h:67
uint32_t maxRetryAttempts
The maximum number of retry attempts.
Definition: backoff_algorithm.h:87
uint16_t maxBackoffDelay
The maximum backoff delay (in milliseconds) between consecutive retry attempts.
Definition: backoff_algorithm.h:71
uint16_t nextJitterMax
The maximum backoff value (in milliseconds) for the next retry attempt.
Definition: backoff_algorithm.h:82
uint32_t attemptsDone
The total number of retry attempts completed. This value is incremented on every call to BackoffAlgor...
Definition: backoff_algorithm.h:77