mqtt_sn_common.h File Reference

Definitions common to MQTT-SN client and gateway. More...

#include "core/net.h"

Go to the source code of this file.

Data Structures

struct  MqttSnPredefinedTopic
 Predefined topic. More...
 

Macros

#define MQTT_SN_PORT   1883
 
#define MQTT_SN_PROTOCOL_ID   0x01
 
#define MQTT_SN_INVALID_TOPIC_ID   0x0000
 

Typedefs

typedef void MqttSnWillTopicReq
 WILLTOPICREQ message. More...
 
typedef void MqttSnWillMsgReq
 WILLMSGREQ message. More...
 
typedef void MqttSnWillMsg
 WILLMSG message. More...
 
typedef void MqttSnPingReq
 PINGREQ message. More...
 
typedef void MqttSnPingResp
 PINGRESP message. More...
 
typedef void MqttSnWillMsgUpd
 WILLMSGUPD message. More...
 

Enumerations

enum  MqttSnTransportProtocol { MQTT_SN_TRANSPORT_PROTOCOL_UDP = 1, MQTT_SN_TRANSPORT_PROTOCOL_DTLS = 2 }
 MQTT-SN transport protocols. More...
 
enum  MqttSnQosLevel { MQTT_SN_QOS_LEVEL_0 = 0, MQTT_SN_QOS_LEVEL_1 = 1, MQTT_SN_QOS_LEVEL_2 = 2, MQTT_SN_QOS_LEVEL_MINUS_1 = 3 }
 Quality of service level. More...
 
enum  MqttSnTopicIdType { MQTT_SN_NORMAL_TOPIC_ID = 0, MQTT_SN_PREDEFINED_TOPIC_ID = 1, MQTT_SN_NORMAL_TOPIC_NAME = 0, MQTT_SN_SHORT_TOPIC_NAME = 2 }
 Topic ID types. More...
 
enum  MqttSnMsgType {
  MQTT_SN_MSG_TYPE_ADVERTISE = 0x00, MQTT_SN_MSG_TYPE_SEARCHGW = 0x01, MQTT_SN_MSG_TYPE_GWINFO = 0x02, MQTT_SN_MSG_TYPE_CONNECT = 0x04,
  MQTT_SN_MSG_TYPE_CONNACK = 0x05, MQTT_SN_MSG_TYPE_WILLTOPICREQ = 0x06, MQTT_SN_MSG_TYPE_WILLTOPIC = 0x07, MQTT_SN_MSG_TYPE_WILLMSGREQ = 0x08,
  MQTT_SN_MSG_TYPE_WILLMSG = 0x09, MQTT_SN_MSG_TYPE_REGISTER = 0x0A, MQTT_SN_MSG_TYPE_REGACK = 0x0B, MQTT_SN_MSG_TYPE_PUBLISH = 0x0C,
  MQTT_SN_MSG_TYPE_PUBACK = 0x0D, MQTT_SN_MSG_TYPE_PUBCOMP = 0x0E, MQTT_SN_MSG_TYPE_PUBREC = 0x0F, MQTT_SN_MSG_TYPE_PUBREL = 0x10,
  MQTT_SN_MSG_TYPE_SUBSCRIBE = 0x12, MQTT_SN_MSG_TYPE_SUBACK = 0x13, MQTT_SN_MSG_TYPE_UNSUBSCRIBE = 0x14, MQTT_SN_MSG_TYPE_UNSUBACK = 0x15,
  MQTT_SN_MSG_TYPE_PINGREQ = 0x16, MQTT_SN_MSG_TYPE_PINGRESP = 0x17, MQTT_SN_MSG_TYPE_DISCONNECT = 0x18, MQTT_SN_MSG_TYPE_WILLTOPICUPD = 0x1A,
  MQTT_SN_MSG_TYPE_WILLTOPICRESP = 0x1B, MQTT_SN_MSG_TYPE_WILLMSGUPD = 0x1C, MQTT_SN_MSG_TYPE_WILLMSGRESP = 0x1D, MQTT_SN_MSG_TYPE_ENCAPSULATED = 0xFE
}
 MQTT-SN message types. More...
 
