76 Commits

Author SHA1 Message Date
dhb
00cc9dbd9a feat(mqtt): enable custom TLS cipher suites for MQTTs
- Add `ciphersuites_list` to `esp_mqtt_client_config_t` for specifying TLS cipher suites.
- Update SSL transport configuration to use the provided cipher suites.
- Users are responsible for managing the cipher suites list memory.
2025-05-21 10:05:00 +02:00
b35a69121c feat(mqtt): Add support for ECDSA signing
Added support for ECDSA signing in MQTT.
2025-05-14 12:14:43 +05:30
c395c2f0f3 fix: Change error message to fix warning.
This fixes an error on gen_esp_err_to_name.py. The message wasn't adding
information to the user so removal of ESP_OK text is the simpler fix.
2025-04-08 14:36:09 +02:00
470cb93049 mqtt_client: Manage disconnect packet
In the mqtt5 protocol the broker can disconnect the client with
a disconnect packet. This packet contains a reason value that can be
useful for certain applications in which it is important to know
the reason of disconnection.
While the client is connected is possible that a disconnect packet
is reaceived by the broker to force a disconnection. Before this
patch this approach causes a generic error on transport in case of
disconnection from the broker. If the packet is managed before getting
an error it is possible to save the reason code in the
disconnect_return_code variable in the error_handle, and dispatch
the disconnect event that can be managed by the application event
loop, that now can know the reason of disconnection from the broker.
Reset the variable in case of error.

Signed-off-by: Flavia Caforio <flavia.caforio@amarulasolutions.com>
2025-02-18 16:24:13 +01:00
7c3227a24d feat: Add TCP keepalive configuration 2024-08-22 11:18:43 +02:00
891380bdf5 feat: Make state and size atomic
This makes the mqtt client state atomic to reduce the scope of locking in
some parts of the code.
2024-03-12 08:49:36 +01:00
ea0df31e00 fix: Move buffer initialization to set config
When calling set config message buffers were not affected because the
creation was handled on init.

Closes https://github.com/espressif/esp-mqtt/issues/267
2023-10-25 07:47:05 +00:00
a3b04f2d0a fix: LOG format strings
Fix log format strings and remove no-format warning configuration.
2023-06-30 10:17:32 +02:00
363fbf7dab feat: Add option to bind interface of use
Enable user to set which interface should be used for client network,
allowing client to be binded to the interface selected by user forcing
it to go through the selected interface.

Closes https://github.com/espressif/esp-mqtt/issues/253
2023-06-14 14:48:44 +02:00
372ab7b374 feat: Introduces outbox limit
A memory limit for the outbox can be configured.
User will not be able to publish or enqueue if the new message goes
beyond the configured limit.
2023-06-13 15:59:55 +02:00
21a5491d53 Removes unused outbox functions. 2023-06-13 11:56:11 +02:00
122875bf8a refactor: Group access to output buffer in mqtt_connection_t
- Moves mqtt_connect_info to mqtt_connection_t.
  - Removes outbound_message in favor of accessing it trough connection.
2023-06-13 11:56:05 +02:00
ed628098a1 Merge branch 'feature/custom_transport' into 'master'
Add custom transport configuration

See merge request espressif/esp-mqtt!169
2023-06-13 14:30:24 +08:00
a492935951 Removes leftover calls to event_handler
The possibility to add a callback as custom handler was removed from
the client in favor of esp_event. These removes the older alternative
that wasn't possible to use.
2023-06-09 10:44:50 +02:00
6195762d28 Added support to set server common name. 2023-06-08 08:46:41 +02:00
a5c1b441dc feat: Add custom transport configuration
Today there is no way to add a new transport without applying
modifications to the transport list. This impose limitations on the
client usage. Adding the custom configuration we enable user defined
transports.
2023-06-08 06:38:53 +00:00
da6d38a17e Removes pending message count
The information was used only to log remaining messages on debug log.
It was checked on writing but updated prior to every call making the
verification meaningless.
2023-04-21 08:40:12 +02:00
2c71f9e69b feat: Adds a configuration for outbox data destination
Allow user to move outbox data to external SPI RAM.
2023-04-12 08:43:40 +00:00
32102558d3 Feature: Enable SUBSCRIBE to multiple topics
- Adds an api for multiple topics on SUBSCRIBE message.

Apply 2 suggestion(s) to 1 file(s)

Removing headers

y
2023-02-03 14:19:24 +01:00
2fa945d0b8 Adds Kconfig option to configure poll read timeout
A new Kconfig option was added to allow users to configure poll read
timeout.

Closes: https://github.com/espressif/esp-mqtt/issues/245
2023-02-02 20:52:02 +08:00
ed76036744 mqtt5: Fix flow control will regard the DUP packet and not consider PUBCOMP packet
Closes https://github.com/espressif/esp-mqtt/issues/243
2023-01-18 14:16:28 +08:00
fb42588a03 Fix the default configuration for event queue
- Event queue should be disabled, making it an opt-in feature.
2022-11-23 20:40:31 +08:00
97503cceb3 client: Add support for user events
Also supporting configurable queue size for the internal event loop.

Closes https://github.com/espressif/esp-mqtt/issues/230
2022-07-29 09:08:52 +02:00
ae53d799da Restructure the client configuration struct
- Groups configuration fields by context.
- Removes user_context in favor of the event loop.
2022-07-13 08:37:20 -03:00
89e5c6014f fix: MQTT tick not starting on connect and switch to esp_timer
- Tick should be updated on connect
- Dependency of system timer removed to avoid issues when updating via
  SNTP

