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

Copyright (C) 2010-2018 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
1.9.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 756 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 1380 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 1348 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 1027 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 1171 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 953 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 1075 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 1123 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 1221 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 1289 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 262 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 167 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 725 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 433 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 593 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 319 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 477 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 535 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 637 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 681 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 71 of file mqtt_client_packet.c.