fixed_header.hpp 562 B

123456789101112131415161718192021
  1. // Copyright Takatoshi Kondo 2015
  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_FIXED_HEADER_HPP)
  7. #define MQTT_FIXED_HEADER_HPP
  8. #include <mqtt/namespace.hpp>
  9. #include <mqtt/control_packet_type.hpp>
  10. namespace MQTT_NS {
  11. constexpr std::uint8_t make_fixed_header(control_packet_type type, std::uint8_t flags) {
  12. return static_cast<std::uint8_t>(type) | (flags & 0x0f);
  13. }
  14. } // namespace MQTT_NS
  15. #endif // MQTT_FIXED_HEADER_HPP