• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // local/stream_protocol.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2015 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 ASIO_LOCAL_STREAM_PROTOCOL_HPP
12 #define ASIO_LOCAL_STREAM_PROTOCOL_HPP
13 
14 
15 #include "asio/detail/config.hpp"
16 
17 
18 #include "asio/basic_socket_acceptor.hpp"
19 #include "asio/basic_socket_iostream.hpp"
20 #include "asio/basic_stream_socket.hpp"
21 #include "asio/detail/socket_types.hpp"
22 #include "asio/local/basic_endpoint.hpp"
23 
24 #include "asio/detail/push_options.hpp"
25 
26 namespace asio {
27 namespace local {
28 
29 /// Encapsulates the flags needed for stream-oriented UNIX sockets.
30 /**
31  * The asio::local::stream_protocol class contains flags necessary for
32  * stream-oriented UNIX domain sockets.
33  *
34  * @par Thread Safety
35  * @e Distinct @e objects: Safe.@n
36  * @e Shared @e objects: Safe.
37  *
38  * @par Concepts:
39  * Protocol.
40  */
41 class stream_protocol
42 {
43 public:
44   /// Obtain an identifier for the type of the protocol.
type() const45   int type() const
46   {
47     return SOCK_STREAM;
48   }
49 
50   /// Obtain an identifier for the protocol.
protocol() const51   int protocol() const
52   {
53     return 0;
54   }
55 
56   /// Obtain an identifier for the protocol family.
family() const57   int family() const
58   {
59     return AF_UNIX;
60   }
61 
62   /// The type of a UNIX domain endpoint.
63   typedef basic_endpoint<stream_protocol> endpoint;
64 
65   /// The UNIX domain socket type.
66   typedef basic_stream_socket<stream_protocol> socket;
67 
68   /// The UNIX domain acceptor type.
69   typedef basic_socket_acceptor<stream_protocol> acceptor;
70 
71 };
72 
73 } // namespace local
74 } // namespace asio
75 
76 #include "asio/detail/pop_options.hpp"
77 
78        //   || defined(GENERATING_DOCUMENTATION)
79 
80 #endif // ASIO_LOCAL_STREAM_PROTOCOL_HPP
81