#include <glib.h>
#include <string.h>
#include <stdlib.h>
+#include <unistd.h>
#include <mono/metadata/object.h>
#include <mono/io-layer/io-layer.h>
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
+#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
gint32 ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal(void)
{
+#ifdef DEBUG
g_message(G_GNUC_PRETTY_FUNCTION ": returning %d", WSAGetLastError());
+#endif
+
return(WSAGetLastError());
}
return(TRUE);
}
-extern gboolean ves_icall_System_Net_Dns_GetHostByName_internal(MonoString *host, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list)
+extern MonoBoolean ves_icall_System_Net_Dns_GetHostByName_internal(MonoString *host, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list)
{
char *hostname;
struct hostent *he;
}
#endif /* !HAVE_INET_PTON */
-extern gboolean ves_icall_System_Net_Dns_GetHostByAddr_internal(MonoString *addr, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list)
+extern MonoBoolean ves_icall_System_Net_Dns_GetHostByAddr_internal(MonoString *addr, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list)
{
struct in_addr inaddr;
struct hostent *he;
return(hostent_to_IPHostEntry(he, h_name, h_aliases, h_addr_list));
}
+extern MonoBoolean ves_icall_System_Net_Dns_GetHostName_internal(MonoString **h_name)
+{
+ guchar hostname[256];
+ int ret;
+
+ ret=gethostname (hostname, sizeof(hostname));
+ if(ret==-1) {
+ return(FALSE);
+ }
+
+ *h_name=mono_string_new(mono_domain_get (), hostname);
+
+ return(TRUE);
+}
+
+
void mono_network_init(void)
{
WSADATA wsadata;