Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
 4.1.99
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
mqtt.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
22#ifndef ZEPHYR_INCLUDE_NET_MQTT_H_
23#define ZEPHYR_INCLUDE_NET_MQTT_H_
24
25#include <stddef.h>
26
27#include <zephyr/kernel.h>
28#include <zephyr/types.h>
30#include <zephyr/net/net_ip.h>
31#include <zephyr/sys/mutex.h>
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
47
52
61
64
67
70
73
76
79
82
83#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
86#endif /* CONFIG_MQTT_VERSION_5_0 */
87};
88
95
114
141
167
182
215
222
228
238#define MQTT_UTF8_LITERAL(literal) \
239 ((struct mqtt_utf8) {literal, sizeof(literal) - 1})
240
246
249#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
251 uint8_t topic_buf[CONFIG_MQTT_TOPIC_ALIAS_STRING_MAX];
252
255#endif /* CONFIG_MQTT_VERSION_5_0 */
256};
257
264
269};
270
276};
277
283
392
395#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
397 struct mqtt_utf8_pair user_prop[CONFIG_MQTT_USER_PROPERTIES_MAX];
398
401
403 struct {
408 } rx;
409#endif /* CONFIG_MQTT_VERSION_5_0 */
410};
411
416
417#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
420
423#endif /* CONFIG_MQTT_VERSION_5_0 */
424};
425
430
431#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
434
437#endif /* CONFIG_MQTT_VERSION_5_0 */
438};
439
444
445#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
448
451#endif /* CONFIG_MQTT_VERSION_5_0 */
452};
453
458
459#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
462
465#endif /* CONFIG_MQTT_VERSION_5_0 */
466};
467
472
479
480#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
483#endif /* CONFIG_MQTT_VERSION_5_0 */
484};
485
490
491#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
494
497#endif /* CONFIG_MQTT_VERSION_5_0 */
498};
499
506
509
514
519
520#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
522 struct {
524 struct mqtt_utf8_pair user_prop[CONFIG_MQTT_USER_PROPERTIES_MAX];
525
527 struct mqtt_utf8 response_topic;
528
530 struct mqtt_binstr correlation_data;
531
533 struct mqtt_utf8 content_type;
534
536 uint32_t subscription_identifier[CONFIG_MQTT_SUBSCRIPTION_ID_PROPERTIES_MAX];
537
540
543
546
548 struct {
565 } rx;
567#endif /* CONFIG_MQTT_VERSION_5_0 */
568};
569
574
577
580
581#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
583 struct {
585 struct mqtt_utf8_pair user_prop[CONFIG_MQTT_USER_PROPERTIES_MAX];
586
592#endif /* CONFIG_MQTT_VERSION_5_0 */
593};
594
597#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
598 /* MQTT 5.0 Disconnect reason code. */
600
602 struct {
604 struct mqtt_utf8_pair user_prop[CONFIG_MQTT_USER_PROPERTIES_MAX];
605
608
611
614
616 struct {
625 } rx;
627#endif /* CONFIG_MQTT_VERSION_5_0 */
628};
629
632#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
633 /* MQTT 5.0, chapter 3.15.2.1 Authenticate Reason Code */
635
636 struct {
638 struct mqtt_utf8_pair user_prop[CONFIG_MQTT_USER_PROPERTIES_MAX];
639
642
645
648
650 struct {
659 } rx;
661#endif /* CONFIG_MQTT_VERSION_5_0 */
662};
663
671
679
682
685
688
691
694
697
698#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
701
704#endif /* CONFIG_MQTT_VERSION_5_0 */
705};
706
708struct mqtt_evt {
711
714
719};
720
721struct mqtt_client;
722
731typedef void (*mqtt_evt_cb_t)(struct mqtt_client *client,
732 const struct mqtt_evt *evt);
733
738
741
745 const int *cipher_list;
746
749
752
753#if defined(CONFIG_MQTT_LIB_TLS_USE_ALPN)
758 const char **alpn_protocol_name_list;
759
763 uint32_t alpn_protocol_name_count;
764#endif
765
769 const char *hostname;
770
773};
774
779
780#if defined(CONFIG_MQTT_LIB_TLS)
782 MQTT_TRANSPORT_SECURE,
783#endif /* CONFIG_MQTT_LIB_TLS */
784
785#if defined(CONFIG_MQTT_LIB_WEBSOCKET)
787 MQTT_TRANSPORT_NON_SECURE_WEBSOCKET,
788#if defined(CONFIG_MQTT_LIB_TLS)
790 MQTT_TRANSPORT_SECURE_WEBSOCKET,
791#endif
792#endif /* CONFIG_MQTT_LIB_WEBSOCKET */
793#if defined(CONFIG_MQTT_LIB_CUSTOM_TRANSPORT)
795 MQTT_TRANSPORT_CUSTOM,
796#endif /* CONFIG_MQTT_LIB_CUSTOM_TRANSPORT */
797
803
811
813 union {
815 struct {
817 int sock;
819
820#if defined(CONFIG_MQTT_LIB_TLS)
822 struct {
824 int sock;
825
829 struct mqtt_sec_config config;
830 } tls;
831#endif /* CONFIG_MQTT_LIB_TLS */
832 };
833
834#if defined(CONFIG_MQTT_LIB_WEBSOCKET)
836 struct {
838 struct websocket_request config;
839
841 int sock;
842
844 int32_t timeout;
845 } websocket;
846#endif
847
848#if defined(CONFIG_MQTT_LIB_CUSTOM_TRANSPORT)
850 void *custom_transport_data;
851#endif /* CONFIG_MQTT_LIB_CUSTOM_TRANSPORT */
852
853#if defined(CONFIG_SOCKS)
854 struct {
855 struct sockaddr addr;
856 socklen_t addrlen;
857 } proxy;
858#endif
859};
860
865
870
873
876
879
880#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
882 struct mqtt_topic_alias topic_aliases[CONFIG_MQTT_TOPIC_ALIAS_MAX];
883
886#endif /* CONFIG_MQTT_VERSION_5_0 */
887};
888
896
899
902
906 const void *broker;
907
912
918
919#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
921 struct {
923 struct mqtt_utf8_pair user_prop[CONFIG_MQTT_USER_PROPERTIES_MAX];
924
926 struct mqtt_utf8 content_type;
927
929 struct mqtt_utf8 response_topic;
930
932 struct mqtt_binstr correlation_data;
933
936
939
943#endif /* CONFIG_MQTT_VERSION_5_0 */
944
947
952
956
959
962
965
968
973
976
979
980#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
982 struct {
984 struct mqtt_utf8_pair user_prop[CONFIG_MQTT_USER_PROPERTIES_MAX];
985
987 struct mqtt_utf8 auth_method;
988
990 struct mqtt_binstr auth_data;
991
994
997
1000
1003
1007#endif /* CONFIG_MQTT_VERSION_5_0 */
1008
1012
1017
1020};
1021
1031void mqtt_client_init(struct mqtt_client *client);
1032
1033#if defined(CONFIG_SOCKS)
1034/*
1035 * @brief Set proxy server details
1036 *
1037 * @param[in] client Client instance for which the procedure is requested,
1038 * Shall not be NULL.
1039 * @param[in] proxy_addr Proxy server address.
1040 * @param[in] addrlen Proxy server address length.
1041 *
1042 * @return 0 or a negative error code (errno.h) indicating reason of failure.
1043 *
1044 * @note Must be called before calling mqtt_connect().
1045 */
1046int mqtt_client_set_proxy(struct mqtt_client *client,
1047 struct sockaddr *proxy_addr,
1048 socklen_t addrlen);
1049#endif
1050
1069int mqtt_connect(struct mqtt_client *client);
1070
1081int mqtt_publish(struct mqtt_client *client,
1082 const struct mqtt_publish_param *param);
1083
1096 const struct mqtt_puback_param *param);
1097
1110 const struct mqtt_pubrec_param *param);
1111
1123 const struct mqtt_pubrel_param *param);
1124
1137 const struct mqtt_pubcomp_param *param);
1138
1148int mqtt_subscribe(struct mqtt_client *client,
1149 const struct mqtt_subscription_list *param);
1150
1164 const struct mqtt_subscription_list *param);
1165
1175int mqtt_ping(struct mqtt_client *client);
1176
1187int mqtt_disconnect(struct mqtt_client *client,
1188 const struct mqtt_disconnect_param *param);
1189
1190#if defined(CONFIG_MQTT_VERSION_5_0) || defined(__DOXYGEN__)
1201int mqtt_auth(struct mqtt_client *client, const struct mqtt_auth_param *param);
1202#endif /* CONFIG_MQTT_VERSION_5_0 */
1203
1214int mqtt_abort(struct mqtt_client *client);
1215
1230int mqtt_live(struct mqtt_client *client);
1231
1242int mqtt_keepalive_time_left(const struct mqtt_client *client);
1243
1259int mqtt_input(struct mqtt_client *client);
1260
1276int mqtt_read_publish_payload(struct mqtt_client *client, void *buffer,
1277 size_t length);
1278
1290int mqtt_read_publish_payload_blocking(struct mqtt_client *client, void *buffer,
1291 size_t length);
1292
1306 size_t length);
1307
1308#ifdef __cplusplus
1309}
1310#endif
1311
1312#endif /* ZEPHYR_INCLUDE_NET_MQTT_H_ */
1313
size_t socklen_t
Length of a socket address.
Definition net_ip.h:172
mqtt_evt_type
MQTT Asynchronous Events notified to the application from the module through the callback registered ...
Definition mqtt.h:42
int mqtt_read_publish_payload_blocking(struct mqtt_client *client, void *buffer, size_t length)
Blocking version of mqtt_read_publish_payload function.
int mqtt_disconnect(struct mqtt_client *client, const struct mqtt_disconnect_param *param)
API to disconnect MQTT connection.
int mqtt_publish_qos2_complete(struct mqtt_client *client, const struct mqtt_pubcomp_param *param)
API used by client to send acknowledgment on receiving QoS2 publish release message.
int mqtt_input(struct mqtt_client *client)
Receive an incoming MQTT packet.
int mqtt_readall_publish_payload(struct mqtt_client *client, uint8_t *buffer, size_t length)
Blocking version of mqtt_read_publish_payload function which runs until the required number of bytes ...
int mqtt_read_publish_payload(struct mqtt_client *client, void *buffer, size_t length)
Read the payload of the received PUBLISH message.
mqtt_qos
MQTT Quality of Service types.
Definition mqtt.h:97
int mqtt_subscribe(struct mqtt_client *client, const struct mqtt_subscription_list *param)
API to request subscription of one or more topics on the connection.
int mqtt_unsubscribe(struct mqtt_client *client, const struct mqtt_subscription_list *param)
API to request unsubscription of one or more topics on the connection.
int mqtt_publish(struct mqtt_client *client, const struct mqtt_publish_param *param)
API to publish messages on topics.
int mqtt_publish_qos2_release(struct mqtt_client *client, const struct mqtt_pubrel_param *param)
API used by client to request release of QoS2 publish message.
int mqtt_live(struct mqtt_client *client)
This API should be called periodically for the client to be able to keep the connection alive by send...
mqtt_version
MQTT version protocol level.
Definition mqtt.h:90
int mqtt_keepalive_time_left(const struct mqtt_client *client)
Helper function to determine when next keep alive message should be sent.
mqtt_conn_return_code
MQTT 3.1 CONNACK return codes.
Definition mqtt.h:116
mqtt_disconnect_reason_code
MQTT Disconnect reason codes (MQTT 5.0, chapter 3.14.2.1).
Definition mqtt.h:184
void(* mqtt_evt_cb_t)(struct mqtt_client *client, const struct mqtt_evt *evt)
Asynchronous event notification callback registered by the application.
Definition mqtt.h:731
mqtt_suback_return_code
MQTT SUBACK return codes.
Definition mqtt.h:169
int mqtt_publish_qos2_receive(struct mqtt_client *client, const struct mqtt_pubrec_param *param)
API used by client to send acknowledgment on receiving QoS2 publish message.
mqtt_auth_reason_code
MQTT Authenticate reason codes (MQTT 5.0, chapter 3.15.2.1).
Definition mqtt.h:217
void mqtt_client_init(struct mqtt_client *client)
Initializes the client instance.
int mqtt_ping(struct mqtt_client *client)
API to send MQTT ping.
int mqtt_auth(struct mqtt_client *client, const struct mqtt_auth_param *param)
API to send an authentication packet to the server.
int mqtt_connect(struct mqtt_client *client)
API to request new MQTT client connection.
mqtt_connack_reason_code
MQTT 5.0 CONNACK reason codes (MQTT 5.0, chapter 3.2.2.2).
Definition mqtt.h:143
int mqtt_publish_qos1_ack(struct mqtt_client *client, const struct mqtt_puback_param *param)
API used by client to send acknowledgment on receiving QoS1 publish message.
int mqtt_abort(struct mqtt_client *client)
API to abort MQTT connection.
mqtt_transport_type
MQTT transport type.
Definition mqtt.h:776
@ MQTT_EVT_PUBREC
Reception confirmation for published message with QoS 2.
Definition mqtt.h:66
@ MQTT_EVT_PUBACK
Acknowledgment for published message with QoS 1.
Definition mqtt.h:63
@ MQTT_EVT_AUTH
Authentication packet received from server.
Definition mqtt.h:85
@ MQTT_EVT_PINGRESP
Ping Response from server.
Definition mqtt.h:81
@ MQTT_EVT_SUBACK
Acknowledgment to a subscribe request.
Definition mqtt.h:75
@ MQTT_EVT_DISCONNECT
Disconnection Event.
Definition mqtt.h:51
@ MQTT_EVT_UNSUBACK
Acknowledgment to a unsubscribe request.
Definition mqtt.h:78
@ MQTT_EVT_PUBLISH
Publish event received when message is published on a topic client is subscribed to.
Definition mqtt.h:60
@ MQTT_EVT_PUBREL
Release of published message with QoS 2.
Definition mqtt.h:69
@ MQTT_EVT_CONNACK
Acknowledgment of connection request.
Definition mqtt.h:46
@ MQTT_EVT_PUBCOMP
Confirmation to a publish release message with QoS 2.
Definition mqtt.h:72
@ MQTT_QOS_0_AT_MOST_ONCE
Lowest Quality of Service, no acknowledgment needed for published message.
Definition mqtt.h:101
@ MQTT_QOS_1_AT_LEAST_ONCE
Medium Quality of Service, if acknowledgment expected for published message, duplicate messages permi...
Definition mqtt.h:106
@ MQTT_QOS_2_EXACTLY_ONCE
Highest Quality of Service, acknowledgment expected and message shall be published only once.
Definition mqtt.h:112
@ MQTT_VERSION_5_0
Protocol level for 5.0.
Definition mqtt.h:93
@ MQTT_VERSION_3_1_0
Protocol level for 3.1.0.
Definition mqtt.h:91
@ MQTT_VERSION_3_1_1
Protocol level for 3.1.1.
Definition mqtt.h:92
@ MQTT_CONNECTION_ACCEPTED
Connection accepted.
Definition mqtt.h:118
@ MQTT_NOT_AUTHORIZED
The Client is not authorized to connect.
Definition mqtt.h:139
@ MQTT_UNACCEPTABLE_PROTOCOL_VERSION
The Server does not support the level of the MQTT protocol requested by the Client.
Definition mqtt.h:123
@ MQTT_BAD_USER_NAME_OR_PASSWORD
The data in the user name or password is malformed.
Definition mqtt.h:136
@ MQTT_IDENTIFIER_REJECTED
The Client identifier is correct UTF-8 but not allowed by the Server.
Definition mqtt.h:128
@ MQTT_SERVER_UNAVAILABLE
The Network Connection has been made but the MQTT service is unavailable.
Definition mqtt.h:133
@ MQTT_DISCONNECT_TOPIC_NAME_INVALID
Definition mqtt.h:197
@ MQTT_DISCONNECT_SHARED_SUB_NOT_SUPPORTED
Definition mqtt.h:209
@ MQTT_DISCONNECT_SESSION_TAKE_OVER
Definition mqtt.h:195
@ MQTT_DISCONNECT_TOPIC_ALIAS_INVALID
Definition mqtt.h:199
@ MQTT_DISCONNECT_IMPL_SPECIFIC_ERROR
Definition mqtt.h:190
@ MQTT_DISCONNECT_USE_ANOTHER_SERVER
Definition mqtt.h:207
@ MQTT_DISCONNECT_PACKET_TOO_LARGE
Definition mqtt.h:200
@ MQTT_DISCONNECT_NOT_AUTHORIZED
Definition mqtt.h:191
@ MQTT_DISCONNECT_RECV_MAX_EXCEEDED
Definition mqtt.h:198
@ MQTT_DISCONNECT_SERVER_SHUTTING_DOWN
Definition mqtt.h:193
@ MQTT_DISCONNECT_QOS_NOT_SUPPORTED
Definition mqtt.h:206
@ MQTT_DISCONNECT_WILDCARD_SUB_NOT_SUPPORTED
Definition mqtt.h:213
@ MQTT_DISCONNECT_SUB_ID_NOT_SUPPORTED
Definition mqtt.h:212
@ MQTT_DISCONNECT_TOPIC_FILTER_INVALID
Definition mqtt.h:196
@ MQTT_DISCONNECT_PROTOCOL_ERROR
Definition mqtt.h:189
@ MQTT_DISCONNECT_CONNECTION_RATE_EXCEEDED
Definition mqtt.h:210
@ MQTT_DISCONNECT_MESSAGE_RATE_TOO_HIGH
Definition mqtt.h:201
@ MQTT_DISCONNECT_MALFORMED_PACKET
Definition mqtt.h:188
@ MQTT_DISCONNECT_NORMAL
Definition mqtt.h:185
@ MQTT_DISCONNECT_QUOTA_EXCEEDED
Definition mqtt.h:202
@ MQTT_DISCONNECT_ADMIN_ACTION
Definition mqtt.h:203
@ MQTT_DISCONNECT_RETAIN_NOT_SUPPORTED
Definition mqtt.h:205
@ MQTT_DISCONNECT_UNSPECIFIED_ERROR
Definition mqtt.h:187
@ MQTT_DISCONNECT_WITH_WILL_MSG
Definition mqtt.h:186
@ MQTT_DISCONNECT_SERVER_MOVED
Definition mqtt.h:208
@ MQTT_DISCONNECT_SERVER_BUSY
Definition mqtt.h:192
@ MQTT_DISCONNECT_KEEP_ALIVE_TIMEOUT
Definition mqtt.h:194
@ MQTT_DISCONNECT_MAX_CONNECT_TIME
Definition mqtt.h:211
@ MQTT_DISCONNECT_PAYLOAD_FORMAT_INVALID
Definition mqtt.h:204
@ MQTT_SUBACK_FAILURE
Subscription for a topic failed.
Definition mqtt.h:180
@ MQTT_SUBACK_SUCCESS_QoS_0
Subscription with QoS 0 succeeded.
Definition mqtt.h:171
@ MQTT_SUBACK_SUCCESS_QoS_2
Subscription with QoS 2 succeeded.
Definition mqtt.h:177
@ MQTT_SUBACK_SUCCESS_QoS_1
Subscription with QoS 1 succeeded.
Definition mqtt.h:174
@ MQTT_AUTH_RE_AUTHENTICATE
Definition mqtt.h:220
@ MQTT_AUTH_SUCCESS
Definition mqtt.h:218
@ MQTT_AUTH_CONTINUE_AUTHENTICATION
Definition mqtt.h:219
@ MQTT_CONNACK_MALFORMED_PACKET
Definition mqtt.h:146
@ MQTT_CONNACK_UNSPECIFIED_ERROR
Definition mqtt.h:145
@ MQTT_CONNACK_PROTOCOL_ERROR
Definition mqtt.h:147
@ MQTT_CONNACK_UNSUPPORTED_PROTO_ERROR
Definition mqtt.h:149
@ MQTT_CONNACK_SERVER_BUSY
Definition mqtt.h:154
@ MQTT_CONNACK_IMPL_SPECIFIC_ERROR
Definition mqtt.h:148
@ MQTT_CONNACK_BANNED
Definition mqtt.h:155
@ MQTT_CONNACK_TOPIC_NAME_INVALID
Definition mqtt.h:157
@ MQTT_CONNACK_QOS_NOT_SUPPORTED
Definition mqtt.h:162
@ MQTT_CONNACK_SERVER_UNAVAILABLE
Definition mqtt.h:153
@ MQTT_CONNACK_BAD_USERNAME_OR_PASS
Definition mqtt.h:151
@ MQTT_CONNACK_NOT_AUTHORIZED
Definition mqtt.h:152
@ MQTT_CONNACK_PAYLOAD_FORMAT_INVALID
Definition mqtt.h:160
@ MQTT_CONNACK_SERVER_MOVED
Definition mqtt.h:164
@ MQTT_CONNACK_PACKET_TOO_LARGE
Definition mqtt.h:158
@ MQTT_CONNACK_QUOTA_EXCEEDED
Definition mqtt.h:159
@ MQTT_CONNACK_RETAIN_NOT_SUPPORTED
Definition mqtt.h:161
@ MQTT_CONNACK_SUCCESS
Definition mqtt.h:144
@ MQTT_CONNACK_CONNECTION_RATE_EXCEEDED
Definition mqtt.h:165
@ MQTT_CONNACK_USE_ANOTHER_SERVER
Definition mqtt.h:163
@ MQTT_CONNACK_BAD_AUTH_METHOD
Definition mqtt.h:156
@ MQTT_CONNACK_CLIENT_ID_NOT_VALID
Definition mqtt.h:150
@ MQTT_TRANSPORT_NUM
Shall not be used as a transport type.
Definition mqtt.h:801
@ MQTT_TRANSPORT_NON_SECURE
Use non secure TCP transport for MQTT connection.
Definition mqtt.h:778
int sec_tag_t
Secure tag, a reference to TLS credential.
Definition tls_credentials.h:78
Public kernel APIs.
IPv6 and IPv4 definitions.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__INT32_TYPE__ int32_t
Definition stdint.h:74
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
__INT8_TYPE__ int8_t
Definition stdint.h:72
Parameters for auth message.
Definition mqtt.h:631
struct mqtt_utf8_pair user_prop[CONFIG_MQTT_USER_PROPERTIES_MAX]
MQTT 5.0, chapter 3.15.2.2.5 User Property.
Definition mqtt.h:638
bool has_auth_data
Authentication Data property was present.
Definition mqtt.h:654
struct mqtt_utf8 reason_string
MQTT 5.0, chapter 3.15.2.2.4 Reason String.
Definition mqtt.h:647
bool has_user_prop
User Property property was present.
Definition mqtt.h:658
struct mqtt_utf8 auth_method
MQTT 5.0, chapter 3.15.2.2.2 Authentication Method.
Definition mqtt.h:641
struct mqtt_auth_param::@398::@399 rx
Flags indicating whether given property was present in received packet.
bool has_auth_method
Authentication Method property was present.
Definition mqtt.h:652
bool has_reason_string
Reason String property was present.
Definition mqtt.h:656
struct mqtt_auth_param::@398 prop
struct mqtt_binstr auth_data
MQTT 5.0, chapter 3.15.2.2.3 Authentication Data.
Definition mqtt.h:644
enum mqtt_auth_reason_code reason_code
Definition mqtt.h:634
Abstracts binary strings.
Definition mqtt.h:242
uint8_t * data
Pointer to binary stream.
Definition mqtt.h:243
uint32_t len
Length of binary stream.
Definition mqtt.h:244
MQTT Client definition to maintain information relevant to the client.
Definition mqtt.h:893
bool request_problem_info
MQTT 5.0, chapter 3.1.2.11.7 Request Response Information.
Definition mqtt.h:1005
bool request_response_info
MQTT 5.0, chapter 3.1.2.11.6 Request Response Information.
Definition mqtt.h:1002
uint32_t session_expiry_interval
MQTT 5.0, chapter 3.1.2.11.2 Session Expiry Interval.
Definition mqtt.h:993
struct mqtt_client::@403 will_prop
MQTT 5.0 Will properties.
uint32_t will_delay_interval
MQTT 5.0, chapter 3.1.3.2.2 Will Delay Interval.
Definition mqtt.h:935
struct mqtt_client::@404 prop
MQTT 5.0 properties.
uint32_t maximum_packet_size
MQTT 5.0, chapter 3.1.2.11.4 Maximum Packet Size.
Definition mqtt.h:996
struct mqtt_internal internal
MQTT client internal state.
Definition mqtt.h:895
mqtt_evt_cb_t evt_cb
Application callback registered with the module to get MQTT events.
Definition mqtt.h:955
uint32_t message_expiry_interval
MQTT 5.0, chapter 3.1.3.2.4 Message Expiry Interval.
Definition mqtt.h:938
struct mqtt_topic * will_topic
Will topic and QoS.
Definition mqtt.h:946
uint32_t tx_buf_size
Size of transmit buffer.
Definition mqtt.h:967
uint8_t protocol_version
MQTT protocol version.
Definition mqtt.h:975
uint32_t rx_buf_size
Size of receive buffer.
Definition mqtt.h:961
uint16_t receive_maximum
MQTT 5.0, chapter 3.1.2.11.3 Receive Maximum.
Definition mqtt.h:999
int8_t unacked_ping
Unanswered PINGREQ count on this connection.
Definition mqtt.h:978
const void * broker
Broker details, for example, address, port.
Definition mqtt.h:906
struct mqtt_utf8 * will_message
Will message.
Definition mqtt.h:951
uint8_t * rx_buf
Receive buffer used for MQTT packet reception in RX path.
Definition mqtt.h:958
uint16_t keepalive
Keepalive interval for this client in seconds.
Definition mqtt.h:972
struct mqtt_utf8 client_id
Unique client identification to be used for the connection.
Definition mqtt.h:901
uint8_t clean_session
Clean session flag indicating a fresh (1) or a retained session (0).
Definition mqtt.h:1016
struct mqtt_utf8 * user_name
User name (if any) to be used for the connection.
Definition mqtt.h:911
uint8_t payload_format_indicator
MQTT 5.0, chapter 3.1.3.2.3 Payload Format Indicator.
Definition mqtt.h:941
struct mqtt_transport transport
MQTT transport configuration and data.
Definition mqtt.h:898
uint8_t will_retain
Will retain flag, 1 if will message shall be retained persistently.
Definition mqtt.h:1011
uint8_t * tx_buf
Transmit buffer used for creating MQTT packet in TX path.
Definition mqtt.h:964
struct mqtt_utf8 * password
Password (if any) to be used for the connection.
Definition mqtt.h:917
void * user_data
User specific opaque data.
Definition mqtt.h:1019
Common MQTT 5.0 properties shared across all ack-type messages.
Definition mqtt.h:394
struct mqtt_utf8 reason_string
MQTT 5.0, chapter 3.4.2.2.2 Reason String.
Definition mqtt.h:400
struct mqtt_common_ack_properties::@392 rx
Flags indicating whether given property was present in received packet.
bool has_user_prop
User Property property was present.
Definition mqtt.h:407
struct mqtt_utf8_pair user_prop[CONFIG_MQTT_USER_PROPERTIES_MAX]
MQTT 5.0, chapter 3.4.2.2.3 User Property.
Definition mqtt.h:397
bool has_reason_string
Reason String property was present.
Definition mqtt.h:405
Parameters for a connection acknowledgment (CONNACK).
Definition mqtt.h:285
struct mqtt_utf8 server_reference
MQTT 5.0, chapter 3.2.2.3.16 Server Reference.
Definition mqtt.h:314
uint16_t topic_alias_maximum
MQTT 5.0, chapter 3.2.2.3.8 Topic Alias Maximum.
Definition mqtt.h:332
struct mqtt_connack_param::@390 prop
bool has_server_keep_alive
Server Keep Alive property was present.
Definition mqtt.h:379
bool has_maximum_qos
Maximum QoS property was present.
Definition mqtt.h:359
bool has_response_information
Response Information property was present.
Definition mqtt.h:381
struct mqtt_utf8 response_information
MQTT 5.0, chapter 3.2.2.3.15 Response Information.
Definition mqtt.h:311
uint8_t wildcard_sub_available
MQTT 5.0, chapter 3.2.2.3.11 Wildcard Subscription Available.
Definition mqtt.h:344
bool has_receive_maximum
Receive Maximum property was present.
Definition mqtt.h:357
struct mqtt_utf8_pair user_prop[CONFIG_MQTT_USER_PROPERTIES_MAX]
MQTT 5.0, chapter 3.2.2.3.10 User Property.
Definition mqtt.h:302
bool has_server_reference
Server Reference property was present.
Definition mqtt.h:383
uint8_t shared_sub_available
MQTT 5.0, chapter 3.2.2.3.13 Shared Subscription Available.
Definition mqtt.h:350
bool has_wildcard_sub_available
Wildcard Subscription Available property was present.
Definition mqtt.h:373
bool has_subscription_ids_available
Subscription Identifiers Available property was present.
Definition mqtt.h:375
bool has_user_prop
User Property property was present.
Definition mqtt.h:371
bool has_reason_string
Reason String property was present.
Definition mqtt.h:369
struct mqtt_connack_param::@390::@391 rx
Flags indicating whether given property was present in received packet.
struct mqtt_utf8 reason_string
MQTT 5.0, chapter 3.2.2.3.9 Reason String.
Definition mqtt.h:308
bool has_auth_data
Authentication Data property was present.
Definition mqtt.h:387
bool has_auth_method
Authentication Method property was present.
Definition mqtt.h:385
bool has_shared_sub_available
Shared Subscription Available property was present.
Definition mqtt.h:377
bool has_retain_available
Retain Available property was present.
Definition mqtt.h:361
uint32_t session_expiry_interval
MQTT 5.0, chapter 3.2.2.3.2 Session Expiry Interval.
Definition mqtt.h:323
struct mqtt_utf8 assigned_client_id
MQTT 5.0, chapter 3.2.2.3.7 Assigned Client Identifier.
Definition mqtt.h:305
bool has_maximum_packet_size
Maximum Packet Size property was present.
Definition mqtt.h:363
uint32_t maximum_packet_size
MQTT 5.0, chapter 3.2.2.3.6 Maximum Packet Size.
Definition mqtt.h:326
uint8_t maximum_qos
MQTT 5.0, chapter 3.2.2.3.4 Maximum QoS.
Definition mqtt.h:338
uint16_t receive_maximum
MQTT 5.0, chapter 3.3.2.3.3 Receive Maximum.
Definition mqtt.h:329
uint8_t return_code
The appropriate non-zero Connect return code indicates if the Server is unable to process a connectio...
Definition mqtt.h:297
uint8_t session_present_flag
The Session Present flag enables a Client to establish whether the Client and Server have a consisten...
Definition mqtt.h:290
struct mqtt_utf8 auth_method
MQTT 5.0, chapter 3.2.2.3.17 Authentication Method.
Definition mqtt.h:317
uint8_t subscription_ids_available
MQTT 5.0, chapter 3.2.2.3.12 Subscription Identifiers Available.
Definition mqtt.h:347
bool has_topic_alias_maximum
Topic Alias Maximum property was present.
Definition mqtt.h:367
struct mqtt_binstr auth_data
MQTT 5.0, chapter 3.2.2.3.18 Authentication Data.
Definition mqtt.h:320
bool has_session_expiry_interval
Session Expiry Interval property was present.
Definition mqtt.h:355
uint8_t retain_available
MQTT 5.0, chapter 3.2.2.3.5 Retain Available.
Definition mqtt.h:341
uint16_t server_keep_alive
MQTT 5.0, chapter 3.2.2.3.14 Server Keep Alive.
Definition mqtt.h:335
bool has_assigned_client_id
Assigned Client Identifier property was present.
Definition mqtt.h:365
Parameters for disconnect message.
Definition mqtt.h:596
bool has_user_prop
User Property property was present.
Definition mqtt.h:622
struct mqtt_utf8_pair user_prop[CONFIG_MQTT_USER_PROPERTIES_MAX]
MQTT 5.0, chapter 3.14.2.2.4 User Property.
Definition mqtt.h:604
bool has_session_expiry_interval
Session Expiry Interval property was present.
Definition mqtt.h:618
struct mqtt_disconnect_param::@396::@397 rx
Flags indicating whether given property was present in received packet.
struct mqtt_disconnect_param::@396 prop
MQTT 5.0 properties.
struct mqtt_utf8 reason_string
MQTT 5.0, chapter 3.14.2.2.3 Reason String.
Definition mqtt.h:607
bool has_server_reference
Server Reference property was present.
Definition mqtt.h:624
uint32_t session_expiry_interval
MQTT 5.0, chapter 3.14.2.2.2 Session Expiry Interval.
Definition mqtt.h:613
enum mqtt_disconnect_reason_code reason_code
Definition mqtt.h:599
struct mqtt_utf8 server_reference
MQTT 5.0, chapter 3.14.2.2.5 Server Reference.
Definition mqtt.h:610
bool has_reason_string
Reason String property was present.
Definition mqtt.h:620
Defines MQTT asynchronous event notified to the application.
Definition mqtt.h:708
enum mqtt_evt_type type
Identifies the event.
Definition mqtt.h:710
int result
Event result.
Definition mqtt.h:718
union mqtt_evt_param param
Contains parameters (if any) accompanying the event.
Definition mqtt.h:713
MQTT internal state.
Definition mqtt.h:862
uint32_t rx_buf_datalen
Internal.
Definition mqtt.h:875
struct mqtt_topic_alias topic_aliases[CONFIG_MQTT_TOPIC_ALIAS_MAX]
Internal.
Definition mqtt.h:882
uint32_t last_activity
Internal.
Definition mqtt.h:869
uint32_t remaining_payload
Internal.
Definition mqtt.h:878
uint32_t state
Internal.
Definition mqtt.h:872
enum mqtt_disconnect_reason_code disconnect_reason
Internal.
Definition mqtt.h:885
struct sys_mutex mutex
Internal.
Definition mqtt.h:864
Parameters for MQTT publish acknowledgment (PUBACK).
Definition mqtt.h:413
uint8_t reason_code
MQTT 5.0 reason code.
Definition mqtt.h:419
struct mqtt_common_ack_properties prop
MQTT 5.0 properties.
Definition mqtt.h:422
uint16_t message_id
Message id of the PUBLISH message being acknowledged.
Definition mqtt.h:415
Parameters for MQTT publish complete (PUBCOMP).
Definition mqtt.h:455
struct mqtt_common_ack_properties prop
MQTT 5.0 properties.
Definition mqtt.h:464
uint8_t reason_code
MQTT 5.0 reason code.
Definition mqtt.h:461
uint16_t message_id
Message id of the PUBREL message being acknowledged.
Definition mqtt.h:457
Parameters for a publish message.
Definition mqtt.h:279
struct mqtt_binstr payload
Payload on the topic published.
Definition mqtt.h:281
struct mqtt_topic topic
Topic on which data was published.
Definition mqtt.h:280
Parameters for a publish message (PUBLISH).
Definition mqtt.h:501
bool has_content_type
Content Type property was present.
Definition mqtt.h:564
uint16_t topic_alias
MQTT 5.0, chapter 3.3.2.3.4 Topic Alias.
Definition mqtt.h:542
uint8_t dup_flag
Duplicate flag.
Definition mqtt.h:513
bool has_topic_alias
Topic Alias property was present.
Definition mqtt.h:554
bool has_payload_format_indicator
Payload Format Indicator property was present.
Definition mqtt.h:550
uint32_t message_expiry_interval
MQTT 5.0, chapter 3.3.2.3.3 Message Expiry Interval.
Definition mqtt.h:539
bool has_correlation_data
Correlation Data property was present.
Definition mqtt.h:558
bool has_user_prop
User Property property was present.
Definition mqtt.h:560
bool has_message_expiry_interval
Message Expiry Interval property was present.
Definition mqtt.h:552
uint8_t payload_format_indicator
MQTT 5.0, chapter 3.3.2.3.2 Payload Format Indicator.
Definition mqtt.h:545
struct mqtt_publish_message message
Messages including topic, QoS and its payload (if any) to be published.
Definition mqtt.h:505
uint8_t retain_flag
Retain flag.
Definition mqtt.h:518
struct mqtt_publish_param::@393 prop
MQTT 5.0 properties.
bool has_subscription_identifier
Subscription Identifier property was present.
Definition mqtt.h:562
uint16_t message_id
Message id used for the publish message.
Definition mqtt.h:508
bool has_response_topic
Response Topic property was present.
Definition mqtt.h:556
Parameters for MQTT publish receive (PUBREC).
Definition mqtt.h:427
uint8_t reason_code
MQTT 5.0 reason code.
Definition mqtt.h:433
uint16_t message_id
Message id of the PUBLISH message being acknowledged.
Definition mqtt.h:429
struct mqtt_common_ack_properties prop
MQTT 5.0 properties.
Definition mqtt.h:436
Parameters for MQTT publish release (PUBREL).
Definition mqtt.h:441
uint16_t message_id
Message id of the PUBREC message being acknowledged.
Definition mqtt.h:443
struct mqtt_common_ack_properties prop
MQTT 5.0 properties.
Definition mqtt.h:450
uint8_t reason_code
MQTT 5.0 reason code.
Definition mqtt.h:447
TLS configuration for secure MQTT transports.
Definition mqtt.h:735
int peer_verify
Indicates the preference for peer verification.
Definition mqtt.h:737
const int * cipher_list
Indicates the list of ciphers to be used for the session.
Definition mqtt.h:745
uint32_t cipher_count
Indicates the number of entries in the cipher list.
Definition mqtt.h:740
int cert_nocopy
Indicates the preference for copying certificates to the heap.
Definition mqtt.h:772
uint32_t sec_tag_count
Indicates the number of entries in the sec tag list.
Definition mqtt.h:748
const sec_tag_t * sec_tag_list
Indicates the list of security tags to be used for the session.
Definition mqtt.h:751
const char * hostname
Peer hostname for ceritificate verification.
Definition mqtt.h:769
Parameters for MQTT subscription acknowledgment (SUBACK).
Definition mqtt.h:469
struct mqtt_common_ack_properties prop
MQTT 5.0 properties.
Definition mqtt.h:482
struct mqtt_binstr return_codes
MQTT 3.1 - Return codes indicating maximum QoS level granted for each topic in the subscription list.
Definition mqtt.h:478
uint16_t message_id
Message id of the SUBSCRIBE message being acknowledged.
Definition mqtt.h:471
Parameters for subscribe/unsubscribe message.
Definition mqtt.h:571
uint16_t message_id
Message id used to identify subscription request.
Definition mqtt.h:579
uint32_t subscription_identifier
MQTT 5.0, chapter 3.8.2.1.2 Subscription Identifier.
Definition mqtt.h:590
uint16_t list_count
Number of topics in the subscription list.
Definition mqtt.h:576
struct mqtt_subscription_list::@395 prop
MQTT 5.0 properties.
struct mqtt_topic * list
Array containing topics along with QoS for each.
Definition mqtt.h:573
Abstracts aliased topic.
Definition mqtt.h:248
uint16_t topic_size
Topic name size.
Definition mqtt.h:254
uint8_t topic_buf[CONFIG_MQTT_TOPIC_ALIAS_STRING_MAX]
UTF-8 encoded topic name.
Definition mqtt.h:251
Abstracts MQTT UTF-8 encoded topic that can be subscribed to or published.
Definition mqtt.h:261
uint8_t qos
Quality of service requested for the subscription.
Definition mqtt.h:268
struct mqtt_utf8 topic
Topic on to be published or subscribed to.
Definition mqtt.h:263
MQTT transport specific data.
Definition mqtt.h:805
int sock
Socket descriptor.
Definition mqtt.h:817
enum mqtt_transport_type type
Transport type selection for client instance.
Definition mqtt.h:810
struct mqtt_transport::@400::@402 tcp
TCP socket transport for MQTT.
Parameters for MQTT unsubscribe acknowledgment (UNSUBACK).
Definition mqtt.h:487
struct mqtt_common_ack_properties prop
MQTT 5.0 properties.
Definition mqtt.h:496
struct mqtt_binstr reason_codes
Reason codes corresponding to each topic in the unsubscription list.
Definition mqtt.h:493
uint16_t message_id
Message id of the UNSUBSCRIBE message being acknowledged.
Definition mqtt.h:489
Abstracts MQTT UTF-8 encoded string pair.
Definition mqtt.h:273
struct mqtt_utf8 value
Definition mqtt.h:275
struct mqtt_utf8 name
Definition mqtt.h:274
Abstracts UTF-8 encoded strings.
Definition mqtt.h:224
uint32_t size
Size of UTF string, in bytes.
Definition mqtt.h:226
const uint8_t * utf8
Pointer to UTF-8 string.
Definition mqtt.h:225
Generic sockaddr struct.
Definition net_ip.h:408
Definition mutex.h:28
Websocket client connection request.
Definition websocket.h:70
TLS credentials management.
Defines event parameters notified along with asynchronous events to the application.
Definition mqtt.h:668
struct mqtt_pubrel_param pubrel
Parameters accompanying MQTT_EVT_PUBREL event.
Definition mqtt.h:687
struct mqtt_puback_param puback
Parameters accompanying MQTT_EVT_PUBACK event.
Definition mqtt.h:681
struct mqtt_pubrec_param pubrec
Parameters accompanying MQTT_EVT_PUBREC event.
Definition mqtt.h:684
struct mqtt_publish_param publish
Parameters accompanying MQTT_EVT_PUBLISH event.
Definition mqtt.h:678
struct mqtt_disconnect_param disconnect
Parameters accompanying MQTT_EVT_DISCONNECT event.
Definition mqtt.h:700
struct mqtt_connack_param connack
Parameters accompanying MQTT_EVT_CONNACK event.
Definition mqtt.h:670
struct mqtt_pubcomp_param pubcomp
Parameters accompanying MQTT_EVT_PUBCOMP event.
Definition mqtt.h:690
struct mqtt_unsuback_param unsuback
Parameters accompanying MQTT_EVT_UNSUBACK event.
Definition mqtt.h:696
struct mqtt_auth_param auth
Parameters accompanying MQTT_EVT_AUTH event.
Definition mqtt.h:703
struct mqtt_suback_param suback
Parameters accompanying MQTT_EVT_SUBACK event.
Definition mqtt.h:693
Websocket API.