enum  MqttSnReturnCode { MQTT_SN_RETURN_CODE_ACCEPTED = 0, MQTT_SN_RETURN_CODE_REJECTED_CONGESTION = 1, MQTT_SN_RETURN_CODE_REJECTED_INVALID_TOPIC_ID = 2, MQTT_SN_RETURN_CODE_REJECTED_NOT_SUPPORTED = 3 }
 MQTT-SN return codes. More...
 

Variables

typedef __packed_struct
 MQTT-SN flags. More...
 
 MqttSnFlags
 
uint8_t msgType
 
uint8_t data []
 
 MqttSnHeader
 
uint16_t length
 
 MqttSnExtHeader
 
uint16_t duration
 
 MqttSnAdvertise
 
 MqttSnSearchGw
 
uint8_t gwAdd []
 
 MqttSnGwInfo
 
uint8_t protocolId
 
char_t clientId []
 
 MqttSnConnect
 
 MqttSnConnAck
 
char_t willTopic []
 
 MqttSnWillTopic
 
uint16_t msgId
 
char_t topicName []
 
 MqttSnRegister
 
uint8_t returnCode
 
 MqttSnRegAck
 
uint16_t topicId
 
 MqttSnPublish
 
 MqttSnPubAck
 
 MqttSnPubRec
 
 MqttSnPubRel
 
 MqttSnPubComp
 
 MqttSnSubscribe
 
 MqttSnSubAck
 
 MqttSnUnsubscribe
 
 MqttSnUnsubAck
 
 MqttSnDisconnect
 
 MqttSnWillTopicUpd
 
 MqttSnWillTopicResp
 
 MqttSnWillMsgResp
 

Detailed Description

Definitions common to MQTT-SN client and gateway.

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.4

Definition in file mqtt_sn_common.h.

Macro Definition Documentation

◆ MQTT_SN_INVALID_TOPIC_ID

#define MQTT_SN_INVALID_TOPIC_ID   0x0000

Definition at line 48 of file mqtt_sn_common.h.

◆ MQTT_SN_PORT

#define MQTT_SN_PORT   1883

Definition at line 38 of file mqtt_sn_common.h.

◆ MQTT_SN_PROTOCOL_ID

#define MQTT_SN_PROTOCOL_ID   0x01

Definition at line 46 of file mqtt_sn_common.h.

Typedef Documentation

◆ MqttSnPingReq

typedef void MqttSnPingReq

PINGREQ message.

Definition at line 418 of file mqtt_sn_common.h.

◆ MqttSnPingResp

typedef void MqttSnPingResp

PINGRESP message.

Definition at line 425 of file mqtt_sn_common.h.

◆ MqttSnWillMsg

typedef void MqttSnWillMsg

WILLMSG message.

Definition at line 285 of file mqtt_sn_common.h.

◆ MqttSnWillMsgReq

typedef void MqttSnWillMsgReq

WILLMSGREQ message.

Definition at line 278 of file mqtt_sn_common.h.

◆ MqttSnWillMsgUpd

typedef void MqttSnWillMsgUpd

WILLMSGUPD message.

Definition at line 463 of file mqtt_sn_common.h.

◆ MqttSnWillTopicReq

typedef void MqttSnWillTopicReq

WILLTOPICREQ message.

Definition at line 260 of file mqtt_sn_common.h.

Enumeration Type Documentation

◆ MqttSnMsgType

MQTT-SN message types.

