2 * networking.h: Portable networking functions
5 * Rodrigo Kumpera (kumpera@gmail.com)
11 #ifndef __MONO_NETWORKING_H__
12 #define __MONO_NETWORKING_H__
17 #ifdef HAVE_ARPA_INET_H
18 #include <arpa/inet.h>
20 #include <sys/types.h>
21 #ifdef HAVE_SYS_SOCKET_H
22 #include <sys/socket.h>
24 #ifdef HAVE_SYS_SOCKIO_H
25 #include <sys/sockio.h>
28 #ifdef HAVE_NETINET_IN_H
29 #include <netinet/in.h>
37 #include <mono/utils/mono-compiler.h>
40 MONO_HINT_UNSPECIFIED = 0,
43 MONO_HINT_CANONICAL_NAME = 4,
44 MONO_HINT_CONFIGURED_ONLY = 8,
45 } MonoGetAddressHints;
47 typedef struct _MonoAddressEntry MonoAddressEntry;
49 struct _MonoAddressEntry {
58 const char *canonical_name;
59 MonoAddressEntry *next;
63 MonoAddressEntry *entries;
68 struct sockaddr_in v4;
69 struct sockaddr_in6 v6;
81 /* This only supports IPV4 / IPV6 and tcp */
82 int mono_get_address_info (const char *hostname, int port, int flags, MonoAddressInfo **res) MONO_INTERNAL;
84 void mono_free_address_info (MonoAddressInfo *ai) MONO_INTERNAL;
86 void mono_socket_address_init (MonoSocketAddress *sa, socklen_t *len, int family, const void *address, int port) MONO_INTERNAL;
88 void *mono_get_local_interfaces (int family, int *interface_count) MONO_INTERNAL;
90 #ifndef HAVE_INET_PTON
91 int inet_pton (int family, const char *address, void *inaddrp) MONO_INTERNAL;
94 void mono_address_init (MonoAddress *out_addr, int family, void *in_addr) MONO_INTERNAL;
95 int mono_address_size_for_family (int family) MONO_INTERNAL;
96 gboolean mono_networking_addr_to_str (MonoAddress *address, char *buffer, socklen_t buflen) MONO_INTERNAL;
98 int mono_networking_get_tcp_protocol (void) MONO_INTERNAL;
99 int mono_networking_get_ip_protocol (void) MONO_INTERNAL;
100 int mono_networking_get_ipv6_protocol (void) MONO_INTERNAL;