Просмотр исходного кода

Add CONNACK macros for MQTT V3.1.1

Feng Lee 7 лет назад
Родитель
Сommit
b10f49b52c
1 измененных файлов с 14 добавлено и 1 удалено
  1. 14 1
      include/emqx_mqtt.hrl

+ 14 - 1
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).