/src/contrib/boost/asio/local/datagram_protocol.hpp

http://pythonocc.googlecode.com/ · C++ Header · 80 lines · 38 code · 15 blank · 27 comment · 2 complexity · 98c35ea5e51fb35447876c73c05bcdcd MD5 · raw file

  1. //
  2. // datagram_protocol.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2010 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_DATAGRAM_PROTOCOL_HPP
  11. #define BOOST_ASIO_LOCAL_DATAGRAM_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_datagram_socket.hpp>
  17. #include <boost/asio/local/basic_endpoint.hpp>
  18. #include <boost/asio/detail/socket_types.hpp>
  19. #if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) \
  20. || defined(GENERATING_DOCUMENTATION)
  21. namespace boost {
  22. namespace asio {
  23. namespace local {
  24. /// Encapsulates the flags needed for datagram-oriented UNIX sockets.
  25. /**
  26. * The boost::asio::local::datagram_protocol class contains flags necessary for
  27. * datagram-oriented UNIX domain sockets.
  28. *
  29. * @par Thread Safety
  30. * @e Distinct @e objects: Safe.@n
  31. * @e Shared @e objects: Safe.
  32. *
  33. * @par Concepts:
  34. * Protocol.
  35. */
  36. class datagram_protocol
  37. {
  38. public:
  39. /// Obtain an identifier for the type of the protocol.
  40. int type() const
  41. {
  42. return SOCK_DGRAM;
  43. }
  44. /// Obtain an identifier for the protocol.
  45. int protocol() const
  46. {
  47. return 0;
  48. }
  49. /// Obtain an identifier for the protocol family.
  50. int family() const
  51. {
  52. return AF_UNIX;
  53. }
  54. /// The type of a UNIX domain endpoint.
  55. typedef basic_endpoint<datagram_protocol> endpoint;
  56. /// The UNIX domain socket type.
  57. typedef basic_datagram_socket<datagram_protocol> socket;
  58. };
  59. } // namespace local
  60. } // namespace asio
  61. } // namespace boost
  62. #endif // defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
  63. // || defined(GENERATING_DOCUMENTATION)
  64. #include <boost/asio/detail/pop_options.hpp>
  65. #endif // BOOST_ASIO_LOCAL_DATAGRAM_PROTOCOL_HPP