Enumerator
MQTT_SN_MSG_TYPE_ADVERTISE 
MQTT_SN_MSG_TYPE_SEARCHGW 
MQTT_SN_MSG_TYPE_GWINFO 
MQTT_SN_MSG_TYPE_CONNECT 
MQTT_SN_MSG_TYPE_CONNACK 
MQTT_SN_MSG_TYPE_WILLTOPICREQ 
MQTT_SN_MSG_TYPE_WILLTOPIC 
MQTT_SN_MSG_TYPE_WILLMSGREQ 
MQTT_SN_MSG_TYPE_WILLMSG 
MQTT_SN_MSG_TYPE_REGISTER 
MQTT_SN_MSG_TYPE_REGACK 
MQTT_SN_MSG_TYPE_PUBLISH 
MQTT_SN_MSG_TYPE_PUBACK 
MQTT_SN_MSG_TYPE_PUBCOMP 
MQTT_SN_MSG_TYPE_PUBREC 
MQTT_SN_MSG_TYPE_PUBREL 
MQTT_SN_MSG_TYPE_SUBSCRIBE 
MQTT_SN_MSG_TYPE_SUBACK 
MQTT_SN_MSG_TYPE_UNSUBSCRIBE 
MQTT_SN_MSG_TYPE_UNSUBACK 
MQTT_SN_MSG_TYPE_PINGREQ 
MQTT_SN_MSG_TYPE_PINGRESP 
MQTT_SN_MSG_TYPE_DISCONNECT 
MQTT_SN_MSG_TYPE_WILLTOPICUPD 
MQTT_SN_MSG_TYPE_WILLTOPICRESP 
MQTT_SN_MSG_TYPE_WILLMSGUPD 
MQTT_SN_MSG_TYPE_WILLMSGRESP 
MQTT_SN_MSG_TYPE_ENCAPSULATED 

Definition at line 91 of file mqtt_sn_common.h.

◆ MqttSnQosLevel

Quality of service level.

Enumerator
MQTT_SN_QOS_LEVEL_0 

At most once delivery.

MQTT_SN_QOS_LEVEL_1 

At least once delivery.

MQTT_SN_QOS_LEVEL_2 

Exactly once delivery.

MQTT_SN_QOS_LEVEL_MINUS_1 

No connection setup.

Definition at line 65 of file mqtt_sn_common.h.

◆ MqttSnReturnCode

MQTT-SN return codes.

Enumerator
MQTT_SN_RETURN_CODE_ACCEPTED 
MQTT_SN_RETURN_CODE_REJECTED_CONGESTION 
MQTT_SN_RETURN_CODE_REJECTED_INVALID_TOPIC_ID 
MQTT_SN_RETURN_CODE_REJECTED_NOT_SUPPORTED 

Definition at line 128 of file mqtt_sn_common.h.

◆ MqttSnTopicIdType

Topic ID types.

Enumerator
MQTT_SN_NORMAL_TOPIC_ID 

Normal topic ID.

MQTT_SN_PREDEFINED_TOPIC_ID 

Predefined topic ID.

MQTT_SN_NORMAL_TOPIC_NAME 

Normal topic name.

MQTT_SN_SHORT_TOPIC_NAME 

Short topic name.

Definition at line 78 of file mqtt_sn_common.h.

◆ MqttSnTransportProtocol

MQTT-SN transport protocols.

Enumerator
MQTT_SN_TRANSPORT_PROTOCOL_UDP 

UDP protocol.

MQTT_SN_TRANSPORT_PROTOCOL_DTLS 

DTLS protocol.

Definition at line 55 of file mqtt_sn_common.h.

Variable Documentation

◆ __packed_struct

