MQTT-SN message formatting and parsing. More...
#include "core/net.h"
#include "mqtt_sn/mqtt_sn_client.h"
#include "mqtt_sn/mqtt_sn_client_message.h"
#include "mqtt_sn/mqtt_sn_client_transport.h"
#include "mqtt_sn/mqtt_sn_client_misc.h"
#include "mqtt_sn/mqtt_sn_message.h"
#include "mqtt_sn/mqtt_sn_debug.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL MQTT_SN_TRACE_LEVEL |
Detailed Description
MQTT-SN message formatting and parsing.
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_sn_client_message.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL MQTT_SN_TRACE_LEVEL |
Definition at line 32 of file mqtt_sn_client_message.c.
Function Documentation
◆ mqttSnClientProcessConnAck()
error_t mqttSnClientProcessConnAck | ( | MqttSnClientContext * | context, |
const MqttSnMessage * | message | ||
) |
Process incoming CONNACK message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message
- Returns
- Error code
Definition at line 237 of file mqtt_sn_client_message.c.
◆ mqttSnClientProcessDisconnect()
error_t mqttSnClientProcessDisconnect | ( | MqttSnClientContext * | context, |
const MqttSnMessage * | message | ||
) |
Process incoming DISCONNECT message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message
- Returns
- Error code
Definition at line 814 of file mqtt_sn_client_message.c.
◆ mqttSnClientProcessGwInfo()
error_t mqttSnClientProcessGwInfo | ( | MqttSnClientContext * | context, |
const MqttSnMessage * | message, | ||
const IpAddr * | ipAddr, | ||
uint16_t | port | ||
) |
Process incoming GWINFO message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message [in] ipAddr Source IP address [in] port Source port
- Returns
- Error code
Definition at line 200 of file mqtt_sn_client_message.c.
◆ mqttSnClientProcessMessage()
error_t mqttSnClientProcessMessage | ( | MqttSnClientContext * | context, |
MqttSnMessage * | message, | ||
const IpAddr * | ipAddr, | ||
uint16_t | port | ||
) |
Process incoming MQTT-SN message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message [in] ipAddr Source IP address [in] port Source port
- Returns
- Error code
Definition at line 57 of file mqtt_sn_client_message.c.
◆ mqttSnClientProcessPingReq()
error_t mqttSnClientProcessPingReq | ( | MqttSnClientContext * | context, |
const MqttSnMessage * | message | ||
) |
Process incoming PINGREQ message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message
- Returns
- Error code
Definition at line 749 of file mqtt_sn_client_message.c.
◆ mqttSnClientProcessPingResp()
error_t mqttSnClientProcessPingResp | ( | MqttSnClientContext * | context, |
const MqttSnMessage * | message | ||
) |
Process incoming PINGRESP message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message
- Returns
- Error code
Definition at line 778 of file mqtt_sn_client_message.c.
◆ mqttSnClientProcessPubAck()
error_t mqttSnClientProcessPubAck | ( | MqttSnClientContext * | context, |
const MqttSnMessage * | message | ||
) |
Process incoming PUBACK message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message
- Returns
- Error code
Definition at line 519 of file mqtt_sn_client_message.c.
◆ mqttSnClientProcessPubComp()
error_t mqttSnClientProcessPubComp | ( | MqttSnClientContext * | context, |
const MqttSnMessage * | message | ||
) |
Process incoming PUBCOMP message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message
- Returns
- Error code
Definition at line 630 of file mqtt_sn_client_message.c.
◆ mqttSnClientProcessPublish()
error_t mqttSnClientProcessPublish | ( | MqttSnClientContext * | context, |
const MqttSnMessage * | message | ||
) |
Process incoming PUBLISH message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message
- Returns
- Error code
Definition at line 418 of file mqtt_sn_client_message.c.
◆ mqttSnClientProcessPubRec()
error_t mqttSnClientProcessPubRec | ( | MqttSnClientContext * | context, |
const MqttSnMessage * | message | ||
) |
Process incoming PUBREC message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message
- Returns
- Error code
Definition at line 560 of file mqtt_sn_client_message.c.
◆ mqttSnClientProcessPubRel()
error_t mqttSnClientProcessPubRel | ( | MqttSnClientContext * | context, |
const MqttSnMessage * | message | ||
) |
Process incoming PUBREL message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message
- Returns
- Error code
Definition at line 598 of file mqtt_sn_client_message.c.
◆ mqttSnClientProcessRegAck()
error_t mqttSnClientProcessRegAck | ( | MqttSnClientContext * | context, |
const MqttSnMessage * | message | ||
) |
Process incoming REGACK message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message
- Returns
- Error code
Definition at line 376 of file mqtt_sn_client_message.c.
◆ mqttSnClientProcessRegister()
error_t mqttSnClientProcessRegister | ( | MqttSnClientContext * | context, |
const MqttSnMessage * | message | ||
) |
Process incoming REGISTER message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message
- Returns
- Error code
Definition at line 331 of file mqtt_sn_client_message.c.
◆ mqttSnClientProcessSubAck()
error_t mqttSnClientProcessSubAck | ( | MqttSnClientContext * | context, |
const MqttSnMessage * | message | ||
) |
Process incoming SUBACK message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message
- Returns
- Error code
Definition at line 668 of file mqtt_sn_client_message.c.
◆ mqttSnClientProcessUnsubAck()
error_t mqttSnClientProcessUnsubAck | ( | MqttSnClientContext * | context, |
const MqttSnMessage * | message | ||
) |
Process incoming UNSUBACK message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message
- Returns
- Error code
Definition at line 711 of file mqtt_sn_client_message.c.
◆ mqttSnClientProcessWillMsgReq()
error_t mqttSnClientProcessWillMsgReq | ( | MqttSnClientContext * | context, |
const MqttSnMessage * | message | ||
) |
Process incoming WILLMSGREQ message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message
- Returns
- Error code
Definition at line 303 of file mqtt_sn_client_message.c.
◆ mqttSnClientProcessWillMsgResp()
error_t mqttSnClientProcessWillMsgResp | ( | MqttSnClientContext * | context, |
const MqttSnMessage * | message | ||
) |
Process incoming WILLMSGRESP message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message
- Returns
- Error code
Definition at line 880 of file mqtt_sn_client_message.c.
◆ mqttSnClientProcessWillTopicReq()
error_t mqttSnClientProcessWillTopicReq | ( | MqttSnClientContext * | context, |
const MqttSnMessage * | message | ||
) |
Process incoming WILLTOPICREQ message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message
- Returns
- Error code
Definition at line 275 of file mqtt_sn_client_message.c.
◆ mqttSnClientProcessWillTopicResp()
error_t mqttSnClientProcessWillTopicResp | ( | MqttSnClientContext * | context, |
const MqttSnMessage * | message | ||
) |
Process incoming WILLTOPICRESP message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] message Pointer to the received MQTT-SN message
- Returns
- Error code
Definition at line 842 of file mqtt_sn_client_message.c.
◆ mqttSnClientSendConnect()
error_t mqttSnClientSendConnect | ( | MqttSnClientContext * | context, |
bool_t | cleanSession | ||
) |
Send CONNECT message.
- Parameters
-
[in] context Pointer to the MQTT-SN 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 959 of file mqtt_sn_client_message.c.
◆ mqttSnClientSendDisconnect()
error_t mqttSnClientSendDisconnect | ( | MqttSnClientContext * | context, |
uint16_t | duration | ||
) |
Send DISCONNECT message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] duration Value of the sleep timer
- Returns
- Error code
Definition at line 1686 of file mqtt_sn_client_message.c.
◆ mqttSnClientSendPingReq()
error_t mqttSnClientSendPingReq | ( | MqttSnClientContext * | context | ) |
Send PINGREQ message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context
- Returns
- Error code
Definition at line 1616 of file mqtt_sn_client_message.c.
◆ mqttSnClientSendPingResp()
error_t mqttSnClientSendPingResp | ( | MqttSnClientContext * | context | ) |
Send PINGRESP message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context
- Returns
- Error code
Definition at line 1652 of file mqtt_sn_client_message.c.
◆ mqttSnClientSendPubAck()
error_t mqttSnClientSendPubAck | ( | MqttSnClientContext * | context, |
uint16_t | msgId, | ||
uint16_t | topicId, | ||
MqttSnReturnCode | returnCode | ||
) |
Send PUBACK message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] msgId Message identifier of the corresponding PUBLISH message [in] topicId Topic identifier [in] returnCode Return code
- Returns
- Error code
Definition at line 1303 of file mqtt_sn_client_message.c.
◆ mqttSnClientSendPubComp()
error_t mqttSnClientSendPubComp | ( | MqttSnClientContext * | context, |
uint16_t | msgId | ||
) |
Send PUBCOMP message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] msgId Message identifier of the corresponding PUBLISH message
- Returns
- Error code
Definition at line 1418 of file mqtt_sn_client_message.c.
◆ mqttSnClientSendPublish()
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.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] msgId Message identifier [in] topicName Short topic name [in] data 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 [in] dup This flag specifies if the message is sent for the first time or if the message is retransmitted
- Returns
- Error code
Definition at line 1186 of file mqtt_sn_client_message.c.
◆ mqttSnClientSendPubRec()
error_t mqttSnClientSendPubRec | ( | MqttSnClientContext * | context, |
uint16_t | msgId | ||
) |
Send PUBREC message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] msgId Message identifier of the corresponding PUBLISH message
- Returns
- Error code
Definition at line 1338 of file mqtt_sn_client_message.c.
◆ mqttSnClientSendPubRel()
error_t mqttSnClientSendPubRel | ( | MqttSnClientContext * | context, |
uint16_t | msgId | ||
) |
Send PUBREL message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] msgId Message identifier of the corresponding PUBLISH message
- Returns
- Error code
Definition at line 1372 of file mqtt_sn_client_message.c.
◆ mqttSnClientSendRegAck()
error_t mqttSnClientSendRegAck | ( | MqttSnClientContext * | context, |
uint16_t | msgId, | ||
uint16_t | topicId, | ||
MqttSnReturnCode | returnCode | ||
) |
Send REGACK message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] msgId Message identifier [in] topicId Topic identifier [in] returnCode Return code
- Returns
- Error code
Definition at line 1144 of file mqtt_sn_client_message.c.
◆ mqttSnClientSendRegister()
error_t mqttSnClientSendRegister | ( | MqttSnClientContext * | context, |
const char_t * | topicName | ||
) |
Send REGISTER message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] topicName Topic name
- Returns
- Error code
Definition at line 1094 of file mqtt_sn_client_message.c.
◆ mqttSnClientSendSearchGw()
error_t mqttSnClientSendSearchGw | ( | MqttSnClientContext * | context, |
uint8_t | radius, | ||
const IpAddr * | destIpAddr, | ||
uint16_t | destPort | ||
) |
Send SEARCHGW message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] radius Broadcast radius of SEARCHGW message [in] destIpAddr Destination IP address [in] destPort Destination port number
- Returns
- Error code
Definition at line 920 of file mqtt_sn_client_message.c.
◆ mqttSnClientSendSubscribe()
error_t mqttSnClientSendSubscribe | ( | MqttSnClientContext * | context, |
const char_t * | topicName, | ||
MqttSnQosLevel | qos | ||
) |
Send SUBSCRIBE message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] topicName Topic filter [in] qos Maximum QoS level at which the server can send application messages to the client
- Returns
- Error code
Definition at line 1454 of file mqtt_sn_client_message.c.
◆ mqttSnClientSendUnsubscribe()
error_t mqttSnClientSendUnsubscribe | ( | MqttSnClientContext * | context, |
const char_t * | topicName | ||
) |
Send UNSUBSCRIBE message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context [in] topicName Topic filter
- Returns
- Error code
Definition at line 1536 of file mqtt_sn_client_message.c.
◆ mqttSnClientSendWillMsg()
error_t mqttSnClientSendWillMsg | ( | MqttSnClientContext * | context | ) |
Send WILLMSG message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context
- Returns
- Error code
Definition at line 1059 of file mqtt_sn_client_message.c.
◆ mqttSnClientSendWillMsgUpd()
error_t mqttSnClientSendWillMsgUpd | ( | MqttSnClientContext * | context | ) |
Send WILLMSGUPD message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context
- Returns
- Error code
Definition at line 1773 of file mqtt_sn_client_message.c.
◆ mqttSnClientSendWillTopic()
error_t mqttSnClientSendWillTopic | ( | MqttSnClientContext * | context | ) |
Send WILLTOPIC message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context
- Returns
- Error code
Definition at line 1025 of file mqtt_sn_client_message.c.
◆ mqttSnClientSendWillTopicUpd()
error_t mqttSnClientSendWillTopicUpd | ( | MqttSnClientContext * | context | ) |
Send WILLTOPICUPD message.
- Parameters
-
[in] context Pointer to the MQTT-SN client context
- Returns
- Error code
Definition at line 1727 of file mqtt_sn_client_message.c.