Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:00

0001 //
0002 // local/datagram_protocol.hpp
0003 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 //
0010 
0011 #ifndef BOOST_ASIO_LOCAL_DATAGRAM_PROTOCOL_HPP
0012 #define BOOST_ASIO_LOCAL_DATAGRAM_PROTOCOL_HPP
0013 
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
0017 
0018 #include <boost/asio/detail/config.hpp>
0019 
0020 #if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) \
0021   || defined(GENERATING_DOCUMENTATION)
0022 
0023 #include <boost/asio/basic_datagram_socket.hpp>
0024 #include <boost/asio/detail/socket_types.hpp>
0025 #include <boost/asio/local/basic_endpoint.hpp>
0026 
0027 #include <boost/asio/detail/push_options.hpp>
0028 
0029 namespace boost {
0030 namespace asio {
0031 namespace local {
0032 
0033 /// Encapsulates the flags needed for datagram-oriented UNIX sockets.
0034 /**
0035  * The boost::asio::local::datagram_protocol class contains flags necessary for
0036  * datagram-oriented UNIX domain sockets.
0037  *
0038  * @par Thread Safety
0039  * @e Distinct @e objects: Safe.@n
0040  * @e Shared @e objects: Safe.
0041  *
0042  * @par Concepts:
0043  * Protocol.
0044  */
0045 class datagram_protocol
0046 {
0047 public:
0048   /// Obtain an identifier for the type of the protocol.
0049   int type() const noexcept
0050   {
0051     return SOCK_DGRAM;
0052   }
0053 
0054   /// Obtain an identifier for the protocol.
0055   int protocol() const noexcept
0056   {
0057     return 0;
0058   }
0059 
0060   /// Obtain an identifier for the protocol family.
0061   int family() const noexcept
0062   {
0063     return AF_UNIX;
0064   }
0065 
0066   /// The type of a UNIX domain endpoint.
0067   typedef basic_endpoint<datagram_protocol> endpoint;
0068 
0069   /// The UNIX domain socket type.
0070   typedef basic_datagram_socket<datagram_protocol> socket;
0071 };
0072 
0073 } // namespace local
0074 } // namespace asio
0075 } // namespace boost
0076 
0077 #include <boost/asio/detail/pop_options.hpp>
0078 
0079 #endif // defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
0080        //   || defined(GENERATING_DOCUMENTATION)
0081 
0082 #endif // BOOST_ASIO_LOCAL_DATAGRAM_PROTOCOL_HPP