retain_t.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright Takatoshi Kondo 2020
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. #if !defined(MQTT_BROKER_RETAIN_T_HPP)
  7. #define MQTT_BROKER_RETAIN_T_HPP
  8. #include <mqtt/config.hpp>
  9. #include <boost/asio/steady_timer.hpp>
  10. #include <mqtt/broker/broker_namespace.hpp>
  11. #include <mqtt/buffer.hpp>
  12. #include <mqtt/property_variant.hpp>
  13. #include <mqtt/subscribe_options.hpp>
  14. MQTT_BROKER_NS_BEGIN
  15. struct session_state;
  16. // A collection of messages that have been retained in
  17. // case clients add a new subscription to the associated topics.
  18. struct retain_t {
  19. retain_t(
  20. buffer topic,
  21. buffer contents,
  22. v5::properties props,
  23. qos qos_value,
  24. std::shared_ptr<as::steady_timer> tim_message_expiry = std::shared_ptr<as::steady_timer>())
  25. :topic(force_move(topic)),
  26. contents(force_move(contents)),
  27. props(force_move(props)),
  28. qos_value(qos_value),
  29. tim_message_expiry(force_move(tim_message_expiry))
  30. { }
  31. buffer topic;
  32. buffer contents;
  33. v5::properties props;
  34. qos qos_value;
  35. std::shared_ptr<as::steady_timer> tim_message_expiry;
  36. };
  37. MQTT_BROKER_NS_END
  38. #endif // MQTT_BROKER_RETAIN_T_HPP