2002-02-14 Jeffrey Stedfast <fejj@ximian.com>
authorJeffrey Stedfast <fejj@novell.com>
Thu, 14 Feb 2002 21:22:40 +0000 (21:22 -0000)
committerJeffrey Stedfast <fejj@novell.com>
Thu, 14 Feb 2002 21:22:40 +0000 (21:22 -0000)
* socket-io.c: Don't conditionally include sys/filio.h or
sys/sockio.h here anymore since we now get them from
io-layer/io-layer.h
(inet_pton): If the system doesn't support inet_aton, implement
using inet_addr and also #define INADDR_NONE if it isn't defined
by the system.

svn path=/trunk/mono/; revision=2415

mono/metadata/ChangeLog
mono/metadata/socket-io.c

index 044240c3fcc083291843bf9b9a794830d9081ed8..009684dcfd05654a21a1066c1c3013134eb6ee94 100644 (file)
@@ -1,3 +1,11 @@
+2002-02-14  Jeffrey Stedfast  <fejj@ximian.com>
+
+       * socket-io.c: Don't conditionally include sys/filio.h or
+       sys/sockio.h here anymore since we now get them from
+       io-layer/io-layer.h
+       (inet_pton): If the system doesn't support inet_aton, implement
+       using inet_addr and also #define INADDR_NONE if it isn't defined
+       by the system.
 
 Thu Feb 14 19:01:06 CET 2002 Paolo Molaro <lupus@ximian.com>
 
index eb7f5789b88dd53e009d82f2f64039953a51cea7..5366e7941e50537e0e28cf192e111b186c2c4b66 100644 (file)
 
 #include <sys/time.h> 
 
-#ifdef HAVE_SYS_FILIO_H
-#include <sys/filio.h>    /* defines FIONBIO and FIONREAD */
-#endif
-#ifdef HAVE_SYS_SOCKIO_H
-#include <sys/sockio.h>   /* defines SIOCATMARK */
-#endif
-
 #undef DEBUG
 
 static gint32 convert_family(MonoAddressFamily mono_family)
@@ -1242,6 +1235,7 @@ static int
 inet_pton (int family, const char *address, void *inaddrp)
 {
        if (family == AF_INET) {
+#ifdef HAVE_INET_ATON
                struct in_addr inaddr;
                
                if (!inet_aton (address, &inaddr))
@@ -1249,6 +1243,26 @@ inet_pton (int family, const char *address, void *inaddrp)
                
                memcpy (inaddrp, &inaddr, sizeof (struct in_addr));
                return 1;
+#else
+               /* assume the system has inet_addr(), if it doesn't
+                  have that we're pretty much screwed... */
+               in_addr_t inaddr;
+               
+               if (!strcmp (address, "255.255.255.255")) {
+                       /* special-case hack */
+                       inaddr = 0xffffffff;
+               } else {
+                       inaddr = inet_addr (address);
+#ifndef INADDR_NONE
+#define INADDR_NONE ((in_addr_t) -1)
+#endif
+                       if (inaddr == INADDR_NONE)
+                               return 0;
+               }
+               
+               memcpy (inaddrp, &inaddr, sizeof (in_addr_t));
+               return 1;
+#endif /* HAVE_INET_ATON */
        }
        
        errno = EAFNOSUPPRT;