Commit bf7c2936 authored by Ian Craggs's avatar Ian Craggs

Start MQTTV5 support - allow MQTTV5 connect to work

parent 13da462a
...@@ -1198,6 +1198,13 @@ int MQTTClient_connect(MQTTClient handle, MQTTClient_connectOptions* options) ...@@ -1198,6 +1198,13 @@ int MQTTClient_connect(MQTTClient handle, MQTTClient_connectOptions* options)
goto exit; goto exit;
} }
if (options->MQTTVersion != MQTTVERSION_DEFAULT &&
(options->MQTTVersion < MQTTVERSION_3_1 || options->MQTTVersion > MQTTVERSION_5))
{
rc = MQTTCLIENT_BAD_MQTT_VERSION;
goto exit;
}
if (options->struct_version < 2 || options->serverURIcount == 0) if (options->struct_version < 2 || options->serverURIcount == 0)
rc = MQTTClient_connectURI(handle, options, m->serverURI); rc = MQTTClient_connectURI(handle, options, m->serverURI);
else else
......
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009, 2017 IBM Corp. * Copyright (c) 2009, 2018 IBM Corp.
* *
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
...@@ -175,6 +175,10 @@ ...@@ -175,6 +175,10 @@
* Return code: Attempting SSL connection using non-SSL version of library * Return code: Attempting SSL connection using non-SSL version of library
*/ */
#define MQTTCLIENT_SSL_NOT_SUPPORTED -10 #define MQTTCLIENT_SSL_NOT_SUPPORTED -10
/**
* Return code: unrecognized MQTT version
*/
#define MQTTCLIENT_BAD_MQTT_VERSION -11
/** /**
* Default MQTT version to connect with. Use 3.1.1 then fall back to 3.1 * Default MQTT version to connect with. Use 3.1.1 then fall back to 3.1
...@@ -188,6 +192,10 @@ ...@@ -188,6 +192,10 @@
* MQTT version to connect with: 3.1.1 * MQTT version to connect with: 3.1.1
*/ */
#define MQTTVERSION_3_1_1 4 #define MQTTVERSION_3_1_1 4
/**
* MQTT version to connect with: 5
*/
#define MQTTVERSION_5 5
/** /**
* Bad return code from subscribe, as defined in the 3.1.1 specification * Bad return code from subscribe, as defined in the 3.1.1 specification
*/ */
......
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009, 2017 IBM Corp. * Copyright (c) 2009, 2018 IBM Corp.
* *
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
* Ian Craggs, Allan Stockdill-Mander - SSL updates * Ian Craggs, Allan Stockdill-Mander - SSL updates
* Ian Craggs - MQTT 3.1.1 support * Ian Craggs - MQTT 3.1.1 support
* Ian Craggs - big endian Linux reversed definition * Ian Craggs - big endian Linux reversed definition
* Ian Craggs - MQTT 5.0 support
*******************************************************************************/ *******************************************************************************/
#if !defined(MQTTPACKET_H) #if !defined(MQTTPACKET_H)
...@@ -255,8 +256,7 @@ int MQTTPacket_send_pubcomp(int msgid, networkHandles* net, const char* clientID ...@@ -255,8 +256,7 @@ int MQTTPacket_send_pubcomp(int msgid, networkHandles* net, const char* clientID
void MQTTPacket_free_packet(MQTTPacket* pack); void MQTTPacket_free_packet(MQTTPacket* pack);
#if !defined(NO_BRIDGE) #include "MQTTPacketOut.h"
#include "MQTTPacketOut.h" #include "MQTTV5Packet.h"
#endif
#endif /* MQTTPACKET_H */ #endif /* MQTTPACKET_H */
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009, 2017 IBM Corp. * Copyright (c) 2009, 2018 IBM Corp.
* *
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
...@@ -48,6 +48,8 @@ int MQTTPacket_send_connect(Clients* client, int MQTTVersion) ...@@ -48,6 +48,8 @@ int MQTTPacket_send_connect(Clients* client, int MQTTVersion)
Connect packet; Connect packet;
int rc = -1, len; int rc = -1, len;
MQTTProperties connectProperties = MQTTProperties_initializer;
FUNC_ENTRY; FUNC_ENTRY;
packet.header.byte = 0; packet.header.byte = 0;
packet.header.bits.type = CONNECT; packet.header.bits.type = CONNECT;
...@@ -59,6 +61,13 @@ int MQTTPacket_send_connect(Clients* client, int MQTTVersion) ...@@ -59,6 +61,13 @@ int MQTTPacket_send_connect(Clients* client, int MQTTVersion)
len += (int)strlen(client->username)+2; len += (int)strlen(client->username)+2;
if (client->password) if (client->password)
len += client->passwordlen+2; len += client->passwordlen+2;
if (MQTTVersion >= 5)
{
//if (connectProperties)
len += MQTTProperties_len(&connectProperties);
/*if (client->will && willProperties)
len += MQTTProperties_len(willProperties);*/
}
ptr = buf = malloc(len); ptr = buf = malloc(len);
if (MQTTVersion == 3) if (MQTTVersion == 3)
...@@ -66,10 +75,10 @@ int MQTTPacket_send_connect(Clients* client, int MQTTVersion) ...@@ -66,10 +75,10 @@ int MQTTPacket_send_connect(Clients* client, int MQTTVersion)
writeUTF(&ptr, "MQIsdp"); writeUTF(&ptr, "MQIsdp");
writeChar(&ptr, (char)3); writeChar(&ptr, (char)3);
} }
else if (MQTTVersion == 4) else if (MQTTVersion == 4 || MQTTVersion == 5)
{ {
writeUTF(&ptr, "MQTT"); writeUTF(&ptr, "MQTT");
writeChar(&ptr, (char)4); writeChar(&ptr, (char)MQTTVersion);
} }
else else
goto exit; goto exit;
...@@ -90,6 +99,8 @@ int MQTTPacket_send_connect(Clients* client, int MQTTVersion) ...@@ -90,6 +99,8 @@ int MQTTPacket_send_connect(Clients* client, int MQTTVersion)
writeChar(&ptr, packet.flags.all); writeChar(&ptr, packet.flags.all);
writeInt(&ptr, client->keepAliveInterval); writeInt(&ptr, client->keepAliveInterval);
if (MQTTVersion == 5)
MQTTProperties_write(&ptr, &connectProperties);
writeUTF(&ptr, client->clientID); writeUTF(&ptr, client->clientID);
if (client->will) if (client->will)
{ {
......
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009, 2014 IBM Corp. * Copyright (c) 2009, 2018 IBM Corp.
* *
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
......
/*******************************************************************************
* Copyright (c) 2017, 2018 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Ian Craggs - initial API and implementation and/or initial documentation
*******************************************************************************/
#include "MQTTV5Packet.h"
#include "MQTTPacket.h"
#include <string.h>
/**
* Writes an integer as 4 bytes to an output buffer.
* @param pptr pointer to the output buffer - incremented by the number of bytes used & returned
* @param anInt the integer to write
*/
void writeInt4(char** pptr, int anInt)
{
**pptr = (char)(anInt / 16777216);
(*pptr)++;
anInt %= 16777216;
**pptr = (char)(anInt / 65536);
(*pptr)++;
anInt %= 65536;
**pptr = (char)(anInt / 256);
(*pptr)++;
**pptr = (char)(anInt % 256);
(*pptr)++;
}
/**
* Calculates an integer from two bytes read from the input buffer
* @param pptr pointer to the input buffer - incremented by the number of bytes used & returned
* @return the integer value calculated
*/
int readInt4(char** pptr)
{
char* ptr = *pptr;
int value = 16777216*(*ptr) + 65536*(*(ptr+1)) + 256*(*(ptr+2)) + (*(ptr+3));
*pptr += 4;
return value;
}
void writeMQTTLenString(char** pptr, MQTTLenString lenstring)
{
writeInt(pptr, lenstring.len);
memcpy(*pptr, lenstring.data, lenstring.len);
*pptr += lenstring.len;
}
int MQTTLenStringRead(MQTTLenString* lenstring, char** pptr, char* enddata)
{
int len = 0;
/* the first two bytes are the length of the string */
if (enddata - (*pptr) > 1) /* enough length to read the integer? */
{
lenstring->len = readInt(pptr); /* increments pptr to point past length */
if (&(*pptr)[lenstring->len] <= enddata)
{
lenstring->data = (char*)*pptr;
*pptr += lenstring->len;
len = 2 + lenstring->len;
}
}
return len;
}
/*
if (prop->value.integer4 >= 0 && prop->value.integer4 <= 127)
len = 1;
else if (prop->value.integer4 >= 128 && prop->value.integer4 <= 16383)
len = 2;
else if (prop->value.integer4 >= 16384 && prop->value.integer4 < 2097151)
len = 3;
else if (prop->value.integer4 >= 2097152 && prop->value.integer4 < 268435455)
len = 4;
*/
int MQTTPacket_VBIlen(int rem_len)
{
int rc = 0;
if (rem_len < 128)
rc = 1;
else if (rem_len < 16384)
rc = 2;
else if (rem_len < 2097152)
rc = 3;
else
rc = 4;
return rc;
}
/**
* Decodes the message length according to the MQTT algorithm
* @param getcharfn pointer to function to read the next character from the data source
* @param value the decoded length returned
* @return the number of bytes read from the socket
*/
int MQTTPacket_VBIdecode(int (*getcharfn)(char*, int), int* value)
{
char c;
int multiplier = 1;
int len = 0;
#define MAX_NO_OF_REMAINING_LENGTH_BYTES 4
*value = 0;
do
{
int rc = MQTTPACKET_READ_ERROR;
if (++len > MAX_NO_OF_REMAINING_LENGTH_BYTES)
{
rc = MQTTPACKET_READ_ERROR; /* bad data */
goto exit;
}
rc = (*getcharfn)(&c, 1);
if (rc != 1)
goto exit;
*value += (c & 127) * multiplier;
multiplier *= 128;
} while ((c & 128) != 0);
exit:
return len;
}
static char* bufptr;
int bufchar(char* c, int count)
{
int i;
for (i = 0; i < count; ++i)
*c = *bufptr++;
return count;
}
int MQTTPacket_decodeBuf(char* buf, int* value)
{
bufptr = buf;
return MQTTPacket_VBIdecode(bufchar, value);
}
/*******************************************************************************
* Copyright (c) 2017, 2018 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Ian Craggs - initial API and implementation and/or initial documentation
*******************************************************************************/
#if !defined(MQTTV5PACKET_H)
#define MQTTV5PACKET_H
#include "MQTTV5Properties.h"
enum errors
{
MQTTPACKET_BUFFER_TOO_SHORT = -2,
MQTTPACKET_READ_ERROR = -1,
MQTTPACKET_READ_COMPLETE
};
void writeInt4(char** pptr, int anInt);
int readInt4(char** pptr);
void writeMQTTLenString(char** pptr, MQTTLenString lenstring);
int MQTTLenStringRead(MQTTLenString* lenstring, char** pptr, char* enddata);
int MQTTPacket_VBIlen(int rem_len);
int MQTTPacket_decodeBuf(char* buf, int* value);
#endif /* MQTTV5PACKET_H */
/*******************************************************************************
* Copyright (c) 2017, 2018 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Ian Craggs - initial API and implementation and/or initial documentation
*******************************************************************************/
#include "MQTTV5Properties.h"
#include "MQTTPacket.h"
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
struct nameToType
{
enum PropertyNames name;
enum PropertyTypes type;
} namesToTypes[] =
{
{PAYLOAD_FORMAT_INDICATOR, BYTE},
{MESSAGE_EXPIRY_INTERVAL, FOUR_BYTE_INTEGER},
{CONTENT_TYPE, UTF_8_ENCODED_STRING},
{RESPONSE_TOPIC, UTF_8_ENCODED_STRING},
{CORRELATION_DATA, BINARY_DATA},
{SUBSCRIPTION_IDENTIFIER, VARIABLE_BYTE_INTEGER},
{SESSION_EXPIRY_INTERVAL, FOUR_BYTE_INTEGER},
{ASSIGNED_CLIENT_IDENTIFER, UTF_8_ENCODED_STRING},
{SERVER_KEEP_ALIVE, TWO_BYTE_INTEGER},
{AUTHENTICATION_METHOD, UTF_8_ENCODED_STRING},
{AUTHENTICATION_DATA, BINARY_DATA},
{REQUEST_PROBLEM_INFORMATION, BYTE},
{WILL_DELAY_INTERVAL, FOUR_BYTE_INTEGER},
{REQUEST_RESPONSE_INFORMATION, BYTE},
{RESPONSE_INFORMATION, UTF_8_ENCODED_STRING},
{SERVER_REFERENCE, UTF_8_ENCODED_STRING},
{REASON_STRING, UTF_8_ENCODED_STRING},
{RECEIVE_MAXIMUM, TWO_BYTE_INTEGER},
{TOPIC_ALIAS_MAXIMUM, TWO_BYTE_INTEGER},
{TOPIC_ALIAS, TWO_BYTE_INTEGER},
{MAXIMUM_QOS, BYTE},
{RETAIN_AVAILABLE, BYTE},
{USER_PROPERTY, UTF_8_STRING_PAIR},
{MAXIMUM_PACKET_SIZE, FOUR_BYTE_INTEGER},
{WILDCARD_SUBSCRIPTION_AVAILABLE, BYTE},
{SUBSCRIPTION_IDENTIFIER_AVAILABLE, BYTE},
{SHARED_SUBSCRIPTION_AVAILABLE, BYTE}
};
int MQTTProperty_getType(int identifier)
{
int i, rc = -1;
for (i = 0; i < ARRAY_SIZE(namesToTypes); ++i)
{
if (namesToTypes[i].name == identifier)
{
rc = namesToTypes[i].type;
break;
}
}
return rc;
}
int MQTTProperties_len(MQTTProperties* props)
{
/* properties length is an mbi */
return props->length + MQTTPacket_VBIlen(props->length);
}
int MQTTProperties_add(MQTTProperties* props, MQTTProperty* prop)
{
int rc = 0, type;
if (props->count == props->max_count)
rc = -1; /* max number of properties already in structure */
else if ((type = MQTTProperty_getType(prop->identifier)) < 0)
rc = -2;
else
{
int len = 0;
props->array[props->count++] = *prop;
/* calculate length */
switch (type)
{
case BYTE:
len = 1;
break;
case TWO_BYTE_INTEGER:
len = 2;
break;
case FOUR_BYTE_INTEGER:
len = 4;
break;
case VARIABLE_BYTE_INTEGER:
len = MQTTPacket_VBIlen(prop->value.integer4);
break;
case BINARY_DATA:
case UTF_8_ENCODED_STRING:
len = 2 + prop->value.data.len;
break;
case UTF_8_STRING_PAIR:
len = 2 + prop->value.data.len;
len += 2 + prop->value.value.len;
break;
}
props->length += len + 1; /* add identifier byte */
}
return rc;
}
int MQTTProperty_write(char** pptr, MQTTProperty* prop)
{
int rc = -1,
type = -1;
type = MQTTProperty_getType(prop->identifier);
if (type >= BYTE && type <= UTF_8_STRING_PAIR)
{
writeChar(pptr, prop->identifier);
switch (type)
{
case BYTE:
writeChar(pptr, prop->value.byte);
rc = 1;
break;
case TWO_BYTE_INTEGER:
writeInt(pptr, prop->value.integer2);
rc = 2;
break;
case FOUR_BYTE_INTEGER:
writeInt4(pptr, prop->value.integer4);
rc = 4;
break;
case VARIABLE_BYTE_INTEGER:
rc = MQTTPacket_encode(*pptr, prop->value.integer4);
break;
case BINARY_DATA:
case UTF_8_ENCODED_STRING:
writeMQTTLenString(pptr, prop->value.data);
rc = prop->value.data.len + 2; /* include length field */
break;
case UTF_8_STRING_PAIR:
writeMQTTLenString(pptr, prop->value.data);
writeMQTTLenString(pptr, prop->value.value);
rc = prop->value.data.len + prop->value.value.len + 4; /* include length fields */
break;
}
}
return rc + 1; /* include identifier byte */
}
/**
* write the supplied properties into a packet buffer
* @param pptr pointer to the buffer - move the pointer as we add data
* @param remlength the max length of the buffer
* @return whether the write succeeded or not, number of bytes written or < 0
*/
int MQTTProperties_write(char** pptr, MQTTProperties* properties)
{
int rc = -1;
int i = 0, len = 0;
/* write the entire property list length first */
*pptr += MQTTPacket_encode(*pptr, properties->length);
len = rc = 1;
for (i = 0; i < properties->count; ++i)
{
rc = MQTTProperty_write(pptr, &properties->array[i]);
if (rc < 0)
break;
else
len += rc;
}
if (rc >= 0)
rc = len;
return rc;
}
int MQTTProperty_read(MQTTProperty* prop, char** pptr, char* enddata)
{
int type = -1,
len = 0;
prop->identifier = readChar(pptr);
type = MQTTProperty_getType(prop->identifier);
if (type >= BYTE && type <= UTF_8_STRING_PAIR)
{
switch (type)
{
case BYTE:
prop->value.byte = readChar(pptr);
len = 1;
break;
case TWO_BYTE_INTEGER:
prop->value.integer2 = readInt(pptr);
len = 2;
break;
case FOUR_BYTE_INTEGER:
prop->value.integer4 = readInt4(pptr);
len = 4;
break;
case VARIABLE_BYTE_INTEGER:
len = MQTTPacket_decodeBuf(*pptr, &prop->value.integer4);
*pptr += len;
break;
case BINARY_DATA:
case UTF_8_ENCODED_STRING:
len = MQTTLenStringRead(&prop->value.data, pptr, enddata);
break;
case UTF_8_STRING_PAIR:
len = MQTTLenStringRead(&prop->value.data, pptr, enddata);
len += MQTTLenStringRead(&prop->value.value, pptr, enddata);
break;
}
}
return len + 1; /* 1 byte for identifier */
}
int MQTTProperties_read(MQTTProperties* properties, char** pptr, char* enddata)
{
int rc = 0;
int remlength = 0;
properties->count = 0;
if (enddata - (*pptr) > 0) /* enough length to read the VBI? */
{
*pptr += MQTTPacket_decodeBuf(*pptr, &remlength);
properties->length = remlength;
while (properties->count < properties->max_count && remlength > 0)
{
remlength -= MQTTProperty_read(&properties->array[properties->count], pptr, enddata);
properties->count++;
}
if (remlength == 0)
rc = 1; /* data read successfully */
}
return rc;
}
/*******************************************************************************
* Copyright (c) 2017, 2018 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Ian Craggs - initial API and implementation and/or initial documentation
*******************************************************************************/
#if !defined(MQTTPROPERTIES_H)
#define MQTTPROPERTIES_H
typedef struct
{
int len;
char* data;
} MQTTLenString;
enum PropertyNames {
PAYLOAD_FORMAT_INDICATOR = 1,
MESSAGE_EXPIRY_INTERVAL = 2,
CONTENT_TYPE = 3,
RESPONSE_TOPIC = 8,
CORRELATION_DATA = 9,
SUBSCRIPTION_IDENTIFIER = 11,
SESSION_EXPIRY_INTERVAL = 17,
ASSIGNED_CLIENT_IDENTIFER = 18,
SERVER_KEEP_ALIVE = 19,
AUTHENTICATION_METHOD = 21,
AUTHENTICATION_DATA = 22,
REQUEST_PROBLEM_INFORMATION = 23,
WILL_DELAY_INTERVAL = 24,
REQUEST_RESPONSE_INFORMATION = 25,
RESPONSE_INFORMATION = 26,
SERVER_REFERENCE = 28,
REASON_STRING = 31,
RECEIVE_MAXIMUM = 33,
TOPIC_ALIAS_MAXIMUM = 34,
TOPIC_ALIAS = 35,
MAXIMUM_QOS = 36,
RETAIN_AVAILABLE = 37,
USER_PROPERTY = 38,
MAXIMUM_PACKET_SIZE = 39,
WILDCARD_SUBSCRIPTION_AVAILABLE = 40,
SUBSCRIPTION_IDENTIFIER_AVAILABLE = 41,
SHARED_SUBSCRIPTION_AVAILABLE = 42
};
enum PropertyTypes {
BYTE,
TWO_BYTE_INTEGER,
FOUR_BYTE_INTEGER,
VARIABLE_BYTE_INTEGER,
BINARY_DATA,
UTF_8_ENCODED_STRING,
UTF_8_STRING_PAIR
};
typedef struct
{
int identifier; /* mbi */
union {
char byte;
short integer2;
int integer4;
MQTTLenString data;
MQTTLenString value; /* for user properties */
} value;
} MQTTProperty;
typedef struct MQTTProperties
{
int count; /* number of property entries */
int max_count;
int length; /* mbi: byte length of all properties */
MQTTProperty *array; /* array of properties */
} MQTTProperties;
#define MQTTProperties_initializer {0, 0, 0, NULL}
int MQTTProperties_len(MQTTProperties* props);
/**
* Add the property pointer to the property array, no allocation, just a reference
* @param props
* @param prop
* @return whether the write succeeded or not, number of bytes written or < 0
*/
int MQTTProperties_add(MQTTProperties* props, MQTTProperty* prop);
int MQTTProperties_write(char** pptr, MQTTProperties* properties);
int MQTTProperties_read(MQTTProperties* properties, char** pptr, char* enddata);
#endif /* MQTTPROPERTIES_H */
/*******************************************************************************
* Copyright (c) 2017, 2018 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Ian Craggs - initial API and implementation and/or initial documentation
*******************************************************************************/
enum ReasonCodes {
SUCCESS = 0,
NORMAL_DISCONNECTION = 0,
GRANTED_QOS_0 = 0,
GRANTED_QOS_1 = 1,
GRANTED_QOS_2 = 2,
DISCONNECT_WITH_WILL_MESSAGE = 4,
NO_MATCHING_SUBSCRIBERS = 16,
NO_SUBSCRIPTION_FOUND = 17,
CONTINUE_AUTHENTICATION = 24,
RE_AUTHENTICATE = 25,
UNSPECIFIED_ERROR = 128,
MALFORMED_PACKET = 129,
PROTOCOL_ERROR = 130,
IMPLEMENTATION_SPECIFIC_ERROR = 131,
UNSUPPORTED_PROTOCOL_VERSION = 132,
CLIENT_IDENTIFIER_NOT_VALID = 133,
BAD_USER_NAME_OR_PASSWORD = 134,
NOT_AUTHORIZED = 135,
SERVER_UNAVAILABLE = 136,
SERVER_BUSY = 137,
BANNED = 138,
SERVER_SHUTTING_DOWN = 139,
BAD_AUTHENTICATION_METHOD = 140,
KEEP_ALIVE_TIMEOUT = 141,
SESSION_TAKEN_OVER = 142,
TOPIC_FILTER_INVALID = 143,
TOPIC_NAME_INVALID = 144,
PACKET_IDENTIFIER_IN_USE = 145,
PACKET_IDENTIFIER_NOT_FOUND = 146,
RECEIVE_MAXIMUM_EXCEEDED = 147,
TOPIC_ALIAS_INVALID = 148,
PACKET_TOO_LARGE = 149,
MESSAGE_RATE_TOO_HIGH = 150,
QUOTA_EXCEEDED = 151,
ADMINISTRATIVE_ACTION = 152,
PAYLOAD_FORMAT_INVALID = 153,
RETAIN_NOT_SUPPORTED = 154,
QOS_NOT_SUPPORTED = 155,
USE_ANOTHER_SERVER = 156,
SERVER_MOVED = 157,
SHARED_SUBSCRIPTION_NOT_SUPPORTED = 158,
CONNECTION_RATE_EXCEEDED = 159,
MAXIMUM_CONNECT_TIME = 160,
SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED = 161,
WILDCARD_SUBSCRIPTION_NOT_SUPPORTED = 162
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment