From 13835511a8e03df07bec964d1d0f3e86053317ca Mon Sep 17 00:00:00 2001 From: CIPop Date: Thu, 10 Aug 2023 23:32:41 +0000 Subject: [PATCH] Removing struct_version: Applications must recompile with the latest library (no ABI compatibility available). --- MQTTPacket/src/MQTTConnect.h | 12 ++++-------- MQTTPacket/test/test1.c | 6 ------ MQTTPacket/test/test2.c | 6 ------ 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/MQTTPacket/src/MQTTConnect.h b/MQTTPacket/src/MQTTConnect.h index 0cb1b862..f6386ea1 100644 --- a/MQTTPacket/src/MQTTConnect.h +++ b/MQTTPacket/src/MQTTConnect.h @@ -81,8 +81,6 @@ typedef struct { /** The eyecatcher for this structure. must be MQTW. */ char struct_id[4]; - /** The version number of this structure. Must be 0 */ - int struct_version; /** The LWT topic to which the LWT message will be published. */ MQTTString topicName; /** The LWT payload. */ @@ -105,18 +103,16 @@ typedef struct } MQTTPacket_willOptions; #if defined(MQTTV5) -#define MQTTPacket_willOptions_initializer { {'M', 'Q', 'T', 'W'}, 0, {NULL, {0, NULL}}, {NULL, {0, NULL}}, 0, 0, NULL } +#define MQTTPacket_willOptions_initializer { {'M', 'Q', 'T', 'W'}, {NULL, {0, NULL}}, {NULL, {0, NULL}}, 0, 0, NULL } #else -#define MQTTPacket_willOptions_initializer { {'M', 'Q', 'T', 'W'}, 0, {NULL, {0, NULL}}, {NULL, {0, NULL}}, 0, 0 } +#define MQTTPacket_willOptions_initializer { {'M', 'Q', 'T', 'W'}, {NULL, {0, NULL}}, {NULL, {0, NULL}}, 0, 0 } #endif typedef struct { /** The eyecatcher for this structure. must be MQTC. */ char struct_id[4]; - /** The version number of this structure. Must be 0 */ - int struct_version; - /** Version of MQTT to be used. 3 = 3.1 4 = 3.1.1 + /** Version of MQTT to be used. 3 = 3.1 4 = 3.1.1, 5 = 5.0 */ unsigned char MQTTVersion; MQTTString clientID; @@ -146,7 +142,7 @@ typedef union #endif } MQTTConnackFlags; /**< connack flags byte */ -#define MQTTPacket_connectData_initializer { {'M', 'Q', 'T', 'C'}, 0, 4, {NULL, {0, NULL}}, 60, 1, 0, \ +#define MQTTPacket_connectData_initializer { {'M', 'Q', 'T', 'C'}, 4, {NULL, {0, NULL}}, 60, 1, 0, \ MQTTPacket_willOptions_initializer, {NULL, {0, NULL}}, {NULL, {0, NULL}} } DLLExport int MQTTSerialize_connect(unsigned char* buf, int32_t buflen, MQTTPacket_connectData* options); diff --git a/MQTTPacket/test/test1.c b/MQTTPacket/test/test1.c index a04c4a55..73e404ad 100644 --- a/MQTTPacket/test/test1.c +++ b/MQTTPacket/test/test1.c @@ -273,9 +273,6 @@ int checkConnectPackets(MQTTPacket_connectData* before, MQTTPacket_connectData* assert("struct_ids should be the same", memcmp(before->struct_id, after->struct_id, 4) == 0, "struct_ids were different %.4s\n", after->struct_id); - assert("struct_versions should be the same", - before->struct_version == after->struct_version, "struct_versions were different\n", rc); - assert("MQTT versions should be the same", before->MQTTVersion == after->MQTTVersion, "MQTT versions were different\n", rc); @@ -296,9 +293,6 @@ int checkConnectPackets(MQTTPacket_connectData* before, MQTTPacket_connectData* assert("will struct_ids should be the same", memcmp(before->will.struct_id, after->will.struct_id, 4) == 0, "will struct_ids were different %.4s\n", after->struct_id); - assert("will struct_versions should be the same", - before->will.struct_version == after->will.struct_version, "will struct_versions were different\n", rc); - assert("topic names should be the same", checkMQTTStrings(before->will.topicName, after->will.topicName), "topic names were different\n", rc); diff --git a/MQTTPacket/test/test2.c b/MQTTPacket/test/test2.c index 0622ec40..eab32cc5 100644 --- a/MQTTPacket/test/test2.c +++ b/MQTTPacket/test/test2.c @@ -276,9 +276,6 @@ int checkConnectPackets(MQTTPacket_connectData* before, MQTTPacket_connectData* assert("struct_ids should be the same", memcmp(before->struct_id, after->struct_id, 4) == 0, "struct_ids were different %.4s\n", after->struct_id); - assert("struct_versions should be the same", - before->struct_version == after->struct_version, "struct_versions were different\n", rc); - assert("MQTT versions should be the same", before->MQTTVersion == after->MQTTVersion, "MQTT versions were different\n", rc); @@ -299,9 +296,6 @@ int checkConnectPackets(MQTTPacket_connectData* before, MQTTPacket_connectData* assert("will struct_ids should be the same", memcmp(before->will.struct_id, after->will.struct_id, 4) == 0, "will struct_ids were different %.4s\n", after->struct_id); - assert("will struct_versions should be the same", - before->will.struct_version == after->will.struct_version, "will struct_versions were different\n", rc); - assert("topic names should be the same", checkMQTTStrings(before->will.topicName, after->will.topicName), "topic names were different\n", rc);