// // dccp.hpp // ~~~~~~~~ // // Copyright (c) 2009 Alexander Dubov (oakad at yahoo dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef BOOST_ASIO_IP_DCCP_HPP #define BOOST_ASIO_IP_DCCP_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include #include "basic_dccp_socket.hpp" #include #include #include #include #include namespace boost { namespace asio { namespace ip { /// Encapsulates the flags needed for DCCP. /** * The boost::asio::ip::dccp class contains flags necessary for UDP sockets. * * @par Thread Safety * @e Distinct @e objects: Safe.@n * @e Shared @e objects: Safe. * * @par Concepts: * Protocol, InternetProtocol. */ class dccp { public: /// The type of a DCCP endpoint. typedef basic_endpoint endpoint; /// The type of a resolver query. typedef basic_resolver_query resolver_query; /// The type of a resolver iterator. typedef basic_resolver_iterator resolver_iterator; /// Construct to represent the IPv4 DCCP protocol. static dccp v4() { return dccp(PF_INET); } /// Construct to represent the IPv6 DCCP protocol. static dccp v6() { return dccp(PF_INET6); } /// Obtain an identifier for the type of the protocol. int type() const { return SOCK_DCCP; } /// Obtain an identifier for the protocol. int protocol() const { return IPPROTO_DCCP; } /// Obtain an identifier for the protocol family. int family() const { return family_; } /// The DCCP socket type. typedef basic_dccp_socket socket; /// The DCCP acceptor type. typedef basic_socket_acceptor acceptor; /// The DCCP resolver type. typedef basic_resolver resolver; /// Compare two protocols for equality. friend bool operator==(const dccp& p1, const dccp& p2) { return p1.family_ == p2.family_; } /// Compare two protocols for inequality. friend bool operator!=(const dccp& p1, const dccp& p2) { return p1.family_ != p2.family_; } private: // Construct with a specific family. explicit dccp(int family) : family_(family) { } int family_; }; } // namespace ip } // namespace asio } // namespace boost #include #endif // BOOST_ASIO_IP_DCCP_HPP