3 * Implements missing standard socket functions.
6 * Rodrigo Kumpera (kumpera@gmail.com)
11 #include <mono/utils/networking.h>
12 #include <mono/utils/mono-compiler.h>
19 #ifndef HAVE_INET_PTON
22 inet_pton (int family, const char *address, void *inaddrp)
24 if (family == AF_INET) {
26 struct in_addr inaddr;
28 if (!inet_aton (address, &inaddr))
31 memcpy (inaddrp, &inaddr, sizeof (struct in_addr));
34 /* assume the system has inet_addr(), if it doesn't
35 have that we're pretty much screwed... */
38 if (!strcmp (address, "255.255.255.255")) {
39 /* special-case hack */
42 inaddr = inet_addr (address);
44 #define INADDR_NONE ((in_addr_t) -1)
46 if (inaddr == INADDR_NONE)
50 memcpy (inaddrp, &inaddr, sizeof (guint32));
52 #endif /* HAVE_INET_ATON */
58 #else /* !HAVE_INET_PTON */
60 MONO_EMPTY_SOURCE_FILE (networking_missing);
61 #endif /* !HAVE_INET_PTON */