Skip to content

Commit f12e098

Browse files
committed
[nrf fromtree] net: lib: mqtt: Add extra MQTT 5.0 ifdefs to prevent compile errors
Upstream PR #: 87741 Add some extra ifdefs around MQTT 5.0 specific structures to prevent compiler errors due to undefined symbols in certain configurations. Signed-off-by: Robert Lubos <[email protected]>
1 parent 2f7db51 commit f12e098

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

include/zephyr/net/mqtt.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,13 @@ struct mqtt_binstr {
244244

245245
/** @brief Abstracts aliased topic. */
246246
struct mqtt_topic_alias {
247+
#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
247248
/** UTF-8 encoded topic name. */
248249
uint8_t topic_buf[CONFIG_MQTT_TOPIC_ALIAS_STRING_MAX];
249250

250251
/** Topic name size. */
251252
uint16_t topic_size;
253+
#endif /* CONFIG_MQTT_VERSION_5_0 */
252254
};
253255

254256
/** @brief Abstracts MQTT UTF-8 encoded topic that can be subscribed
@@ -388,6 +390,7 @@ struct mqtt_connack_param {
388390

389391
/** @brief Common MQTT 5.0 properties shared across all ack-type messages. */
390392
struct mqtt_common_ack_properties {
393+
#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
391394
/** MQTT 5.0, chapter 3.4.2.2.3 User Property. */
392395
struct mqtt_utf8_pair user_prop[CONFIG_MQTT_USER_PROPERTIES_MAX];
393396

@@ -401,6 +404,7 @@ struct mqtt_common_ack_properties {
401404
/** User Property property was present. */
402405
bool has_user_prop;
403406
} rx;
407+
#endif /* CONFIG_MQTT_VERSION_5_0 */
404408
};
405409

406410
/** @brief Parameters for MQTT publish acknowledgment (PUBACK). */
@@ -621,8 +625,9 @@ struct mqtt_disconnect_param {
621625
#endif /* CONFIG_MQTT_VERSION_5_0 */
622626
};
623627

624-
#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
628+
/** @brief Parameters for auth message. */
625629
struct mqtt_auth_param {
630+
#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
626631
/* MQTT 5.0, chapter 3.15.2.1 Authenticate Reason Code */
627632
enum mqtt_auth_reason_code reason_code;
628633

@@ -651,8 +656,8 @@ struct mqtt_auth_param {
651656
bool has_user_prop;
652657
} rx;
653658
} prop;
654-
};
655659
#endif /* CONFIG_MQTT_VERSION_5_0 */
660+
};
656661

657662
/**
658663
* @brief Defines event parameters notified along with asynchronous events

0 commit comments

Comments
 (0)