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  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 #ifndef _MQTT_CLIENT_PACKET_H
32 #define _MQTT_CLIENT_PACKET_H
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "mqtt/mqtt_client.h"
37 
38 //C++ guard
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 //MQTT client related functions
46 
48  bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
49 
51  bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
52 
54  bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
55 
57  bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
58 
60  bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
61 
63  bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
64 
66  bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
67 
69  bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
70 
72  bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
73 
75  bool_t cleanSession);
76 
78  const void *message, size_t length, MqttQosLevel qos, bool_t retain);
79 
80 error_t mqttClientFormatPubAck(MqttClientContext *context, uint16_t packetId);
81 error_t mqttClientFormatPubRec(MqttClientContext *context, uint16_t packetId);
82 error_t mqttClientFormatPubRel(MqttClientContext *context, uint16_t packetId);
83 error_t mqttClientFormatPubComp(MqttClientContext *context, uint16_t packetId);
84 
86  const char_t *topic, MqttQosLevel qos);
87 
89  const char_t *topic);
90 
93 
94 //C++ guard
95 #ifdef __cplusplus
96 }
97 #endif
98 
99 #endif
uint8_t message[]
Definition: chap.h:154
char char_t
Definition: compiler_port.h:48
int bool_t
Definition: compiler_port.h:53
error_t
Error codes.
Definition: error.h:43
MQTT client.
#define MqttClientContext
Definition: mqtt_client.h:147
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 mqttClientFormatUnsubscribe(MqttClientContext *context, const char_t *topic)
Format UNSUBSCRIBE packet.
error_t mqttClientFormatSubscribe(MqttClientContext *context, const char_t *topic, MqttQosLevel qos)
Format SUBSCRIBE packet.
error_t mqttClientProcessPubComp(MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
Process incoming PUBCOMP packet.
error_t mqttClientProcessSubAck(MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
Process incoming SUBACK packet.
error_t mqttClientFormatConnect(MqttClientContext *context, bool_t cleanSession)
Format CONNECT packet.
error_t mqttClientFormatPubRel(MqttClientContext *context, uint16_t packetId)
Format PUBREL packet.
error_t mqttClientProcessConnAck(MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
Process incoming CONNACK packet.
error_t mqttClientProcessPubRec(MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
Process incoming PUBREC packet.
error_t mqttClientFormatPingReq(MqttClientContext *context)
Format PINGREQ packet.
error_t mqttClientProcessPacket(MqttClientContext *context)
Process incoming MQTT packet.
error_t mqttClientProcessUnsubAck(MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
Process incoming UNSUBACK packet.
error_t mqttClientProcessPubAck(MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
Process incoming PUBACK packet.
error_t mqttClientFormatDisconnect(MqttClientContext *context)
Format DISCONNECT packet.
error_t mqttClientFormatPubAck(MqttClientContext *context, uint16_t packetId)
Format PUBACK packet.
error_t mqttClientFormatPubRec(MqttClientContext *context, uint16_t packetId)
Format PUBREC packet.
error_t mqttClientProcessPingResp(MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
Process incoming PINGRESP packet.
error_t mqttClientFormatPubComp(MqttClientContext *context, uint16_t packetId)
Format PUBCOMP packet.
error_t mqttClientReceivePacket(MqttClientContext *context)
Receive MQTT packet.
error_t mqttClientProcessPubRel(MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
Process incoming PUBREL packet.
error_t mqttClientProcessPublish(MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
Process incoming PUBLISH packet.
uint8_t dup
Definition: mqtt_common.h:182
uint8_t qos
Definition: mqtt_common.h:181
MqttQosLevel
Quality of service level.
Definition: mqtt_common.h:87
TCP/IP stack core.
uint8_t length
Definition: tcp.h:368