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

struct {
   union {
      uint8_t   all
 
      struct {
         uint8_t   topicIdType: 2
 
         uint8_t   cleanSession: 1
 
         uint8_t   will: 1
 
         uint8_t   retain: 1
 
         uint8_t   qos: 2
 
         uint8_t   dup: 1
 
      } 
 
   } 
 
MqttSnFlags
 MQTT-SN flags. More...
 
struct {
   uint8_t   length
 
   uint8_t   msgType
 
   uint8_t   data []
 
MqttSnHeader
 Message header. More...
 
struct {
   uint8_t   prefix
 
   uint16_t   length
 
   uint8_t   msgType
 
   uint8_t   data []
 
MqttSnExtHeader
 Extended message header. More...
 
struct {
   uint8_t   gwId
 
   uint16_t   duration
 
MqttSnAdvertise
 ADVERTISE message. More...
 
struct {
   uint8_t   radius
 
MqttSnSearchGw
 SEARCHGW message. More...
 
struct {
   uint8_t   gwId
 
   uint8_t   gwAdd []
 
MqttSnGwInfo
 GWINFO message. More...
 
struct {
   MqttSnFlags   flags
 
   uint8_t   protocolId
 
   uint16_t   duration
 
   char_t   clientId []
 
MqttSnConnect
 CONNECT message. More...
 
struct {
   uint8_t   returnCode
 
MqttSnConnAck
 CONNACK message. More...
 
typedef void MqttSnWillTopicReq
 WILLTOPICREQ message. More...
 
struct {
   MqttSnFlags   flags
 
   char_t   willTopic []
 
MqttSnWillTopic
 WILLTOPIC message. More...
 
typedef void MqttSnWillMsgReq
 WILLMSGREQ message. More...
 
typedef void MqttSnWillMsg
 WILLMSG message. More...
 
struct {
   uint16_t   topicId
 
   uint16_t   msgId
 
   char_t   topicName []
 
MqttSnRegister
 REGISTER message. More...
 
struct {
   uint16_t   topicId
 
   uint16_t   msgId
 
   uint8_t   returnCode
 
MqttSnRegAck
 REGACK message. More...
 
struct {
   MqttSnFlags   flags
 
   uint16_t   topicId
 
   uint16_t   msgId
 
   uint8_t   data []
 
MqttSnPublish
 PUBLISH message. More...
 
struct {
   uint16_t   topicId
 
   uint16_t   msgId
 
   uint8_t   returnCode
 
MqttSnPubAck
 PUBACK message. More...
 
struct {
   uint16_t   msgId
 
MqttSnPubRec
 PUBREC message. More...
 
struct {
   uint16_t   msgId
 
MqttSnPubRel
 PUBREL message. More...
 
struct {
   uint16_t   msgId
 
MqttSnPubComp
 PUBCOMP message. More...
 
struct {
   MqttSnFlags   flags
 
   uint16_t   msgId
 
   char_t   topicName []
 
MqttSnSubscribe
 SUBSCRIBE message. More...
 
struct {
   MqttSnFlags   flags
 
   uint16_t   topicId
 
   uint16_t   msgId
 
   uint8_t   returnCode
 
MqttSnSubAck
 SUBACK message. More...
 
struct {
   MqttSnFlags   flags
 
   uint16_t   msgId
 
   char_t   topicName []
 
MqttSnUnsubscribe
 UNSUBSCRIBE message. More...
 
struct {
   uint16_t   msgId
 
MqttSnUnsubAck
 UNSUBACK message. More...
 
typedef void MqttSnPingReq
 PINGREQ message. More...
 
typedef void MqttSnPingResp
 PINGRESP message. More...
 
struct {
   uint16_t   duration
 
MqttSnDisconnect
 DISCONNECT message. More...
 
struct {
   MqttSnFlags   flags
 
