summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2003-07-25 09:36:11 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2003-07-25 09:36:11 +0000
commitb4d95b1d67569c31b1a25ceb0c7b7d8b47360687 (patch)
tree4c36337e44488141f49b3cf6c58b295277a91c80
parent87b64b78d1c50918baf02144f64703acbd38be77 (diff)
downloadATCD-b4d95b1d67569c31b1a25ceb0c7b7d8b47360687.tar.gz
ChangeLogTag: Fri Jul 25 09:11:12 UTC 2003 Johnny Willemsen <jwillemsen@remedy.nl>
-rw-r--r--ChangeLog12
-rw-r--r--ace/OS.cpp122
-rw-r--r--ace/config-win32-common.h10
3 files changed, 80 insertions, 64 deletions
diff --git a/ChangeLog b/ChangeLog
index 723ad22890a..516165007a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Fri Jul 25 09:34:11 UTC 2003 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/config-win32-common.h:
+ Also include nb30.h with MinGW and Borland, but don't do a
+ pragma comment with MinGW
+
+ * ace/OS.cpp (getmacaddress):
+ Fixed incorrect trace, with Borland and MinGW use a reinterpret
+ cast instead of a static cast.
+
Thu Jul 24 17:32:51 2003 Pradeep Gore <pradeep@oomworks.com>
* bin/tao_other_tests.lst:
@@ -13,7 +23,7 @@ Thu Jul 24 16:23:53 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
Thu Jul 24 14:00:29 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
- * ace/DEV_IO.h (recv_n):
+ * ace/DEV_IO.h (recv_n):
* ace/DEV_IO.i: The semantics of recv_n () is now changed to have
a timeout and a byte transferred variable. The interface now has
the semantics asscoiated with ACE_OS::recv_n () and ACE::recv_n
diff --git a/ace/OS.cpp b/ace/OS.cpp
index 1b6b5ac4cd9..5722d741817 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -4807,12 +4807,12 @@ ACE_Thread_ID::handle (ACE_hthread_t thread_handle)
void
ACE_Thread_ID::to_string (char* thr_id)
{
-
+
char format[128]; // Converted format string
char *fp; // Current format pointer
fp = format;
*fp++ = '%'; // Copy in the %
-
+
#if defined (ACE_WIN32)
ACE_OS::strcpy (fp, "u");
ACE_OS::sprintf (thr_id,
@@ -7715,145 +7715,149 @@ ACE_OS::num_processors_online (void)
#endif
int
-ACE_OS::getmacaddress (struct macaddr_node_t *node)
+ACE_OS::getmacaddress (struct macaddr_node_t *node)
{
- ACE_OS_TRACE ("getmacaddr");
-
+ ACE_OS_TRACE ("ACE_OS::getmacaddress");
+
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
-
+
/** Define a structure for use with the netbios routine */
struct ADAPTERSTAT
{
ADAPTER_STATUS adapt;
NAME_BUFFER NameBuff [30];
};
-
+
NCB ncb;
LANA_ENUM lenum;
unsigned char result;
-
+
ACE_OS::memset (&ncb, 0, sizeof(ncb));
ncb.ncb_command = NCBENUM;
ncb.ncb_buffer = ACE_reinterpret_cast (unsigned char*,&lenum);
ncb.ncb_length = sizeof(lenum);
-
+
result = Netbios (&ncb);
-
+
for(int i = 0; i < lenum.length; i++)
{
ACE_OS::memset (&ncb, 0, sizeof(ncb));
ncb.ncb_command = NCBRESET;
ncb.ncb_lana_num = lenum.lana [i];
-
+
/** Reset the netbios */
result = Netbios (&ncb);
-
- if (ncb.ncb_retcode != NRC_GOODRET)
+
+ if (ncb.ncb_retcode != NRC_GOODRET)
{
return -1;
}
-
+
ADAPTERSTAT adapter;
ACE_OS::memset (&ncb, 0, sizeof (ncb));
+# if defined (__BORLANDC__) || defined (__MINGW32__)
+ ACE_OS::strcpy (ACE_reinterpret_cast (char*, ncb.ncb_callname), "*");
+# else
ACE_OS::strcpy (ACE_static_cast (char*, ncb.ncb_callname), "*");
+# endif /* __BORLANDC__ || __MINGW32__ */
ncb.ncb_command = NCBASTAT;
ncb.ncb_lana_num = lenum.lana[i];
ncb.ncb_buffer = ACE_reinterpret_cast (unsigned char*, &adapter);
ncb.ncb_length = sizeof (adapter);
-
+
result = Netbios (&ncb);
-
+
if (result == 0)
{
ACE_OS::memcpy (node->node,
- adapter.adapt.adapter_address,
+ adapter.adapt.adapter_address,
6);
return 0;
}
}
return 0;
#elif defined (sun)
-
+
int result = 0;
-
+
/** obtain the local host name */
char hostname [MAXHOSTNAMELEN];
ACE_OS::hostname (hostname, sizeof (hostname));
-
+
/** Get the hostent to use with ioctl */
- struct hostent *phost =
+ struct hostent *phost =
ACE_OS::gethostbyname (hostname);
-
- if (phost == 0)
+
+ if (phost == 0)
{
return -1;
}
-
- ACE_HANDLE handle =
+
+ ACE_HANDLE handle =
ACE_OS::socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP);
-
- if (handle == ACE_INVALID_HANDLE)
+
+ if (handle == ACE_INVALID_HANDLE)
{
return -1;
}
-
+
char **paddrs = phost->h_addr_list;
-
+
struct arpreq ar;
-
- struct sockaddr_in *psa =
+
+ struct sockaddr_in *psa =
(struct sockaddr_in *)&(ar.arp_pa);
-
- ACE_OS::memset (&ar,
- 0,
+
+ ACE_OS::memset (&ar,
+ 0,
sizeof (struct arpreq));
-
+
psa->sin_family = AF_INET;
-
- ACE_OS::memcpy (&(psa->sin_addr),
- *paddrs,
- sizeof (struct in_addr));
-
- if (ACE_OS::ioctl (handle,
- SIOCGARP,
+
+ ACE_OS::memcpy (&(psa->sin_addr),
+ *paddrs,
+ sizeof (struct in_addr));
+
+ if (ACE_OS::ioctl (handle,
+ SIOCGARP,
&ar) == -1)
{
return -1;
}
-
+
ACE_OS::close (handle);
-
+
ACE_OS::memcpy (node->node,
ar.arp_ha.sa_data,
6);
-
+
return 0;
-
+
#elif defined (linux)
-
+
struct ifreq ifr;
-
- ACE_HANDLE handle =
+
+ ACE_HANDLE handle =
ACE_OS::socket (PF_INET, SOCK_DGRAM, 0);
-
- if (handle == ACE_INVALID_HANDLE)
+
+ if (handle == ACE_INVALID_HANDLE)
{
return -1;
}
-
+
ACE_OS::strcpy (ifr.ifr_name, "eth0");
-
- if (ACE_OS::ioctl (handle/*s*/, SIOCGIFHWADDR, &ifr) < 0)
+
+ if (ACE_OS::ioctl (handle/*s*/, SIOCGIFHWADDR, &ifr) < 0)
{
ACE_OS::close (handle);
return -1;
}
-
- struct sockaddr* sa =
+
+ struct sockaddr* sa =
(struct sockaddr *) &ifr.ifr_addr;
-
- ACE_OS::memcpy (node->node,
- sa->sa_data,
+
+ ACE_OS::memcpy (node->node,
+ sa->sa_data,
6);
return 0;
diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h
index 798f42b6a42..9b2656b2931 100644
--- a/ace/config-win32-common.h
+++ b/ace/config-win32-common.h
@@ -578,11 +578,13 @@ typedef unsigned long long ACE_UINT64;
// Needed for obtaining the MAC address
// I dont believe this will work under CE, notice the
-// check for UNDER_CE.
-# if defined (_MSC_VER) && !defined (UNDER_CE)
+// check for ACE_HAS_WINCE.
+# if !defined (ACE_HAS_WINCE)
# include <nb30.h>
-# pragma comment(lib, "netapi32.lib") // needed for obtaing MACaddress
-# endif /* _MSC_VER */
+# if !defined (__MINGW32__)
+# pragma comment(lib, "netapi32.lib") // needed for obtaing MACaddress
+# endif
+# endif /* !ACE_HAS_WINCE */
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_WIN32_COMMON_H */