role_type is in boost/beast/core/role.hpp (API Change):

This enumeration is now part of the library core and
not specific to websocket.
This commit is contained in:
Vinnie Falco
2019-02-26 07:20:46 -08:00
parent 81f33a0f89
commit 0647c902ac
54 changed files with 395 additions and 345 deletions
@@ -392,7 +392,7 @@ async_write_some(
template<class TeardownHandler>
void
async_teardown(
websocket::role_type,
role_type,
stream& s,
TeardownHandler&& handler)
{
@@ -255,7 +255,7 @@ close_remote()
void
teardown(
websocket::role_type,
role_type,
stream& s,
boost::system::error_code& ec)
{
@@ -13,8 +13,8 @@
#include <boost/beast/core/detail/config.hpp>
#include <boost/beast/core/bind_handler.hpp>
#include <boost/beast/core/flat_buffer.hpp>
#include <boost/beast/core/role.hpp>
#include <boost/beast/core/string.hpp>
#include <boost/beast/websocket/role.hpp>
#include <boost/beast/_experimental/test/fail_count.hpp>
#include <boost/asio/async_result.hpp>
#include <boost/asio/buffer.hpp>
@@ -494,7 +494,7 @@ public:
BOOST_BEAST_DECL
void
teardown(
websocket::role_type,
role_type,
stream& s,
boost::system::error_code& ec);
@@ -503,7 +503,7 @@ public:
BOOST_BEAST_DECL
void
async_teardown(
websocket::role_type role,
role_type role,
stream& s,
TeardownHandler&& handler);
#endif
+1 -1
View File
@@ -14,8 +14,8 @@
#include <boost/beast/core/detail/stream_base.hpp>
#include <boost/beast/core/error.hpp>
#include <boost/beast/core/rate_policy.hpp>
#include <boost/beast/core/role.hpp>
#include <boost/beast/core/stream_traits.hpp>
#include <boost/beast/websocket/role.hpp> // VFALCO This is unfortunate
#include <boost/asio/async_result.hpp>
#include <boost/asio/basic_stream_socket.hpp>
#include <boost/asio/connect.hpp>
@@ -972,7 +972,7 @@ template<
class Protocol, class Executor, class RatePolicy>
void
teardown(
websocket::role_type role,
role_type role,
basic_stream<Protocol, Executor, RatePolicy>& stream,
error_code& ec)
{
@@ -985,7 +985,7 @@ template<
class TeardownHandler>
void
async_teardown(
websocket::role_type role,
role_type role,
basic_stream<Protocol, Executor, RatePolicy>& stream,
TeardownHandler&& handler)
{
@@ -255,7 +255,7 @@ async_write_some(
template<class NextLayer>
void
teardown(
boost::beast::websocket::role_type role,
boost::beast::role_type role,
flat_stream<NextLayer>& s,
error_code& ec)
{
@@ -266,7 +266,7 @@ teardown(
template<class NextLayer, class TeardownHandler>
void
async_teardown(
boost::beast::websocket::role_type role,
boost::beast::role_type role,
flat_stream<NextLayer>& s,
TeardownHandler&& handler)
{
+50
View File
@@ -0,0 +1,50 @@
//
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Official repository: https://github.com/boostorg/beast
//
#ifndef BOOST_BEAST_ROLE_HPP
#define BOOST_BEAST_ROLE_HPP
#include <boost/beast/core/detail/config.hpp>
namespace boost {
namespace beast {
/** The role of local or remote peer.
Whether the endpoint is a client or server affects the
behavior of teardown.
The teardown behavior also depends on the type of the stream
being torn down.
The default implementation of teardown for regular
TCP/IP sockets is as follows:
@li In the client role, a TCP/IP shutdown is sent after
reading all remaining data on the connection.
@li In the server role, a TCP/IP shutdown is sent before
reading all remaining data on the connection.
When the next layer type is a `net::ssl::stream`,
the connection is closed by performing the SSL closing
handshake corresponding to the role type, client or server.
*/
enum class role_type
{
/// The stream is operating as a client.
client,
/// The stream is operating as a server.
server
};
} // beast
} // boost
#endif
+2 -2
View File
@@ -658,7 +658,7 @@ public:
template<class SyncStream>
void
teardown(
boost::beast::websocket::role_type role,
boost::beast::role_type role,
ssl_stream<SyncStream>& stream,
boost::system::error_code& ec)
{
@@ -670,7 +670,7 @@ teardown(
template<class AsyncStream, class TeardownHandler>
void
async_teardown(
boost::beast::websocket::role_type role,
boost::beast::role_type role,
ssl_stream<AsyncStream>& stream,
TeardownHandler&& handler)
{
-1
View File
@@ -15,7 +15,6 @@
#include <boost/beast/websocket/error.hpp>
#include <boost/beast/websocket/option.hpp>
#include <boost/beast/websocket/rfc6455.hpp>
#include <boost/beast/websocket/role.hpp>
#include <boost/beast/websocket/stream.hpp>
#include <boost/beast/websocket/stream_fwd.hpp>
#include <boost/beast/websocket/teardown.hpp>
@@ -10,14 +10,14 @@
#ifndef BOOST_BEAST_WEBSOCKET_DETAIL_IMPL_BASE_HPP
#define BOOST_BEAST_WEBSOCKET_DETAIL_IMPL_BASE_HPP
#include <boost/beast/websocket/option.hpp>
#include <boost/beast/websocket/detail/frame.hpp>
#include <boost/beast/websocket/detail/pmd_extension.hpp>
#include <boost/beast/core/buffer_size.hpp>
#include <boost/beast/core/role.hpp>
#include <boost/beast/http/empty_body.hpp>
#include <boost/beast/http/message.hpp>
#include <boost/beast/http/string_body.hpp>
#include <boost/beast/websocket/option.hpp>
#include <boost/beast/websocket/role.hpp>
#include <boost/beast/websocket/detail/frame.hpp>
#include <boost/beast/websocket/detail/pmd_extension.hpp>
#include <boost/beast/zlib/deflate_stream.hpp>
#include <boost/beast/zlib/inflate_stream.hpp>
#include <boost/beast/core/buffers_suffix.hpp>
+11 -35
View File
@@ -12,48 +12,24 @@
#include <boost/beast/core/detail/config.hpp>
#if ! BOOST_BEAST_ALLOW_DEPRECATED
#error This file is deprecated interface, #define BOOST_BEAST_ALLOW_DEPRECATED to allow it
#else
#include <boost/beast/core/role.hpp>
namespace boost {
namespace beast {
namespace websocket {
/** The role of the websocket stream endpoint.
Whether the endpoint is a client or server affects the
behavior of the <em>Close the WebSocket Connection</em>
operation described in rfc6455 section 7.1.1.
The shutdown behavior depends on the type of the next
layer template parameter used to construct the @ref stream.
Other next layer types including user-defined types
may implement different role-based behavior when
performing the close operation.
The default implementation for @ref stream when the next
layer type is a `net::ip::tcp::socket` behaves
as follows:
@li In the client role, a TCP/IP shutdown is sent after
reading all remaining data on the connection.
@li In the server role, a TCP/IP shutdown is sent before
reading all remaining data on the connection.
When the next layer type is a `net::ssl::stream`,
the connection is closed by performing the SSL closing
handshake corresponding to the role type, client or server.
@see https://tools.ietf.org/html/rfc6455#section-7.1.1
*/
enum class role_type
{
/// The stream is operating as a client.
client,
/// The stream is operating as a server.
server
};
using role_type = beast::role_type;
} // websocket
} // beast
} // boost
#endif
#endif
-1
View File
@@ -73,7 +73,6 @@ teardown(
*/
template<class AsyncStream, class TeardownHandler>
inline
void
async_teardown(
role_type role,
+1 -1
View File
@@ -13,13 +13,13 @@
#include <boost/beast/core/detail/config.hpp>
#include <boost/beast/websocket/error.hpp>
#include <boost/beast/websocket/option.hpp>
#include <boost/beast/websocket/role.hpp>
#include <boost/beast/websocket/rfc6455.hpp>
#include <boost/beast/websocket/stream_base.hpp>
#include <boost/beast/websocket/stream_fwd.hpp>
#include <boost/beast/websocket/detail/hybi13.hpp>
#include <boost/beast/websocket/detail/impl_base.hpp>
#include <boost/beast/websocket/detail/pmd_extension.hpp>
#include <boost/beast/core/role.hpp>
#include <boost/beast/core/stream_traits.hpp>
#include <boost/beast/core/string.hpp>
#include <boost/beast/core/detail/type_traits.hpp>
@@ -11,8 +11,8 @@
#define BOOST_BEAST_WEBSOCKET_STREAM_BASE_HPP
#include <boost/beast/core/detail/config.hpp>
#include <boost/beast/websocket/role.hpp>
#include <boost/beast/websocket/detail/decorator.hpp>
#include <boost/beast/core/role.hpp>
#include <chrono>
namespace boost {
@@ -12,6 +12,8 @@
#include <boost/beast/core/detail/config.hpp>
//[code_websocket_1h
namespace boost {
namespace beast {
namespace websocket {
@@ -25,4 +27,6 @@ class stream;
} // beast
} // boost
//]
#endif
+1 -1
View File
@@ -12,7 +12,7 @@
#include <boost/beast/core/detail/config.hpp>
#include <boost/beast/core/error.hpp>
#include <boost/beast/websocket/role.hpp>
#include <boost/beast/core/role.hpp>
#include <boost/asio/basic_stream_socket.hpp>
#include <type_traits>