Update of /cvsroot/boost/boost/boost/asio/ip
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7221/boost/asio/ip

Modified Files:
        address_v6.hpp basic_endpoint.hpp multicast.hpp unicast.hpp 
Log Message:
Some fixes for Solaris, AIX and HP-UX.


Index: address_v6.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/asio/ip/address_v6.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- address_v6.hpp      4 Jan 2007 05:53:01 -0000       1.5
+++ address_v6.hpp      20 Feb 2007 13:19:53 -0000      1.6
@@ -167,8 +167,8 @@
   {
     if (!is_v4_mapped() && !is_v4_compatible())
       throw std::bad_cast();
-    address_v4::bytes_type v4_bytes = { addr_.s6_addr[12],
-      addr_.s6_addr[13], addr_.s6_addr[14], addr_.s6_addr[15] };
+    address_v4::bytes_type v4_bytes = { { addr_.s6_addr[12],
+      addr_.s6_addr[13], addr_.s6_addr[14], addr_.s6_addr[15] } };
     return address_v4(v4_bytes);
   }
 
@@ -346,8 +346,8 @@
   static address_v6 v4_mapped(const address_v4& addr)
   {
     address_v4::bytes_type v4_bytes = addr.to_bytes();
-    bytes_type v6_bytes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF,
-      v4_bytes[0], v4_bytes[1], v4_bytes[2], v4_bytes[3] };
+    bytes_type v6_bytes = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF,
+      v4_bytes[0], v4_bytes[1], v4_bytes[2], v4_bytes[3] } };
     return address_v6(v6_bytes);
   }
 
@@ -355,8 +355,8 @@
   static address_v6 v4_compatible(const address_v4& addr)
   {
     address_v4::bytes_type v4_bytes = addr.to_bytes();
-    bytes_type v6_bytes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-      v4_bytes[0], v4_bytes[1], v4_bytes[2], v4_bytes[3] };
+    bytes_type v6_bytes = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+      v4_bytes[0], v4_bytes[1], v4_bytes[2], v4_bytes[3] } };
     return address_v6(v6_bytes);
   }
 

Index: basic_endpoint.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/asio/ip/basic_endpoint.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- basic_endpoint.hpp  4 Jan 2007 05:53:01 -0000       1.6
+++ basic_endpoint.hpp  20 Feb 2007 13:19:53 -0000      1.7
@@ -173,7 +173,7 @@
   /// The protocol associated with the endpoint.
   protocol_type protocol() const
   {
-    if (data_.ss_family == AF_INET)
+    if (is_v4())
       return InternetProtocol::v4();
     return InternetProtocol::v6();
   }
@@ -193,7 +193,7 @@
   /// Get the underlying size of the endpoint in the native type.
   size_type size() const
   {
-    if (data_.ss_family == AF_INET)
+    if (is_v4())
       return sizeof(boost::asio::detail::sockaddr_in4_type);
     else
       return sizeof(boost::asio::detail::sockaddr_in6_type);
@@ -219,7 +219,7 @@
   /// the host's byte order.
   unsigned short port() const
   {
-    if (data_.ss_family == AF_INET)
+    if (is_v4())
     {
       return boost::asio::detail::socket_ops::network_to_host_short(
           reinterpret_cast<const boost::asio::detail::sockaddr_in4_type&>(
@@ -237,7 +237,7 @@
   /// the host's byte order.
   void port(unsigned short port_num)
   {
-    if (data_.ss_family == AF_INET)
+    if (is_v4())
     {
       reinterpret_cast<boost::asio::detail::sockaddr_in4_type&>(data_).sin_port
         = boost::asio::detail::socket_ops::host_to_network_short(port_num);
@@ -253,7 +253,7 @@
   boost::asio::ip::address address() const
   {
     using namespace std; // For memcpy.
-    if (data_.ss_family == AF_INET)
+    if (is_v4())
     {
       const boost::asio::detail::sockaddr_in4_type& data
         = reinterpret_cast<const boost::asio::detail::sockaddr_in4_type&>(
@@ -306,6 +306,16 @@
   }
 
 private:
+  // Helper function to determine whether the endpoint is IPv4.
+  bool is_v4() const
+  {
+#if defined(_AIX)
+    return data_.__ss_family == AF_INET;
+#else
+    return data_.ss_family == AF_INET;
+#endif
+  }
+
   // The underlying IP socket address.
   boost::asio::detail::sockaddr_storage_type data_;
 };

Index: multicast.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/asio/ip/multicast.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- multicast.hpp       6 Jan 2007 09:07:13 -0000       1.4
+++ multicast.hpp       20 Feb 2007 13:19:53 -0000      1.5
@@ -134,7 +134,7 @@
 #if defined(GENERATING_DOCUMENTATION)
 typedef implementation_defined hops;
 #else
-typedef boost::asio::ip::detail::socket_option::integer<
+typedef boost::asio::ip::detail::socket_option::multicast_hops<
   IPPROTO_IP, IP_MULTICAST_TTL, IPPROTO_IPV6, IPV6_MULTICAST_HOPS> hops;
 #endif
 

Index: unicast.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/asio/ip/unicast.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- unicast.hpp 6 Jan 2007 09:10:54 -0000       1.1
+++ unicast.hpp 20 Feb 2007 13:19:53 -0000      1.2
@@ -58,7 +58,7 @@
 #if defined(GENERATING_DOCUMENTATION)
 typedef implementation_defined hops;
 #else
-typedef boost::asio::ip::detail::socket_option::integer<
+typedef boost::asio::ip::detail::socket_option::unicast_hops<
   IPPROTO_IP, IP_TTL, IPPROTO_IPV6, IPV6_UNICAST_HOPS> hops;
 #endif
 


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to