MQTT packet parsing and formatting. More...
#include "core/net.h"
#include "mqtt/mqtt_client.h"
#include "mqtt/mqtt_client_packet.h"
#include "mqtt/mqtt_client_transport.h"
#include "mqtt/mqtt_client_misc.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL MQTT_TRACE_LEVEL |
Variables | |
const char_t *const | mqttPacketLabel [16] |
Detailed Description
MQTT packet parsing and formatting.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.4.4
Definition in file mqtt_client_packet.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL MQTT_TRACE_LEVEL |
Definition at line 32 of file mqtt_client_packet.c.
Function Documentation
◆ mqttClientFormatConnect()
error_t mqttClientFormatConnect | ( | MqttClientContext * | context, |
bool_t | cleanSession | ||
) |
Format CONNECT packet.
- Parameters
-
[in] context Pointer to the MQTT client context [in] cleanSession If this flag is set, then the client and server must discard any previous session and start a new one
- Returns
- Error code
Definition at line 758 of file mqtt_client_packet.c.
◆ mqttClientFormatDisconnect()
error_t mqttClientFormatDisconnect | ( | MqttClientContext * | context | ) |
Format DISCONNECT packet.
- Parameters
-
[in] context Pointer to the MQTT client context
- Returns
- Error code
Definition at line 1386 of file mqtt_client_packet.c.
◆ mqttClientFormatPingReq()
error_t mqttClientFormatPingReq | ( | MqttClientContext * | context | ) |
Format PINGREQ packet.
- Parameters
-
[in] context Pointer to the MQTT client context
- Returns
- Error code
Definition at line 1354 of file mqtt_client_packet.c.
◆ mqttClientFormatPubAck()
error_t mqttClientFormatPubAck | ( | MqttClientContext * | context, |
uint16_t | packetId | ||
) |
Format PUBACK packet.
- Parameters
-
[in] context Pointer to the MQTT client context [in] packetId Packet identifier
- Returns
- Error code
Definition at line 1033 of file mqtt_client_packet.c.
◆ mqttClientFormatPubComp()
error_t mqttClientFormatPubComp | ( | MqttClientContext * | context, |
uint16_t | packetId | ||
) |
Format PUBCOMP packet.
- Parameters
-
[in] context Pointer to the MQTT client context [in] packetId Packet identifier
- Returns
- Error code
Definition at line 1177 of file mqtt_client_packet.c.
◆ mqttClientFormatPublish()
error_t mqttClientFormatPublish | ( | MqttClientContext * | context, |
const char_t * | topic, | ||
const void * | message, | ||
size_t | length, | ||
MqttQosLevel | qos, | ||
bool_t | retain | ||
) |
Format PUBLISH packet.
- Parameters
-
[in] context Pointer to the MQTT client context [in] topic Topic name [in] message Message payload [in] length Length of the message payload [in] qos QoS level to be used when publishing the message [in] retain This flag specifies if the message is to be retained
- Returns
- Error code
Definition at line 959 of file mqtt_client_packet.c.
◆ mqttClientFormatPubRec()
error_t mqttClientFormatPubRec | ( | MqttClientContext * | context, |
uint16_t | packetId | ||
) |
Format PUBREC packet.
- Parameters
-
[in] context Pointer to the MQTT client context [in] packetId Packet identifier
- Returns
- Error code
Definition at line 1081 of file mqtt_client_packet.c.
◆ mqttClientFormatPubRel()
error_t mqttClientFormatPubRel | ( | MqttClientContext * | context, |
uint16_t | packetId | ||
) |
Format PUBREL packet.
- Parameters
-
[in] context Pointer to the MQTT client context [in] packetId Packet identifier
- Returns
- Error code
Definition at line 1129 of file mqtt_client_packet.c.
◆ mqttClientFormatSubscribe()
error_t mqttClientFormatSubscribe | ( | MqttClientContext * | context, |
const char_t * | topic, | ||
MqttQosLevel | qos | ||
) |
Format SUBSCRIBE packet.
- Parameters
-
[in] context Pointer to the MQTT client context [in] topic Topic filter [in] qos Maximum QoS level at which the server can send application messages to the client
- Returns
- Error code
Definition at line 1227 of file mqtt_client_packet.c.
◆ mqttClientFormatUnsubscribe()
error_t mqttClientFormatUnsubscribe | ( | MqttClientContext * | context, |
const char_t * | topic | ||
) |
Format UNSUBSCRIBE packet.
- Parameters
-
[in] context Pointer to the MQTT client context [in] topic Topic filter
- Returns
- Error code
Definition at line 1295 of file mqtt_client_packet.c.
◆ mqttClientProcessConnAck()
error_t mqttClientProcessConnAck | ( | MqttClientContext * | context, |
bool_t | dup, | ||
MqttQosLevel | qos, | ||
bool_t | retain, | ||
size_t | remainingLen | ||
) |
Process incoming CONNACK packet.
- Parameters
-
[in] context Pointer to the MQTT client context [in] dup DUP flag from the fixed header [in] qos QoS field from the fixed header [in] retain RETAIN flag from the fixed header [in] remainingLen Length of the variable header and the payload
Definition at line 264 of file mqtt_client_packet.c.
◆ mqttClientProcessPacket()
error_t mqttClientProcessPacket | ( | MqttClientContext * | context | ) |
Process incoming MQTT packet.
- Parameters
-
[in] context Pointer to the MQTT client context
- Returns
- Error code
Definition at line 169 of file mqtt_client_packet.c.
◆ mqttClientProcessPingResp()
error_t mqttClientProcessPingResp | ( | MqttClientContext * | context, |
bool_t | dup, | ||
MqttQosLevel | qos, | ||
bool_t | retain, | ||
size_t | remainingLen | ||
) |
Process incoming PINGRESP packet.
- Parameters
-
[in] context Pointer to the MQTT client context [in] dup DUP flag from the fixed header [in] qos QoS field from the fixed header [in] retain RETAIN flag from the fixed header [in] remainingLen Length of the variable header and the payload
Definition at line 727 of file mqtt_client_packet.c.
◆ mqttClientProcessPubAck()
error_t mqttClientProcessPubAck | ( | MqttClientContext * | context, |
bool_t | dup, | ||
MqttQosLevel | qos, | ||
bool_t | retain, | ||
size_t | remainingLen | ||
) |
Process incoming PUBACK packet.
- Parameters
-
[in] context Pointer to the MQTT client context [in] dup DUP flag from the fixed header [in] qos QoS field from the fixed header [in] retain RETAIN flag from the fixed header [in] remainingLen Length of the variable header and the payload
Definition at line 435 of file mqtt_client_packet.c.
◆ mqttClientProcessPubComp()
error_t mqttClientProcessPubComp | ( | MqttClientContext * | context, |
bool_t | dup, | ||
MqttQosLevel | qos, | ||
bool_t | retain, | ||
size_t | remainingLen | ||
) |
Process incoming PUBCOMP packet.
- Parameters
-
[in] context Pointer to the MQTT client context [in] dup DUP flag from the fixed header [in] qos QoS field from the fixed header [in] retain RETAIN flag from the fixed header [in] remainingLen Length of the variable header and the payload
Definition at line 595 of file mqtt_client_packet.c.
◆ mqttClientProcessPublish()
error_t mqttClientProcessPublish | ( | MqttClientContext * | context, |
bool_t | dup, | ||
MqttQosLevel | qos, | ||
bool_t | retain, | ||
size_t | remainingLen | ||
) |
Process incoming PUBLISH packet.
- Parameters
-
[in] context Pointer to the MQTT client context [in] dup DUP flag from the fixed header [in] qos QoS field from the fixed header [in] retain RETAIN flag from the fixed header [in] remainingLen Length of the variable header and the payload
Definition at line 321 of file mqtt_client_packet.c.
◆ mqttClientProcessPubRec()
error_t mqttClientProcessPubRec | ( | MqttClientContext * | context, |
bool_t | dup, | ||
MqttQosLevel | qos, | ||
bool_t | retain, | ||
size_t | remainingLen | ||
) |
Process incoming PUBREC packet.
- Parameters
-
[in] context Pointer to the MQTT client context [in] dup DUP flag from the fixed header [in] qos QoS field from the fixed header [in] retain RETAIN flag from the fixed header [in] remainingLen Length of the variable header and the payload
Definition at line 479 of file mqtt_client_packet.c.
◆ mqttClientProcessPubRel()
error_t mqttClientProcessPubRel | ( | MqttClientContext * | context, |
bool_t | dup, | ||
MqttQosLevel | qos, | ||
bool_t | retain, | ||
size_t | remainingLen | ||
) |
Process incoming PUBREL packet.
- Parameters
-
[in] context Pointer to the MQTT client context [in] dup DUP flag from the fixed header [in] qos QoS field from the fixed header [in] retain RETAIN flag from the fixed header [in] remainingLen Length of the variable header and the payload
Definition at line 537 of file mqtt_client_packet.c.
◆ mqttClientProcessSubAck()
error_t mqttClientProcessSubAck | ( | MqttClientContext * | context, |
bool_t | dup, | ||
MqttQosLevel | qos, | ||
bool_t | retain, | ||
size_t | remainingLen | ||
) |
Process incoming SUBACK packet.
- Parameters
-
[in] context Pointer to the MQTT client context [in] dup DUP flag from the fixed header [in] qos QoS field from the fixed header [in] retain RETAIN flag from the fixed header [in] remainingLen Length of the variable header and the payload
Definition at line 639 of file mqtt_client_packet.c.
◆ mqttClientProcessUnsubAck()
error_t mqttClientProcessUnsubAck | ( | MqttClientContext * | context, |
bool_t | dup, | ||
MqttQosLevel | qos, | ||
bool_t | retain, | ||
size_t | remainingLen | ||
) |
Process incoming UNSUBACK packet.
- Parameters
-
[in] context Pointer to the MQTT client context [in] dup DUP flag from the fixed header [in] qos QoS field from the fixed header [in] retain RETAIN flag from the fixed header [in] remainingLen Length of the variable header and the payload
Definition at line 683 of file mqtt_client_packet.c.
◆ mqttClientReceivePacket()
error_t mqttClientReceivePacket | ( | MqttClientContext * | context | ) |
Receive MQTT packet.
- Parameters
-
[in] context Pointer to the MQTT client context
- Returns
- Error code
Definition at line 73 of file mqtt_client_packet.c.
Variable Documentation
◆ mqttPacketLabel
const char_t* const mqttPacketLabel[16] |
Definition at line 46 of file mqtt_client_packet.c.