option.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //
  2. // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // Official repository: https://github.com/boostorg/beast
  8. //
  9. #ifndef BOOST_BEAST_WEBSOCKET_OPTION_HPP
  10. #define BOOST_BEAST_WEBSOCKET_OPTION_HPP
  11. #include <boost/beast/core/detail/config.hpp>
  12. #include <boost/beast/websocket/rfc6455.hpp>
  13. #include <boost/beast/core/detail/type_traits.hpp>
  14. #include <boost/throw_exception.hpp>
  15. #include <algorithm>
  16. #include <cstdint>
  17. #include <functional>
  18. #include <stdexcept>
  19. #include <type_traits>
  20. #include <utility>
  21. namespace boost {
  22. namespace beast {
  23. namespace websocket {
  24. /** permessage-deflate extension options.
  25. These settings control the permessage-deflate extension,
  26. which allows messages to be compressed.
  27. @note Objects of this type are used with
  28. @ref beast::websocket::stream::set_option.
  29. */
  30. struct permessage_deflate
  31. {
  32. /// `true` to offer the extension in the server role
  33. bool server_enable = false;
  34. /// `true` to offer the extension in the client role
  35. bool client_enable = false;
  36. /** Maximum server window bits to offer
  37. @note Due to a bug in ZLib, this value must be greater than 8.
  38. */
  39. int server_max_window_bits = 15;
  40. /** Maximum client window bits to offer
  41. @note Due to a bug in ZLib, this value must be greater than 8.
  42. */
  43. int client_max_window_bits = 15;
  44. /// `true` if server_no_context_takeover desired
  45. bool server_no_context_takeover = false;
  46. /// `true` if client_no_context_takeover desired
  47. bool client_no_context_takeover = false;
  48. /// Deflate compression level 0..9
  49. int compLevel = 8;
  50. /// Deflate memory level, 1..9
  51. int memLevel = 4;
  52. };
  53. } // websocket
  54. } // beast
  55. } // boost
  56. #endif