option.hpp 1.8 KB

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