Loading...
Searching...
No Matches
random.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_COMMON_RANDOM_DEVICE_HPP
#define WEBSOCKETPP_COMMON_RANDOM_DEVICE_HPP
#include <websocketpp/common/cpp11.hpp>
// If we've determined that we're in full C++11 mode and the user hasn't
// explicitly disabled the use of C++11 random header, then prefer it to
// boost.
#if defined _WEBSOCKETPP_CPP11_INTERNAL_ && !defined _WEBSOCKETPP_NO_CPP11_RANDOM_DEVICE_
#ifndef _WEBSOCKETPP_CPP11_RANDOM_DEVICE_
#define _WEBSOCKETPP_CPP11_RANDOM_DEVICE_
#endif
#endif
// If we're on Visual Studio 2010 or higher and haven't explicitly disabled
// the use of C++11 random header then prefer it to boost.
#if defined(_MSC_VER) && _MSC_VER >= 1600 && !defined _WEBSOCKETPP_NO_CPP11_MEMORY_
#ifndef _WEBSOCKETPP_CPP11_MEMORY_
#define _WEBSOCKETPP_CPP11_MEMORY_
#endif
#endif
#ifdef _WEBSOCKETPP_CPP11_RANDOM_DEVICE_
#include <random>
#else
#include <boost/random/uniform_int_distribution.hpp>
#include <boost/random/random_device.hpp>
#endif
namespace websocketpp {
namespace lib {
#ifdef _WEBSOCKETPP_CPP11_RANDOM_DEVICE_
using std::random_device;
using std::uniform_int_distribution;
#else
using boost::random::random_device;
using boost::random::uniform_int_distribution;
#endif
} // namespace lib
} // namespace websocketpp
#endif // WEBSOCKETPP_COMMON_RANDOM_DEVICE_HPP
_WEBSOCKETPP_CPP11_RANDOM_DEVICE_
#define _WEBSOCKETPP_CPP11_RANDOM_DEVICE_
Definition boost_config.hpp:49
websocket_endpoint
Definition step3.cpp:42
websocketpp::client
Client endpoint role based on the given config.
Definition client_endpoint.hpp:47
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::random_device::int_generator
Thread safe non-deterministic random integer generator.
Definition random_device.hpp:53
websocketpp::random::random_device::int_generator::operator()
int_type operator()()
advances the engine's state and returns the generated value
Definition random_device.hpp:63
websocketpp::random::random_device::int_generator::int_generator
int_generator()
constructor
Definition random_device.hpp:60
websocketpp::transport::asio::basic_socket::endpoint
Basic ASIO endpoint socket component.
Definition none.hpp:318
websocketpp::transport::asio::endpoint
Asio based endpoint transport component.
Definition endpoint.hpp:54
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::random_device
RNG policy based on std::random_device or boost::random_device.
Definition random_device.hpp:36
websocketpp::random
Random number generation policies.
Definition random_device.hpp:34
websocketpp::transport::asio::basic_socket
Definition none.hpp:47
websocketpp::transport::asio
Transport policy that uses asio.
Definition endpoint.hpp:46
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::asio_client::transport_config
Definition asio_no_tls_client.hpp:56
websocketpp::config::asio_client
Client config with asio transport and TLS disabled.
Definition asio_no_tls_client.hpp:38
websocketpp::config::core_client::permessage_deflate_config
Extension specific settings:
Definition core_client.hpp:257
websocketpp::config::core_client::permessage_deflate_config::minimum_outgoing_window_bits
static const uint8_t minimum_outgoing_window_bits
Definition core_client.hpp:269
websocketpp::config::core_client::permessage_deflate_config::allow_disabling_context_takeover
static const bool allow_disabling_context_takeover
Definition core_client.hpp:262
websocketpp::config::core_client::transport_config
Definition core_client.hpp:108
websocketpp::config::core_client::transport_config::timeout_dns_resolve
static const long timeout_dns_resolve
Length of time to wait for dns resolution.
Definition core_client.hpp:139
websocketpp::config::core_client::transport_config::timeout_socket_shutdown
static const long timeout_socket_shutdown
Length of time to wait for socket shutdown.
Definition core_client.hpp:145
websocketpp::config::core_client::transport_config::timeout_socket_pre_init
static const long timeout_socket_pre_init
Default timer values (in ms).
Definition core_client.hpp:126
websocketpp::config::core_client::transport_config::enable_multithreading
static bool const enable_multithreading
Definition core_client.hpp:118
websocketpp::config::core_client::transport_config::timeout_proxy
static const long timeout_proxy
Length of time to wait before a proxy handshake is aborted.
Definition core_client.hpp:129
websocketpp::config::core_client::transport_config::timeout_connect
static const long timeout_connect
Length of time to wait for TCP connect.
Definition core_client.hpp:142
websocketpp::config::core_client::transport_config::timeout_socket_post_init
static const long timeout_socket_post_init
Length of time to wait for socket post-initialization.
Definition core_client.hpp:136
websocketpp::config::core_client
Client config with iostream transport.
Definition core_client.hpp:71
websocketpp::config::core_client::enable_multithreading
static bool const enable_multithreading
Definition core_client.hpp:106
websocketpp::config::core_client::enable_extensions
static const bool enable_extensions
Global flag for enabling/disabling extensions.
Definition core_client.hpp:252
websocketpp::config::core_client::elog_type
websocketpp::log::basic< concurrency_type, websocketpp::log::elevel > elog_type
Logging policies.
Definition core_client.hpp:95
websocketpp::config::core_client::alog_level
static const websocketpp::log::level alog_level
Default static access logging channels.
Definition core_client.hpp:197
websocketpp::config::core_client::max_http_body_size
static const size_t max_http_body_size
Default maximum http body size.
Definition core_client.hpp:249
websocketpp::config::core_client::elog_level
static const websocketpp::log::level elog_level
Default static error logging channels.
Definition core_client.hpp:184
websocketpp::config::core_client::max_message_size
static const size_t max_message_size
Default maximum message size.
Definition core_client.hpp:237
websocketpp::config::core_client::transport_type
websocketpp::transport::iostream::endpoint< transport_config > transport_type
Transport Endpoint Component.
Definition core_client.hpp:150
websocketpp::config::core_client::drop_on_protocol_error
static const bool drop_on_protocol_error
Drop connections immediately on protocol error.
Definition core_client.hpp:210
websocketpp::config::core_client::timeout_close_handshake
static const long timeout_close_handshake
Length of time before a closing handshake is aborted.
Definition core_client.hpp:162
websocketpp::config::core_client::timeout_open_handshake
static const long timeout_open_handshake
Default timer values (in ms).
Definition core_client.hpp:160
websocketpp::config::core_client::rng_type
websocketpp::random::random_device::int_generator< uint32_t, concurrency_type > rng_type
RNG policies.
Definition core_client.hpp:101
websocketpp::config::core_client::timeout_pong
static const long timeout_pong
Length of time to wait for a pong after a ping.
Definition core_client.hpp:164
websocketpp::config::core_client::client_version
static const int client_version
WebSocket Protocol version to use as a client.
Definition core_client.hpp:172
websocketpp::config::core_client::silent_close
static const bool silent_close
Suppresses the return of detailed connection close information.
Definition core_client.hpp:225
websocketpp::log::alevel
Package of log levels for logging access events.
Definition levels.hpp:112
websocketpp::log::alevel::devel
static level const devel
Development messages (warning: very chatty).
Definition levels.hpp:141
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::devel
static level const devel
Low level debugging information (warning: very chatty).
Definition levels.hpp:63
websocketpp::log::elevel::all
static level const all
Special aggregate value representing "all levels".
Definition levels.hpp:80