Add files missing in previous checkin

This commit is contained in:
Corinna Vinschen 2012-07-06 13:53:23 +00:00
parent db80f635c1
commit acddda4bf9
2 changed files with 52 additions and 65 deletions

View File

@ -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
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"
#ifdef __CYGWIN__
@ -24,13 +33,6 @@ details. */
#undef NOERROR
#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
***********************************************************************/

View File

@ -12,27 +12,27 @@ details. */
/* #define DEBUG_NEST_ON 1 */
#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"
/* unfortunately defined in windows header file but used in
cygwin header files too */
#undef NOERROR
#undef DELETE
#include <ws2tcpip.h>
#include <mswsock.h>
#include <iphlpapi.h>
#include "miscfuncs.h"
#include <ctype.h>
#include <wchar.h>
#include <stdlib.h>
#define gethostname cygwin_gethostname
#include <unistd.h>
#undef gethostname
#include <netdb.h>
#include <cygwin/in.h>
#include <asm/byteorder.h>
#define USE_SYS_TYPES_FD_SET
#include <winsock2.h>
#include <iphlpapi.h>
#include <assert.h>
#include "cygerrno.h"
#include "security.h"
@ -46,10 +46,13 @@ details. */
#include "sigproc.h"
#include "registry.h"
#include "cygtls.h"
#include "cygwin/in6.h"
#include "ifaddrs.h"
#include "tls_pbuf.h"
#include "ntdll.h"
/* Unfortunately defined in Windows header files and arpa/nameser_compat.h. */
#undef NOERROR
#undef DELETE
#define _CYGWIN_IN_H
#include <resolv.h>
@ -1522,6 +1525,8 @@ getdomainname (char *domain, size_t len)
/* Fill out an ifconf struct. */
#ifndef __MINGW64_VERSION_MAJOR
/* Vista/Longhorn: unicast address has additional OnLinkPrefixLength member. */
typedef struct _IP_ADAPTER_UNICAST_ADDRESS_LH {
_ANONYMOUS_UNION union {
@ -1579,29 +1584,9 @@ typedef struct _IP_ADAPTER_ADDRESSES_LH {
ULONG Ipv6Metric;
} IP_ADAPTER_ADDRESSES_LH,*PIP_ADAPTER_ADDRESSES_LH;
/* We can't include ws2tcpip.h. */
#define SIO_GET_INTERFACE_LIST _IOR('t', 127, u_long)
struct sockaddr_in6_old {
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;
#endif /* !__MINGW64_VERSION_MAJOR */
#ifndef IN_LOOPBACK
#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
version above. */
static void (WINAPI *freeaddrinfo)(const struct addrinfo *);
static int (WINAPI *getaddrinfo)(const char *, const char *,
const struct addrinfo *,
struct addrinfo **);
static int (WINAPI *getnameinfo)(const struct sockaddr *, socklen_t,
char *, size_t, char *, size_t, int);
static void (WINAPI *ws_freeaddrinfo)(const struct addrinfo *);
static int (WINAPI *ws_getaddrinfo)(const char *, const char *,
const struct addrinfo *,
struct addrinfo **);
static int (WINAPI *ws_getnameinfo)(const struct sockaddr *, socklen_t,
char *, size_t, char *, size_t, int);
static bool
get_ipv6_funcs (HMODULE lib)
{
return ((freeaddrinfo = (void (WINAPI *)(const struct addrinfo *))
return ((ws_freeaddrinfo = (void (WINAPI *)(const struct addrinfo *))
GetProcAddress (lib, "freeaddrinfo"))
&& (getaddrinfo = (int (WINAPI *)(const char *, const char *,
const struct addrinfo *,
struct addrinfo **))
&& (ws_getaddrinfo = (int (WINAPI *)(const char *, const char *,
const struct addrinfo *,
struct addrinfo **))
GetProcAddress (lib, "getaddrinfo"))
&& (getnameinfo = (int (WINAPI *)(const struct sockaddr *,
socklen_t, char *, size_t,
char *, size_t, int))
&& (ws_getnameinfo = (int (WINAPI *)(const struct sockaddr *,
socklen_t, char *, size_t,
char *, size_t, int))
GetProcAddress (lib, "getnameinfo")));
}
@ -4282,9 +4267,9 @@ load_ipv6_funcs ()
goto out;
FreeLibrary (lib);
}
freeaddrinfo = NULL;
getaddrinfo = NULL;
getnameinfo = NULL;
ws_freeaddrinfo = NULL;
ws_getaddrinfo = NULL;
ws_getnameinfo = NULL;
out:
ipv6_inited = true;
@ -4324,7 +4309,7 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
return EAI_NONAME;
}
load_ipv6 ();
if (!getaddrinfo)
if (!ws_getaddrinfo)
return ipv4_getaddrinfo (hostname, servname, hints, res);
struct addrinfo nhints, *dupres;
@ -4341,12 +4326,12 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
hints = &nhints;
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. */
if (!ret)
{
dupres = ga_duplist (*res, false);
freeaddrinfo (*res);
ws_freeaddrinfo (*res);
*res = dupres;
if (!dupres)
return EAI_MEMORY;
@ -4366,12 +4351,12 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
struct addrinfo *v4res;
nhints = *hints;
nhints.ai_family = AF_INET;
int ret2 = w32_to_gai_err (getaddrinfo (hostname, servname,
&nhints, &v4res));
int ret2 = w32_to_gai_err (ws_getaddrinfo (hostname, servname,
&nhints, &v4res));
if (!ret2)
{
dupres = ga_duplist (v4res, true);
freeaddrinfo (v4res);
ws_freeaddrinfo (v4res);
if (!dupres)
{
if (!ret)
@ -4404,7 +4389,7 @@ cygwin_getnameinfo (const struct sockaddr *sa, socklen_t salen,
if (efault.faulted (EFAULT))
return EAI_SYSTEM;
load_ipv6 ();
if (!getnameinfo)
if (!ws_getnameinfo)
return ipv4_getnameinfo (sa, salen, host, hostlen, serv, servlen, flags);
/* 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"))
flags |= NI_NUMERICSERV;
}
int ret = w32_to_gai_err (getnameinfo (sa, salen, host, hostlen, serv,
servlen, flags));
int ret = w32_to_gai_err (ws_getnameinfo (sa, salen, host, hostlen, serv,
servlen, flags));
if (ret)
set_winsock_errno ();
return ret;