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 10 #ifndef BOOST_BEAST_ROLE_HPP 11 #define BOOST_BEAST_ROLE_HPP 12 13 #include <boost/beast/core/detail/config.hpp> 14 15 namespace boost { 16 namespace beast { 17 18 /** The role of local or remote peer. 19 20 Whether the endpoint is a client or server affects the 21 behavior of teardown. 22 The teardown behavior also depends on the type of the stream 23 being torn down. 24 25 The default implementation of teardown for regular 26 TCP/IP sockets is as follows: 27 28 @li In the client role, a TCP/IP shutdown is sent after 29 reading all remaining data on the connection. 30 31 @li In the server role, a TCP/IP shutdown is sent before 32 reading all remaining data on the connection. 33 34 When the next layer type is a `net::ssl::stream`, 35 the connection is closed by performing the SSL closing 36 handshake corresponding to the role type, client or server. 37 */ 38 enum class role_type 39 { 40 /// The stream is operating as a client. 41 client, 42 43 /// The stream is operating as a server. 44 server 45 }; 46 47 } // beast 48 } // boost 49 50 #endif 51