seq_packet_protocol.hpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //
  2. // local/seq_packet_protocol.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2024 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_SEQ_PACKET_PROTOCOL_HPP
  11. #define BOOST_ASIO_LOCAL_SEQ_PACKET_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/config.hpp>
  16. #if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) \
  17. || defined(GENERATING_DOCUMENTATION)
  18. #include <boost/asio/basic_socket_acceptor.hpp>
  19. #include <boost/asio/basic_seq_packet_socket.hpp>
  20. #include <boost/asio/detail/socket_types.hpp>
  21. #include <boost/asio/local/basic_endpoint.hpp>
  22. #include <boost/asio/detail/push_options.hpp>
  23. namespace boost {
  24. namespace asio {
  25. namespace local {
  26. /// Encapsulates the flags needed for seq_packet UNIX sockets.
  27. /**
  28. * The boost::asio::local::seq_packet_protocol class contains flags necessary
  29. * for sequenced packet 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 seq_packet_protocol
  39. {
  40. public:
  41. /// Obtain an identifier for the type of the protocol.
  42. int type() const noexcept
  43. {
  44. return SOCK_SEQPACKET;
  45. }
  46. /// Obtain an identifier for the protocol.
  47. int protocol() const noexcept
  48. {
  49. return 0;
  50. }
  51. /// Obtain an identifier for the protocol family.
  52. int family() const noexcept
  53. {
  54. return AF_UNIX;
  55. }
  56. /// The type of a UNIX domain endpoint.
  57. typedef basic_endpoint<seq_packet_protocol> endpoint;
  58. /// The UNIX domain socket type.
  59. typedef basic_seq_packet_socket<seq_packet_protocol> socket;
  60. /// The UNIX domain acceptor type.
  61. typedef basic_socket_acceptor<seq_packet_protocol> acceptor;
  62. };
  63. } // namespace local
  64. } // namespace asio
  65. } // namespace boost
  66. #include <boost/asio/detail/pop_options.hpp>
  67. #endif // defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
  68. // || defined(GENERATING_DOCUMENTATION)
  69. #endif // BOOST_ASIO_LOCAL_SEQ_PACKET_PROTOCOL_HPP