2 * networking-missing.c: Implements missing standard socket functions.
5 * Rodrigo Kumpera (kumpera@gmail.com)
10 #include <mono/utils/networking.h>
11 #include <mono/utils/mono-compiler.h>
18 #ifndef HAVE_INET_PTON
21 inet_pton (int family, const char *address, void *inaddrp)
23 if (family == AF_INET) {
25 struct in_addr inaddr;
27 if (!inet_aton (address, &inaddr))
30 memcpy (inaddrp, &inaddr, sizeof (struct in_addr));
33 /* assume the system has inet_addr(), if it doesn't
34 have that we're pretty much screwed... */
37 if (!strcmp (address, "255.255.255.255")) {
38 /* special-case hack */
41 inaddr = inet_addr (address);
43 #define INADDR_NONE ((in_addr_t) -1)
45 if (inaddr == INADDR_NONE)
49 memcpy (inaddrp, &inaddr, sizeof (guint32));
51 #endif /* HAVE_INET_ATON */
57 #else /* !HAVE_INET_PTON */
59 MONO_EMPTY_SOURCE_FILE (networking_missing);
60 #endif /* !HAVE_INET_PTON */