typedef __packed_struct
Initial value:
{
__packed_union
{
uint8_t all;
{
uint8_t topicIdType : 2;
uint8_t cleanSession : 1;
uint8_t will : 1;
uint8_t retain : 1;
uint8_t qos : 2;
uint8_t dup : 1;
};
}

MQTT-SN flags.

WILLMSGRESP message.

WILLTOPICRESP message.

WILLTOPICUPD message.

DISCONNECT message.

UNSUBACK message.

UNSUBSCRIBE message.

SUBACK message.

SUBSCRIBE message.

PUBCOMP message.

PUBREL message.

PUBREC message.

PUBACK message.

PUBLISH message.

REGACK message.

REGISTER message.

WILLTOPIC message.

CONNACK message.

CONNECT message.

GWINFO message.

SEARCHGW message.

ADVERTISE message.

Extended message header.

Message header.

Definition at line 149 of file mqtt_sn_common.h.

◆ clientId

char_t clientId[]

Definition at line 242 of file mqtt_sn_common.h.

◆ data

uint8_t data[]

Definition at line 184 of file mqtt_sn_common.h.

◆ duration

uint16_t duration

Definition at line 208 of file mqtt_sn_common.h.

◆ gwAdd

uint8_t gwAdd[]

Definition at line 229 of file mqtt_sn_common.h.

◆ length

uint16_t length

Definition at line 195 of file mqtt_sn_common.h.

◆ MqttSnAdvertise

MqttSnAdvertise

Definition at line 209 of file mqtt_sn_common.h.

◆ MqttSnConnAck

MqttSnConnAck

Definition at line 253 of file mqtt_sn_common.h.

◆ MqttSnConnect

MqttSnConnect

Definition at line 243 of file mqtt_sn_common.h.

◆ MqttSnDisconnect

MqttSnDisconnect

Definition at line 435 of file mqtt_sn_common.h.

◆ MqttSnExtHeader

MqttSnExtHeader

Definition at line 198 of file mqtt_sn_common.h.

◆ MqttSnFlags

MqttSnFlags

Definition at line 173 of file mqtt_sn_common.h.

◆ MqttSnGwInfo

MqttSnGwInfo

Definition at line 230 of file mqtt_sn_common.h.

◆ MqttSnHeader

MqttSnHeader

Definition at line 185 of file mqtt_sn_common.h.

◆ MqttSnPubAck

MqttSnPubAck

Definition at line 334 of file mqtt_sn_common.h.

◆ MqttSnPubComp

MqttSnPubComp

Definition at line 364 of file mqtt_sn_common.h.

◆ MqttSnPublish

MqttSnPublish

Definition at line 322 of file mqtt_sn_common.h.

◆ MqttSnPubRec

MqttSnPubRec

Definition at line 344 of file mqtt_sn_common.h.

◆ MqttSnPubRel

MqttSnPubRel

Definition at line 354 of file mqtt_sn_common.h.

◆ MqttSnRegAck

MqttSnRegAck

Definition at line 309 of file mqtt_sn_common.h.

◆ MqttSnRegister

MqttSnRegister

Definition at line 297 of file mqtt_sn_common.h.

◆ MqttSnSearchGw

MqttSnSearchGw

Definition at line 219 of file mqtt_sn_common.h.

◆ MqttSnSubAck

MqttSnSubAck

Definition at line 389 of file mqtt_sn_common.h.

◆ MqttSnSubscribe

MqttSnSubscribe

Definition at line 376 of file mqtt_sn_common.h.

◆ MqttSnUnsubAck

MqttSnUnsubAck

Definition at line 411 of file mqtt_sn_common.h.

◆ MqttSnUnsubscribe

MqttSnUnsubscribe

Definition at line 401 of file mqtt_sn_common.h.

◆ MqttSnWillMsgResp

MqttSnWillMsgResp

Definition at line 473 of file mqtt_sn_common.h.

◆ MqttSnWillTopic

MqttSnWillTopic

Definition at line 271 of file mqtt_sn_common.h.

◆ MqttSnWillTopicResp

MqttSnWillTopicResp

Definition at line 456 of file mqtt_sn_common.h.

◆ MqttSnWillTopicUpd

MqttSnWillTopicUpd

Definition at line 446 of file mqtt_sn_common.h.

◆ msgId

uint16_t msgId

Definition at line 295 of file mqtt_sn_common.h.

◆ msgType

uint8_t msgType

Definition at line 183 of file mqtt_sn_common.h.

◆ protocolId

uint8_t protocolId

Definition at line 240 of file mqtt_sn_common.h.

◆ returnCode

uint8_t returnCode

Definition at line 308 of file mqtt_sn_common.h.

◆ topicId

uint16_t topicId

Definition at line 319 of file mqtt_sn_common.h.

◆ topicName

char_t topicName

Definition at line 296 of file mqtt_sn_common.h.

◆ willTopic

char_t willTopic

Definition at line 270 of file mqtt_sn_common.h.

typedef __packed_struct
MQTT-SN flags.
uint8_t qos
Definition: mqtt_common.h:181
uint8_t dup
Definition: mqtt_common.h:182