mqtt_client_packet.h File Reference

MQTT packet parsing and formatting. More...

#include "core/net.h"
#include "mqtt/mqtt_client.h"

Go to the source code of this file.

Functions

error_t mqttClientReceivePacket (MqttClientContext *context)
 Receive MQTT packet. More...
 
error_t mqttClientProcessPacket (MqttClientContext *context)
 Process incoming MQTT packet. More...
 
error_t mqttClientProcessConnAck (MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
 Process incoming CONNACK packet. More...
 
error_t mqttClientProcessPubAck (MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
 Process incoming PUBACK packet. More...
 
error_t mqttClientProcessPublish (MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
 Process incoming PUBLISH packet. More...
 
error_t mqttClientProcessPubRec (MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
 Process incoming PUBREC packet. More...
 
error_t mqttClientProcessPubRel (MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
 Process incoming PUBREL packet. More...
 
error_t mqttClientProcessPubComp (MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
 Process incoming PUBCOMP packet. More...
 
error_t mqttClientProcessSubAck (MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
 Process incoming SUBACK packet. More...
 
error_t mqttClientProcessUnsubAck (MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
 Process incoming UNSUBACK packet. More...
 
error_t mqttClientProcessPingResp (MqttClientContext *context, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen)
 Process incoming PINGRESP packet. More...
 
error_t mqttClientFormatConnect (MqttClientContext *context, bool_t cleanSession)
 Format CONNECT packet. More...
 
error_t mqttClientFormatPublish (MqttClientContext *context, const char_t *topic, const void *message, size_t length, MqttQosLevel qos, bool_t retain)
 Format PUBLISH packet. More...
 
error_t mqttClientFormatPubAck (MqttClientContext *context, uint16_t packetId)
 Format PUBACK packet. More...
 
error_t mqttClientFormatPubRec (MqttClientContext *context, uint16_t packetId)
 Format PUBREC packet. More...
 
error_t mqttClientFormatPubRel (MqttClientContext *context, uint16_t packetId)
 Format PUBREL packet. More...
 
error_t mqttClientFormatPubComp (MqttClientContext *context, uint16_t packetId)
 Format PUBCOMP packet. More...
 
error_t mqttClientFormatSubscribe (MqttClientContext *context, const char_t *topic, MqttQosLevel qos)
 Format SUBSCRIBE packet. More...
 
error_t mqttClientFormatUnsubscribe (MqttClientContext *context, const char_t *topic)
 Format UNSUBSCRIBE packet. More...
 
error_t mqttClientFormatPingReq (MqttClientContext *context)
 Format PINGREQ packet. More...
 
error_t mqttClientFormatDisconnect (MqttClientContext *context)
 Format DISCONNECT packet. More...
 

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.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.0

Definition in file mqtt_client_packet.h.

Function Documentation

◆ mqttClientFormatConnect()

error_t mqttClientFormatConnect ( MqttClientContext context,
bool_t  cleanSession 
)

Format CONNECT packet.

Parameters
[in]contextPointer to the MQTT client context
[in]cleanSessionIf 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]contextPointer 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]contextPointer 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]contextPointer to the MQTT client context
[in]packetIdPacket 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]contextPointer to the MQTT client context
[in]packetIdPacket 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]contextPointer to the MQTT client context
[in]topicTopic name
[in]messageMessage payload
[in]lengthLength of the message payload
[in]qosQoS level to be used when publishing the message
[in]retainThis 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]contextPointer to the MQTT client context
[in]packetIdPacket 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]contextPointer to the MQTT client context
[in]packetIdPacket 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]contextPointer to the MQTT client context
[in]topicTopic filter
[in]qosMaximum 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]contextPointer to the MQTT client context
[in]topicTopic 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]contextPointer to the MQTT client context
[in]dupDUP flag from the fixed header
[in]qosQoS field from the fixed header
[in]retainRETAIN flag from the fixed header
[in]remainingLenLength 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]contextPointer 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]contextPointer to the MQTT client context
[in]dupDUP flag from the fixed header
[in]qosQoS field from the fixed header
[in]retainRETAIN flag from the fixed header
[in]remainingLenLength 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]contextPointer to the MQTT client context
[in]dupDUP flag from the fixed header
[in]qosQoS field from the fixed header
[in]retainRETAIN flag from the fixed header
[in]remainingLenLength 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]contextPointer to the MQTT client context
[in]dupDUP flag from the fixed header
[in]qosQoS field from the fixed header
[in]retainRETAIN flag from the fixed header
[in]remainingLenLength 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]contextPointer to the MQTT client context
[in]dupDUP flag from the fixed header
[in]qosQoS field from the fixed header
[in]retainRETAIN flag from the fixed header
[in]remainingLenLength 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]contextPointer to the MQTT client context
[in]dupDUP flag from the fixed header
[in]qosQoS field from the fixed header
[in]retainRETAIN flag from the fixed header
[in]remainingLenLength 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]contextPointer to the MQTT client context
[in]dupDUP flag from the fixed header
[in]qosQoS field from the fixed header
[in]retainRETAIN flag from the fixed header
[in]remainingLenLength 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]contextPointer to the MQTT client context
[in]dupDUP flag from the fixed header
[in]qosQoS field from the fixed header
[in]retainRETAIN flag from the fixed header
[in]remainingLenLength 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]contextPointer to the MQTT client context
[in]dupDUP flag from the fixed header
[in]qosQoS field from the fixed header
[in]retainRETAIN flag from the fixed header
[in]remainingLenLength 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]contextPointer to the MQTT client context
Returns
Error code

Definition at line 73 of file mqtt_client_packet.c.