# Socket MQTT Library for Zephyr

# Copyright (c) 2018 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

config MQTT_LIB
	bool "Socket MQTT Library Support"
	select NET_SOCKETS
	help
	  Enable the Zephyr MQTT Library

if MQTT_LIB

module=MQTT
module-dep=NET_LOG
module-str=Log level for MQTT
module-help=Enables mqtt debug messages.
source "subsys/net/Kconfig.template.log_config.net"

choice MQTT_VERSION_SUPPORT
	prompt "Maximum MQTT protocol version supported"
	default MQTT_VERSION_3_1_1
	help
	  Maximum MQTT protocol version supported by the library.

config MQTT_VERSION_3_1_1
	bool "Support up to version 3.1.1 of the MQTT protocol"
	help
	  The MQTT version 3.1.1 will be the default library choice. Applications
	  will still be able to choose to use an older MQTT protocol version
	  with respective runtime MQTT client configuration.

config MQTT_VERSION_5_0
	bool "Support up to version 5.0 of the MQTT protocol [EXPERIMENTAL]"
	select EXPERIMENTAL
	help
	  The MQTT version 5.0 will be the default library choice. Applications
	  will still be able to choose to use an older MQTT protocol version
	  with respective runtime MQTT client configuration.

endchoice

config MQTT_KEEPALIVE
	int "Maximum number of clients Keep alive time for MQTT (in seconds)"
	default 60
	help
	  Keep alive time for MQTT (in seconds). Sending of Ping Requests to
	  keep the connection alive are governed by this value.

config MQTT_LIB_TLS
	bool "TLS support for socket MQTT Library"
	help
	  Enable TLS support for socket MQTT Library

config MQTT_LIB_TLS_USE_ALPN
	bool "ALPN support for MQTT"
	depends on MQTT_LIB_TLS
	help
	  Enable ALPN protocol for socket MQTT Library.

config MQTT_LIB_WEBSOCKET
	bool "Websocket support for socket MQTT Library"
	help
	  Enable Websocket support for socket MQTT Library.

config MQTT_LIB_CUSTOM_TRANSPORT
	bool "Custom transport support for socket MQTT Library"
	help
	  Enable custom transport support for socket MQTT Library.
	  User must provide implementation for transport procedure.

config MQTT_CLEAN_SESSION
	bool "MQTT Clean Session Flag."
	help
	  When a client connects to a MQTT broker using a persistent session,
	  the message broker saves all subscriptions. When the client
	  disconnects, the message broker stores unacknowledged QoS 1 messages
	  and new QoS 1 messages published to topics to which the client is
	  subscribed. When the client reconnects to the persistent session,
	  all subscriptions are reinstated and all stored messages are sent to
	  the client. Setting this flag to 0 allows the client to create a
	  persistent session.

#if MQTT_VERSION_5_0

config MQTT_USER_PROPERTIES_MAX
	int "Maximum number of user properties in a packet"
	default 1
	range 1 $(UINT16_MAX)
	help
	  Maximum number of user properties that the client can include in a
	  packet or parse on input.

config MQTT_SUBSCRIPTION_ID_PROPERTIES_MAX
	int "Maximum number of Subscription ID properties in a Publish packet"
	default 1
	range 1 32
	help
	  Maximum number of Subscription ID properties that the client can
	  parse when processing Publish message.

config MQTT_TOPIC_ALIAS_MAX
	int "Maximum number of supported topic aliases"
	default 5
	range 0 $(UINT16_MAX)
	help
	  Maximum number of supported topic aliases used in PUBLISH packets.
	  If set to 0, topic aliasing is disabled.

config MQTT_TOPIC_ALIAS_STRING_MAX
	int "The longest topic name that can be aliased"
	default 64
	range 8 $(UINT16_MAX)
	help
	  Specifies a size of a buffer for storing aliased topics.

#endif # MQTT_VERSION_5_0

endif # MQTT_LIB
