Skip to content

Commit

Permalink
Removing struct_version: Applications must recompile with the latest …
Browse files Browse the repository at this point in the history
…library (no ABI compatibility available).
  • Loading branch information
CIPop committed Aug 11, 2023
1 parent 76307e8 commit 9b04ed6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
12 changes: 4 additions & 8 deletions MQTTPacket/src/MQTTConnect.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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;
Expand Down Expand Up @@ -150,7 +146,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);
Expand Down
6 changes: 0 additions & 6 deletions MQTTPacket/test/test1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand Down
6 changes: 0 additions & 6 deletions MQTTPacket/test/test2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand Down

0 comments on commit 9b04ed6

Please sign in to comment.