From b10f49b52cdca554f48d3c5f71f98492dfa85725 Mon Sep 17 00:00:00 2001 From: Feng Lee Date: Sat, 25 Aug 2018 11:49:19 +0800 Subject: [PATCH] Add CONNACK macros for MQTT V3.1.1 --- include/emqx_mqtt.hrl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/include/emqx_mqtt.hrl b/include/emqx_mqtt.hrl index e429aa4a3..1d69ac365 100644 --- a/include/emqx_mqtt.hrl +++ b/include/emqx_mqtt.hrl @@ -140,7 +140,20 @@ -type(mqtt_packet_type() :: ?RESERVED..?AUTH). %%-------------------------------------------------------------------- -%% MQTT Reason Codes +%% MQTT V3.1.1 Connect Return Codes +%%-------------------------------------------------------------------- + +-define(CONNACK_ACCEPT, 0). %% Connection accepted +-define(CONNACK_PROTO_VER, 1). %% Unacceptable protocol version +-define(CONNACK_INVALID_ID, 2). %% Client Identifier is correct UTF-8 but not allowed by the Server +-define(CONNACK_SERVER, 3). %% Server unavailable +-define(CONNACK_CREDENTIALS, 4). %% Username or password is malformed +-define(CONNACK_AUTH, 5). %% Client is not authorized to connect + +-type(mqtt_connack() :: ?CONNACK_ACCEPT..?CONNACK_AUTH). + +%%-------------------------------------------------------------------- +%% MQTT V5.0 Reason Codes %%-------------------------------------------------------------------- -define(RC_SUCCESS, 16#00).