Declares the private functions/macros to be used with serialization and deserialization by the core_mqtt library. DO NOT include this in your application. More...
Go to the source code of this file.
Macros | |
| #define | MQTT_SUBSCRIPTION_ID_POS ( 1 ) |
| Position of the properties for the fieldSet. | |
| #define | MQTT_SESSION_EXPIRY_INTERVAL_POS ( 2 ) |
Defines the position of the Session Expiry Interval property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_RECEIVE_MAXIMUM_POS ( 3 ) |
Defines the position of the Receive Maximum property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_MAX_PACKET_SIZE_POS ( 4 ) |
Defines the position of the Maximum Packet Size property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_TOPIC_ALIAS_MAX_POS ( 5 ) |
Defines the position of the Topic Alias Maximum property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_REQUEST_RESPONSE_INFO_POS ( 6 ) |
Defines the position of the Request Response Information property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_REQUEST_PROBLEM_INFO_POS ( 7 ) |
Defines the position of the Request Problem Information property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_AUTHENTICATION_METHOD_POS ( 9 ) |
Defines the position of the Authentication Method property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_AUTHENTICATION_DATA_POS ( 10 ) |
Defines the position of the Authentication Data property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_PAYLOAD_FORMAT_INDICATOR_POS ( 11 ) |
Defines the position of the Payload Format Indicator property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_MESSAGE_EXPIRY_INTERVAL_POS ( 12 ) |
Defines the position of the Message Expiry Interval property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_TOPIC_ALIAS_POS ( 13 ) |
Defines the position of the Topic Alias property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_RESPONSE_TOPIC_POS ( 14 ) |
Defines the position of the Response Topic property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_CORRELATION_DATA_POS ( 15 ) |
Defines the position of the Correlation Data property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_CONTENT_TYPE_POS ( 16 ) |
Defines the position of the Content Type property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_REASON_STRING_POS ( 17 ) |
Defines the position of the Reason String property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_WILL_DELAY_POS ( 18 ) |
Defines the position of the Will Delay Interval property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_ASSIGNED_CLIENT_ID_POS ( 19 ) |
Defines the position of the Assigned Client Identifier property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_SERVER_KEEP_ALIVE_POS ( 20 ) |
Defines the position of the Server Keep Alive property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_RESPONSE_INFORMATION_POS ( 21 ) |
Defines the position of the Response Information property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_SERVER_REFERENCE_POS ( 22 ) |
Defines the position of the Server Reference property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_MAX_QOS_POS ( 23 ) |
Defines the position of the Maximum QoS property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_RETAIN_AVAILABLE_POS ( 24 ) |
Defines the position of the Retain Available property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_WILDCARD_SUBSCRIPTION_AVAILABLE_POS ( 25 ) |
Defines the position of the Wildcard Subscription Available property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_SUBSCRIPTION_ID_AVAILABLE_POS ( 26 ) |
Defines the position of the Subscription Identifier Available property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_SHARED_SUBSCRIPTION_AVAILABLE_POS ( 27 ) |
Defines the position of the Shared Subscription Available property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_USER_PROP_POS ( 28 ) |
Defines the position of the User property in the fieldSet bitfield of the MQTTPropBuilder_t struct. | |
| #define | MQTT_CONNECT_FLAG_CLEAN ( 1 ) |
| Clean session. | |
| #define | MQTT_CONNECT_FLAG_WILL ( 2 ) |
| Will present. | |
| #define | MQTT_CONNECT_FLAG_WILL_QOS1 ( 3 ) |
| Will QoS 1. | |
| #define | MQTT_CONNECT_FLAG_WILL_QOS2 ( 4 ) |
| Will QoS 2. | |
| #define | MQTT_CONNECT_FLAG_WILL_RETAIN ( 5 ) |
| Will retain. | |
| #define | MQTT_CONNECT_FLAG_PASSWORD ( 6 ) |
| Password present. | |
| #define | MQTT_CONNECT_FLAG_USERNAME ( 7 ) |
| User name present. | |
| #define | UINT32_DECODE(ptr) |
| Macro for decoding a 4-byte unsigned int from a sequence of bytes. | |
| #define | WRITE_UINT32(addr, val) |
| #define | UINT8_SET_BIT(x, position) ( ( x ) = ( uint8_t ) ( ( x ) | ( 0x01U << ( position ) ) ) ) |
| Set a bit in an 8-bit unsigned integer. | |
| #define | UINT8_CLEAR_BIT(x, position) ( ( x ) = ( uint8_t ) ( ( x ) & ( ~( 0x01U << ( position ) ) ) ) ) |
| Clear a bit in an 8-bit unsigned integer. | |
| #define | UINT8_CHECK_BIT(x, position) ( ( ( x ) & ( 0x01U << ( position ) ) ) == ( 0x01U << ( position ) ) ) |
| Macro for checking if a bit is set in a 1-byte unsigned int. | |
| #define | UINT16_HIGH_BYTE(x) ( ( uint8_t ) ( ( x ) >> 8 ) ) |
| Get the high byte of a 16-bit unsigned integer. | |
| #define | UINT16_LOW_BYTE(x) ( ( uint8_t ) ( ( x ) & 0x00ffU ) ) |
| Get the low byte of a 16-bit unsigned integer. | |
| #define | UINT16_DECODE(ptr) |
| Macro for decoding a 2-byte unsigned int from a sequence of bytes. | |
| #define | UINT32_SET_BIT(x, position) ( ( x ) = ( uint32_t ) ( ( x ) | ( ( uint32_t ) 0x01U << ( position ) ) ) ) |
| Set a bit in an 32-bit unsigned integer. | |
| #define | UINT32_CHECK_BIT(x, position) ( ( ( uint32_t ) ( x ) & ( ( uint32_t ) 0x01U << ( position ) ) ) == ( ( uint32_t ) 0x01U << ( position ) ) ) |
| Macro for checking if a bit is set in a 4-byte unsigned int. | |
| #define | MQTT_MAX_REMAINING_LENGTH ( 268435455U ) |
| Per the MQTT spec, the largest "Remaining Length" of an MQTT packet is this value, 256 MB. | |
| #define | MQTT_REMAINING_LENGTH_INVALID ( ( uint32_t ) MQTT_MAX_REMAINING_LENGTH + 1U ) |
| A value that represents an invalid remaining length. | |
| #define | MQTT_MAX_PACKET_SIZE ( MQTT_MAX_REMAINING_LENGTH + 5U ) |
| Per the MQTT spec, the max packet size can be of max remaining length + 5 bytes. Fixed header MQTT packet type nibble + MQTT flags nibble 1 Maximum bytes used to encode the remaining length 4. | |
| #define | MQTT_MAX_UTF8_STR_LENGTH ( ( uint32_t ) 65535 ) |
| A value that represents maximum value of UTF-8 encoded string. | |
| #define | MAX_VARIABLE_LENGTH_INT_VALUE ( ( uint32_t ) 268435455U ) |
| A value that represents the maximum value which can fit in a variable byte integer. | |
| #define | CHECK_U32T_OVERFLOWS_SIZE_T(x) false |
| A macro to check whether the uint32_t values will overflow when converted to size_t. | |
| #define | CHECK_SIZE_T_OVERFLOWS_16BIT(x) false |
| A macro to check whether the size_t values will overflow when converted to uint16_t which is used to represent MQTT UTF8 strings. | |
| #define | CHECK_SIZE_T_OVERFLOWS_32BIT(x) false |
| A macro to check whether the size_t values will overflow when converted to uint32_t. | |
| #define | ADDITION_WILL_OVERFLOW_U32(x, y) ( ( x ) > ( UINT32_MAX - ( y ) ) ) |
| A macro to check whether the addition of two unsigned 32-bit numbers will overflow. | |
| #define | ADDITION_WILL_OVERFLOW_SIZE_T(x, y) ( ( x ) > ( SIZE_MAX - ( y ) ) ) |
| A macro to check whether the addition of two unsigned size_t numbers will overflow. | |
Declares the private functions/macros to be used with serialization and deserialization by the core_mqtt library. DO NOT include this in your application.
| #define MQTT_SUBSCRIPTION_ID_POS ( 1 ) |
Position of the properties for the fieldSet.
Each property that can be added to an MQTT packet is assigned a unique bit position (0–31). This macro defines the position of the property in the fieldSet bitfield of the MQTTPropBuilder_t struct.
The fieldSet is used to track which properties have already been added to prevent duplication, as many MQTT v5 properties must not appear more than once in a packet.
Defines the position of the Subscription Identifier property in the fieldSet bitfield of the MQTTPropBuilder_t struct.
| #define UINT32_DECODE | ( | ptr | ) |
Macro for decoding a 4-byte unsigned int from a sequence of bytes.
| [in] | ptr | A uint8_t* that points to the high byte. |
| #define WRITE_UINT32 | ( | addr, | |
| val | |||
| ) |
This macro serializes a 32-bit unsigned integer (val) into 4 bytes at the specified memory location (addr).
| #define UINT8_CHECK_BIT | ( | x, | |
| position | |||
| ) | ( ( ( x ) & ( 0x01U << ( position ) ) ) == ( 0x01U << ( position ) ) ) |
Macro for checking if a bit is set in a 1-byte unsigned int.
| [in] | x | The unsigned int to check. |
| [in] | position | Which bit to check. |
| #define UINT16_DECODE | ( | ptr | ) |
Macro for decoding a 2-byte unsigned int from a sequence of bytes.
| [in] | ptr | A uint8_t* that points to the high byte. |
| #define UINT32_CHECK_BIT | ( | x, | |
| position | |||
| ) | ( ( ( uint32_t ) ( x ) & ( ( uint32_t ) 0x01U << ( position ) ) ) == ( ( uint32_t ) 0x01U << ( position ) ) ) |
Macro for checking if a bit is set in a 4-byte unsigned int.
| [in] | x | The unsigned int to check. |
| [in] | position | Which bit to check. |
| #define MQTT_REMAINING_LENGTH_INVALID ( ( uint32_t ) MQTT_MAX_REMAINING_LENGTH + 1U ) |
A value that represents an invalid remaining length.
This value is greater than what is allowed by the MQTT specification.
| #define CHECK_U32T_OVERFLOWS_SIZE_T | ( | x | ) | false |
A macro to check whether the uint32_t values will overflow when converted to size_t.
Evaluates to true when the value provided will overflow size_t variable. False otherwise.
| #define CHECK_SIZE_T_OVERFLOWS_16BIT | ( | x | ) | false |
A macro to check whether the size_t values will overflow when converted to uint16_t which is used to represent MQTT UTF8 strings.
Evaluates to true when the value provided will overflow 16-bit variable. False otherwise.
| #define CHECK_SIZE_T_OVERFLOWS_32BIT | ( | x | ) | false |
A macro to check whether the size_t values will overflow when converted to uint32_t.
Evaluates to true when the value provided will overflow 32-bit variable. False otherwise.
| #define ADDITION_WILL_OVERFLOW_U32 | ( | x, | |
| y | |||
| ) | ( ( x ) > ( UINT32_MAX - ( y ) ) ) |
A macro to check whether the addition of two unsigned 32-bit numbers will overflow.
Evaluates to true when the addition will overflow. False otherwise.
| #define ADDITION_WILL_OVERFLOW_SIZE_T | ( | x, | |
| y | |||
| ) | ( ( x ) > ( SIZE_MAX - ( y ) ) ) |
A macro to check whether the addition of two unsigned size_t numbers will overflow.
Evaluates to true when the addition will overflow. False otherwise.