tcp.hpp
Go to the documentation of this file.
00001 //
00002 // tcp.hpp
00003 // ~~~~~~~
00004 //
00005 // Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
00006 //
00007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
00008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00009 //
00010 
00011 #ifndef ASIO_IP_TCP_HPP
00012 #define ASIO_IP_TCP_HPP
00013 
00014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
00015 # pragma once
00016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
00017 
00018 #include "asio/detail/push_options.hpp"
00019 
00020 #include "asio/basic_socket_acceptor.hpp"
00021 #include "asio/basic_socket_iostream.hpp"
00022 #include "asio/basic_stream_socket.hpp"
00023 #include "asio/ip/basic_endpoint.hpp"
00024 #include "asio/ip/basic_resolver.hpp"
00025 #include "asio/ip/basic_resolver_iterator.hpp"
00026 #include "asio/ip/basic_resolver_query.hpp"
00027 #include "asio/detail/socket_option.hpp"
00028 #include "asio/detail/socket_types.hpp"
00029 
00030 namespace asio {
00031 namespace ip {
00032 
00034 
00044 class tcp
00045 {
00046 public:
00048   typedef basic_endpoint<tcp> endpoint;
00049 
00051   typedef basic_resolver_query<tcp> resolver_query;
00052 
00054   typedef basic_resolver_iterator<tcp> resolver_iterator;
00055 
00057   static tcp v4()
00058   {
00059     return tcp(PF_INET);
00060   }
00061 
00063   static tcp v6()
00064   {
00065     return tcp(PF_INET6);
00066   }
00067 
00069   int type() const
00070   {
00071     return SOCK_STREAM;
00072   }
00073 
00075   int protocol() const
00076   {
00077     return IPPROTO_TCP;
00078   }
00079 
00081   int family() const
00082   {
00083     return family_;
00084   }
00085 
00087   typedef basic_stream_socket<tcp> socket;
00088 
00090   typedef basic_socket_acceptor<tcp> acceptor;
00091 
00093   typedef basic_resolver<tcp> resolver;
00094 
00096   typedef basic_socket_iostream<tcp> iostream;
00097 
00099 
00124 #if defined(GENERATING_DOCUMENTATION)
00125   typedef implementation_defined no_delay;
00126 #else
00127   typedef asio::detail::socket_option::boolean<
00128     IPPROTO_TCP, TCP_NODELAY> no_delay;
00129 #endif
00130 
00132   friend bool operator==(const tcp& p1, const tcp& p2)
00133   {
00134     return p1.family_ == p2.family_;
00135   }
00136 
00138   friend bool operator!=(const tcp& p1, const tcp& p2)
00139   {
00140     return p1.family_ != p2.family_;
00141   }
00142 
00143 private:
00144   // Construct with a specific family.
00145   explicit tcp(int family)
00146     : family_(family)
00147   {
00148   }
00149 
00150   int family_;
00151 };
00152 
00153 } // namespace ip
00154 } // namespace asio
00155 
00156 #include "asio/detail/pop_options.hpp"
00157 
00158 #endif // ASIO_IP_TCP_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Castor
Author(s): Carpe Noctem
autogenerated on Fri Nov 8 2013 11:05:39