1 // 2 // local/stream_protocol.hpp 3 // ~~~~~~~~~~~~~~~~~~~~~~~~~ 4 // 5 // Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 // 7 // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 // 10 11 #ifndef BOOST_ASIO_LOCAL_STREAM_PROTOCOL_HPP 12 #define BOOST_ASIO_LOCAL_STREAM_PROTOCOL_HPP 13 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 # pragma once 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 18 #include <boost/asio/detail/config.hpp> 19 20 #if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) \ 21 || defined(GENERATING_DOCUMENTATION) 22 23 #include <boost/asio/basic_socket_acceptor.hpp> 24 #include <boost/asio/basic_socket_iostream.hpp> 25 #include <boost/asio/basic_stream_socket.hpp> 26 #include <boost/asio/detail/socket_types.hpp> 27 #include <boost/asio/local/basic_endpoint.hpp> 28 29 #include <boost/asio/detail/push_options.hpp> 30 31 namespace boost { 32 namespace asio { 33 namespace local { 34 35 /// Encapsulates the flags needed for stream-oriented UNIX sockets. 36 /** 37 * The boost::asio::local::stream_protocol class contains flags necessary for 38 * stream-oriented UNIX domain sockets. 39 * 40 * @par Thread Safety 41 * @e Distinct @e objects: Safe.@n 42 * @e Shared @e objects: Safe. 43 * 44 * @par Concepts: 45 * Protocol. 46 */ 47 class stream_protocol 48 { 49 public: 50 /// Obtain an identifier for the type of the protocol. type() const51 int type() const BOOST_ASIO_NOEXCEPT 52 { 53 return SOCK_STREAM; 54 } 55 56 /// Obtain an identifier for the protocol. protocol() const57 int protocol() const BOOST_ASIO_NOEXCEPT 58 { 59 return 0; 60 } 61 62 /// Obtain an identifier for the protocol family. family() const63 int family() const BOOST_ASIO_NOEXCEPT 64 { 65 return AF_UNIX; 66 } 67 68 /// The type of a UNIX domain endpoint. 69 typedef basic_endpoint<stream_protocol> endpoint; 70 71 /// The UNIX domain socket type. 72 typedef basic_stream_socket<stream_protocol> socket; 73 74 /// The UNIX domain acceptor type. 75 typedef basic_socket_acceptor<stream_protocol> acceptor; 76 77 #if !defined(BOOST_ASIO_NO_IOSTREAM) 78 /// The UNIX domain iostream type. 79 typedef basic_socket_iostream<stream_protocol> iostream; 80 #endif // !defined(BOOST_ASIO_NO_IOSTREAM) 81 }; 82 83 } // namespace local 84 } // namespace asio 85 } // namespace boost 86 87 #include <boost/asio/detail/pop_options.hpp> 88 89 #endif // defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) 90 // || defined(GENERATING_DOCUMENTATION) 91 92 #endif // BOOST_ASIO_LOCAL_STREAM_PROTOCOL_HPP 93