AWS IoT Device SDK C: MQTT
MQTT 3.1.1 client library
Return to main page ↑
iot_mqtt_static_memory.c File Reference

Implementation of MQTT static memory functions. More...

#include "iot_config.h"
#include <stddef.h>
#include <string.h>
#include "iot_static_memory.h"
#include "private/iot_mqtt_internal.h"

Macros

#define MQTT_SUBSCRIPTION_SIZE   ( sizeof( _mqttSubscription_t ) + AWS_IOT_MQTT_SERVER_MAX_TOPIC_LENGTH )
 The size of a static memory MQTT subscription. More...
 

Functions

void * IotMqtt_MallocConnection (size_t size)
 Allocate an _mqttConnection_t. This function should have the same signature as malloc.
 
void IotMqtt_FreeConnection (void *ptr)
 Free an _mqttConnection_t. This function should have the same signature as free.
 
void * IotMqtt_MallocOperation (size_t size)
 Allocate an _mqttOperation_t. This function should have the same signature as malloc.
 
void IotMqtt_FreeOperation (void *ptr)
 Free an _mqttOperation_t. This function should have the same signature as free.
 
void * IotMqtt_MallocSubscription (size_t size)
 Allocate an _mqttSubscription_t. This function should have the same signature as malloc.
 
void IotMqtt_FreeSubscription (void *ptr)
 Free an _mqttSubscription_t. This function should have the same signature as free.
 

Variables

static uint32_t _pInUseMqttConnections [IOT_MQTT_CONNECTIONS]
 MQTT connection in-use flags.
 
static _mqttConnection_t _pMqttConnections [IOT_MQTT_CONNECTIONS]
 MQTT connections.
 
static uint32_t _pInUseMqttOperations [IOT_MQTT_MAX_IN_PROGRESS_OPERATIONS]
 MQTT operation in-use flags.
 
static _mqttOperation_t _pMqttOperations [IOT_MQTT_MAX_IN_PROGRESS_OPERATIONS]
 MQTT operations.
 
static uint32_t _pInUseMqttSubscriptions [IOT_MQTT_SUBSCRIPTIONS]
 MQTT subscription in-use flags.
 
static char _pMqttSubscriptions [IOT_MQTT_SUBSCRIPTIONS][MQTT_SUBSCRIPTION_SIZE]
 MQTT subscriptions.
 

Detailed Description

Implementation of MQTT static memory functions.

Macro Definition Documentation

◆ MQTT_SUBSCRIPTION_SIZE

#define MQTT_SUBSCRIPTION_SIZE   ( sizeof( _mqttSubscription_t ) + AWS_IOT_MQTT_SERVER_MAX_TOPIC_LENGTH )

The size of a static memory MQTT subscription.

Since the pTopic member of _mqttSubscription_t is variable-length, the constant AWS_IOT_MQTT_SERVER_MAX_TOPIC_LENGTH is used for the length of _mqttSubscription_t.pTopicFilter.