3 * Portable networking functions
6 * Rodrigo Kumpera (kumpera@gmail.com)
12 #ifndef __MONO_NETWORKING_H__
13 #define __MONO_NETWORKING_H__
18 #ifdef HAVE_ARPA_INET_H
19 #include <arpa/inet.h>
21 #include <sys/types.h>
22 #ifdef HAVE_SYS_SOCKET_H
23 #include <sys/socket.h>
25 #ifdef HAVE_SYS_SOCKIO_H
26 #include <sys/sockio.h>
29 #ifdef HAVE_NETINET_IN_H
30 #include <netinet/in.h>
38 #include <mono/utils/mono-compiler.h>
41 MONO_HINT_UNSPECIFIED = 0,
44 MONO_HINT_CANONICAL_NAME = 4,
45 MONO_HINT_CONFIGURED_ONLY = 8,
46 } MonoGetAddressHints;
48 typedef struct _MonoAddressEntry MonoAddressEntry;
50 struct _MonoAddressEntry {
59 const char *canonical_name;
60 MonoAddressEntry *next;
64 MonoAddressEntry *entries;
69 struct sockaddr_in v4;
70 struct sockaddr_in6 v6;
82 /* This only supports IPV4 / IPV6 and tcp */
83 int mono_get_address_info (const char *hostname, int port, int flags, MonoAddressInfo **res);
85 void mono_free_address_info (MonoAddressInfo *ai);
87 void mono_socket_address_init (MonoSocketAddress *sa, socklen_t *len, int family, const void *address, int port);
89 void *mono_get_local_interfaces (int family, int *interface_count);
91 #ifndef HAVE_INET_PTON
92 int inet_pton (int family, const char *address, void *inaddrp);
95 void mono_address_init (MonoAddress *out_addr, int family, void *in_addr);
96 int mono_address_size_for_family (int family);
97 gboolean mono_networking_addr_to_str (MonoAddress *address, char *buffer, socklen_t buflen);
99 int mono_networking_get_tcp_protocol (void);
100 int mono_networking_get_ip_protocol (void);
101 int mono_networking_get_ipv6_protocol (void);
103 void mono_networking_init (void);
104 void mono_networking_shutdown (void);