emqttd_acl_mod.erl 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. %%--------------------------------------------------------------------
  2. %% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>.
  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. -module(emqttd_acl_mod).
  17. -include("emqttd.hrl").
  18. %%--------------------------------------------------------------------
  19. %% ACL behavihour
  20. %%--------------------------------------------------------------------
  21. -ifdef(use_specs).
  22. -callback(init(AclOpts :: list()) -> {ok, State :: any()}).
  23. -callback(check_acl({Client, PubSub, Topic}, State :: any()) -> allow | deny | ignore when
  24. Client :: mqtt_client(),
  25. PubSub :: pubsub(),
  26. Topic :: binary()).
  27. -callback(reload_acl(State :: any()) -> ok | {error, any()}).
  28. -callback(description() -> string()).
  29. -else.
  30. -export([behaviour_info/1]).
  31. behaviour_info(callbacks) ->
  32. [{init, 1}, {check_acl, 2}, {reload_acl, 1}, {description, 0}];
  33. behaviour_info(_Other) ->
  34. undefined.
  35. -endif.