option.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. namespace boost {
  13. namespace beast {
  14. namespace websocket {
  15. /** permessage-deflate extension options.
  16. These settings control the permessage-deflate extension,
  17. which allows messages to be compressed.
  18. @note
  19. These settings should be configured before performing the WebSocket
  20. handshake.
  21. Objects of this type are used with
  22. @ref beast::websocket::stream::set_option.
  23. */
  24. struct permessage_deflate
  25. {
  26. /// `true` to offer the extension in the server role
  27. bool server_enable = false;
  28. /// `true` to offer the extension in the client role
  29. bool client_enable = false;
  30. /** Maximum server window bits to offer
  31. @note Due to a bug in ZLib, this value must be greater than 8.
  32. */
  33. int server_max_window_bits = 15;
  34. /** Maximum client window bits to offer
  35. @note Due to a bug in ZLib, this value must be greater than 8.
  36. */
  37. int client_max_window_bits = 15;
  38. /// `true` if server_no_context_takeover desired
  39. bool server_no_context_takeover = false;
  40. /// `true` if client_no_context_takeover desired
  41. bool client_no_context_takeover = false;
  42. /// Deflate compression level 0..9
  43. int compLevel = 8;
  44. /// Deflate memory level, 1..9
  45. int memLevel = 4;
  46. /// The minimum size a message should have to be compressed
  47. std::size_t msg_size_threshold = 0;
  48. };
  49. } // websocket
  50. } // beast
  51. } // boost
  52. #endif