   char_t   willTopic []
 
MqttSnWillTopicUpd
 WILLTOPICUPD message. More...
 
struct {
   uint8_t   returnCode
 
MqttSnWillTopicResp
 WILLTOPICRESP message. More...
 
typedef void MqttSnWillMsgUpd
 WILLMSGUPD message. More...
 
struct {
   uint8_t   returnCode
 
MqttSnWillMsgResp
 WILLMSGRESP 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...
 

Detailed Description

Definitions common to MQTT-SN client and gateway.

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_sn_common.h.

Macro Definition Documentation

◆ MQTT_SN_INVALID_TOPIC_ID

#define MQTT_SN_INVALID_TOPIC_ID   0x0000

Definition at line 46 of file mqtt_sn_common.h.

◆ MQTT_SN_PORT

#define MQTT_SN_PORT   1883

Definition at line 36 of file mqtt_sn_common.h.

◆ MQTT_SN_PROTOCOL_ID

#define MQTT_SN_PROTOCOL_ID   0x01

Definition at line 44 of file mqtt_sn_common.h.

Typedef Documentation

◆ MqttSnAdvertise

typedef { ... } MqttSnAdvertise

ADVERTISE message.

◆ MqttSnConnAck

typedef { ... } MqttSnConnAck

CONNACK message.

◆ MqttSnConnect

typedef { ... } MqttSnConnect

CONNECT message.

◆ MqttSnDisconnect

typedef { ... } MqttSnDisconnect

DISCONNECT message.

◆ MqttSnExtHeader

typedef { ... } MqttSnExtHeader

Extended message header.

◆ MqttSnFlags

typedef { ... } MqttSnFlags

MQTT-SN flags.

◆ MqttSnGwInfo

typedef { ... } MqttSnGwInfo

GWINFO message.

◆ MqttSnHeader

typedef { ... } MqttSnHeader

Message header.

◆ MqttSnPingReq

typedef void MqttSnPingReq

PINGREQ message.

Definition at line 414 of file mqtt_sn_common.h.

◆ MqttSnPingResp

typedef void MqttSnPingResp

PINGRESP message.

Definition at line 421 of file mqtt_sn_common.h.

◆ MqttSnPubAck

typedef { ... } MqttSnPubAck

PUBACK message.

◆ MqttSnPubComp

typedef { ... } MqttSnPubComp

PUBCOMP message.

◆ MqttSnPublish

typedef { ... } MqttSnPublish

PUBLISH message.

◆ MqttSnPubRec

typedef { ... } MqttSnPubRec

PUBREC message.

◆ MqttSnPubRel

typedef { ... } MqttSnPubRel

PUBREL message.

◆ MqttSnRegAck

typedef { ... } MqttSnRegAck

REGACK message.

◆ MqttSnRegister

typedef { ... } MqttSnRegister

REGISTER message.

◆ MqttSnSearchGw

typedef { ... } MqttSnSearchGw

SEARCHGW message.

◆ MqttSnSubAck

typedef { ... } MqttSnSubAck

SUBACK message.

◆ MqttSnSubscribe

typedef { ... } MqttSnSubscribe

SUBSCRIBE message.

◆ MqttSnUnsubAck

typedef { ... } MqttSnUnsubAck

UNSUBACK message.

◆ MqttSnUnsubscribe

typedef { ... } MqttSnUnsubscribe

UNSUBSCRIBE message.

◆ MqttSnWillMsg

typedef void MqttSnWillMsg

WILLMSG message.

Definition at line 281 of file mqtt_sn_common.h.

◆ MqttSnWillMsgReq

typedef void MqttSnWillMsgReq

WILLMSGREQ message.

Definition at line 274 of file mqtt_sn_common.h.

◆ MqttSnWillMsgResp

typedef { ... } MqttSnWillMsgResp

WILLMSGRESP message.

◆ MqttSnWillMsgUpd

typedef void MqttSnWillMsgUpd

WILLMSGUPD message.

Definition at line 459 of file mqtt_sn_common.h.

◆ MqttSnWillTopic

typedef { ... } MqttSnWillTopic

WILLTOPIC message.

◆ MqttSnWillTopicReq

typedef void MqttSnWillTopicReq

WILLTOPICREQ message.

Definition at line 256 of file mqtt_sn_common.h.

◆ MqttSnWillTopicResp

typedef { ... } MqttSnWillTopicResp

WILLTOPICRESP message.

◆ MqttSnWillTopicUpd

typedef { ... } MqttSnWillTopicUpd

WILLTOPICUPD message.

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 89 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 63 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 126 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 76 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 53 of file mqtt_sn_common.h.

Variable Documentation

◆ all

uint8_t all

Definition at line 149 of file mqtt_sn_common.h.

◆ cleanSession

uint8_t cleanSession

Definition at line 161 of file mqtt_sn_common.h.

◆ clientId

char_t clientId[]

Definition at line 238 of file mqtt_sn_common.h.

◆ data

uint8_t data[]

Definition at line 180 of file mqtt_sn_common.h.

◆ dup

uint8_t dup

Definition at line 165 of file mqtt_sn_common.h.

◆ duration

uint16_t duration

Definition at line 204 of file mqtt_sn_common.h.

◆ flags

MqttSnFlags flags

Definition at line 235 of file mqtt_sn_common.h.

◆ gwAdd

uint8_t gwAdd[]

Definition at line 225 of file mqtt_sn_common.h.

◆ gwId

uint8_t gwId

Definition at line 203 of file mqtt_sn_common.h.

◆ length

uint16_t length

Definition at line 178 of file mqtt_sn_common.h.

◆ msgId

uint16_t msgId

Definition at line 291 of file mqtt_sn_common.h.

◆ msgType

uint8_t msgType

Definition at line 179 of file mqtt_sn_common.h.

◆ prefix

uint8_t prefix

Definition at line 190 of file mqtt_sn_common.h.

◆ protocolId

uint8_t protocolId

Definition at line 236 of file mqtt_sn_common.h.

◆ qos

uint8_t qos

Definition at line 164 of file mqtt_sn_common.h.

◆ radius

uint8_t radius

Definition at line 214 of file mqtt_sn_common.h.

◆ retain

uint8_t retain

Definition at line 163 of file mqtt_sn_common.h.

◆ returnCode

uint8_t returnCode

Definition at line 248 of file mqtt_sn_common.h.

◆ topicId

uint16_t topicId

Definition at line 290 of file mqtt_sn_common.h.

◆ topicIdType

uint8_t topicIdType

Definition at line 160 of file mqtt_sn_common.h.

◆ topicName

char_t topicName[]

Definition at line 292 of file mqtt_sn_common.h.

◆ will

uint8_t will

Definition at line 162 of file mqtt_sn_common.h.

◆ willTopic

char_t willTopic[]

Definition at line 266 of file mqtt_sn_common.h.