emqx_placeholder.hrl 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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_PLACEHOLDER_HRL).
  17. -define(EMQX_PLACEHOLDER_HRL, true).
  18. -define(PH_VAR_THIS, <<"$_THIS_">>).
  19. -define(PH(Type), <<"${", Type/binary, "}">>).
  20. %% action: publish/subscribe
  21. -define(PH_ACTION, <<"${action}">>).
  22. %% cert
  23. -define(PH_CERT_SUBJECT, <<"${cert_subject}">>).
  24. -define(PH_CERT_CN_NAME, <<"${cert_common_name}">>).
  25. %% MQTT
  26. -define(PH_PASSWORD, <<"${password}">>).
  27. -define(PH_CLIENTID, <<"${clientid}">>).
  28. -define(PH_FROM_CLIENTID, <<"${from_clientid}">>).
  29. -define(PH_USERNAME, <<"${username}">>).
  30. -define(PH_FROM_USERNAME, <<"${from_username}">>).
  31. -define(PH_TOPIC, <<"${topic}">>).
  32. %% MQTT payload
  33. -define(PH_PAYLOAD, <<"${payload}">>).
  34. %% client IPAddress
  35. -define(PH_PEERHOST, <<"${peerhost}">>).
  36. %% ip & port
  37. -define(PH_HOST, <<"${host}">>).
  38. -define(PH_PORT, <<"${port}">>).
  39. %% Enumeration of message QoS 0,1,2
  40. -define(PH_QOS, <<"${qos}">>).
  41. -define(PH_FLAGS, <<"${flags}">>).
  42. %% Additional data related to process within the MQTT message
  43. -define(PH_HEADERS, <<"${headers}">>).
  44. %% protocol name
  45. -define(PH_PROTONAME, <<"${proto_name}">>).
  46. %% protocol version
  47. -define(PH_PROTOVER, <<"${proto_ver}">>).
  48. %% MQTT keepalive interval
  49. -define(PH_KEEPALIVE, <<"${keepalive}">>).
  50. %% MQTT clean_start
  51. -define(PH_CLEAR_START, <<"${clean_start}">>).
  52. %% MQTT Session Expiration time
  53. -define(PH_EXPIRY_INTERVAL, <<"${expiry_interval}">>).
  54. %% Time when PUBLISH message reaches Broker (ms)
  55. -define(PH_PUBLISH_RECEIVED_AT, <<"${publish_received_at}">>).
  56. %% Mountpoint for bridging messages
  57. -define(PH_MOUNTPOINT, <<"${mountpoint}">>).
  58. %% IPAddress and Port of terminal
  59. -define(PH_PEERNAME, <<"${peername}">>).
  60. %% IPAddress and Port listened by emqx
  61. -define(PH_SOCKNAME, <<"${sockname}">>).
  62. %% whether it is MQTT bridge connection
  63. -define(PH_IS_BRIDGE, <<"${is_bridge}">>).
  64. %% Terminal connection completion time (s)
  65. -define(PH_CONNECTED_AT, <<"${connected_at}">>).
  66. %% Event trigger time(millisecond)
  67. -define(PH_TIMESTAMP, <<"${timestamp}">>).
  68. %% Terminal disconnection completion time (s)
  69. -define(PH_DISCONNECTED_AT, <<"${disconnected_at}">>).
  70. -define(PH_NODE, <<"${node}">>).
  71. -define(PH_REASON, <<"${reason}">>).
  72. -define(PH_ENDPOINT_NAME, <<"${endpoint_name}">>).
  73. -define(PH_RETAIN, <<"${retain}">>).
  74. %% sync change these place holder with binary def.
  75. -define(PH_S_ACTION, "${action}").
  76. -define(PH_S_CERT_SUBJECT, "${cert_subject}").
  77. -define(PH_S_CERT_CN_NAME, "${cert_common_name}").
  78. -define(PH_S_PASSWORD, "${password}").
  79. -define(PH_S_CLIENTID, "${clientid}").
  80. -define(PH_S_FROM_CLIENTID, "${from_clientid}").
  81. -define(PH_S_USERNAME, "${username}").
  82. -define(PH_S_FROM_USERNAME, "${from_username}").
  83. -define(PH_S_TOPIC, "${topic}").
  84. -define(PH_S_PAYLOAD, "${payload}").
  85. -define(PH_S_PEERHOST, "${peerhost}").
  86. -define(PH_S_HOST, "${host}").
  87. -define(PH_S_PORT, "${port}").
  88. -define(PH_S_QOS, "${qos}").
  89. -define(PH_S_FLAGS, "${flags}").
  90. -define(PH_S_HEADERS, "${headers}").
  91. -define(PH_S_PROTONAME, "${proto_name}").
  92. -define(PH_S_PROTOVER, "${proto_ver}").
  93. -define(PH_S_KEEPALIVE, "${keepalive}").
  94. -define(PH_S_CLEAR_START, "${clean_start}").
  95. -define(PH_S_EXPIRY_INTERVAL, "${expiry_interval}").
  96. -define(PH_S_PUBLISH_RECEIVED_AT, "${publish_received_at}").
  97. -define(PH_S_MOUNTPOINT, "${mountpoint}").
  98. -define(PH_S_PEERNAME, "${peername}").
  99. -define(PH_S_SOCKNAME, "${sockname}").
  100. -define(PH_S_IS_BRIDGE, "${is_bridge}").
  101. -define(PH_S_CONNECTED_AT, "${connected_at}").
  102. -define(PH_S_TIMESTAMP, "${timestamp}").
  103. -define(PH_S_DISCONNECTED_AT, "${disconnected_at}").
  104. -define(PH_S_NODE, "${node}").
  105. -define(PH_S_REASON, "${reason}").
  106. -define(PH_S_ENDPOINT_NAME, "${endpoint_name}").
  107. -define(PH_S_RETAIN, "${retain}").
  108. -endif.