mqtt_sn_client_message.h
Go to the documentation of this file.
1 /**
2  * @file mqtt_sn_client_message.h
3  * @brief MQTT-SN message formatting and parsing
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.4
29  **/
30 
31 #ifndef _MQTT_SN_CLIENT_MESSAGE_H
32 #define _MQTT_SN_CLIENT_MESSAGE_H
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "mqtt_sn/mqtt_sn_client.h"
37 
38 //C++ guard
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 //MQTT-SN client related functions
45  MqttSnMessage *message, const IpAddr *ipAddr, uint16_t port);
46 
48  const MqttSnMessage *message, const IpAddr *ipAddr, uint16_t port);
49 
51  const MqttSnMessage *message);
52 
54  const MqttSnMessage *message);
55 
57  const MqttSnMessage *message);
58 
60  const MqttSnMessage *message);
61 
63  const MqttSnMessage *message);
64 
66  const MqttSnMessage *message);
67 
69  const MqttSnMessage *message);
70 
72  const MqttSnMessage *message);
73 
75  const MqttSnMessage *message);
76 
78  const MqttSnMessage *message);
79 
81  const MqttSnMessage *message);
82 
84  const MqttSnMessage *message);
85 
87  const MqttSnMessage *message);
88 
90  const MqttSnMessage *message);
91 
93  const MqttSnMessage *message);
94 
96  const MqttSnMessage *message);
97 
99  const MqttSnMessage *message);
100 
101 error_t mqttSnClientSendSearchGw(MqttSnClientContext *context, uint8_t radius,
102  const IpAddr *destIpAddr, uint16_t destPort);
103 
105  bool_t cleanSession);
106 
109 
111  const char_t *topicName);
112 
115 
117  uint16_t msgId, const char_t *topicName, const uint8_t *data,
118  size_t length, MqttSnQosLevel qos, bool_t retain, bool_t dup);
119 
122 
126 
129 
131  const char_t *topicName);
132 
135 
137  uint16_t duration);
138 
141 
142 //C++ guard
143 #ifdef __cplusplus
144 }
145 #endif
146 
147 #endif
int bool_t
Definition: compiler_port.h:53
error_t mqttSnClientSendWillTopicUpd(MqttSnClientContext *context)
Send WILLTOPICUPD message.
IP network address.
Definition: ip.h:90
error_t mqttSnClientProcessPubRec(MqttSnClientContext *context, const MqttSnMessage *message)
Process incoming PUBREC message.
uint8_t message[]
Definition: chap.h:154
#define MqttSnClientContext
uint8_t data[]
Definition: ethernet.h:222
MqttSnReturnCode
MQTT-SN return codes.
MqttSnQosLevel
Quality of service level.
error_t mqttSnClientSendRegister(MqttSnClientContext *context, const char_t *topicName)
Send REGISTER message.
uint16_t msgId
uint16_t destPort
Definition: tcp.h:340
error_t mqttSnClientSendConnect(MqttSnClientContext *context, bool_t cleanSession)
Send CONNECT message.
uint8_t qos
Definition: mqtt_common.h:181
uint16_t topicId
error_t mqttSnClientProcessPingResp(MqttSnClientContext *context, const MqttSnMessage *message)
Process incoming PINGRESP message.
uint8_t returnCode
error_t mqttSnClientProcessSubAck(MqttSnClientContext *context, const MqttSnMessage *message)
Process incoming SUBACK message.
error_t mqttSnClientSendRegAck(MqttSnClientContext *context, uint16_t msgId, uint16_t topicId, MqttSnReturnCode returnCode)
Send REGACK message.
error_t mqttSnClientSendUnsubscribe(MqttSnClientContext *context, const char_t *topicName)
Send UNSUBSCRIBE message.
error_t mqttSnClientSendPubRec(MqttSnClientContext *context, uint16_t msgId)
Send PUBREC message.
error_t
Error codes.
Definition: error.h:43
error_t mqttSnClientSendWillMsg(MqttSnClientContext *context)
Send WILLMSG message.
error_t mqttSnClientSendPingReq(MqttSnClientContext *context)
Send PINGREQ message.
error_t mqttSnClientSendPingResp(MqttSnClientContext *context)
Send PINGRESP message.
error_t mqttSnClientProcessUnsubAck(MqttSnClientContext *context, const MqttSnMessage *message)
Process incoming UNSUBACK message.
error_t mqttSnClientProcessRegAck(MqttSnClientContext *context, const MqttSnMessage *message)
Process incoming REGACK message.
error_t mqttSnClientProcessPubComp(MqttSnClientContext *context, const MqttSnMessage *message)
Process incoming PUBCOMP message.
uint8_t length
Definition: tcp.h:368
error_t mqttSnClientProcessPubRel(MqttSnClientContext *context, const MqttSnMessage *message)
Process incoming PUBREL message.
error_t mqttSnClientSendWillMsgUpd(MqttSnClientContext *context)
Send WILLMSGUPD message.
error_t mqttSnClientProcessGwInfo(MqttSnClientContext *context, const MqttSnMessage *message, const IpAddr *ipAddr, uint16_t port)
Process incoming GWINFO message.
error_t mqttSnClientProcessRegister(MqttSnClientContext *context, const MqttSnMessage *message)
Process incoming REGISTER message.
uint16_t port
Definition: dns_common.h:267
uint16_t duration
error_t mqttSnClientProcessPingReq(MqttSnClientContext *context, const MqttSnMessage *message)
Process incoming PINGREQ message.
char char_t
Definition: compiler_port.h:48
error_t mqttSnClientSendPublish(MqttSnClientContext *context, uint16_t msgId, const char_t *topicName, const uint8_t *data, size_t length, MqttSnQosLevel qos, bool_t retain, bool_t dup)
Send PUBLISH message.
error_t mqttSnClientSendDisconnect(MqttSnClientContext *context, uint16_t duration)
Send DISCONNECT message.
char_t topicName[]
MQTT-SN message.
error_t mqttSnClientSendPubAck(MqttSnClientContext *context, uint16_t msgId, uint16_t topicId, MqttSnReturnCode returnCode)
Send PUBACK message.
error_t mqttSnClientSendSearchGw(MqttSnClientContext *context, uint8_t radius, const IpAddr *destIpAddr, uint16_t destPort)
Send SEARCHGW message.
uint8_t dup
Definition: mqtt_common.h:182
error_t mqttSnClientSendPubRel(MqttSnClientContext *context, uint16_t msgId)
Send PUBREL message.
error_t mqttSnClientSendPubComp(MqttSnClientContext *context, uint16_t msgId)
Send PUBCOMP message.
error_t mqttSnClientProcessWillTopicReq(MqttSnClientContext *context, const MqttSnMessage *message)
Process incoming WILLTOPICREQ message.
Ipv4Addr ipAddr
Definition: ipcp.h:105
error_t mqttSnClientProcessDisconnect(MqttSnClientContext *context, const MqttSnMessage *message)
Process incoming DISCONNECT message.
error_t mqttSnClientSendWillTopic(MqttSnClientContext *context)
Send WILLTOPIC message.
MQTT-SN client.
error_t mqttSnClientProcessWillMsgReq(MqttSnClientContext *context, const MqttSnMessage *message)
Process incoming WILLMSGREQ message.
error_t mqttSnClientProcessConnAck(MqttSnClientContext *context, const MqttSnMessage *message)
Process incoming CONNACK message.
TCP/IP stack core.
error_t mqttSnClientProcessPubAck(MqttSnClientContext *context, const MqttSnMessage *message)
Process incoming PUBACK message.
error_t mqttSnClientSendSubscribe(MqttSnClientContext *context, const char_t *topicName, MqttSnQosLevel qos)
Send SUBSCRIBE message.
error_t mqttSnClientProcessPublish(MqttSnClientContext *context, const MqttSnMessage *message)
Process incoming PUBLISH message.
error_t mqttSnClientProcessMessage(MqttSnClientContext *context, MqttSnMessage *message, const IpAddr *ipAddr, uint16_t port)
Process incoming MQTT-SN message.
error_t mqttSnClientProcessWillTopicResp(MqttSnClientContext *context, const MqttSnMessage *message)
Process incoming WILLTOPICRESP message.
error_t mqttSnClientProcessWillMsgResp(MqttSnClientContext *context, const MqttSnMessage *message)
Process incoming WILLMSGRESP message.
Ipv4Addr destIpAddr
Definition: ipcp.h:80