| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- %%--------------------------------------------------------------------
- %% Copyright (c) 2019 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.
- %%--------------------------------------------------------------------
- -ifndef(EMQ_X_HRL).
- -define(EMQ_X_HRL, true).
- %%--------------------------------------------------------------------
- %% Common
- %%--------------------------------------------------------------------
- -define(Otherwise, true).
- %%--------------------------------------------------------------------
- %% Banner
- %%--------------------------------------------------------------------
- -define(PROTOCOL_VERSION, "MQTT/5.0").
- -define(ERTS_MINIMUM_REQUIRED, "10.0").
- %%--------------------------------------------------------------------
- %% Configs
- %%--------------------------------------------------------------------
- -define(NO_PRIORITY_TABLE, none).
- %%--------------------------------------------------------------------
- %% Topics' prefix: $SYS | $queue | $share
- %%--------------------------------------------------------------------
- %% System topic
- -define(SYSTOP, <<"$SYS/">>).
- %% Queue topic
- -define(QUEUE, <<"$queue/">>).
- %%--------------------------------------------------------------------
- %% Message and Delivery
- %%--------------------------------------------------------------------
- -record(subscription, {topic, subid, subopts}).
- %% See 'Application Message' in MQTT Version 5.0
- -record(message, {
- %% Global unique message ID
- id :: binary(),
- %% Message QoS
- qos = 0,
- %% Message from
- from :: atom() | binary(),
- %% Message flags
- flags :: #{atom() => boolean()},
- %% Message headers, or MQTT 5.0 Properties
- headers = #{},
- %% Topic that the message is published to
- topic :: binary(),
- %% Message Payload
- payload :: binary(),
- %% Timestamp
- timestamp :: erlang:timestamp()
- }).
- -record(delivery, {
- sender :: pid(), %% Sender of the delivery
- message :: #message{} %% The message delivered
- }).
- %%--------------------------------------------------------------------
- %% Route
- %%--------------------------------------------------------------------
- -record(route, {
- topic :: binary(),
- dest :: node() | {binary(), node()}
- }).
- %%--------------------------------------------------------------------
- %% Trie
- %%--------------------------------------------------------------------
- -type(trie_node_id() :: binary() | atom()).
- -record(trie_node, {
- node_id :: trie_node_id(),
- edge_count = 0 :: non_neg_integer(),
- topic :: binary() | undefined,
- flags :: list(atom())
- }).
- -record(trie_edge, {
- node_id :: trie_node_id(),
- word :: binary() | atom()
- }).
- -record(trie, {
- edge :: #trie_edge{},
- node_id :: trie_node_id()
- }).
- %%--------------------------------------------------------------------
- %% Alarm
- %%--------------------------------------------------------------------
- -record(alarm, {
- id :: binary(),
- severity :: notice | warning | error | critical,
- title :: iolist(),
- summary :: iolist(),
- timestamp :: erlang:timestamp()
- }).
- %%--------------------------------------------------------------------
- %% Plugin
- %%--------------------------------------------------------------------
- -record(plugin, {
- name :: atom(),
- version :: string(),
- dir :: string(),
- descr :: string(),
- vendor :: string(),
- active = false :: boolean(),
- info :: map(),
- type :: atom()
- }).
- %%--------------------------------------------------------------------
- %% Command
- %%--------------------------------------------------------------------
- -record(command, {
- name :: atom(),
- action :: atom(),
- args = [] :: list(),
- opts = [] :: list(),
- usage :: string(),
- descr :: string()
- }).
- %%--------------------------------------------------------------------
- %% Banned
- %%--------------------------------------------------------------------
- -type(banned_who() :: {client_id, binary()}
- | {username, binary()}
- | {ip_address, inet:ip_address()}).
- -record(banned, {
- who :: banned_who(),
- reason :: binary(),
- by :: binary(),
- desc :: binary(),
- until :: integer()
- }).
- -endif.
|