#include <enabled.hpp>
Public Member Functions | |
enabled () | |
~enabled () | |
lib::error_code | init (bool is_server) |
Initialize zlib state. More... | |
bool | is_implemented () const |
Test if this object implements the permessage-deflate specification. More... | |
bool | is_enabled () const |
Test if the extension was negotiated for this connection. More... | |
void | enable_server_no_context_takeover () |
Reset server's outgoing LZ77 sliding window for each new message. More... | |
void | enable_client_no_context_takeover () |
Reset client's outgoing LZ77 sliding window for each new message. More... | |
lib::error_code | set_server_max_window_bits (uint8_t bits, mode::value mode) |
Limit server LZ77 sliding window size. More... | |
lib::error_code | set_client_max_window_bits (uint8_t bits, mode::value mode) |
Limit client LZ77 sliding window size. More... | |
std::string | generate_offer () const |
Generate extension offer. More... | |
lib::error_code | validate_offer (http::attribute_list const &) |
Validate extension response. More... | |
err_str_pair | negotiate (http::attribute_list const &offer) |
Negotiate extension. More... | |
lib::error_code | compress (std::string const &in, std::string &out) |
Compress bytes. More... | |
lib::error_code | decompress (uint8_t const *buf, size_t len, std::string &out) |
Decompress bytes. More... | |
Definition at line 205 of file enabled.hpp.
|
inline |
Definition at line 207 of file enabled.hpp.
|
inline |
Definition at line 229 of file enabled.hpp.
|
inline |
Initialize zlib state.
Note: this should be called after the negotiation methods. It will use information from the negotiation to determine how to initialize the zlib data structures.
is_server | True to initialize as a server, false for a client. |
Definition at line 260 of file enabled.hpp.
References websocketpp::extensions::permessage_deflate::error::make_error_code(), and websocketpp::extensions::permessage_deflate::error::zlib_error.
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Test if this object implements the permessage-deflate specification.
Because this object does implieent it, it will always return true.
Definition at line 312 of file enabled.hpp.
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Test if the extension was negotiated for this connection.
Retrieves whether or not this extension is in use based on the initial handshake extension negotiations.
Definition at line 323 of file enabled.hpp.
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Reset server's outgoing LZ77 sliding window for each new message.
Enabling this setting will cause the server's compressor to reset the compression state (the LZ77 sliding window) for every message. This means that the compressor will not look back to patterns in previous messages to improve compression. This will reduce the compression efficiency for large messages somewhat and small messages drastically.
This option may reduce server compressor memory usage and client decompressor memory usage.
For clients, this option is dependent on server support. Enabling it via this method does not guarantee that it will be successfully negotiated, only that it will be requested.
For servers, no client support is required. Enabling this option on a server will result in its use. The server will signal to clients that the option will be in use so they can optimize resource usage if they are able.
Definition at line 348 of file enabled.hpp.
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Reset client's outgoing LZ77 sliding window for each new message.
Enabling this setting will cause the client's compressor to reset the compression state (the LZ77 sliding window) for every message. This means that the compressor will not look back to patterns in previous messages to improve compression. This will reduce the compression efficiency for large messages somewhat and small messages drastically.
This option may reduce client compressor memory usage and server decompressor memory usage.
This option is supported by all compliant clients and servers. Enabling it via either endpoint should be sufficient to ensure it is used.
Definition at line 367 of file enabled.hpp.
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Limit server LZ77 sliding window size.
The bits setting is the base 2 logarithm of the maximum window size that the server must use to compress outgoing messages. The permitted range is 8 to 15 inclusive. 8 represents a 256 byte window and 15 a 32KiB window. The default setting is 15.
Mode Options:
This setting is dependent on server support. A client requesting this setting may be rejected by the server or have the exact value used adjusted by the server. A server may unilaterally set this value without client support.
bits | The size to request for the outgoing window size |
mode | The mode to use for negotiating this parameter |
Definition at line 393 of file enabled.hpp.
References websocketpp::extensions::permessage_deflate::error::invalid_max_window_bits, and websocketpp::extensions::permessage_deflate::error::make_error_code().
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Limit client LZ77 sliding window size.
The bits setting is the base 2 logarithm of the window size that the client must use to compress outgoing messages. The permitted range is 8 to 15 inclusive. 8 represents a 256 byte window and 15 a 32KiB window. The default setting is 15.
Mode Options:
This setting is dependent on client support. A client may limit its own outgoing window size unilaterally. A server may only limit the client's window size if the remote client supports that feature.
bits | The size to request for the outgoing window size |
mode | The mode to use for negotiating this parameter |
Definition at line 424 of file enabled.hpp.
References websocketpp::extensions::permessage_deflate::error::invalid_max_window_bits, and websocketpp::extensions::permessage_deflate::error::make_error_code().
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Generate extension offer.
Creates an offer string to include in the Sec-WebSocket-Extensions header of outgoing client requests.
Definition at line 441 of file enabled.hpp.
|
inline |
Validate extension response.
Confirm that the server has negotiated settings compatible with our original offer and apply those settings to the extension state.
response | The server response attribute list to validate |
Definition at line 454 of file enabled.hpp.
|
inline |
Negotiate extension.
Confirm that the client's extension negotiation offer has settings compatible with local policy. If so, generate a reply and apply those settings to the extension state.
offer | Attribute from client's offer |
Definition at line 467 of file enabled.hpp.
References websocketpp::extensions::permessage_deflate::error::invalid_attributes, and websocketpp::extensions::permessage_deflate::error::make_error_code().
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Compress bytes.
[in] | in | String to compress |
[out] | out | String to append compressed bytes to |
Definition at line 506 of file enabled.hpp.
References websocketpp::extensions::permessage_deflate::error::make_error_code(), and websocketpp::extensions::permessage_deflate::error::uninitialized.
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Decompress bytes.
buf | Byte buffer to decompress |
len | Length of buf |
out | String to append decompressed bytes to |
Definition at line 544 of file enabled.hpp.
References websocketpp::extensions::permessage_deflate::mode::accept, websocketpp::extensions::permessage_deflate::mode::decline, websocketpp::extensions::permessage_deflate::default_client_max_window_bits, websocketpp::extensions::permessage_deflate::default_server_max_window_bits, websocketpp::extensions::permessage_deflate::error::invalid_attribute_value, websocketpp::extensions::permessage_deflate::error::invalid_mode, websocketpp::extensions::permessage_deflate::mode::largest, websocketpp::extensions::permessage_deflate::error::make_error_code(), websocketpp::extensions::permessage_deflate::min_client_max_window_bits, websocketpp::extensions::permessage_deflate::min_server_max_window_bits, websocketpp::extensions::permessage_deflate::mode::smallest, websocketpp::extensions::permessage_deflate::error::uninitialized, and websocketpp::extensions::permessage_deflate::error::zlib_error.
Referenced by BOOST_AUTO_TEST_CASE().