Loading...
Searching...
No Matches
debug.hpp
/*
* Copyright (c) 2014, Peter Thorson. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the WebSocket++ Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef WEBSOCKETPP_CONFIG_DEBUG_HPP
#define WEBSOCKETPP_CONFIG_DEBUG_HPP
// Non-Policy common stuff
#include <websocketpp/common/cpp11.hpp>
#include <websocketpp/common/stdint.hpp>
// Concurrency
#include <websocketpp/concurrency/basic.hpp>
// Transport
#include <websocketpp/transport/iostream/endpoint.hpp>
// HTTP
#include <websocketpp/http/request.hpp>
#include <websocketpp/http/response.hpp>
// Messages
#include <websocketpp/message_buffer/message.hpp>
#include <websocketpp/message_buffer/alloc.hpp>
// Loggers
#include <websocketpp/logger/basic.hpp>
// RNG
#include <websocketpp/random/none.hpp>
// User stub base classes
#include <websocketpp/endpoint_base.hpp>
#include <websocketpp/connection_base.hpp>
// Extensions
#include <websocketpp/extensions/permessage_deflate/disabled.hpp>
namespace websocketpp {
namespace config {
/// Client/Server debug config with iostream transport
struct debug_core {
typedef debug_core type;
// Concurrency policy
typedef websocketpp::concurrency::basic concurrency_type;
// HTTP Parser Policies
typedef http::parser::request request_type;
typedef http::parser::response response_type;
// Message Policies
typedef message_buffer::message<message_buffer::alloc::con_msg_manager>
message_type;
typedef message_buffer::alloc::con_msg_manager<message_type>
con_msg_manager_type;
typedef message_buffer::alloc::endpoint_msg_manager<con_msg_manager_type>
endpoint_msg_manager_type;
/// Logging policies
typedef websocketpp::log::basic<concurrency_type,
websocketpp::log::elevel> elog_type;
typedef websocketpp::log::basic<concurrency_type,
websocketpp::log::alevel> alog_type;
/// RNG policies
typedef websocketpp::random::none::int_generator<uint32_t> rng_type;
/// Controls compile time enabling/disabling of thread syncronization
/// code Disabling can provide a minor performance improvement to single
/// threaded applications
static bool const enable_multithreading = true;
struct transport_config {
typedef type::concurrency_type concurrency_type;
typedef type::elog_type elog_type;
typedef type::alog_type alog_type;
typedef type::request_type request_type;
typedef type::response_type response_type;
/// Controls compile time enabling/disabling of thread syncronization
/// code Disabling can provide a minor performance improvement to single
/// threaded applications
static bool const enable_multithreading = true;
/// Default timer values (in ms)
/// Length of time to wait for socket pre-initialization
/**
* Exactly what this includes depends on the socket policy in use
*/
static const long timeout_socket_pre_init = 5000;
/// Length of time to wait before a proxy handshake is aborted
static const long timeout_proxy = 5000;
/// Length of time to wait for socket post-initialization
/**
* Exactly what this includes depends on the socket policy in use.
* Often this means the TLS handshake
*/
static const long timeout_socket_post_init = 5000;
/// Length of time to wait for dns resolution
static const long timeout_dns_resolve = 5000;
/// Length of time to wait for TCP connect
static const long timeout_connect = 5000;
/// Length of time to wait for socket shutdown
static const long timeout_socket_shutdown = 5000;
};
/// Transport Endpoint Component
typedef websocketpp::transport::iostream::endpoint<transport_config>
transport_type;
/// User overridable Endpoint base class
typedef websocketpp::endpoint_base endpoint_base;
/// User overridable Connection base class
typedef websocketpp::connection_base connection_base;
/// Default timer values (in ms)
/// Length of time before an opening handshake is aborted
static const long timeout_open_handshake = 5000;
/// Length of time before a closing handshake is aborted
static const long timeout_close_handshake = 5000;
/// Length of time to wait for a pong after a ping
static const long timeout_pong = 5000;
/// WebSocket Protocol version to use as a client
/**
* What version of the WebSocket Protocol to use for outgoing client
* connections. Setting this to a value other than 13 (RFC6455) is not
* recommended.
*/
static const int client_version = 13; // RFC6455
/// Default static error logging channels
/**
* Which error logging channels to enable at compile time. Channels not
* enabled here will be unable to be selected by programs using the library.
* This option gives an optimizing compiler the ability to remove entirely
* code to test whether or not to print out log messages on a certain
* channel
*
* Default is all except for development/debug level errors
*/
static const websocketpp::log::level elog_level =
websocketpp::log::elevel::all;
/// Default static access logging channels
/**
* Which access logging channels to enable at compile time. Channels not
* enabled here will be unable to be selected by programs using the library.
* This option gives an optimizing compiler the ability to remove entirely
* code to test whether or not to print out log messages on a certain
* channel
*
* Default is all except for development/debug level access messages
*/
static const websocketpp::log::level alog_level =
websocketpp::log::alevel::all;
///
static const size_t connection_read_buffer_size = 16384;
/// Drop connections immediately on protocol error.
/**
* Drop connections on protocol error rather than sending a close frame.
* Off by default. This may result in legit messages near the error being
* dropped as well. It may free up resources otherwise spent dealing with
* misbehaving clients.
*/
static const bool drop_on_protocol_error = false;
/// Suppresses the return of detailed connection close information
/**
* Silence close suppresses the return of detailed connection close
* information during the closing handshake. This information is useful
* for debugging and presenting useful errors to end users but may be
* undesirable for security reasons in some production environments.
* Close reasons could be used by an attacker to confirm that the endpoint
* is out of resources or be used to identify the WebSocket implementation
* in use.
*
* Note: this will suppress *all* close codes, including those explicitly
* sent by local applications.
*/
static const bool silent_close = false;
/// Default maximum message size
/**
* Default value for the processor's maximum message size. Maximum message size
* determines the point at which the library will fail a connection with the
* message_too_big protocol error.
*
* The default is 32MB
*
* @since 0.3.0
*/
static const size_t max_message_size = 32000000;
/// Default maximum http body size
/**
* Default value for the http parser's maximum body size. Maximum body size
* determines the point at which the library will abort reading an HTTP
* connection with the 413/request entity too large error.
*
* The default is 32MB
*
* @since 0.5.0
*/
static const size_t max_http_body_size = 32000000;
/// Global flag for enabling/disabling extensions
static const bool enable_extensions = true;
/// Extension specific settings:
/// permessage_compress extension
struct permessage_deflate_config {
typedef type::request_type request_type;
/// If the remote endpoint requests that we reset the compression
/// context after each message should we honor the request?
static const bool allow_disabling_context_takeover = true;
/// If the remote endpoint requests that we reduce the size of the
/// LZ77 sliding window size this is the lowest value that will be
/// allowed. Values range from 8 to 15. A value of 8 means we will
/// allow any possible window size. A value of 15 means do not allow
/// negotiation of the window size (ie require the default).
static const uint8_t minimum_outgoing_window_bits = 8;
};
typedef websocketpp::extensions::permessage_deflate::disabled
<permessage_deflate_config> permessage_deflate_type;
/// Autonegotiate permessage-deflate
/**
* Automatically enables the permessage-deflate extension.
*
* For clients this results in a permessage-deflate extension request being
* sent with every request rather than requiring it to be requested manually
*
* For servers this results in accepting the first set of extension settings
* requested by the client that we understand being used. The alternative is
* requiring the extension to be manually negotiated in `validate`. With
* auto-negotiate on, you may still override the auto-negotiate manually if
* needed.
*/
//static const bool autonegotiate_compression = false;
};
} // namespace config
} // namespace websocketpp
#endif // WEBSOCKETPP_CONFIG_CORE_HPP
websocketpp::concurrency::basic
Concurrency policy that uses std::mutex / boost::mutex.
Definition basic.hpp:37
websocketpp::connection_base
Stub for user supplied base class.
Definition connection_base.hpp:34
websocketpp::endpoint_base
Stub for user supplied base class.
Definition endpoint_base.hpp:34
websocketpp::extensions::permessage_deflate::disabled
Stub class for use when disabling permessage_deflate extension.
Definition disabled.hpp:53
websocketpp::http::parser::request
Stores, parses, and manipulates HTTP requests.
Definition request.hpp:50
websocketpp::http::parser::response
Stores, parses, and manipulates HTTP responses.
Definition response.hpp:57
websocketpp::log::basic
Basic logger that outputs to an ostream.
Definition basic.hpp:59
websocketpp::message_buffer::alloc::con_msg_manager
Definition alloc.hpp:43
websocketpp::message_buffer::alloc::endpoint_msg_manager
Definition alloc.hpp:88
websocketpp::random::none::int_generator
Thread safe stub "random" integer generator.
Definition none.hpp:46
websocketpp::transport::iostream::endpoint
Definition endpoint.hpp:46
websocketpp::concurrency
Concurrency handling support.
Definition basic.hpp:34
websocketpp::extensions::permessage_deflate
Implementation of RFC 7692, the permessage-deflate WebSocket extension.
Definition disabled.hpp:44
websocketpp::extensions
Definition disabled.hpp:43
websocketpp::http
HTTP handling support.
Definition request.hpp:37
websocketpp::random::none
Stub RNG policy that always returns 0.
Definition none.hpp:35
websocketpp::random
Random number generation policies.
Definition random_device.hpp:34
websocketpp::transport::iostream
Transport policy that uses STL iostream for I/O and does not support timers.
Definition endpoint.hpp:43
websocketpp::transport
Transport policies provide network connectivity and timers.
Definition endpoint.hpp:45
websocketpp
Namespace for the WebSocket++ project.
Definition asio_no_tls_client.hpp:34
websocketpp::config::debug_core::permessage_deflate_config
Extension specific settings:
Definition debug.hpp:249
websocketpp::config::debug_core::permessage_deflate_config::allow_disabling_context_takeover
static const bool allow_disabling_context_takeover
Definition debug.hpp:254
websocketpp::config::debug_core::permessage_deflate_config::minimum_outgoing_window_bits
static const uint8_t minimum_outgoing_window_bits
Definition debug.hpp:261
websocketpp::config::debug_core::transport_config
Definition debug.hpp:100
websocketpp::config::debug_core::transport_config::timeout_proxy
static const long timeout_proxy
Length of time to wait before a proxy handshake is aborted.
Definition debug.hpp:121
websocketpp::config::debug_core::transport_config::enable_multithreading
static bool const enable_multithreading
Definition debug.hpp:110
websocketpp::config::debug_core::transport_config::timeout_connect
static const long timeout_connect
Length of time to wait for TCP connect.
Definition debug.hpp:134
websocketpp::config::debug_core::transport_config::timeout_socket_pre_init
static const long timeout_socket_pre_init
Default timer values (in ms).
Definition debug.hpp:118
websocketpp::config::debug_core::transport_config::timeout_socket_shutdown
static const long timeout_socket_shutdown
Length of time to wait for socket shutdown.
Definition debug.hpp:137
websocketpp::config::debug_core::transport_config::timeout_socket_post_init
static const long timeout_socket_post_init
Length of time to wait for socket post-initialization.
Definition debug.hpp:128
websocketpp::config::debug_core::transport_config::timeout_dns_resolve
static const long timeout_dns_resolve
Length of time to wait for dns resolution.
Definition debug.hpp:131
websocketpp::config::debug_core
Client/Server debug config with iostream transport.
Definition debug.hpp:68
websocketpp::config::debug_core::drop_on_protocol_error
static const bool drop_on_protocol_error
Drop connections immediately on protocol error.
Definition debug.hpp:202
websocketpp::config::debug_core::elog_level
static const websocketpp::log::level elog_level
Default static error logging channels.
Definition debug.hpp:176
websocketpp::config::debug_core::client_version
static const int client_version
WebSocket Protocol version to use as a client.
Definition debug.hpp:164
websocketpp::config::debug_core::max_message_size
static const size_t max_message_size
Default maximum message size.
Definition debug.hpp:229
websocketpp::config::debug_core::enable_extensions
static const bool enable_extensions
Global flag for enabling/disabling extensions.
Definition debug.hpp:244
websocketpp::config::debug_core::timeout_pong
static const long timeout_pong
Length of time to wait for a pong after a ping.
Definition debug.hpp:156
websocketpp::config::debug_core::max_http_body_size
static const size_t max_http_body_size
Default maximum http body size.
Definition debug.hpp:241
websocketpp::config::debug_core::silent_close
static const bool silent_close
Suppresses the return of detailed connection close information.
Definition debug.hpp:217
websocketpp::config::debug_core::timeout_open_handshake
static const long timeout_open_handshake
Default timer values (in ms).
Definition debug.hpp:152
websocketpp::config::debug_core::timeout_close_handshake
static const long timeout_close_handshake
Length of time before a closing handshake is aborted.
Definition debug.hpp:154
websocketpp::config::debug_core::transport_type
websocketpp::transport::iostream::endpoint< transport_config > transport_type
Transport Endpoint Component.
Definition debug.hpp:142
websocketpp::config::debug_core::enable_multithreading
static bool const enable_multithreading
Definition debug.hpp:98
websocketpp::config::debug_core::elog_type
websocketpp::log::basic< concurrency_type, websocketpp::log::elevel > elog_type
Logging policies.
Definition debug.hpp:88
websocketpp::config::debug_core::rng_type
websocketpp::random::none::int_generator< uint32_t > rng_type
RNG policies.
Definition debug.hpp:93
websocketpp::config::debug_core::alog_level
static const websocketpp::log::level alog_level
Default static access logging channels.
Definition debug.hpp:189
websocketpp::log::alevel
Package of log levels for logging access events.
Definition levels.hpp:112
websocketpp::log::alevel::all
static level const all
Special aggregate value representing "all levels".
Definition levels.hpp:152
websocketpp::log::elevel
Package of log levels for logging errors.
Definition levels.hpp:59
websocketpp::log::elevel::all
static level const all
Special aggregate value representing "all levels".
Definition levels.hpp:80