summaryrefslogtreecommitdiff
path: root/ACE/ace/Sock_Connect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ACE/ace/Sock_Connect.cpp')
-rw-r--r--ACE/ace/Sock_Connect.cpp42
1 files changed, 17 insertions, 25 deletions
diff --git a/ACE/ace/Sock_Connect.cpp b/ACE/ace/Sock_Connect.cpp
index e275c96bcb2..9df93e68414 100644
--- a/ACE/ace/Sock_Connect.cpp
+++ b/ACE/ace/Sock_Connect.cpp
@@ -58,8 +58,8 @@ const struct in6_addr in6addr_linklocal_allrouters = IN6ADDR_LINKLOCAL_ALLROUTER
#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.
@@ -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 (__Lynx__) || 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
@@ -1347,7 +1346,7 @@ ACE::get_ip_interfaces (size_t &count,
// 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 (__Lynx__) || 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.