summaryrefslogtreecommitdiff
path: root/ace/Sock_Connect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ace/Sock_Connect.cpp')
-rw-r--r--ace/Sock_Connect.cpp60
1 files changed, 26 insertions, 34 deletions
diff --git a/ace/Sock_Connect.cpp b/ace/Sock_Connect.cpp
index 99229c7c3f9..c598b103ef1 100644
--- a/ace/Sock_Connect.cpp
+++ b/ace/Sock_Connect.cpp
@@ -50,16 +50,16 @@ extern "C" {
#include "ace/OS_NS_stdio.h"
#endif /* ACE_VXWORKS < 0x600 */
-#if defined (ACE_VXWORKS) && ((ACE_VXWORKS == 0x630) || (ACE_VXWORKS == 0x640)) && defined (__RTP__) && defined (ACE_HAS_IPV6)
+#if defined (ACE_VXWORKS) && ((ACE_VXWORKS >= 0x630) && (ACE_VXWORKS <= 0x670)) && defined (__RTP__) && defined (ACE_HAS_IPV6)
const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
const struct in6_addr in6addr_nodelocal_allnodes = IN6ADDR_NODELOCAL_ALLNODES_INIT;
const struct in6_addr in6addr_linklocal_allnodes = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
const struct in6_addr in6addr_linklocal_allrouters = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT;
-#endif /* ACE_VXWORKS == 0x630 && __RTP__ && ACE_HAS_IPV6 */
+#endif /* ACE_VXWORKS >= 0x630 && <= 0x670 && __RTP__ && ACE_HAS_IPV6 */
#if defined (ACE_HAS_WINCE)
-#include /**/ <Iphlpapi.h>
-# if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
+#include /**/ <iphlpapi.h>
+# if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && (_WIN32_WCE < 0x600) && defined (ACE_HAS_IPV6)
// The following code is suggested by microsoft as a workaround to the fact
// that on Windows CE, these constants are exported as function addresses
// rather than simply values.
@@ -275,7 +275,7 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr,
#endif /* ! _UNICOS */
}
-#if !defined(AIX) && !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__)
+#if !defined(AIX) && !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (__Lynx__)
for (int n = ifc.ifc_len / sizeof (struct ifreq) ; n > 0;
n--, ifr++)
#else
@@ -288,7 +288,7 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr,
ifr = (struct ifreq *)
((caddr_t) &ifr->ifr_addr + ifr->ifr_addr.sa_len)) :
(nbytes -= sizeof (struct ifreq), ifr++)))
-#endif /* !defined(AIX) && !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) */
+#endif /* !defined(AIX) && !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (__Lynx__) */
{
struct sockaddr_in if_addr;
@@ -1180,8 +1180,7 @@ get_ip_interfaces_vxworks_lt600 (size_t &count,
// responsible for calling delete [] on parray
int
-ACE::get_ip_interfaces (size_t &count,
- ACE_INET_Addr *&addrs)
+ACE::get_ip_interfaces (size_t &count, ACE_INET_Addr *&addrs)
{
ACE_TRACE ("ACE::get_ip_interfaces");
@@ -1198,7 +1197,7 @@ ACE::get_ip_interfaces (size_t &count,
return get_ip_interfaces_aix (count, addrs);
#elif defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x600) && !defined (ACE_HAS_VXWORKS551_MEDUSA)
return get_ip_interfaces_vxworks_lt600 (count, addrs);
-#elif (defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (ACE_OPENVMS) || (defined (ACE_VXWORKS) && (ACE_VXWORKS == 0x650)) || defined (ACE_HAS_RTEMS)) && !defined (ACE_LACKS_NETWORKING)
+#elif (defined (__unix) || defined (__unix__) || defined (ACE_OPENVMS) || (defined (ACE_VXWORKS) && !defined (ACE_HAS_GETIFADDRS)) || defined (ACE_HAS_RTEMS)) && !defined (ACE_LACKS_NETWORKING)
// COMMON (SVR4 and BSD) UNIX CODE
// Call specific routine as necessary.
@@ -1210,7 +1209,7 @@ ACE::get_ip_interfaces (size_t &count,
ACE_TEXT ("ACE::get_ip_interfaces:open")),
-1);
- size_t num_ifs, num_ifs_found;
+ size_t num_ifs = 0;
if (ACE::count_interfaces (handle, num_ifs))
{
@@ -1269,7 +1268,7 @@ ACE::get_ip_interfaces (size_t &count,
-1); // caller must free
struct IFREQ *pcur = p_ifs.get ();
- num_ifs_found = ifcfg.IFC_LEN / sizeof (struct IFREQ); // get the number of returned ifs
+ size_t num_ifs_found = ifcfg.IFC_LEN / sizeof (struct IFREQ); // get the number of returned ifs
// Pull the address out of each INET interface. Not every interface
// is for IP, so be careful to count properly. When setting the
@@ -1328,7 +1327,7 @@ ACE::get_ip_interfaces (size_t &count,
# endif /* ! _UNICOS */
}
-#if !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (ACE_HAS_RTEMS)
+#if !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (ACE_HAS_RTEMS) && !defined (__Lynx__)
++pcur;
#else
if (pcur->ifr_addr.sa_len <= sizeof (struct sockaddr))
@@ -1340,14 +1339,14 @@ ACE::get_ip_interfaces (size_t &count,
pcur = (struct ifreq *)
(pcur->ifr_addr.sa_len + (caddr_t) &pcur->ifr_addr);
}
-#endif /* !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) */
+#endif /* !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (ACE_HAS_RTEMS) && !defined (__Lynx__) */
}
# if defined (ACE_HAS_IPV6)
// Retrieve IPv6 local interfaces by scanning /proc/net/if_inet6 if
// it exists. If we cannot open it then ignore possible IPv6
// interfaces, we did our best;-)
- FILE* fp;
+ FILE* fp = 0;
char addr_p[8][5];
char s_ipaddr[64];
int scopeid;
@@ -1404,17 +1403,10 @@ ACE::get_ip_interfaces (size_t &count,
// list of ifreq structs.
int
-ACE::count_interfaces (ACE_HANDLE handle,
- size_t &how_many)
+ACE::count_interfaces (ACE_HANDLE handle, size_t &how_many)
{
-#if defined (ACE_WIN32) || defined (ACE_HAS_GETIFADDRS) || defined (__hpux) || defined (_AIX) || (defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x600))
- // none of these platforms make use of count_interfaces
- ACE_UNUSED_ARG (handle);
- ACE_UNUSED_ARG (how_many);
- ACE_NOTSUP_RETURN (-1); // no implementation
-
-#elif defined (SIOCGIFNUM)
-# if defined (SIOCGLIFNUM)
+#if defined (SIOCGIFNUM)
+# if defined (SIOCGLIFNUM) && !defined (ACE_LACKS_STRUCT_LIFNUM)
int cmd = SIOCGLIFNUM;
struct lifnum if_num = {AF_UNSPEC,0,0};
# else
@@ -1427,29 +1419,28 @@ ACE::count_interfaces (ACE_HANDLE handle,
ACE_TEXT ("ACE::count_interfaces:")
ACE_TEXT ("ioctl - SIOCGLIFNUM failed")),
-1);
-# if defined (SIOCGLIFNUM)
+# if defined (SIOCGLIFNUM) && !defined (ACE_LACKS_STRUCT_LIFNUM)
how_many = if_num.lifn_count;
# else
how_many = if_num;
# endif /* SIOCGLIFNUM */
return 0;
-#elif (defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (ACE_OPENVMS) || defined (ACE_HAS_RTEMS)) && !defined (ACE_LACKS_NETWORKING)
+#elif (defined (__unix) || defined (__unix__) || defined (ACE_OPENVMS) || defined (ACE_HAS_RTEMS) || (defined (ACE_VXWORKS) && !defined (ACE_HAS_GETIFADDRS))) && !defined (ACE_LACKS_NETWORKING)
// Note: DEC CXX doesn't define "unix". BSD compatible OS: HP UX,
// AIX, SunOS 4.x perform some ioctls to retrieve ifconf list of
// ifreq structs no SIOCGIFNUM on SunOS 4.x, so use guess and scan
// algorithm
// Probably hard to put this many ifs in a unix box..
- const int MAX_IF = 50;
+ int const MAX_IF = 50;
// HACK - set to an unreasonable number
- int num_ifs = MAX_IF;
+ int const num_ifs = MAX_IF;
struct ifconf ifcfg;
size_t ifreq_size = num_ifs * sizeof (struct ifreq);
- struct ifreq *p_ifs =
- (struct ifreq *) ACE_OS::malloc (ifreq_size);
+ struct ifreq *p_ifs = (struct ifreq *) ACE_OS::malloc (ifreq_size);
if (!p_ifs)
{
@@ -1475,7 +1466,8 @@ return 0;
-1);
}
- int if_count = 0, i;
+ int if_count = 0;
+ int i = 0;
// get if address out of ifreq buffers. ioctl puts a blank-named
// interface to mark the end of the returned interfaces.
@@ -1489,7 +1481,7 @@ return 0;
break;
++if_count;
-#if !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (ACE_HAS_RTEMS)
+#if !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (ACE_HAS_RTEMS) && !defined (__Lynx__)
++p_ifs;
#else
if (p_ifs->ifr_addr.sa_len <= sizeof (struct sockaddr))
@@ -1501,7 +1493,7 @@ return 0;
p_ifs = (struct ifreq *)
(p_ifs->ifr_addr.sa_len + (caddr_t) &p_ifs->ifr_addr);
}
-#endif /* !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) */
+#endif /* !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (ACE_HAS_RTEMS) && !defined (__Lynx__)*/
}
ACE_OS::free (ifcfg.ifc_req);
@@ -1538,7 +1530,7 @@ ACE::get_handle (void)
ACE_HANDLE handle = ACE_INVALID_HANDLE;
#if defined (sparc)
handle = ACE_OS::open ("/dev/udp", O_RDONLY);
-#elif defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (_AIX) || defined (__hpux) || (defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600)) || defined (ACE_OPENVMS) || defined (ACE_HAS_RTEMS)
+#elif defined (__unix) || defined (__unix__) || defined (_AIX) || defined (__hpux) || (defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600)) || defined (ACE_OPENVMS) || defined (ACE_HAS_RTEMS)
// Note: DEC CXX doesn't define "unix" BSD compatible OS: HP UX,
// AIX, SunOS 4.x