stream_protocol.hpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //
  2. // stream_protocol.hpp
  3. // ~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2008 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. #ifndef BOOST_ASIO_LOCAL_STREAM_PROTOCOL_HPP
  11. #define BOOST_ASIO_LOCAL_STREAM_PROTOCOL_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/push_options.hpp>
  16. #include <boost/asio/basic_socket_acceptor.hpp>
  17. #include <boost/asio/basic_socket_iostream.hpp>
  18. #include <boost/asio/basic_stream_socket.hpp>
  19. #include <boost/asio/local/basic_endpoint.hpp>
  20. #include <boost/asio/detail/socket_types.hpp>
  21. #if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) \
  22. || defined(GENERATING_DOCUMENTATION)
  23. namespace boost {
  24. namespace asio {
  25. namespace local {
  26. /// Encapsulates the flags needed for stream-oriented UNIX sockets.
  27. /**
  28. * The boost::asio::local::stream_protocol class contains flags necessary for
  29. * stream-oriented UNIX domain sockets.
  30. *
  31. * @par Thread Safety
  32. * @e Distinct @e objects: Safe.@n
  33. * @e Shared @e objects: Safe.
  34. *
  35. * @par Concepts:
  36. * Protocol.
  37. */
  38. class stream_protocol
  39. {
  40. public:
  41. /// Obtain an identifier for the type of the protocol.
  42. int type() const
  43. {
  44. return SOCK_STREAM;
  45. }
  46. /// Obtain an identifier for the protocol.
  47. int protocol() const
  48. {
  49. return 0;
  50. }
  51. /// Obtain an identifier for the protocol family.
  52. int family() const
  53. {
  54. return AF_UNIX;
  55. }
  56. /// The type of a UNIX domain endpoint.
  57. typedef basic_endpoint<stream_protocol> endpoint;
  58. /// The UNIX domain socket type.
  59. typedef basic_stream_socket<stream_protocol> socket;
  60. /// The UNIX domain acceptor type.
  61. typedef basic_socket_acceptor<stream_protocol> acceptor;
  62. /// The UNIX domain iostream type.
  63. typedef basic_socket_iostream<stream_protocol> iostream;
  64. };
  65. } // namespace local
  66. } // namespace asio
  67. } // namespace boost
  68. #endif // defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
  69. // || defined(GENERATING_DOCUMENTATION)
  70. #include <boost/asio/detail/pop_options.hpp>
  71. #endif // BOOST_ASIO_LOCAL_STREAM_PROTOCOL_HPP