Skip to content

Commit 1a2d42b

Browse files
committed
[nrf fromlist] 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 415c5af commit 1a2d42b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

include/zephyr/net/mqtt.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ enum mqtt_evt_type {
8080
/** Ping Response from server. */
8181
MQTT_EVT_PINGRESP,
8282

83+
#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
8384
/** Authentication packet received from server. MQTT 5.0 only. */
8485
MQTT_EVT_AUTH,
86+
#endif /* CONFIG_MQTT_VERSION_5_0 */
8587
};
8688

8789
/** @brief MQTT version protocol level. */
@@ -244,11 +246,13 @@ struct mqtt_binstr {
244246

245247
/** @brief Abstracts aliased topic. */
246248
struct mqtt_topic_alias {
249+
#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
247250
/** UTF-8 encoded topic name. */
248251
uint8_t topic_buf[CONFIG_MQTT_TOPIC_ALIAS_STRING_MAX];
249252

250253
/** Topic name size. */
251254
uint16_t topic_size;
255+
#endif /* CONFIG_MQTT_VERSION_5_0 */
252256
};
253257

254258
/** @brief Abstracts MQTT UTF-8 encoded topic that can be subscribed
@@ -388,6 +392,7 @@ struct mqtt_connack_param {
388392

389393
/** @brief Common MQTT 5.0 properties shared across all ack-type messages. */
390394
struct mqtt_common_ack_properties {
395+
#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
391396
/** MQTT 5.0, chapter 3.4.2.2.3 User Property. */
392397
struct mqtt_utf8_pair user_prop[CONFIG_MQTT_USER_PROPERTIES_MAX];
393398

@@ -401,6 +406,7 @@ struct mqtt_common_ack_properties {
401406
/** User Property property was present. */
402407
bool has_user_prop;
403408
} rx;
409+
#endif /* CONFIG_MQTT_VERSION_5_0 */
404410
};
405411

406412
/** @brief Parameters for MQTT publish acknowledgment (PUBACK). */
@@ -621,8 +627,9 @@ struct mqtt_disconnect_param {
621627
#endif /* CONFIG_MQTT_VERSION_5_0 */
622628
};
623629

624-
#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
630+
/** @brief Parameters for auth message. */
625631
struct mqtt_auth_param {
632+
#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
626633
/* MQTT 5.0, chapter 3.15.2.1 Authenticate Reason Code */
627634
enum mqtt_auth_reason_code reason_code;
628635

@@ -651,8 +658,8 @@ struct mqtt_auth_param {
651658
bool has_user_prop;
652659
} rx;
653660
} prop;
654-
};
655661
#endif /* CONFIG_MQTT_VERSION_5_0 */
662+
};
656663

657664
/**
658665
* @brief Defines event parameters notified along with asynchronous events

0 commit comments

Comments
 (0)