diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-05-06 17:44:27 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-05-06 17:44:27 (GMT) |
commit | d76ada0ab59634e3333f9eb5a92d0e850f60d7bf (patch) | |
tree | 5eaae441173fad2ec19ba67d6589f28ecd740991 /3rdParty/Boost/src/boost/asio/ip | |
parent | 6f49e5abee37d37b351d68c01374232eccdac458 (diff) | |
download | swift-d76ada0ab59634e3333f9eb5a92d0e850f60d7bf.zip swift-d76ada0ab59634e3333f9eb5a92d0e850f60d7bf.tar.bz2 |
Updated Boost to 1.43.0.
Diffstat (limited to '3rdParty/Boost/src/boost/asio/ip')
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/ip/address_v4.hpp | 2 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/ip/address_v6.hpp | 2 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/ip/basic_resolver.hpp | 6 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp | 76 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/ip/basic_resolver_query.hpp | 115 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/ip/icmp.hpp | 4 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/ip/resolver_query_base.hpp | 89 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/ip/resolver_service.hpp | 6 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/ip/tcp.hpp | 4 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/ip/udp.hpp | 4 |
10 files changed, 247 insertions, 61 deletions
diff --git a/3rdParty/Boost/src/boost/asio/ip/address_v4.hpp b/3rdParty/Boost/src/boost/asio/ip/address_v4.hpp index e0088dc..47d36b5 100644 --- a/3rdParty/Boost/src/boost/asio/ip/address_v4.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/address_v4.hpp @@ -102,7 +102,7 @@ public: return *this; } - /// Get the address in bytes. + /// Get the address in bytes, in network byte order. bytes_type to_bytes() const { using namespace std; // For memcpy. diff --git a/3rdParty/Boost/src/boost/asio/ip/address_v6.hpp b/3rdParty/Boost/src/boost/asio/ip/address_v6.hpp index 4105c8d..5685f08 100644 --- a/3rdParty/Boost/src/boost/asio/ip/address_v6.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/address_v6.hpp @@ -115,7 +115,7 @@ public: scope_id_ = id; } - /// Get the address in bytes. + /// Get the address in bytes, in network byte order. bytes_type to_bytes() const { using namespace std; // For memcpy. diff --git a/3rdParty/Boost/src/boost/asio/ip/basic_resolver.hpp b/3rdParty/Boost/src/boost/asio/ip/basic_resolver.hpp index c4f13ab..0660ce5 100644 --- a/3rdParty/Boost/src/boost/asio/ip/basic_resolver.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/basic_resolver.hpp @@ -19,6 +19,8 @@ #include <boost/asio/basic_io_object.hpp> #include <boost/asio/error.hpp> +#include <boost/asio/ip/basic_resolver_iterator.hpp> +#include <boost/asio/ip/basic_resolver_query.hpp> #include <boost/asio/ip/resolver_service.hpp> #include <boost/asio/detail/throw_error.hpp> @@ -48,10 +50,10 @@ public: typedef typename InternetProtocol::endpoint endpoint_type; /// The query type. - typedef typename InternetProtocol::resolver_query query; + typedef basic_resolver_query<InternetProtocol> query; /// The iterator type. - typedef typename InternetProtocol::resolver_iterator iterator; + typedef basic_resolver_iterator<InternetProtocol> iterator; /// Constructor. /** diff --git a/3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp b/3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp index 90644a2..5f4937b 100644 --- a/3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp @@ -18,8 +18,7 @@ #include <boost/asio/detail/push_options.hpp> #include <boost/asio/detail/push_options.hpp> -#include <boost/iterator/iterator_facade.hpp> -#include <boost/optional.hpp> +#include <boost/iterator.hpp> #include <boost/shared_ptr.hpp> #include <cstring> #include <string> @@ -48,14 +47,18 @@ namespace ip { */ template <typename InternetProtocol> class basic_resolver_iterator - : public boost::iterator_facade< - basic_resolver_iterator<InternetProtocol>, - const basic_resolver_entry<InternetProtocol>, - boost::forward_traversal_tag> +#if defined(GENERATING_DOCUMENTATION) + : public std::iterator< +#else // defined(GENERATING_DOCUMENTATION) + : public boost::iterator< +#endif // defined(GENERATING_DOCUMENTATION) + std::forward_iterator_tag, + const basic_resolver_entry<InternetProtocol> > { public: /// Default constructor creates an end iterator. basic_resolver_iterator() + : index_(0) { } @@ -91,11 +94,6 @@ public: address_info = address_info->ai_next; } - if (iter.values_->size()) - iter.iter_ = iter.values_->begin(); - else - iter.values_.reset(); - return iter; } @@ -109,21 +107,58 @@ public: iter.values_->push_back( basic_resolver_entry<InternetProtocol>( endpoint, host_name, service_name)); - iter.iter_ = iter.values_->begin(); return iter; } -private: - friend class boost::iterator_core_access; + /// Dereference an iterator. + const basic_resolver_entry<InternetProtocol>& operator*() const + { + return dereference(); + } + + /// Dereference an iterator. + const basic_resolver_entry<InternetProtocol>* operator->() const + { + return &dereference(); + } + + /// Increment operator (prefix). + basic_resolver_iterator& operator++() + { + increment(); + return *this; + } + /// Increment operator (postfix). + basic_resolver_iterator operator++(int) + { + basic_resolver_iterator tmp(*this); + ++*this; + return tmp; + } + + /// Test two iterators for equality. + friend bool operator==(const basic_resolver_iterator& a, + const basic_resolver_iterator& b) + { + return a.equal(b); + } + + /// Test two iterators for inequality. + friend bool operator!=(const basic_resolver_iterator& a, + const basic_resolver_iterator& b) + { + return !a.equal(b); + } + +private: void increment() { - if (++*iter_ == values_->end()) + if (++index_ == values_->size()) { // Reset state to match a default constructed end iterator. values_.reset(); - typedef typename values_type::const_iterator values_iterator_type; - iter_.reset(); + index_ = 0; } } @@ -133,18 +168,17 @@ private: return true; if (values_ != other.values_) return false; - return *iter_ == *other.iter_; + return index_ == other.index_; } const basic_resolver_entry<InternetProtocol>& dereference() const { - return **iter_; + return (*values_)[index_]; } typedef std::vector<basic_resolver_entry<InternetProtocol> > values_type; - typedef typename values_type::const_iterator values_iter_type; boost::shared_ptr<values_type> values_; - boost::optional<values_iter_type> iter_; + std::size_t index_; }; } // namespace ip diff --git a/3rdParty/Boost/src/boost/asio/ip/basic_resolver_query.hpp b/3rdParty/Boost/src/boost/asio/ip/basic_resolver_query.hpp index e95362b..75d3c47 100644 --- a/3rdParty/Boost/src/boost/asio/ip/basic_resolver_query.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/basic_resolver_query.hpp @@ -47,14 +47,30 @@ public: typedef InternetProtocol protocol_type; /// Construct with specified service name for any protocol. + /** + * This constructor is typically used to perform name resolution for local + * service binding. + * + * @param service_name A string identifying the requested service. This may + * be a descriptive name or a numeric string corresponding to a port number. + * + * @param resolve_flags A set of flags that determine how name resolution + * should be performed. The default flags are suitable for local service + * binding. + * + * @note On POSIX systems, service names are typically defined in the file + * <tt>/etc/services</tt>. On Windows, service names may be found in the file + * <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems + * may use additional locations when resolving service names. + */ basic_resolver_query(const std::string& service_name, - int flags = passive | address_configured) + resolver_query_base::flags resolve_flags = passive | address_configured) : hints_(), host_name_(), service_name_(service_name) { typename InternetProtocol::endpoint endpoint; - hints_.ai_flags = flags; + hints_.ai_flags = static_cast<int>(resolve_flags); hints_.ai_family = PF_UNSPEC; hints_.ai_socktype = endpoint.protocol().type(); hints_.ai_protocol = endpoint.protocol().protocol(); @@ -65,14 +81,33 @@ public: } /// Construct with specified service name for a given protocol. + /** + * This constructor is typically used to perform name resolution for local + * service binding with a specific protocol version. + * + * @param protocol A protocol object, normally representing either the IPv4 or + * IPv6 version of an internet protocol. + * + * @param service_name A string identifying the requested service. This may + * be a descriptive name or a numeric string corresponding to a port number. + * + * @param resolve_flags A set of flags that determine how name resolution + * should be performed. The default flags are suitable for local service + * binding. + * + * @note On POSIX systems, service names are typically defined in the file + * <tt>/etc/services</tt>. On Windows, service names may be found in the file + * <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems + * may use additional locations when resolving service names. + */ basic_resolver_query(const protocol_type& protocol, const std::string& service_name, - int flags = passive | address_configured) + resolver_query_base::flags resolve_flags = passive | address_configured) : hints_(), host_name_(), service_name_(service_name) { - hints_.ai_flags = flags; + hints_.ai_flags = static_cast<int>(resolve_flags); hints_.ai_family = protocol.family(); hints_.ai_socktype = protocol.type(); hints_.ai_protocol = protocol.protocol(); @@ -83,14 +118,45 @@ public: } /// Construct with specified host name and service name for any protocol. + /** + * This constructor is typically used to perform name resolution for + * communication with remote hosts. + * + * @param host_name A string identifying a location. May be a descriptive name + * or a numeric address string. If an empty string and the passive flag has + * been specified, the resolved endpoints are suitable for local service + * binding. If an empty string and passive is not specified, the resolved + * endpoints will use the loopback address. + * + * @param service_name A string identifying the requested service. This may + * be a descriptive name or a numeric string corresponding to a port number. + * May be an empty string, in which case all resolved endpoints will have a + * port number of 0. + * + * @param resolve_flags A set of flags that determine how name resolution + * should be performed. The default flags are suitable for communication with + * remote hosts. + * + * @note On POSIX systems, host names may be locally defined in the file + * <tt>/etc/hosts</tt>. On Windows, host names may be defined in the file + * <tt>c:\\windows\\system32\\drivers\\etc\\hosts</tt>. Remote host name + * resolution is performed using DNS. Operating systems may use additional + * locations when resolving host names (such as NETBIOS names on Windows). + * + * On POSIX systems, service names are typically defined in the file + * <tt>/etc/services</tt>. On Windows, service names may be found in the file + * <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems + * may use additional locations when resolving service names. + */ basic_resolver_query(const std::string& host_name, - const std::string& service_name, int flags = address_configured) + const std::string& service_name, + resolver_query_base::flags resolve_flags = address_configured) : hints_(), host_name_(host_name), service_name_(service_name) { typename InternetProtocol::endpoint endpoint; - hints_.ai_flags = flags; + hints_.ai_flags = static_cast<int>(resolve_flags); hints_.ai_family = PF_UNSPEC; hints_.ai_socktype = endpoint.protocol().type(); hints_.ai_protocol = endpoint.protocol().protocol(); @@ -101,14 +167,47 @@ public: } /// Construct with specified host name and service name for a given protocol. + /** + * This constructor is typically used to perform name resolution for + * communication with remote hosts. + * + * @param protocol A protocol object, normally representing either the IPv4 or + * IPv6 version of an internet protocol. + * + * @param host_name A string identifying a location. May be a descriptive name + * or a numeric address string. If an empty string and the passive flag has + * been specified, the resolved endpoints are suitable for local service + * binding. If an empty string and passive is not specified, the resolved + * endpoints will use the loopback address. + * + * @param service_name A string identifying the requested service. This may + * be a descriptive name or a numeric string corresponding to a port number. + * May be an empty string, in which case all resolved endpoints will have a + * port number of 0. + * + * @param resolve_flags A set of flags that determine how name resolution + * should be performed. The default flags are suitable for communication with + * remote hosts. + * + * @note On POSIX systems, host names may be locally defined in the file + * <tt>/etc/hosts</tt>. On Windows, host names may be defined in the file + * <tt>c:\\windows\\system32\\drivers\\etc\\hosts</tt>. Remote host name + * resolution is performed using DNS. Operating systems may use additional + * locations when resolving host names (such as NETBIOS names on Windows). + * + * On POSIX systems, service names are typically defined in the file + * <tt>/etc/services</tt>. On Windows, service names may be found in the file + * <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems + * may use additional locations when resolving service names. + */ basic_resolver_query(const protocol_type& protocol, const std::string& host_name, const std::string& service_name, - int flags = address_configured) + resolver_query_base::flags resolve_flags = address_configured) : hints_(), host_name_(host_name), service_name_(service_name) { - hints_.ai_flags = flags; + hints_.ai_flags = static_cast<int>(resolve_flags); hints_.ai_family = protocol.family(); hints_.ai_socktype = protocol.type(); hints_.ai_protocol = protocol.protocol(); diff --git a/3rdParty/Boost/src/boost/asio/ip/icmp.hpp b/3rdParty/Boost/src/boost/asio/ip/icmp.hpp index b70d87d..5d2fcab 100644 --- a/3rdParty/Boost/src/boost/asio/ip/icmp.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/icmp.hpp @@ -45,10 +45,10 @@ public: /// The type of a ICMP endpoint. typedef basic_endpoint<icmp> endpoint; - /// The type of a resolver query. + /// (Deprecated: use resolver::query.) The type of a resolver query. typedef basic_resolver_query<icmp> resolver_query; - /// The type of a resolver iterator. + /// (Deprecated: use resolver::iterator.) The type of a resolver iterator. typedef basic_resolver_iterator<icmp> resolver_iterator; /// Construct to represent the IPv4 ICMP protocol. diff --git a/3rdParty/Boost/src/boost/asio/ip/resolver_query_base.hpp b/3rdParty/Boost/src/boost/asio/ip/resolver_query_base.hpp index d21b462..7fe1650 100644 --- a/3rdParty/Boost/src/boost/asio/ip/resolver_query_base.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/resolver_query_base.hpp @@ -35,58 +35,107 @@ class resolver_query_base { public: #if defined(GENERATING_DOCUMENTATION) + /// A bitmask type (C++ Std [lib.bitmask.types]). + typedef unspecified flags; + /// Determine the canonical name of the host specified in the query. - static const int canonical_name = implementation_defined; + static const flags canonical_name = implementation_defined; /// Indicate that returned endpoint is intended for use as a locally bound /// socket endpoint. - static const int passive = implementation_defined; + static const flags passive = implementation_defined; /// Host name should be treated as a numeric string defining an IPv4 or IPv6 /// address and no name resolution should be attempted. - static const int numeric_host = implementation_defined; + static const flags numeric_host = implementation_defined; /// Service name should be treated as a numeric string defining a port number /// and no name resolution should be attempted. - static const int numeric_service = implementation_defined; + static const flags numeric_service = implementation_defined; /// If the query protocol family is specified as IPv6, return IPv4-mapped /// IPv6 addresses on finding no IPv6 addresses. - static const int v4_mapped = implementation_defined; + static const flags v4_mapped = implementation_defined; /// If used with v4_mapped, return all matching IPv6 and IPv4 addresses. - static const int all_matching = implementation_defined; + static const flags all_matching = implementation_defined; /// Only return IPv4 addresses if a non-loopback IPv4 address is configured /// for the system. Only return IPv6 addresses if a non-loopback IPv6 address /// is configured for the system. - static const int address_configured = implementation_defined; + static const flags address_configured = implementation_defined; #else - BOOST_STATIC_CONSTANT(int, canonical_name = AI_CANONNAME); - BOOST_STATIC_CONSTANT(int, passive = AI_PASSIVE); - BOOST_STATIC_CONSTANT(int, numeric_host = AI_NUMERICHOST); + enum flags + { + canonical_name = AI_CANONNAME, + passive = AI_PASSIVE, + numeric_host = AI_NUMERICHOST, # if defined(AI_NUMERICSERV) - BOOST_STATIC_CONSTANT(int, numeric_service = AI_NUMERICSERV); + numeric_service = AI_NUMERICSERV, # else - BOOST_STATIC_CONSTANT(int, numeric_service = 0); + numeric_service = 0, # endif - // Note: QNX Neutrino 6.3 defines AI_V4MAPPED, AI_ALL and AI_ADDRCONFIG but - // does not implement them. Therefore they are specifically excluded here. + // Note: QNX Neutrino 6.3 defines AI_V4MAPPED, AI_ALL and AI_ADDRCONFIG but + // does not implement them. Therefore they are specifically excluded here. # if defined(AI_V4MAPPED) && !defined(__QNXNTO__) - BOOST_STATIC_CONSTANT(int, v4_mapped = AI_V4MAPPED); + v4_mapped = AI_V4MAPPED, # else - BOOST_STATIC_CONSTANT(int, v4_mapped = 0); + v4_mapped = 0, # endif # if defined(AI_ALL) && !defined(__QNXNTO__) - BOOST_STATIC_CONSTANT(int, all_matching = AI_ALL); + all_matching = AI_ALL, # else - BOOST_STATIC_CONSTANT(int, all_matching = 0); + all_matching = 0, # endif # if defined(AI_ADDRCONFIG) && !defined(__QNXNTO__) - BOOST_STATIC_CONSTANT(int, address_configured = AI_ADDRCONFIG); + address_configured = AI_ADDRCONFIG # else - BOOST_STATIC_CONSTANT(int, address_configured = 0); + address_configured = 0 # endif + }; + + // Implement bitmask operations as shown in C++ Std [lib.bitmask.types]. + + friend flags operator&(flags x, flags y) + { + return static_cast<flags>( + static_cast<unsigned int>(x) & static_cast<unsigned int>(y)); + } + + friend flags operator|(flags x, flags y) + { + return static_cast<flags>( + static_cast<unsigned int>(x) | static_cast<unsigned int>(y)); + } + + friend flags operator^(flags x, flags y) + { + return static_cast<flags>( + static_cast<unsigned int>(x) ^ static_cast<unsigned int>(y)); + } + + friend flags operator~(flags x) + { + return static_cast<flags>(static_cast<unsigned int>(~x)); + } + + friend flags& operator&=(flags& x, flags y) + { + x = x & y; + return x; + } + + friend flags& operator|=(flags& x, flags y) + { + x = x | y; + return x; + } + + friend flags& operator^=(flags& x, flags y) + { + x = x ^ y; + return x; + } #endif protected: diff --git a/3rdParty/Boost/src/boost/asio/ip/resolver_service.hpp b/3rdParty/Boost/src/boost/asio/ip/resolver_service.hpp index 1cd12b9..ba59f6d 100644 --- a/3rdParty/Boost/src/boost/asio/ip/resolver_service.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/resolver_service.hpp @@ -19,6 +19,8 @@ #include <boost/asio/error.hpp> #include <boost/asio/io_service.hpp> +#include <boost/asio/ip/basic_resolver_iterator.hpp> +#include <boost/asio/ip/basic_resolver_query.hpp> #include <boost/asio/detail/resolver_service.hpp> #include <boost/asio/detail/service_base.hpp> @@ -49,10 +51,10 @@ public: typedef typename InternetProtocol::endpoint endpoint_type; /// The query type. - typedef typename InternetProtocol::resolver_query query_type; + typedef basic_resolver_query<InternetProtocol> query_type; /// The iterator type. - typedef typename InternetProtocol::resolver_iterator iterator_type; + typedef basic_resolver_iterator<InternetProtocol> iterator_type; private: // The type of the platform-specific implementation. diff --git a/3rdParty/Boost/src/boost/asio/ip/tcp.hpp b/3rdParty/Boost/src/boost/asio/ip/tcp.hpp index a42c999..541c95c 100644 --- a/3rdParty/Boost/src/boost/asio/ip/tcp.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/tcp.hpp @@ -48,10 +48,10 @@ public: /// The type of a TCP endpoint. typedef basic_endpoint<tcp> endpoint; - /// The type of a resolver query. + /// (Deprecated: use resolver::query.) The type of a resolver query. typedef basic_resolver_query<tcp> resolver_query; - /// The type of a resolver iterator. + /// (Deprecated: use resolver::iterator.) The type of a resolver iterator. typedef basic_resolver_iterator<tcp> resolver_iterator; /// Construct to represent the IPv4 TCP protocol. diff --git a/3rdParty/Boost/src/boost/asio/ip/udp.hpp b/3rdParty/Boost/src/boost/asio/ip/udp.hpp index e1793c7..e592e06 100644 --- a/3rdParty/Boost/src/boost/asio/ip/udp.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/udp.hpp @@ -45,10 +45,10 @@ public: /// The type of a UDP endpoint. typedef basic_endpoint<udp> endpoint; - /// The type of a resolver query. + /// (Deprecated: use resolver::query.) The type of a resolver query. typedef basic_resolver_query<udp> resolver_query; - /// The type of a resolver iterator. + /// (Deprecated: use resolver::iterator.) The type of a resolver iterator. typedef basic_resolver_iterator<udp> resolver_iterator; /// Construct to represent the IPv4 UDP protocol. |