Add files missing in previous checkin
This commit is contained in:
parent
db80f635c1
commit
acddda4bf9
|
@ -10,6 +10,15 @@ This software is a copyrighted work licensed under the terms of the
|
||||||
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||||
details. */
|
details. */
|
||||||
|
|
||||||
|
#define __INSIDE_CYGWIN_NET__
|
||||||
|
#define USE_SYS_TYPES_FD_SET
|
||||||
|
#include <winsup.h>
|
||||||
|
#include <ws2tcpip.h>
|
||||||
|
#include <iphlpapi.h>
|
||||||
|
#include <windns.h>
|
||||||
|
#include <ntdef.h>
|
||||||
|
#include "ntdll.h"
|
||||||
|
#undef h_errno
|
||||||
#include "minires.h"
|
#include "minires.h"
|
||||||
|
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
|
@ -24,13 +33,6 @@ details. */
|
||||||
#undef NOERROR
|
#undef NOERROR
|
||||||
#undef DELETE
|
#undef DELETE
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
#include <iphlpapi.h>
|
|
||||||
#include <windns.h>
|
|
||||||
#include <ntdef.h>
|
|
||||||
#include "ntdll.h"
|
|
||||||
#include <wchar.h>
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* write_record: Translates a Windows DNS record into a compressed record
|
* write_record: Translates a Windows DNS record into a compressed record
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
|
@ -12,27 +12,27 @@ details. */
|
||||||
/* #define DEBUG_NEST_ON 1 */
|
/* #define DEBUG_NEST_ON 1 */
|
||||||
|
|
||||||
#define __INSIDE_CYGWIN_NET__
|
#define __INSIDE_CYGWIN_NET__
|
||||||
|
#define USE_SYS_TYPES_FD_SET
|
||||||
|
#define __WSA_ERR_MACROS_DEFINED
|
||||||
|
/* FIXME: Collision with different declarations of if_nametoindex and
|
||||||
|
if_indextoname functions in iphlpapi.h since Vista.
|
||||||
|
TODO: Convert if_nametoindex to cygwin_if_nametoindex and call
|
||||||
|
system functions on Vista and later. */
|
||||||
|
#define _INC_NETIOAPI
|
||||||
#include "winsup.h"
|
#include "winsup.h"
|
||||||
|
#include <ws2tcpip.h>
|
||||||
/* unfortunately defined in windows header file but used in
|
#include <mswsock.h>
|
||||||
cygwin header files too */
|
#include <iphlpapi.h>
|
||||||
#undef NOERROR
|
|
||||||
#undef DELETE
|
|
||||||
|
|
||||||
#include "miscfuncs.h"
|
#include "miscfuncs.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#define gethostname cygwin_gethostname
|
#define gethostname cygwin_gethostname
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#undef gethostname
|
#undef gethostname
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
#include <cygwin/in.h>
|
||||||
#include <asm/byteorder.h>
|
#include <asm/byteorder.h>
|
||||||
#define USE_SYS_TYPES_FD_SET
|
|
||||||
#include <winsock2.h>
|
|
||||||
#include <iphlpapi.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "cygerrno.h"
|
#include "cygerrno.h"
|
||||||
#include "security.h"
|
#include "security.h"
|
||||||
|
@ -46,10 +46,13 @@ details. */
|
||||||
#include "sigproc.h"
|
#include "sigproc.h"
|
||||||
#include "registry.h"
|
#include "registry.h"
|
||||||
#include "cygtls.h"
|
#include "cygtls.h"
|
||||||
#include "cygwin/in6.h"
|
|
||||||
#include "ifaddrs.h"
|
#include "ifaddrs.h"
|
||||||
#include "tls_pbuf.h"
|
#include "tls_pbuf.h"
|
||||||
#include "ntdll.h"
|
#include "ntdll.h"
|
||||||
|
|
||||||
|
/* Unfortunately defined in Windows header files and arpa/nameser_compat.h. */
|
||||||
|
#undef NOERROR
|
||||||
|
#undef DELETE
|
||||||
#define _CYGWIN_IN_H
|
#define _CYGWIN_IN_H
|
||||||
#include <resolv.h>
|
#include <resolv.h>
|
||||||
|
|
||||||
|
@ -1522,6 +1525,8 @@ getdomainname (char *domain, size_t len)
|
||||||
|
|
||||||
/* Fill out an ifconf struct. */
|
/* Fill out an ifconf struct. */
|
||||||
|
|
||||||
|
#ifndef __MINGW64_VERSION_MAJOR
|
||||||
|
|
||||||
/* Vista/Longhorn: unicast address has additional OnLinkPrefixLength member. */
|
/* Vista/Longhorn: unicast address has additional OnLinkPrefixLength member. */
|
||||||
typedef struct _IP_ADAPTER_UNICAST_ADDRESS_LH {
|
typedef struct _IP_ADAPTER_UNICAST_ADDRESS_LH {
|
||||||
_ANONYMOUS_UNION union {
|
_ANONYMOUS_UNION union {
|
||||||
|
@ -1579,29 +1584,9 @@ typedef struct _IP_ADAPTER_ADDRESSES_LH {
|
||||||
ULONG Ipv6Metric;
|
ULONG Ipv6Metric;
|
||||||
} IP_ADAPTER_ADDRESSES_LH,*PIP_ADAPTER_ADDRESSES_LH;
|
} IP_ADAPTER_ADDRESSES_LH,*PIP_ADAPTER_ADDRESSES_LH;
|
||||||
|
|
||||||
/* We can't include ws2tcpip.h. */
|
|
||||||
|
|
||||||
#define SIO_GET_INTERFACE_LIST _IOR('t', 127, u_long)
|
#define SIO_GET_INTERFACE_LIST _IOR('t', 127, u_long)
|
||||||
|
|
||||||
struct sockaddr_in6_old {
|
#endif /* !__MINGW64_VERSION_MAJOR */
|
||||||
short sin6_family;
|
|
||||||
u_short sin6_port;
|
|
||||||
u_long sin6_flowinfo;
|
|
||||||
struct in6_addr sin6_addr;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef union sockaddr_gen{
|
|
||||||
struct sockaddr Address;
|
|
||||||
struct sockaddr_in AddressIn;
|
|
||||||
struct sockaddr_in6_old AddressIn6;
|
|
||||||
} sockaddr_gen;
|
|
||||||
|
|
||||||
typedef struct _INTERFACE_INFO {
|
|
||||||
u_long iiFlags;
|
|
||||||
sockaddr_gen iiAddress;
|
|
||||||
sockaddr_gen iiBroadcastAddress;
|
|
||||||
sockaddr_gen iiNetmask;
|
|
||||||
} INTERFACE_INFO, *LPINTERFACE_INFO;
|
|
||||||
|
|
||||||
#ifndef IN_LOOPBACK
|
#ifndef IN_LOOPBACK
|
||||||
#define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000)
|
#define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000)
|
||||||
|
@ -4230,24 +4215,24 @@ w32_to_gai_err (int w32_err)
|
||||||
are implemented in ws2_32.dll. For older systems we use the ipv4-only
|
are implemented in ws2_32.dll. For older systems we use the ipv4-only
|
||||||
version above. */
|
version above. */
|
||||||
|
|
||||||
static void (WINAPI *freeaddrinfo)(const struct addrinfo *);
|
static void (WINAPI *ws_freeaddrinfo)(const struct addrinfo *);
|
||||||
static int (WINAPI *getaddrinfo)(const char *, const char *,
|
static int (WINAPI *ws_getaddrinfo)(const char *, const char *,
|
||||||
const struct addrinfo *,
|
const struct addrinfo *,
|
||||||
struct addrinfo **);
|
struct addrinfo **);
|
||||||
static int (WINAPI *getnameinfo)(const struct sockaddr *, socklen_t,
|
static int (WINAPI *ws_getnameinfo)(const struct sockaddr *, socklen_t,
|
||||||
char *, size_t, char *, size_t, int);
|
char *, size_t, char *, size_t, int);
|
||||||
static bool
|
static bool
|
||||||
get_ipv6_funcs (HMODULE lib)
|
get_ipv6_funcs (HMODULE lib)
|
||||||
{
|
{
|
||||||
return ((freeaddrinfo = (void (WINAPI *)(const struct addrinfo *))
|
return ((ws_freeaddrinfo = (void (WINAPI *)(const struct addrinfo *))
|
||||||
GetProcAddress (lib, "freeaddrinfo"))
|
GetProcAddress (lib, "freeaddrinfo"))
|
||||||
&& (getaddrinfo = (int (WINAPI *)(const char *, const char *,
|
&& (ws_getaddrinfo = (int (WINAPI *)(const char *, const char *,
|
||||||
const struct addrinfo *,
|
const struct addrinfo *,
|
||||||
struct addrinfo **))
|
struct addrinfo **))
|
||||||
GetProcAddress (lib, "getaddrinfo"))
|
GetProcAddress (lib, "getaddrinfo"))
|
||||||
&& (getnameinfo = (int (WINAPI *)(const struct sockaddr *,
|
&& (ws_getnameinfo = (int (WINAPI *)(const struct sockaddr *,
|
||||||
socklen_t, char *, size_t,
|
socklen_t, char *, size_t,
|
||||||
char *, size_t, int))
|
char *, size_t, int))
|
||||||
GetProcAddress (lib, "getnameinfo")));
|
GetProcAddress (lib, "getnameinfo")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4282,9 +4267,9 @@ load_ipv6_funcs ()
|
||||||
goto out;
|
goto out;
|
||||||
FreeLibrary (lib);
|
FreeLibrary (lib);
|
||||||
}
|
}
|
||||||
freeaddrinfo = NULL;
|
ws_freeaddrinfo = NULL;
|
||||||
getaddrinfo = NULL;
|
ws_getaddrinfo = NULL;
|
||||||
getnameinfo = NULL;
|
ws_getnameinfo = NULL;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
ipv6_inited = true;
|
ipv6_inited = true;
|
||||||
|
@ -4324,7 +4309,7 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
|
||||||
return EAI_NONAME;
|
return EAI_NONAME;
|
||||||
}
|
}
|
||||||
load_ipv6 ();
|
load_ipv6 ();
|
||||||
if (!getaddrinfo)
|
if (!ws_getaddrinfo)
|
||||||
return ipv4_getaddrinfo (hostname, servname, hints, res);
|
return ipv4_getaddrinfo (hostname, servname, hints, res);
|
||||||
|
|
||||||
struct addrinfo nhints, *dupres;
|
struct addrinfo nhints, *dupres;
|
||||||
|
@ -4341,12 +4326,12 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
|
||||||
hints = &nhints;
|
hints = &nhints;
|
||||||
nhints.ai_flags |= AI_ALL;
|
nhints.ai_flags |= AI_ALL;
|
||||||
}
|
}
|
||||||
int ret = w32_to_gai_err (getaddrinfo (hostname, servname, hints, res));
|
int ret = w32_to_gai_err (ws_getaddrinfo (hostname, servname, hints, res));
|
||||||
/* Always copy over to self-allocated memory. */
|
/* Always copy over to self-allocated memory. */
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
dupres = ga_duplist (*res, false);
|
dupres = ga_duplist (*res, false);
|
||||||
freeaddrinfo (*res);
|
ws_freeaddrinfo (*res);
|
||||||
*res = dupres;
|
*res = dupres;
|
||||||
if (!dupres)
|
if (!dupres)
|
||||||
return EAI_MEMORY;
|
return EAI_MEMORY;
|
||||||
|
@ -4366,12 +4351,12 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
|
||||||
struct addrinfo *v4res;
|
struct addrinfo *v4res;
|
||||||
nhints = *hints;
|
nhints = *hints;
|
||||||
nhints.ai_family = AF_INET;
|
nhints.ai_family = AF_INET;
|
||||||
int ret2 = w32_to_gai_err (getaddrinfo (hostname, servname,
|
int ret2 = w32_to_gai_err (ws_getaddrinfo (hostname, servname,
|
||||||
&nhints, &v4res));
|
&nhints, &v4res));
|
||||||
if (!ret2)
|
if (!ret2)
|
||||||
{
|
{
|
||||||
dupres = ga_duplist (v4res, true);
|
dupres = ga_duplist (v4res, true);
|
||||||
freeaddrinfo (v4res);
|
ws_freeaddrinfo (v4res);
|
||||||
if (!dupres)
|
if (!dupres)
|
||||||
{
|
{
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
@ -4404,7 +4389,7 @@ cygwin_getnameinfo (const struct sockaddr *sa, socklen_t salen,
|
||||||
if (efault.faulted (EFAULT))
|
if (efault.faulted (EFAULT))
|
||||||
return EAI_SYSTEM;
|
return EAI_SYSTEM;
|
||||||
load_ipv6 ();
|
load_ipv6 ();
|
||||||
if (!getnameinfo)
|
if (!ws_getnameinfo)
|
||||||
return ipv4_getnameinfo (sa, salen, host, hostlen, serv, servlen, flags);
|
return ipv4_getnameinfo (sa, salen, host, hostlen, serv, servlen, flags);
|
||||||
|
|
||||||
/* When the incoming port number does not resolve to a well-known service,
|
/* When the incoming port number does not resolve to a well-known service,
|
||||||
|
@ -4429,8 +4414,8 @@ cygwin_getnameinfo (const struct sockaddr *sa, socklen_t salen,
|
||||||
if (!port || !getservbyport (port, flags & NI_DGRAM ? "udp" : "tcp"))
|
if (!port || !getservbyport (port, flags & NI_DGRAM ? "udp" : "tcp"))
|
||||||
flags |= NI_NUMERICSERV;
|
flags |= NI_NUMERICSERV;
|
||||||
}
|
}
|
||||||
int ret = w32_to_gai_err (getnameinfo (sa, salen, host, hostlen, serv,
|
int ret = w32_to_gai_err (ws_getnameinfo (sa, salen, host, hostlen, serv,
|
||||||
servlen, flags));
|
servlen, flags));
|
||||||
if (ret)
|
if (ret)
|
||||||
set_winsock_errno ();
|
set_winsock_errno ();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue