mqtt_client_packet.h
Go to the documentation of this file.
1 /**
2  * @file mqtt_client_packet.h
3  * @brief MQTT packet parsing and formatting
4  *
5  * @section License
6  *
7  * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
8  *
9  * This file is part of CycloneTCP Open.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.0
27  **/
28 
29 #ifndef _MQTT_CLIENT_PACKET_H
30 #define _MQTT_CLIENT_PACKET_H
31 
32 //Dependencies
33 #include "core/net.h"
34 #include "mqtt/mqtt_client.h"
35 
36 //C++ guard
37 #ifdef __cplusplus
38  extern "C" {
39 #endif
40 
41 //MQTT client related functions
44 
46  bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
47 
49  bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
50 
52  bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
53 
55  bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
56 
58  bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
59 
61  bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
62 
64  bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
65 
67  bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
68 
70  bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
71 
74 
76  const void *message, size_t length, MqttQosLevel qos, bool_t retain);
77 
78 error_t mqttClientFormatPubAck(MqttClientContext *context, uint16_t packetId);
79 error_t mqttClientFormatPubRec(MqttClientContext *context, uint16_t packetId);
80 error_t mqttClientFormatPubRel(MqttClientContext *context, uint16_t packetId);
81 error_t mqttClientFormatPubComp(MqttClientContext *context, uint16_t packetId);
82 
84  const char_t *topic, MqttQosLevel qos);
85 
87  const char_t *topic);
88 
91 
92 //C++ guard
93 #ifdef __cplusplus
94  }
95 #endif
96 
97 #endif
error_t mqttClientProcessSubAck(MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
Process incoming SUBACK packet.
error_t mqttClientProcessPubAck(MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
Process incoming PUBACK packet.
char char_t
Definition: compiler_port.h:41
error_t mqttClientProcessPubRec(MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
Process incoming PUBREC packet.
TCP/IP stack core.
uint8_t message[]
Definition: chap.h:150
error_t mqttClientFormatUnsubscribe(MqttClientContext *context, const char_t *topic)
Format UNSUBSCRIBE packet.
error_t mqttClientFormatPingReq(MqttClientContext *context)
Format PINGREQ packet.
error_t mqttClientProcessUnsubAck(MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
Process incoming UNSUBACK packet.
MQTT client.
error_t mqttClientFormatPubRel(MqttClientContext *context, uint16_t packetId)
Format PUBREL packet.
error_t mqttClientProcessPubRel(MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
Process incoming PUBREL packet.
error_t mqttClientReceivePacket(MqttClientContext *context)
Receive MQTT packet.
uint8_t qos
Definition: mqtt_common.h:177
error_t mqttClientProcessPingResp(MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
Process incoming PINGRESP packet.
error_t mqttClientFormatPubAck(MqttClientContext *context, uint16_t packetId)
Format PUBACK packet.
error_t mqttClientFormatPubRec(MqttClientContext *context, uint16_t packetId)
Format PUBREC packet.
MqttQosLevel
Quality of service level.
Definition: mqtt_common.h:84
error_t mqttClientFormatPublish(MqttClientContext *context, const char_t *topic, const void *message, size_t length, MqttQosLevel qos, bool_t retain)
Format PUBLISH packet.
error_t mqttClientFormatSubscribe(MqttClientContext *context, const char_t *topic, MqttQosLevel qos)
Format SUBSCRIBE packet.
uint8_t cleanSession
error_t mqttClientFormatConnect(MqttClientContext *context, bool_t cleanSession)
Format CONNECT packet.
error_t mqttClientFormatPubComp(MqttClientContext *context, uint16_t packetId)
Format PUBCOMP packet.
error_t mqttClientProcessConnAck(MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
Process incoming CONNACK packet.
error_t
Error codes.
Definition: error.h:40
uint8_t retain
Definition: mqtt_common.h:176
error_t mqttClientFormatDisconnect(MqttClientContext *context)
Format DISCONNECT packet.
error_t mqttClientProcessPublish(MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
Process incoming PUBLISH packet.
error_t mqttClientProcessPacket(MqttClientContext *context)
Process incoming MQTT packet.
uint8_t dup
Definition: mqtt_common.h:178
uint8_t length
Definition: dtls_misc.h:140
#define MqttClientContext
Definition: mqtt_client.h:140
int bool_t
Definition: compiler_port.h:47
error_t mqttClientProcessPubComp(MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
Process incoming PUBCOMP packet.