Closes https://github.com/espressif/esp-mqtt/issues/225
2022-06-23 12:43:58 -03:00
fdf2aeb36f Seperate MQTT5 from MQTT 3.1.1 2022-06-14 09:37:46 +00:00
3d275f42b9 mqtt: Support MQTT5 protocol 2022-06-14 09:37:46 +00:00
f6caaff254 Fix WSS default port selection through menuconfig.
Evaluate the correct define to select default port.

 - Closes https://github.com/espressif/esp-mqtt/issues/223
2022-05-17 07:16:07 +00:00
2c2e6f38b5 Changes the moment we update keepalive_tick.
In order to keep sending keep alive messages in the scenario were client
publish too often with QoS0 the keepalive is updated when the response
is received.
2022-04-07 09:14:03 -03:00
df8dc92870 Client: Fix use esp_mqtt_client_enqueue API to send data, data dup flag will be set 1 2021-11-26 15:52:04 +08:00
de47f1c341 add payload to MQTT_EVENT_SUBSCRIBE
+ documentation
+ cleanup logging

Closes https://github.com/espressif/esp-mqtt/issues/200
Merges https://github.com/espressif/esp-mqtt/pull/203
2021-10-04 10:38:02 +02:00
ebef896b00 Removes unnecessary outbox_cleanup
The states that were cleaned by this function, CONFIRMED, are no longer reachable.
Itens were marked with this status previously in PUBCOMP and PUBREL
receive handlers.
2021-07-01 14:40:45 +01:00
1a94efe8b9 outbox: Cleanup all items when connection closes 2021-06-24 06:31:29 +02:00
eec6f0e17d Removes unused defines.
- mqtt_config.h had some defines that were not used. This removes them.

Closes https://github.com/espressif/esp-mqtt/issues/194
2021-05-31 13:29:25 +01:00
1db731f985 Merge branch 'feature/mqtt_unit_test_cleanup' into 'master'
Reduce the includes used in files.

See merge request espressif/esp-mqtt!93
2021-04-07 11:37:00 +00:00
87fcce72c9 Reduce the includes used in all files.
- To reduce the dependencies to the minimal the number of includes was
  reduced.
2021-04-07 10:49:49 +01:00
169b6986eb platform: Remove __FILE__ macro from error logs 2021-02-22 18:11:41 +01:00
0213382593 mqtt: Moves mqtt_supported_features to public includes.
- To simplify user code to support multiple IDF versions.

Closes https://github.com/espressif/esp-mqtt/issues/184
2021-01-21 09:49:24 +00:00
e2de0f3e3e Publish: Allow for qos=0 messages to be stored using esp_mqtt_client_enqueue()
The API presents a boolean parameter to control storing the qos=0
messages into the internal outbox
2020-12-15 19:43:33 +01:00
2e35d4d4d5 Events: Add new event to report deleted messages from outbox 2020-12-09 10:14:54 +01:00
f44dcb1c26 Config: Add a new option to disable publishing when disconnected
Related https://github.com/espressif/esp-mqtt/pull/177
2020-12-09 10:14:54 +01:00
8bb4a26f46 Config: Add a new option to use incremental message id
This option is off by default, so the client still uses
random message id unless CONFIG_MQTT_MSG_ID_INCREMENTAL is set

Closes https://github.com/espressif/esp-mqtt/issues/176
2020-12-09 10:12:57 +01:00
f65d5d05db Cleanup public include dirs 2020-12-06 11:26:03 +01:00
8562437c8a mqtt_config: Add config value to disable keepalive mechanism
Added a separate config value to allow disable the keepalive mechanism (and keep the existing API the same)
Internally though, the keepalive value (in connect_info) is in line with 3.1.2.10 Keep Alive from mqtt spec:
* keepalive=0: Keep alive mechanism disabled (server not to disconnect the client on its inactivity)
* period in seconds to send a Control packet if inactive

Closes https://github.com/espressif/esp-mqtt/issues/179
2020-11-18 14:41:44 +01:00
b9db8d9020 Use size_t for all lengths
Previously, uint32_t and size_t were used interchangeably. These types are
interchangeable on Xtensa gcc (uint32_t == size_t == unsigned int), but not on most
other 32-bit gcc architectures (where uint32_t == unsigned long, size_t ==
unsigned int).
2020-10-09 16:33:12 +11:00
420441b677 set separate ssl connection properties before transport connect 2020-01-30 08:31:59 +01:00
7087193093 mqtt_msg: address const correctness 2020-01-25 21:57:02 +01:00
6e08f6a04f mqtt_outbox: fix to store timestamps in long-long format
closes https://github.com/espressif/esp-mqtt/issues/144
closes IDFGH-2491
2020-01-25 21:57:02 +01:00
8ab095b5bb Merge branch 'feature/protocol_ver_rt_cfg' into 'master'
MQTT: Add runtime selection of mqtt protocol version

See merge request espressif/esp-mqtt!54
2020-01-20 16:41:55 +08:00
7ac0a42831 MQTT: Add runtime selection of mqtt protocol version
Add config option for selecting protocol version at runtime.

This also fixed MQTT protocol version 3.1 which wasnt working with the original implementation

Closes https://github.com/espressif/esp-idf/issues/4448
Closes IDFGH-2311
Closes IDF-1320
2020-01-09 14:49:33 +08:00