From 3c8d7526d4f109dc149419ff998e829a35a834ec Mon Sep 17 00:00:00 2001 From: David Garske Date: Mon, 27 Apr 2020 14:11:51 -0700 Subject: [PATCH] Fix for MQTT v5 property name typo. --- examples/mqttclient/mqttclient.c | 4 ++-- src/mqtt_packet.c | 2 +- wolfmqtt/mqtt_packet.h | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/mqttclient/mqttclient.c b/examples/mqttclient/mqttclient.c index 547a1166c..ddf8c6e5d 100644 --- a/examples/mqttclient/mqttclient.c +++ b/examples/mqttclient/mqttclient.c @@ -177,7 +177,7 @@ static int mqtt_property_cb(MqttClient *client, MqttProp *head, void *ctx) PRINTF("Reason String: %s", prop->data_str.str); break; - case MQTT_PROP_PLAYLOAD_FORMAT_IND: + case MQTT_PROP_PAYLOAD_FORMAT_IND: case MQTT_PROP_MSG_EXPIRY_INTERVAL: case MQTT_PROP_CONTENT_TYPE: case MQTT_PROP_RESP_TOPIC: @@ -428,7 +428,7 @@ int mqttclient_test(MQTTCtx *mqttCtx) { /* Payload Format Indicator */ MqttProp* prop = MqttClient_PropsAdd(&mqttCtx->publish.props); - prop->type = MQTT_PROP_PLAYLOAD_FORMAT_IND; + prop->type = MQTT_PROP_PAYLOAD_FORMAT_IND; prop->data_int = 1; } { diff --git a/src/mqtt_packet.c b/src/mqtt_packet.c index 82a7174f7..66a2d5f54 100755 --- a/src/mqtt_packet.c +++ b/src/mqtt_packet.c @@ -35,7 +35,7 @@ struct MqttPropMatrix { }; static const struct MqttPropMatrix gPropMatrix[] = { { MQTT_PROP_NONE, MQTT_DATA_TYPE_NONE, 0 }, - { MQTT_PROP_PLAYLOAD_FORMAT_IND, MQTT_DATA_TYPE_BYTE, + { MQTT_PROP_PAYLOAD_FORMAT_IND, MQTT_DATA_TYPE_BYTE, (1 << MQTT_PACKET_TYPE_PUBLISH) }, { MQTT_PROP_MSG_EXPIRY_INTERVAL, MQTT_DATA_TYPE_INT, (1 << MQTT_PACKET_TYPE_PUBLISH) }, diff --git a/wolfmqtt/mqtt_packet.h b/wolfmqtt/mqtt_packet.h index 14808f1f0..fbe4e2e70 100644 --- a/wolfmqtt/mqtt_packet.h +++ b/wolfmqtt/mqtt_packet.h @@ -62,7 +62,7 @@ typedef enum MqttDataType { /* PROPERTIES */ typedef enum MqttPropertyType { MQTT_PROP_NONE = 0, - MQTT_PROP_PLAYLOAD_FORMAT_IND = 1, + MQTT_PROP_PAYLOAD_FORMAT_IND = 1, MQTT_PROP_MSG_EXPIRY_INTERVAL = 2, MQTT_PROP_CONTENT_TYPE = 3, MQTT_PROP_RESP_TOPIC = 8, @@ -92,6 +92,9 @@ typedef enum MqttPropertyType { MQTT_PROP_TYPE_MAX = 0xFF } MqttPropertyType; +/* backwards compatibility for anyone using the typo name */ +#define MQTT_PROP_PLAYLOAD_FORMAT_IND MQTT_PROP_PAYLOAD_FORMAT_IND + struct _MqttProp_Str { word16 len; char *str;