Upgrade header files for EMQ X 3.0
This commit is contained in:
parent
b3adcc8971
commit
b110a154ef
10
Makefile
10
Makefile
|
@ -4,9 +4,7 @@ PROJECT = emqx
|
||||||
PROJECT_DESCRIPTION = EMQ X Broker
|
PROJECT_DESCRIPTION = EMQ X Broker
|
||||||
PROJECT_VERSION = 3.0
|
PROJECT_VERSION = 3.0
|
||||||
|
|
||||||
NO_AUTOPATCH = gen_rpc cuttlefish
|
DEPS = goldrush gproc lager esockd ekka mochiweb pbkdf2 lager_syslog bcrypt clique jsx
|
||||||
|
|
||||||
DEPS = goldrush gproc lager esockd ekka mochiweb pbkdf2 lager_syslog bcrypt clique jsx canal_lock
|
|
||||||
|
|
||||||
dep_goldrush = git https://github.com/basho/goldrush 0.1.9
|
dep_goldrush = git https://github.com/basho/goldrush 0.1.9
|
||||||
dep_gproc = git https://github.com/uwiger/gproc 0.7.0
|
dep_gproc = git https://github.com/uwiger/gproc 0.7.0
|
||||||
|
@ -19,9 +17,9 @@ dep_ekka = git https://github.com/emqtt/ekka develop
|
||||||
dep_mochiweb = git https://github.com/emqtt/mochiweb emqx30
|
dep_mochiweb = git https://github.com/emqtt/mochiweb emqx30
|
||||||
dep_pbkdf2 = git https://github.com/emqtt/pbkdf2 2.0.1
|
dep_pbkdf2 = git https://github.com/emqtt/pbkdf2 2.0.1
|
||||||
dep_bcrypt = git https://github.com/smarkets/erlang-bcrypt master
|
dep_bcrypt = git https://github.com/smarkets/erlang-bcrypt master
|
||||||
dep_clique = git https://github.com/emqtt/clique
|
dep_clique = git https://github.com/emqx/clique
|
||||||
dep_clique = git https://github.com/emqtt/clique
|
|
||||||
dep_canal_lock = git https://github.com/emqx/canal-lock
|
NO_AUTOPATCH = gen_rpc cuttlefish
|
||||||
|
|
||||||
ERLC_OPTS += +debug_info
|
ERLC_OPTS += +debug_info
|
||||||
ERLC_OPTS += +'{parse_transform, lager_transform}'
|
ERLC_OPTS += +'{parse_transform, lager_transform}'
|
||||||
|
|
5
TODO
5
TODO
|
@ -1,2 +1,5 @@
|
||||||
|
|
||||||
1. Update the README.md
|
1. Update the README.md
|
||||||
2. Update the documentation
|
2. Update the Documentation
|
||||||
|
3. Shared subscription strategy and dispatch strategy
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -1,30 +1,28 @@
|
||||||
%%%===================================================================
|
%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||||
%%% Copyright (c) 2013-2018 EMQ Inc. All rights reserved.
|
%%
|
||||||
%%%
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% you may not use this file except in compliance with the License.
|
||||||
%%% you may not use this file except in compliance with the License.
|
%% You may obtain a copy of the License at
|
||||||
%%% You may obtain a copy of the License at
|
%%
|
||||||
%%%
|
%% http://www.apache.org/licenses/LICENSE-2.0
|
||||||
%%% http://www.apache.org/licenses/LICENSE-2.0
|
%%
|
||||||
%%%
|
%% Unless required by applicable law or agreed to in writing, software
|
||||||
%%% Unless required by applicable law or agreed to in writing, software
|
%% distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
%%% distributed under the License is distributed on an "AS IS" BASIS,
|
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
%%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
%% See the License for the specific language governing permissions and
|
||||||
%%% See the License for the specific language governing permissions and
|
%% limitations under the License.
|
||||||
%%% limitations under the License.
|
|
||||||
%%%===================================================================
|
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Banner
|
%% Banner
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
-define(COPYRIGHT, "Copyright (c) 2013-2018 EMQ Inc.").
|
-define(COPYRIGHT, "Copyright (c) 2018 EMQ Technologies Co., Ltd").
|
||||||
|
|
||||||
-define(LICENSE_MESSAGE, "Licensed under the Apache License, Version 2.0").
|
-define(LICENSE_MESSAGE, "Licensed under the Apache License, Version 2.0").
|
||||||
|
|
||||||
-define(PROTOCOL_VERSION, "MQTT/5.0").
|
-define(PROTOCOL_VERSION, "MQTT/5.0").
|
||||||
|
|
||||||
-define(ERTS_MINIMUM_REQUIRED, "9.2").
|
-define(ERTS_MINIMUM_REQUIRED, "10.0").
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Topics' prefix: $SYS | $queue | $share
|
%% Topics' prefix: $SYS | $queue | $share
|
||||||
|
@ -52,11 +50,9 @@
|
||||||
| {share, binary()}
|
| {share, binary()}
|
||||||
| {atom(), term()}).
|
| {atom(), term()}).
|
||||||
|
|
||||||
-record(subscription,
|
-record(subscription, {subid :: binary() | atom(),
|
||||||
{ subid :: binary() | atom(),
|
topic :: topic(),
|
||||||
topic :: topic(),
|
subopts :: list(suboption())}).
|
||||||
subopts :: list(suboption())
|
|
||||||
}).
|
|
||||||
|
|
||||||
-type(subscription() :: #subscription{}).
|
-type(subscription() :: #subscription{}).
|
||||||
|
|
||||||
|
@ -76,29 +72,20 @@
|
||||||
|
|
||||||
-type(mountpoint() :: binary()).
|
-type(mountpoint() :: binary()).
|
||||||
|
|
||||||
-type(connector() :: atom()).
|
-type(zone() :: undefined | atom()).
|
||||||
|
|
||||||
-type(zone() :: atom()).
|
-record(client, {id :: client_id(),
|
||||||
|
pid :: pid(),
|
||||||
-record(client,
|
zone :: zone(),
|
||||||
{ client_id :: client_id(),
|
peername :: peername(),
|
||||||
client_pid :: pid(),
|
username :: username(),
|
||||||
zone :: zone(),
|
protocol :: protocol(),
|
||||||
node :: node(),
|
attributes :: #{atom() => term()},
|
||||||
username :: username(),
|
connected_at :: erlang:timestamp()}).
|
||||||
peername :: peername(),
|
|
||||||
protocol :: protocol(),
|
|
||||||
connector :: connector(),
|
|
||||||
mountpoint :: mountpoint(),
|
|
||||||
attributes :: #{atom() => term()}
|
|
||||||
}).
|
|
||||||
|
|
||||||
-type(client() :: #client{}).
|
-type(client() :: #client{}).
|
||||||
|
|
||||||
-record(session,
|
-record(session, {sid :: client_id(), pid :: pid()}).
|
||||||
{ sid :: client_id(),
|
|
||||||
pid :: pid()
|
|
||||||
}).
|
|
||||||
|
|
||||||
-type(session() :: #session{}).
|
-type(session() :: #session{}).
|
||||||
|
|
||||||
|
@ -108,11 +95,12 @@
|
||||||
|
|
||||||
-type(message_id() :: binary() | undefined).
|
-type(message_id() :: binary() | undefined).
|
||||||
|
|
||||||
-type(message_flag() :: sys | dup | retain | atom()).
|
-type(message_flag() :: sys | qos | dup | retain | atom()).
|
||||||
|
|
||||||
-type(message_flags() :: #{message_flag() => boolean()}).
|
-type(message_flags() :: #{message_flag() => boolean() | integer()}).
|
||||||
|
|
||||||
-type(message_headers() :: #{packet_id => pos_integer(),
|
-type(message_headers() :: #{protocol => protocol(),
|
||||||
|
packet_id => pos_integer(),
|
||||||
priority => non_neg_integer(),
|
priority => non_neg_integer(),
|
||||||
ttl => pos_integer(),
|
ttl => pos_integer(),
|
||||||
atom() => term()}).
|
atom() => term()}).
|
||||||
|
@ -121,13 +109,13 @@
|
||||||
|
|
||||||
%% See 'Application Message' in MQTT Version 5.0
|
%% See 'Application Message' in MQTT Version 5.0
|
||||||
-record(message,
|
-record(message,
|
||||||
{ id :: message_id(), %% Global unique id
|
{ id :: message_id(), %% Message guid
|
||||||
qos :: qos(), %% Message QoS
|
qos :: qos(), %% Message qos
|
||||||
from :: atom() | client(), %% Message from
|
from :: atom() | client(), %% Message from
|
||||||
sender :: pid(), %% The pid of the sender/publisher
|
sender :: pid(), %% The pid of the sender/publisher
|
||||||
flags :: message_flags(), %% Message flags
|
flags :: message_flags(), %% Message flags
|
||||||
headers :: message_headers(), %% Message headers
|
headers :: message_headers(), %% Message headers
|
||||||
topic :: binary(), %% Message topic
|
topic :: topic(), %% Message topic
|
||||||
properties :: map(), %% Message user properties
|
properties :: map(), %% Message user properties
|
||||||
payload :: payload(), %% Message payload
|
payload :: payload(), %% Message payload
|
||||||
timestamp :: erlang:timestamp() %% Timestamp
|
timestamp :: erlang:timestamp() %% Timestamp
|
||||||
|
@ -136,8 +124,9 @@
|
||||||
-type(message() :: #message{}).
|
-type(message() :: #message{}).
|
||||||
|
|
||||||
-record(delivery,
|
-record(delivery,
|
||||||
{ message :: message(),
|
{ node :: node(), %% The node that created the delivery
|
||||||
flows :: list()
|
message :: message(), %% The message delivered
|
||||||
|
flows :: list() %% The message flow path
|
||||||
}).
|
}).
|
||||||
|
|
||||||
-type(delivery() :: #delivery{}).
|
-type(delivery() :: #delivery{}).
|
||||||
|
@ -219,12 +208,12 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
-record(command,
|
-record(command,
|
||||||
{ name,
|
{ name :: atom(),
|
||||||
action,
|
action :: atom(),
|
||||||
args = [],
|
args = [] :: list(),
|
||||||
opts = [],
|
opts = [] :: list(),
|
||||||
usage,
|
usage :: string(),
|
||||||
descr
|
descr :: string()
|
||||||
}).
|
}).
|
||||||
|
|
||||||
-type(command() :: #command{}).
|
-type(command() :: #command{}).
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
|
%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||||
|
%%
|
||||||
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
%% you may not use this file except in compliance with the License.
|
||||||
|
%% You may obtain a copy of the License at
|
||||||
|
%%
|
||||||
|
%% http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
%%
|
||||||
|
%% Unless required by applicable law or agreed to in writing, software
|
||||||
|
%% distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
%% See the License for the specific language governing permissions and
|
||||||
|
%% limitations under the License.
|
||||||
|
|
||||||
-define(record_to_map(Def, Rec),
|
-define(record_to_map(Def, Rec),
|
||||||
maps:from_list(?record_to_proplist(Def, Rec))).
|
maps:from_list(?record_to_proplist(Def, Rec))).
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
%%%===================================================================
|
%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||||
%%% Copyright (c) 2013-2018 EMQ Inc. All rights reserved.
|
%%
|
||||||
%%%
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% you may not use this file except in compliance with the License.
|
||||||
%%% you may not use this file except in compliance with the License.
|
%% You may obtain a copy of the License at
|
||||||
%%% You may obtain a copy of the License at
|
%%
|
||||||
%%%
|
%% http://www.apache.org/licenses/LICENSE-2.0
|
||||||
%%% http://www.apache.org/licenses/LICENSE-2.0
|
%%
|
||||||
%%%
|
%% Unless required by applicable law or agreed to in writing, software
|
||||||
%%% Unless required by applicable law or agreed to in writing, software
|
%% distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
%%% distributed under the License is distributed on an "AS IS" BASIS,
|
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
%%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
%% See the License for the specific language governing permissions and
|
||||||
%%% See the License for the specific language governing permissions and
|
%% limitations under the License.
|
||||||
%%% limitations under the License.
|
|
||||||
%%%===================================================================
|
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% MQTT SockOpts
|
%% MQTT SockOpts
|
||||||
|
@ -77,7 +75,7 @@
|
||||||
I =:= qos2; I =:= exactly_once)).
|
I =:= qos2; I =:= exactly_once)).
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Maximum ClientId Length. Why 1024?
|
%% Maximum ClientId Length.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
-define(MAX_CLIENTID_LEN, 1024).
|
-define(MAX_CLIENTID_LEN, 1024).
|
||||||
|
@ -199,7 +197,7 @@
|
||||||
-define(MAX_PACKET_SIZE, 16#fffffff).
|
-define(MAX_PACKET_SIZE, 16#fffffff).
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% MQTT Parser and Serializer
|
%% MQTT Frame Mask
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
-define(HIGHBIT, 2#10000000).
|
-define(HIGHBIT, 2#10000000).
|
||||||
|
@ -526,19 +524,5 @@
|
||||||
-type(mqtt_message() :: #mqtt_message{}).
|
-type(mqtt_message() :: #mqtt_message{}).
|
||||||
|
|
||||||
-define(WILL_MSG(Qos, Retain, Topic, Props, Payload),
|
-define(WILL_MSG(Qos, Retain, Topic, Props, Payload),
|
||||||
#mqtt_message{qos = WillQos, retain = WillRetain,
|
#mqtt_message{qos = Qos, retain = Retain, topic = Topic, properties = Props, payload = Payload}).
|
||||||
topic = WillTopic, properties = Props,
|
|
||||||
payload = WillPayload}).
|
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
|
||||||
%% MQTT Delivery
|
|
||||||
%%--------------------------------------------------------------------
|
|
||||||
|
|
||||||
-record(mqtt_delivery,
|
|
||||||
{ sender :: pid(),
|
|
||||||
message :: mqtt_message(),
|
|
||||||
flows :: list()
|
|
||||||
}).
|
|
||||||
|
|
||||||
-type(mqtt_delivery() :: #mqtt_delivery{}).
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue