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 //wasm does have inet_pton even though autoconf fails to find
20 #if !defined (HAVE_INET_PTON) && !defined (HOST_WASM)
23 inet_pton (int family, const char *address, void *inaddrp)
25 if (family == AF_INET) {
27 struct in_addr inaddr;
29 if (!inet_aton (address, &inaddr))
32 memcpy (inaddrp, &inaddr, sizeof (struct in_addr));
35 /* assume the system has inet_addr(), if it doesn't
36 have that we're pretty much screwed... */
39 if (!strcmp (address, "255.255.255.255")) {
40 /* special-case hack */
43 inaddr = inet_addr (address);
45 #define INADDR_NONE ((in_addr_t) -1)
47 if (inaddr == INADDR_NONE)
51 memcpy (inaddrp, &inaddr, sizeof (guint32));
53 #endif /* HAVE_INET_ATON */
59 #else /* !HAVE_INET_PTON */
61 MONO_EMPTY_SOURCE_FILE (networking_missing);
62 #endif /* !HAVE_INET_PTON */