aop_auth.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (c) 2017-2023 zhllxt
  3. *
  4. * author : zhllxt
  5. * email : 37792738@qq.com
  6. *
  7. * Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. */
  10. #ifndef __ASIO2_MQTT_AOP_AUTH_HPP__
  11. #define __ASIO2_MQTT_AOP_AUTH_HPP__
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. #pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <asio2/base/iopool.hpp>
  16. #include <asio2/base/detail/function_traits.hpp>
  17. #include <asio2/base/detail/util.hpp>
  18. #include <asio2/mqtt/message.hpp>
  19. namespace asio2::detail
  20. {
  21. template<class caller_t, class args_t>
  22. class mqtt_aop_auth
  23. {
  24. friend caller_t;
  25. protected:
  26. // must be server
  27. inline void _before_user_callback_impl(
  28. error_code& ec, std::shared_ptr<caller_t>& caller_ptr, caller_t* caller, mqtt::message& om,
  29. mqtt::v5::auth& msg, mqtt::v5::connack& rep)
  30. {
  31. detail::ignore_unused(ec, caller_ptr, caller, om, msg, rep);
  32. }
  33. // server or client
  34. inline void _before_user_callback_impl(
  35. error_code& ec, std::shared_ptr<caller_t>& caller_ptr, caller_t* caller, mqtt::message& om,
  36. mqtt::v5::auth& msg, mqtt::v5::auth& rep)
  37. {
  38. detail::ignore_unused(ec, caller_ptr, caller, om, msg, rep);
  39. }
  40. inline void _after_user_callback_impl(
  41. error_code& ec, std::shared_ptr<caller_t>& caller_ptr, caller_t* caller, mqtt::message& om,
  42. mqtt::v5::auth& msg, mqtt::v5::connack& rep)
  43. {
  44. detail::ignore_unused(ec, caller_ptr, caller, om, msg, rep);
  45. }
  46. inline void _after_user_callback_impl(
  47. error_code& ec, std::shared_ptr<caller_t>& caller_ptr, caller_t* caller, mqtt::message& om,
  48. mqtt::v5::auth& msg, mqtt::v5::auth& rep)
  49. {
  50. detail::ignore_unused(ec, caller_ptr, caller, om, msg, rep);
  51. }
  52. };
  53. }
  54. #endif // !__ASIO2_MQTT_AOP_AUTH_HPP__