File indexing completed on 2025-01-18 09:29:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_ASIO_IP_TCP_HPP
0012 #define BOOST_ASIO_IP_TCP_HPP
0013
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif
0017
0018 #include <boost/asio/detail/config.hpp>
0019 #include <boost/asio/basic_socket_acceptor.hpp>
0020 #include <boost/asio/basic_socket_iostream.hpp>
0021 #include <boost/asio/basic_stream_socket.hpp>
0022 #include <boost/asio/detail/socket_option.hpp>
0023 #include <boost/asio/detail/socket_types.hpp>
0024 #include <boost/asio/ip/basic_endpoint.hpp>
0025 #include <boost/asio/ip/basic_resolver.hpp>
0026 #include <boost/asio/ip/basic_resolver_iterator.hpp>
0027 #include <boost/asio/ip/basic_resolver_query.hpp>
0028
0029 #include <boost/asio/detail/push_options.hpp>
0030
0031 namespace boost {
0032 namespace asio {
0033 namespace ip {
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 class tcp
0047 {
0048 public:
0049
0050 typedef basic_endpoint<tcp> endpoint;
0051
0052
0053 static tcp v4() noexcept
0054 {
0055 return tcp(BOOST_ASIO_OS_DEF(AF_INET));
0056 }
0057
0058
0059 static tcp v6() noexcept
0060 {
0061 return tcp(BOOST_ASIO_OS_DEF(AF_INET6));
0062 }
0063
0064
0065 int type() const noexcept
0066 {
0067 return BOOST_ASIO_OS_DEF(SOCK_STREAM);
0068 }
0069
0070
0071 int protocol() const noexcept
0072 {
0073 return BOOST_ASIO_OS_DEF(IPPROTO_TCP);
0074 }
0075
0076
0077 int family() const noexcept
0078 {
0079 return family_;
0080 }
0081
0082
0083 typedef basic_stream_socket<tcp> socket;
0084
0085
0086 typedef basic_socket_acceptor<tcp> acceptor;
0087
0088
0089 typedef basic_resolver<tcp> resolver;
0090
0091 #if !defined(BOOST_ASIO_NO_IOSTREAM)
0092
0093 typedef basic_socket_iostream<tcp> iostream;
0094 #endif
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122 #if defined(GENERATING_DOCUMENTATION)
0123 typedef implementation_defined no_delay;
0124 #else
0125 typedef boost::asio::detail::socket_option::boolean<
0126 BOOST_ASIO_OS_DEF(IPPROTO_TCP), BOOST_ASIO_OS_DEF(TCP_NODELAY)> no_delay;
0127 #endif
0128
0129
0130 friend bool operator==(const tcp& p1, const tcp& p2)
0131 {
0132 return p1.family_ == p2.family_;
0133 }
0134
0135
0136 friend bool operator!=(const tcp& p1, const tcp& p2)
0137 {
0138 return p1.family_ != p2.family_;
0139 }
0140
0141 private:
0142
0143 explicit tcp(int protocol_family) noexcept
0144 : family_(protocol_family)
0145 {
0146 }
0147
0148 int family_;
0149 };
0150
0151 }
0152 }
0153 }
0154
0155 #include <boost/asio/detail/pop_options.hpp>
0156
0157 #endif