iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Intel Corporation
|
|
|
|
*
|
2017-01-18 17:01:01 -08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _MQTT_H_
|
|
|
|
#define _MQTT_H_
|
|
|
|
|
2016-12-23 15:09:15 -06:00
|
|
|
#include <net/mqtt_types.h>
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
#include <net/net_context.h>
|
|
|
|
|
2017-07-24 16:23:14 +03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2017-02-01 15:33:07 +01:00
|
|
|
/**
|
|
|
|
* @brief MQTT library
|
|
|
|
* @defgroup mqtt MQTT library
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* MQTT application type
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
|
|
|
enum mqtt_app {
|
2016-12-15 22:43:13 -06:00
|
|
|
/** Publisher and Subscriber application */
|
|
|
|
MQTT_APP_PUBLISHER_SUBSCRIBER,
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
/** Publisher only application */
|
|
|
|
MQTT_APP_PUBLISHER,
|
|
|
|
/** Subscriber only application */
|
|
|
|
MQTT_APP_SUBSCRIBER,
|
|
|
|
/** MQTT Server */
|
|
|
|
MQTT_APP_SERVER
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* MQTT context structure
|
|
|
|
*
|
|
|
|
* @details Context structure for the MQTT high-level API with support for QoS.
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*
|
|
|
|
* This API is designed for asynchronous operation, so callbacks are
|
|
|
|
* executed when some events must be addressed outside the MQTT routines.
|
|
|
|
* Those events are triggered by the reception or transmission of MQTT messages
|
|
|
|
* and are defined by the MQTT v3.1.1 spec, see:
|
|
|
|
*
|
|
|
|
* http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/mqtt-v3.1.1.html
|
|
|
|
*
|
|
|
|
* For example, assume that Zephyr is operating as a MQTT_APP_SUBSCRIBER, so it
|
|
|
|
* may receive the MQTT PUBLISH and MQTT PUBREL (QoS2) messages. Once the
|
|
|
|
* messages are parsed and validated, the #publish_rx callback is executed.
|
|
|
|
*
|
|
|
|
* Internally, the #publish_rx callback must store the #mqtt_publish_msg message
|
|
|
|
* when a MQTT PUBLISH msg is received. When a MQTT PUBREL message is received,
|
|
|
|
* the application must evaluate if the PUBREL's Packet Identifier matches a
|
2017-01-13 23:16:53 -06:00
|
|
|
* previous received MQTT PUBLISH message. In this case, the user may provide a
|
|
|
|
* collection of #mqtt_publish_msg structs (array of structs) to store those
|
|
|
|
* messages.
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*
|
|
|
|
* <b>NOTE: The application (and not the API) is in charge of keeping track of
|
|
|
|
* the state of the received and sent messages.</b>
|
|
|
|
*/
|
|
|
|
struct mqtt_ctx {
|
|
|
|
/** IP stack context structure */
|
|
|
|
struct net_context *net_ctx;
|
|
|
|
/** Network timeout for tx and rx routines */
|
2017-04-21 09:27:50 -05:00
|
|
|
s32_t net_timeout;
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
|
|
|
|
/** Callback executed when a MQTT CONNACK msg is received and validated.
|
|
|
|
* If this function pointer is not used, must be set to NULL.
|
|
|
|
*/
|
2017-01-13 23:16:53 -06:00
|
|
|
void (*connect)(struct mqtt_ctx *ctx);
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
|
|
|
|
/** Callback executed when a MQTT DISCONNECT msg is sent.
|
|
|
|
* If this function pointer is not used, must be set to NULL.
|
|
|
|
*/
|
2017-01-13 23:16:53 -06:00
|
|
|
void (*disconnect)(struct mqtt_ctx *ctx);
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
|
|
|
|
/** Callback executed when a #MQTT_APP_PUBLISHER application receives
|
|
|
|
* a MQTT PUBxxxx msg.
|
2017-02-08 15:02:58 -06:00
|
|
|
* If type is MQTT_PUBACK, MQTT_PUBCOMP or MQTT_PUBREC, this callback
|
|
|
|
* must return 0 if pkt_id matches the packet id of a previously
|
|
|
|
* received MQTT_PUBxxx message. If this callback returns 0, the caller
|
|
|
|
* will continue.
|
|
|
|
* Any other value will stop the QoS handshake and the caller will
|
|
|
|
* return -EINVAL. The application must discard all the messages
|
|
|
|
* already processed.
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*
|
|
|
|
* <b>Note: this callback must be not NULL</b>
|
|
|
|
*
|
2017-02-08 15:02:58 -06:00
|
|
|
* @param [in] ctx MQTT context
|
|
|
|
* @param [in] pkt_id Packet Identifier for the input MQTT msg
|
|
|
|
* @param [in] type Packet type
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
2017-04-21 09:27:50 -05:00
|
|
|
int (*publish_tx)(struct mqtt_ctx *ctx, u16_t pkt_id,
|
2017-01-13 23:16:53 -06:00
|
|
|
enum mqtt_packet type);
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
|
|
|
|
/** Callback executed when a MQTT_APP_SUBSCRIBER,
|
2017-02-08 15:02:58 -06:00
|
|
|
* MQTT_APP_PUBLISHER_SUBSCRIBER or MQTT_APP_SERVER applications receive
|
|
|
|
* a MQTT PUBxxxx msg. If this callback returns 0, the caller will
|
|
|
|
* continue. If type is MQTT_PUBREL this callback must return 0 if
|
|
|
|
* pkt_id matches the packet id of a previously received MQTT_PUBxxx
|
|
|
|
* message. Any other value will stop the QoS handshake and the caller
|
|
|
|
* will return -EINVAL
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*
|
|
|
|
* <b>Note: this callback must be not NULL</b>
|
|
|
|
*
|
2017-02-08 15:02:58 -06:00
|
|
|
* @param [in] ctx MQTT context
|
|
|
|
* @param [in] msg Publish message, this parameter is only used
|
|
|
|
* when the type is MQTT_PUBLISH
|
|
|
|
* @param [in] pkt_id Packet Identifier for the input msg
|
|
|
|
* @param [in] type Packet type
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
2017-01-13 23:16:53 -06:00
|
|
|
int (*publish_rx)(struct mqtt_ctx *ctx, struct mqtt_publish_msg *msg,
|
2017-04-21 09:27:50 -05:00
|
|
|
u16_t pkt_id, enum mqtt_packet type);
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
|
|
|
|
/** Callback executed when a MQTT_APP_SUBSCRIBER or
|
|
|
|
* MQTT_APP_PUBLISHER_SUBSCRIBER receives the MQTT SUBACK message
|
2017-02-08 15:02:58 -06:00
|
|
|
* If this callback returns 0, the caller will continue. Any other
|
|
|
|
* value will make the caller return -EINVAL.
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*
|
|
|
|
* <b>Note: this callback must be not NULL</b>
|
|
|
|
*
|
2017-02-08 15:02:58 -06:00
|
|
|
* @param [in] ctx MQTT context
|
|
|
|
* @param [in] pkt_id Packet Identifier for the MQTT SUBACK msg
|
|
|
|
* @param [in] items Number of elements in the qos array
|
|
|
|
* @param [in] qos Array of QoS values
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
2017-04-21 09:27:50 -05:00
|
|
|
int (*subscribe)(struct mqtt_ctx *ctx, u16_t pkt_id,
|
|
|
|
u8_t items, enum mqtt_qos qos[]);
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
|
|
|
|
/** Callback executed when a MQTT_APP_SUBSCRIBER or
|
|
|
|
* MQTT_APP_PUBLISHER_SUBSCRIBER receives the MQTT UNSUBACK message
|
2017-02-08 15:02:58 -06:00
|
|
|
* If this callback returns 0, the caller will continue. Any other value
|
|
|
|
* will make the caller return -EINVAL
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*
|
|
|
|
* <b>Note: this callback must be not NULL</b>
|
2017-01-14 11:08:11 -06:00
|
|
|
*
|
2017-01-13 23:16:53 -06:00
|
|
|
* @param [in] ctx MQTT context
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
* @param [in] pkt_id Packet Identifier for the MQTT SUBACK msg
|
|
|
|
*/
|
2017-04-21 09:27:50 -05:00
|
|
|
int (*unsubscribe)(struct mqtt_ctx *ctx, u16_t pkt_id);
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
|
2017-01-14 11:08:11 -06:00
|
|
|
/** Callback executed when an incoming message doesn't pass the
|
|
|
|
* validation stage. This callback may be NULL.
|
|
|
|
* The pkt_type variable may be set to MQTT_INVALID, if the parsing
|
|
|
|
* stage is aborted before determining the MQTT msg packet type.
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context
|
|
|
|
* @param [in] pkt_type MQTT Packet type
|
|
|
|
*/
|
2017-04-21 09:27:50 -05:00
|
|
|
void (*malformed)(struct mqtt_ctx *ctx, u16_t pkt_type);
|
2017-01-14 11:08:11 -06:00
|
|
|
|
2016-12-15 22:43:13 -06:00
|
|
|
/* Internal use only */
|
2017-04-05 08:37:44 +02:00
|
|
|
int (*rcv)(struct mqtt_ctx *ctx, struct net_pkt *);
|
2016-12-15 22:43:13 -06:00
|
|
|
|
|
|
|
/** Application type, see: enum mqtt_app */
|
2017-04-21 09:27:50 -05:00
|
|
|
u8_t app_type;
|
2016-12-15 22:30:56 -06:00
|
|
|
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
/* Clean session is also part of the MQTT CONNECT msg, however app
|
|
|
|
* behavior is influenced by this parameter, so we keep a copy here
|
|
|
|
*/
|
|
|
|
/** MQTT Clean Session parameter */
|
2017-04-21 09:27:50 -05:00
|
|
|
u8_t clean_session:1;
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
|
|
|
|
/** 1 if the MQTT application is connected and 0 otherwise */
|
2017-04-21 09:27:50 -05:00
|
|
|
u8_t connected:1;
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
};
|
|
|
|
|
2016-12-15 23:15:58 -06:00
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Initializes the MQTT context structure
|
|
|
|
*
|
|
|
|
* @param ctx MQTT context structure
|
|
|
|
* @param app_type See enum mqtt_app
|
|
|
|
* @retval 0, always.
|
2016-12-15 23:15:58 -06:00
|
|
|
*/
|
|
|
|
int mqtt_init(struct mqtt_ctx *ctx, enum mqtt_app app_type);
|
|
|
|
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Sends the MQTT CONNECT message
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
* @param [in] msg MQTT CONNECT msg
|
|
|
|
*
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EIO
|
|
|
|
* @retval -ENOMEM
|
|
|
|
* @retval -EINVAL
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
|
|
|
int mqtt_tx_connect(struct mqtt_ctx *ctx, struct mqtt_connect_msg *msg);
|
|
|
|
|
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Send the MQTT DISCONNECT message
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
*
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EIO
|
|
|
|
* @retval -ENOMEM
|
|
|
|
* @retval -EINVAL
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
|
|
|
int mqtt_tx_disconnect(struct mqtt_ctx *ctx);
|
|
|
|
|
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Sends the MQTT PUBACK message with the given packet id
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
* @param [in] id MQTT Packet Identifier
|
|
|
|
*
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EINVAL
|
|
|
|
* @retval -ENOMEM
|
|
|
|
* @retval -EIO
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
2017-04-21 09:27:50 -05:00
|
|
|
int mqtt_tx_puback(struct mqtt_ctx *ctx, u16_t id);
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
|
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Sends the MQTT PUBCOMP message with the given packet id
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
* @param [in] id MQTT Packet Identifier
|
|
|
|
*
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EINVAL
|
|
|
|
* @retval -ENOMEM
|
|
|
|
* @retval -EIO
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
2017-04-21 09:27:50 -05:00
|
|
|
int mqtt_tx_pubcomp(struct mqtt_ctx *ctx, u16_t id);
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
|
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Sends the MQTT PUBREC message with the given packet id
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
* @param [in] id MQTT Packet Identifier
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EINVAL
|
|
|
|
* @retval -ENOMEM
|
|
|
|
* @retval -EIO
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
2017-04-21 09:27:50 -05:00
|
|
|
int mqtt_tx_pubrec(struct mqtt_ctx *ctx, u16_t id);
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
|
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Sends the MQTT PUBREL message with the given packet id
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
* @param [in] id MQTT Packet Identifier
|
|
|
|
*
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EINVAL
|
|
|
|
* @retval -ENOMEM
|
|
|
|
* @retval -EIO
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
2017-04-21 09:27:50 -05:00
|
|
|
int mqtt_tx_pubrel(struct mqtt_ctx *ctx, u16_t id);
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
|
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Sends the MQTT PUBLISH message
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
* @param [in] msg MQTT PUBLISH msg
|
|
|
|
*
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EINVAL
|
|
|
|
* @retval -ENOMEM
|
|
|
|
* @retval -EIO
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
|
|
|
int mqtt_tx_publish(struct mqtt_ctx *ctx, struct mqtt_publish_msg *msg);
|
|
|
|
|
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Sends the MQTT PINGREQ message
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
*
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EINVAL
|
|
|
|
* @retval -ENOMEM
|
|
|
|
* @retval -EIO
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
|
|
|
int mqtt_tx_pingreq(struct mqtt_ctx *ctx);
|
|
|
|
|
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Sends the MQTT SUBSCRIBE message
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
* @param [in] pkt_id Packet identifier for the MQTT SUBSCRIBE msg
|
|
|
|
* @param [in] items Number of elements in 'topics' and 'qos' arrays
|
|
|
|
* @param [in] topics Array of 'items' elements containing C strings.
|
|
|
|
* For example: {"sensors", "lights", "doors"}
|
|
|
|
* @param [in] qos Array of 'items' elements containing MQTT QoS values:
|
|
|
|
* MQTT_QoS0, MQTT_QoS1, MQTT_QoS2. For example for the 'topics'
|
|
|
|
* array above the following QoS may be used: {MQTT_QoS0,
|
|
|
|
* MQTT_QoS2, MQTT_QoS1}, indicating that the subscription to
|
|
|
|
* 'lights' must be done with MQTT_QoS2
|
|
|
|
*
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EINVAL
|
|
|
|
* @retval -ENOMEM
|
|
|
|
* @retval -EIO
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
2017-04-21 09:27:50 -05:00
|
|
|
int mqtt_tx_subscribe(struct mqtt_ctx *ctx, u16_t pkt_id, u8_t items,
|
2016-12-15 22:30:56 -06:00
|
|
|
const char *topics[], const enum mqtt_qos qos[]);
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
|
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Sends the MQTT UNSUBSCRIBE message
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
* @param [in] pkt_id Packet identifier for the MQTT UNSUBSCRIBE msg
|
|
|
|
* @param [in] items Number of elements in the 'topics' array
|
|
|
|
* @param [in] topics Array of 'items' elements containing C strings
|
|
|
|
*
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EINVAL
|
|
|
|
* @retval -ENOMEM
|
|
|
|
* @retval -EIO
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
2017-04-21 09:27:50 -05:00
|
|
|
int mqtt_tx_unsubscribe(struct mqtt_ctx *ctx, u16_t pkt_id, u8_t items,
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
const char *topics[]);
|
|
|
|
|
2017-02-08 15:02:58 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Parses and validates the MQTT CONNACK msg
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
* @param [in] rx Data buffer
|
|
|
|
* @param [in] clean_session MQTT clean session parameter
|
|
|
|
*
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EINVAL
|
|
|
|
*/
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
int mqtt_rx_connack(struct mqtt_ctx *ctx, struct net_buf *rx,
|
|
|
|
int clean_session);
|
|
|
|
|
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Parses and validates the MQTT PUBACK message
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
* @param [in] rx Data buffer
|
|
|
|
*
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EINVAL
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
|
|
|
int mqtt_rx_puback(struct mqtt_ctx *ctx, struct net_buf *rx);
|
|
|
|
|
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Parses and validates the MQTT PUBCOMP message
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
* @param [in] rx Data buffer
|
|
|
|
*
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EINVAL
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
|
|
|
int mqtt_rx_pubcomp(struct mqtt_ctx *ctx, struct net_buf *rx);
|
|
|
|
|
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Parses and validates the MQTT PUBREC message
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
* @param [in] rx Data buffer
|
|
|
|
*
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EINVAL
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
|
|
|
int mqtt_rx_pubrec(struct mqtt_ctx *ctx, struct net_buf *rx);
|
|
|
|
|
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Parses and validates the MQTT PUBREL message
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
* @param [in] rx Data buffer
|
|
|
|
*
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EINVAL
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
|
|
|
int mqtt_rx_pubrel(struct mqtt_ctx *ctx, struct net_buf *rx);
|
|
|
|
|
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Parses the MQTT PINGRESP message
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
* @param [in] rx Data buffer
|
|
|
|
*
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EINVAL
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
|
|
|
int mqtt_rx_pingresp(struct mqtt_ctx *ctx, struct net_buf *rx);
|
|
|
|
|
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Parses the MQTT SUBACK message
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
* @param [in] rx Data buffer
|
|
|
|
*
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EINVAL
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
*/
|
|
|
|
int mqtt_rx_suback(struct mqtt_ctx *ctx, struct net_buf *rx);
|
|
|
|
|
2016-12-15 23:15:58 -06:00
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Parses the MQTT UNSUBACK message
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
* @param [in] rx Data buffer
|
|
|
|
*
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EINVAL
|
2016-12-15 23:15:58 -06:00
|
|
|
*/
|
|
|
|
int mqtt_rx_unsuback(struct mqtt_ctx *ctx, struct net_buf *rx);
|
|
|
|
|
2016-12-15 23:17:12 -06:00
|
|
|
/**
|
2017-02-08 15:02:58 -06:00
|
|
|
* Parses the MQTT PUBLISH message
|
|
|
|
*
|
|
|
|
* @param [in] ctx MQTT context structure
|
|
|
|
* @param [in] rx Data buffer
|
|
|
|
*
|
|
|
|
* @retval 0 on success
|
|
|
|
* @retval -EINVAL
|
|
|
|
* @retval -ENOMEM
|
2016-12-15 23:17:12 -06:00
|
|
|
*/
|
|
|
|
int mqtt_rx_publish(struct mqtt_ctx *ctx, struct net_buf *rx);
|
|
|
|
|
2017-02-01 15:33:07 +01:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2017-07-24 16:23:14 +03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
iot/mqtt: Add the MQTT high-level API
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-13 22:24:45 -06:00
|
|
|
#endif
|
2017-07-24 16:23:14 +03:00
|
|
|
|
|
|
|
#endif /* _MQTT_H_ */
|