emqx.hrl 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. %%--------------------------------------------------------------------
  2. %% Copyright (c) 2017-2023 EMQ Technologies Co., Ltd. All Rights Reserved.
  3. %%
  4. %% Licensed under the Apache License, Version 2.0 (the "License");
  5. %% you may not use this file except in compliance with the License.
  6. %% You may obtain a copy of the License at
  7. %%
  8. %% http://www.apache.org/licenses/LICENSE-2.0
  9. %%
  10. %% Unless required by applicable law or agreed to in writing, software
  11. %% distributed under the License is distributed on an "AS IS" BASIS,
  12. %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. %% See the License for the specific language governing permissions and
  14. %% limitations under the License.
  15. %%--------------------------------------------------------------------
  16. -ifndef(EMQX_HRL).
  17. -define(EMQX_HRL, true).
  18. %% Shard
  19. %%--------------------------------------------------------------------
  20. -define(COMMON_SHARD, emqx_common_shard).
  21. -define(SHARED_SUB_SHARD, emqx_shared_sub_shard).
  22. -define(CM_SHARD, emqx_cm_shard).
  23. -define(ROUTE_SHARD, route_shard).
  24. -define(PS_ROUTER_SHARD, persistent_session_router_shard).
  25. %% Banner
  26. %%--------------------------------------------------------------------
  27. -define(PROTOCOL_VERSION, "MQTT/5.0").
  28. -define(ERTS_MINIMUM_REQUIRED, "10.0").
  29. %%--------------------------------------------------------------------
  30. %% Topics' prefix: $SYS | $queue | $share
  31. %%--------------------------------------------------------------------
  32. %% System topic
  33. -define(SYSTOP, <<"$SYS/">>).
  34. %% Queue topic
  35. -define(QUEUE, <<"$queue/">>).
  36. %%--------------------------------------------------------------------
  37. %% alarms
  38. %%--------------------------------------------------------------------
  39. -define(ACTIVATED_ALARM, emqx_activated_alarm).
  40. -define(DEACTIVATED_ALARM, emqx_deactivated_alarm).
  41. -define(TRIE, emqx_trie).
  42. %%--------------------------------------------------------------------
  43. %% Message and Delivery
  44. %%--------------------------------------------------------------------
  45. -record(subscription, {topic, subid, subopts}).
  46. -include_lib("emqx_utils/include/emqx_message.hrl").
  47. -record(delivery, {
  48. %% Sender of the delivery
  49. sender :: pid(),
  50. %% The message delivered
  51. message :: #message{}
  52. }).
  53. %%--------------------------------------------------------------------
  54. %% Route
  55. %%--------------------------------------------------------------------
  56. -record(route, {
  57. topic :: binary(),
  58. dest :: node() | {binary(), node()} | emqx_session:session_id()
  59. }).
  60. %%--------------------------------------------------------------------
  61. %% Command
  62. %%--------------------------------------------------------------------
  63. -record(command, {
  64. name :: atom(),
  65. action :: atom(),
  66. args = [] :: list(),
  67. opts = [] :: list(),
  68. usage :: string(),
  69. descr :: string()
  70. }).
  71. %%--------------------------------------------------------------------
  72. %% Banned
  73. %%--------------------------------------------------------------------
  74. -record(banned, {
  75. who ::
  76. {clientid, binary()}
  77. | {peerhost, inet:ip_address()}
  78. | {username, binary()},
  79. by :: binary(),
  80. reason :: binary(),
  81. at :: integer(),
  82. until :: integer()
  83. }).
  84. -endif.