AWS IoT Device SDK C  202011.00
SDK for connecting to AWS IoT from a device using embedded C.
retry_utils.h File Reference

Declaration of the exponential backoff retry logic utility functions and constants. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  RetryUtilsParams_t
 Represents parameters required for retry logic. More...
 

Macros

#define MAX_RETRY_ATTEMPTS   4U
 Max number of retry attempts. Set this value to 0 if the client must retry forever.
 
#define INITIAL_RETRY_BACKOFF_SECONDS   1U
 Initial fixed backoff value in seconds between two successive retries. A random jitter value is added to every backoff value.
 
#define MAX_RETRY_BACKOFF_SECONDS   128U
 Max backoff value in seconds.
 
#define MAX_JITTER_VALUE_SECONDS   5U
 Max jitter value in seconds.
 

Enumerations

enum  RetryUtilsStatus_t { RetryUtilsSuccess = 0, RetryUtilsRetriesExhausted }
 Status for RetryUtils_BackoffAndSleep. More...
 

Functions

void RetryUtils_ParamsReset (RetryUtilsParams_t *pRetryParams)
 Resets the retry timeout value and number of attempts. This function must be called by the application before a new retry attempt. More...
 
RetryUtilsStatus_t RetryUtils_BackoffAndSleep (RetryUtilsParams_t *pRetryParams)
 Simple platform specific exponential backoff function. The application must use this function between retry failures to add exponential delay. This function will block the calling task for the current timeout value. More...
 

Detailed Description

Declaration of the exponential backoff retry logic utility functions and constants.

Enumeration Type Documentation

◆ RetryUtilsStatus_t

Status for RetryUtils_BackoffAndSleep.

Enumerator
RetryUtilsSuccess 

The function returned successfully after sleeping.

RetryUtilsRetriesExhausted 

The function exhausted all retry attempts.

Function Documentation

◆ RetryUtils_ParamsReset()

void RetryUtils_ParamsReset ( RetryUtilsParams_t pRetryParams)

Resets the retry timeout value and number of attempts. This function must be called by the application before a new retry attempt.

Parameters
[in,out]pRetryParamsStructure containing attempts done and timeout value.

◆ RetryUtils_BackoffAndSleep()

RetryUtilsStatus_t RetryUtils_BackoffAndSleep ( RetryUtilsParams_t pRetryParams)

Simple platform specific exponential backoff function. The application must use this function between retry failures to add exponential delay. This function will block the calling task for the current timeout value.

Parameters
[in,out]pRetryParamsStructure containing retry parameters.
Returns
RetryUtilsSuccess after a successful sleep, RetryUtilsRetriesExhausted when all attempts are exhausted.