emqx.hrl 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. %%--------------------------------------------------------------------
  2. %% Copyright (c) 2017-2024 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. %%--------------------------------------------------------------------
  35. %% alarms
  36. %%--------------------------------------------------------------------
  37. -define(ACTIVATED_ALARM, emqx_activated_alarm).
  38. -define(DEACTIVATED_ALARM, emqx_deactivated_alarm).
  39. -define(TRIE, emqx_trie).
  40. %%--------------------------------------------------------------------
  41. %% Message and Delivery
  42. %%--------------------------------------------------------------------
  43. -record(subscription, {topic, subid, subopts}).
  44. -include_lib("emqx_utils/include/emqx_message.hrl").
  45. -record(delivery, {
  46. %% Sender of the delivery
  47. sender :: pid(),
  48. %% The message delivered
  49. message :: #message{}
  50. }).
  51. %%--------------------------------------------------------------------
  52. %% Route
  53. %%--------------------------------------------------------------------
  54. -record(route, {
  55. topic :: binary(),
  56. dest :: node() | {binary(), node()} | emqx_session:session_id()
  57. }).
  58. %%--------------------------------------------------------------------
  59. %% Command
  60. %%--------------------------------------------------------------------
  61. -record(command, {
  62. name :: atom(),
  63. action :: atom(),
  64. args = [] :: list(),
  65. opts = [] :: list(),
  66. usage :: string(),
  67. descr :: string()
  68. }).
  69. %%--------------------------------------------------------------------
  70. %% Banned
  71. %%--------------------------------------------------------------------
  72. -record(banned, {
  73. who :: emqx_types:banned_who(),
  74. by :: binary(),
  75. reason :: binary(),
  76. at :: integer(),
  77. until :: integer()
  78. }).
  79. -endif.