summaryrefslogtreecommitdiff
path: root/gio/ginetaddress.c
diff options
context:
space:
mode:
Diffstat (limited to 'gio/ginetaddress.c')
-rw-r--r--gio/ginetaddress.c92
1 files changed, 0 insertions, 92 deletions
diff --git a/gio/ginetaddress.c b/gio/ginetaddress.c
index 0a0a85a48..787c757da 100644
--- a/gio/ginetaddress.c
+++ b/gio/ginetaddress.c
@@ -376,98 +376,6 @@ g_inet_address_init (GInetAddress *address)
address->priv = g_inet_address_get_instance_private (address);
}
-/* These are provided so that we can use inet_pton() and inet_ntop() on Windows
- * if they are available (i.e. Vista and later), and use the existing code path
- * on Windows XP/Server 2003. We can drop this portion when we drop support for
- * XP/Server 2003.
- */
-#if defined(G_OS_WIN32) && _WIN32_WINNT < 0x0600
-static gint
-inet_pton (gint family,
- const gchar *addr_string,
- gpointer addr)
-{
- /* For Vista/Server 2008 and later, there is native inet_pton() in Winsock2 */
- if (ws2funcs.pInetPton != NULL)
- return ws2funcs.pInetPton (family, addr_string, addr);
- else
- {
- /* Fallback codepath for XP/Server 2003 */
- struct sockaddr_storage sa;
- struct sockaddr_in *sin = (struct sockaddr_in *)&sa;
- struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&sa;
- gint len = sizeof (sa);
-
- if (family != AF_INET && family != AF_INET6)
- {
- WSASetLastError (WSAEAFNOSUPPORT);
- return -1;
- }
-
- /* WSAStringToAddress() will accept various not-an-IP-address
- * strings like "127.0.0.1:80", "[1234::5678]:80", "127.1", etc.
- */
- if (!g_hostname_is_ip_address (addr_string))
- return 0;
-
- if (WSAStringToAddress ((LPTSTR) addr_string, family, NULL, (LPSOCKADDR) &sa, &len) != 0)
- return 0;
-
- if (family == AF_INET)
- *(IN_ADDR *)addr = sin->sin_addr;
- else
- *(IN6_ADDR *)addr = sin6->sin6_addr;
-
- return 1;
- }
-}
-
-static const gchar *
-inet_ntop (gint family,
- const gpointer addr,
- gchar *addr_str,
- socklen_t size)
-{
- /* On Vista/Server 2008 and later, there is native inet_ntop() in Winsock2 */
- if (ws2funcs.pInetNtop != NULL)
- return ws2funcs.pInetNtop (family, addr, addr_str, size);
- else
- {
- /* Fallback codepath for XP/Server 2003 */
- DWORD buflen = size, addrlen;
- struct sockaddr_storage sa;
- struct sockaddr_in *sin = (struct sockaddr_in *)&sa;
- struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&sa;
-
- memset (&sa, 0, sizeof (sa));
- sa.ss_family = family;
- if (sa.ss_family == AF_INET)
- {
- struct in_addr *addrv4 = (struct in_addr *) addr;
-
- addrlen = sizeof (*sin);
- memcpy (&sin->sin_addr, addrv4, sizeof (sin->sin_addr));
- }
- else if (sa.ss_family == AF_INET6)
- {
- struct in6_addr *addrv6 = (struct in6_addr *) addr;
-
- addrlen = sizeof (*sin6);
- memcpy (&sin6->sin6_addr, addrv6, sizeof (sin6->sin6_addr));
- }
- else
- {
- WSASetLastError (WSAEAFNOSUPPORT);
- return NULL;
- }
- if (WSAAddressToString ((LPSOCKADDR) &sa, addrlen, NULL, addr_str, &buflen) == 0)
- return addr_str;
- else
- return NULL;
- }
-}
-#endif
-
/**
* g_inet_address_new_from_string:
* @string: a string representation of an IP address