22#ifndef ZEPHYR_INCLUDE_NET_MQTT_H_
23#define ZEPHYR_INCLUDE_NET_MQTT_H_
166#define MQTT_UTF8_LITERAL(literal) \
167 ((struct mqtt_utf8) {literal, sizeof(literal) - 1})
364#if defined(CONFIG_MQTT_LIB_TLS)
366 MQTT_TRANSPORT_SECURE,
369#if defined(CONFIG_MQTT_LIB_WEBSOCKET)
371 MQTT_TRANSPORT_NON_SECURE_WEBSOCKET,
372#if defined(CONFIG_MQTT_LIB_TLS)
374 MQTT_TRANSPORT_SECURE_WEBSOCKET,
377#if defined(CONFIG_MQTT_LIB_CUSTOM_TRANSPORT)
379 MQTT_TRANSPORT_CUSTOM,
403#if defined(CONFIG_MQTT_LIB_TLS)
417#if defined(CONFIG_MQTT_LIB_WEBSOCKET)
431#if defined(CONFIG_MQTT_LIB_CUSTOM_TRANSPORT)
433 void *custom_transport_data;
436#if defined(CONFIG_SOCKS)
550#if defined(CONFIG_SOCKS)
ZTEST_BMEM int timeout
Definition: main.c:31
void
Definition: eswifi_shell.c:15
size_t socklen_t
Definition: net_ip.h:161
static ZTEST_BMEM char buffer[8]
Test mailbox enhance capabilities.
Definition: test_mbox_api.c:566
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_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. The registered callback will be called with the packet content.
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. This function should be called within the MQTT even...
mqtt_qos
MQTT Quality of Service types.
Definition: mqtt.h:91
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. Should be called on reception of MQTT_...
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:85
int mqtt_keepalive_time_left(const struct mqtt_client *client)
Helper function to determine when next keep alive message should be sent. Can be used for instance as...
mqtt_conn_return_code
MQTT CONNACK return codes.
Definition: mqtt.h:110
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:331
mqtt_suback_return_code
MQTT SUBACK return codes.
Definition: mqtt.h:137
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. Should be called on rece...
void mqtt_client_init(struct mqtt_client *client)
Initializes the client instance.
int mqtt_ping(struct mqtt_client *client)
API to send MQTT ping. The use of this API is optional, as the library handles the connection keep-al...
int mqtt_disconnect(struct mqtt_client *client)
API to disconnect MQTT connection.
int mqtt_connect(struct mqtt_client *client)
API to request new MQTT client connection.
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. Should be called on rece...
int mqtt_abort(struct mqtt_client *client)
API to abort MQTT connection. This will close the corresponding transport without closing the connect...
mqtt_transport_type
MQTT transport type.
Definition: mqtt.h:360
@ MQTT_EVT_PUBREC
Definition: mqtt.h:66
@ MQTT_EVT_PUBACK
Definition: mqtt.h:63
@ MQTT_EVT_PINGRESP
Definition: mqtt.h:81
@ MQTT_EVT_SUBACK
Definition: mqtt.h:75
@ MQTT_EVT_DISCONNECT
Definition: mqtt.h:51
@ MQTT_EVT_UNSUBACK
Definition: mqtt.h:78
@ MQTT_EVT_PUBLISH
Definition: mqtt.h:60
@ MQTT_EVT_PUBREL
Definition: mqtt.h:69
@ MQTT_EVT_CONNACK
Definition: mqtt.h:46
@ MQTT_EVT_PUBCOMP
Definition: mqtt.h:72
@ MQTT_QOS_0_AT_MOST_ONCE
Definition: mqtt.h:95
@ MQTT_QOS_1_AT_LEAST_ONCE
Definition: mqtt.h:100
@ MQTT_QOS_2_EXACTLY_ONCE
Definition: mqtt.h:106
@ MQTT_VERSION_3_1_0
Definition: mqtt.h:86
@ MQTT_VERSION_3_1_1
Definition: mqtt.h:87
@ MQTT_CONNECTION_ACCEPTED
Definition: mqtt.h:112
@ MQTT_NOT_AUTHORIZED
Definition: mqtt.h:133
@ MQTT_UNACCEPTABLE_PROTOCOL_VERSION
Definition: mqtt.h:117
@ MQTT_BAD_USER_NAME_OR_PASSWORD
Definition: mqtt.h:130
@ MQTT_IDENTIFIER_REJECTED
Definition: mqtt.h:122
@ MQTT_SERVER_UNAVAILABLE
Definition: mqtt.h:127
@ MQTT_SUBACK_FAILURE
Definition: mqtt.h:148
@ MQTT_SUBACK_SUCCESS_QoS_0
Definition: mqtt.h:139
@ MQTT_SUBACK_SUCCESS_QoS_2
Definition: mqtt.h:145
@ MQTT_SUBACK_SUCCESS_QoS_1
Definition: mqtt.h:142
@ MQTT_TRANSPORT_NUM
Definition: mqtt.h:385
@ MQTT_TRANSPORT_NON_SECURE
Definition: mqtt.h:362
int sec_tag_t
Definition: tls_credentials.h:70
struct k_thread client
Definition: main.c:31
IPv6 and IPv4 definitions.
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__INT32_TYPE__ int32_t
Definition: stdint.h:44
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59
__INT8_TYPE__ int8_t
Definition: stdint.h:42
Abstracts binary strings.
Definition: mqtt.h:170
uint8_t * data
Definition: mqtt.h:171
uint32_t len
Definition: mqtt.h:172
MQTT Client definition to maintain information relevant to the client.
Definition: mqtt.h:468
struct mqtt_internal internal
Definition: mqtt.h:470
mqtt_evt_cb_t evt_cb
Definition: mqtt.h:504
struct mqtt_topic * will_topic
Definition: mqtt.h:495
uint32_t tx_buf_size
Definition: mqtt.h:516
uint8_t protocol_version
Definition: mqtt.h:524
uint32_t rx_buf_size
Definition: mqtt.h:510
int8_t unacked_ping
Definition: mqtt.h:527
const void * broker
Definition: mqtt.h:481
struct mqtt_utf8 * will_message
Definition: mqtt.h:500
uint8_t * rx_buf
Definition: mqtt.h:507
uint16_t keepalive
Definition: mqtt.h:521
struct mqtt_utf8 client_id
Definition: mqtt.h:476
uint8_t clean_session
Definition: mqtt.h:536
struct mqtt_utf8 * user_name
Definition: mqtt.h:486
struct mqtt_transport transport
Definition: mqtt.h:473
uint8_t will_retain
Definition: mqtt.h:531
uint8_t * tx_buf
Definition: mqtt.h:513
struct mqtt_utf8 * password
Definition: mqtt.h:492
Parameters for a connection acknowledgment (CONNACK).
Definition: mqtt.h:195
enum mqtt_conn_return_code return_code
Definition: mqtt.h:205
uint8_t session_present_flag
Definition: mqtt.h:200
Defines MQTT asynchronous event notified to the application.
Definition: mqtt.h:308
enum mqtt_evt_type type
Definition: mqtt.h:310
int result
Definition: mqtt.h:318
union mqtt_evt_param param
Definition: mqtt.h:313
MQTT internal state.
Definition: mqtt.h:445
uint32_t rx_buf_datalen
Definition: mqtt.h:458
uint32_t last_activity
Definition: mqtt.h:452
uint32_t remaining_payload
Definition: mqtt.h:461
uint32_t state
Definition: mqtt.h:455
struct sys_mutex mutex
Definition: mqtt.h:447
Parameters for MQTT publish acknowledgment (PUBACK).
Definition: mqtt.h:209
uint16_t message_id
Definition: mqtt.h:210
Parameters for MQTT publish complete (PUBCOMP).
Definition: mqtt.h:224
uint16_t message_id
Definition: mqtt.h:225
Parameters for a publish message.
Definition: mqtt.h:189
struct mqtt_binstr payload
Definition: mqtt.h:191
struct mqtt_topic topic
Definition: mqtt.h:190
Parameters for a publish message.
Definition: mqtt.h:240
uint8_t dup_flag
Definition: mqtt.h:252
struct mqtt_publish_message message
Definition: mqtt.h:244
uint8_t retain_flag
Definition: mqtt.h:257
uint16_t message_id
Definition: mqtt.h:247
Parameters for MQTT publish receive (PUBREC).
Definition: mqtt.h:214
uint16_t message_id
Definition: mqtt.h:215
Parameters for MQTT publish release (PUBREL).
Definition: mqtt.h:219
uint16_t message_id
Definition: mqtt.h:220
TLS configuration for secure MQTT transports.
Definition: mqtt.h:335
int * cipher_list
Definition: mqtt.h:345
int peer_verify
Definition: mqtt.h:337
uint32_t cipher_count
Definition: mqtt.h:340
uint32_t sec_tag_count
Definition: mqtt.h:348
sec_tag_t * sec_tag_list
Definition: mqtt.h:351
const char * hostname
Definition: mqtt.h:356
Parameters for MQTT subscription acknowledgment (SUBACK).
Definition: mqtt.h:229
struct mqtt_binstr return_codes
Definition: mqtt.h:231
uint16_t message_id
Definition: mqtt.h:230
List of topics in a subscription request.
Definition: mqtt.h:261
uint16_t message_id
Definition: mqtt.h:269
uint16_t list_count
Definition: mqtt.h:266
struct mqtt_topic * list
Definition: mqtt.h:263
Abstracts MQTT UTF-8 encoded topic that can be subscribed to or published.
Definition: mqtt.h:178
uint8_t qos
Definition: mqtt.h:185
struct mqtt_utf8 topic
Definition: mqtt.h:180
MQTT transport specific data.
Definition: mqtt.h:389
int sock
Definition: mqtt.h:400
enum mqtt_transport_type type
Definition: mqtt.h:394
struct mqtt_transport::@158::@160 tcp
Parameters for MQTT unsubscribe acknowledgment (UNSUBACK).
Definition: mqtt.h:235
uint16_t message_id
Definition: mqtt.h:236
Abstracts UTF-8 encoded strings.
Definition: mqtt.h:152
uint32_t size
Definition: mqtt.h:154
const uint8_t * utf8
Definition: mqtt.h:153
Definition: websocket.h:67
TLS credentials management.
Defines event parameters notified along with asynchronous events to the application.
Definition: mqtt.h:276
struct mqtt_pubrel_param pubrel
Definition: mqtt.h:295
struct mqtt_puback_param puback
Definition: mqtt.h:289
struct mqtt_pubrec_param pubrec
Definition: mqtt.h:292
struct mqtt_publish_param publish
Definition: mqtt.h:286
struct mqtt_connack_param connack
Definition: mqtt.h:278
struct mqtt_pubcomp_param pubcomp
Definition: mqtt.h:298
struct mqtt_unsuback_param unsuback
Definition: mqtt.h:304
struct mqtt_suback_param suback
Definition: mqtt.h:301