211 lines
5.1 KiB
C
211 lines
5.1 KiB
C
/*
|
|
* Copyright (C) 2021 Zebediah Figura for CodeWeavers
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
*/
|
|
|
|
#ifndef __WINE_WS2_32_PRIVATE_H
|
|
#define __WINE_WS2_32_PRIVATE_H
|
|
|
|
#include <stdarg.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <sys/types.h>
|
|
#include <limits.h>
|
|
#ifdef HAVE_SYS_IPC_H
|
|
# include <sys/ipc.h>
|
|
#endif
|
|
#ifdef HAVE_SYS_IOCTL_H
|
|
# include <sys/ioctl.h>
|
|
#endif
|
|
#ifdef HAVE_SYS_FILIO_H
|
|
# include <sys/filio.h>
|
|
#endif
|
|
#ifdef HAVE_SYS_SOCKIO_H
|
|
# include <sys/sockio.h>
|
|
#endif
|
|
|
|
#if defined(__EMX__)
|
|
# include <sys/so_ioctl.h>
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
|
# include <sys/param.h>
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_MSG_H
|
|
# include <sys/msg.h>
|
|
#endif
|
|
#ifdef HAVE_SYS_WAIT_H
|
|
# include <sys/wait.h>
|
|
#endif
|
|
#ifdef HAVE_SYS_UIO_H
|
|
# include <sys/uio.h>
|
|
#endif
|
|
#ifdef HAVE_SYS_SOCKET_H
|
|
#include <sys/socket.h>
|
|
#endif
|
|
#ifdef HAVE_NETINET_IN_H
|
|
# include <netinet/in.h>
|
|
#endif
|
|
#ifdef HAVE_NETINET_TCP_H
|
|
# include <netinet/tcp.h>
|
|
#endif
|
|
#ifdef HAVE_ARPA_INET_H
|
|
# include <arpa/inet.h>
|
|
#endif
|
|
#include <ctype.h>
|
|
#include <fcntl.h>
|
|
#include <errno.h>
|
|
#ifdef HAVE_NETDB_H
|
|
#include <netdb.h>
|
|
#endif
|
|
#ifdef HAVE_UNISTD_H
|
|
# include <unistd.h>
|
|
#endif
|
|
#include <stdlib.h>
|
|
#ifdef HAVE_ARPA_NAMESER_H
|
|
# include <arpa/nameser.h>
|
|
#endif
|
|
#ifdef HAVE_RESOLV_H
|
|
# include <resolv.h>
|
|
#endif
|
|
#ifdef HAVE_NET_IF_H
|
|
# define if_indextoname unix_if_indextoname
|
|
# define if_nametoindex unix_if_nametoindex
|
|
# include <net/if.h>
|
|
# undef if_indextoname
|
|
# undef if_nametoindex
|
|
#endif
|
|
#ifdef HAVE_IFADDRS_H
|
|
# include <ifaddrs.h>
|
|
#endif
|
|
|
|
#ifdef HAVE_NETIPX_IPX_H
|
|
# include <netipx/ipx.h>
|
|
#elif defined(HAVE_LINUX_IPX_H)
|
|
# ifdef HAVE_ASM_TYPES_H
|
|
# include <asm/types.h>
|
|
# endif
|
|
# ifdef HAVE_LINUX_TYPES_H
|
|
# include <linux/types.h>
|
|
# endif
|
|
# include <linux/ipx.h>
|
|
#endif
|
|
#if defined(SOL_IPX) || defined(SO_DEFAULT_HEADERS)
|
|
# define HAS_IPX
|
|
#endif
|
|
|
|
#ifdef HAVE_LINUX_IRDA_H
|
|
# ifdef HAVE_LINUX_TYPES_H
|
|
# include <linux/types.h>
|
|
# endif
|
|
# include <linux/irda.h>
|
|
# define HAS_IRDA
|
|
#endif
|
|
|
|
#ifdef HAVE_POLL_H
|
|
#include <poll.h>
|
|
#endif
|
|
#ifdef HAVE_SYS_POLL_H
|
|
# include <sys/poll.h>
|
|
#endif
|
|
#ifdef HAVE_SYS_TIME_H
|
|
# include <sys/time.h>
|
|
#endif
|
|
|
|
#define NONAMELESSUNION
|
|
#define NONAMELESSSTRUCT
|
|
#include "ntstatus.h"
|
|
#define WIN32_NO_STATUS
|
|
#include "windef.h"
|
|
#include "winbase.h"
|
|
#include "wingdi.h"
|
|
#include "winuser.h"
|
|
#include "winerror.h"
|
|
#include "winnls.h"
|
|
#include "winsock2.h"
|
|
#include "mswsock.h"
|
|
#include "ws2tcpip.h"
|
|
#include "ws2spi.h"
|
|
#include "wsipx.h"
|
|
#include "wsnwlink.h"
|
|
#include "wshisotp.h"
|
|
#include "mstcpip.h"
|
|
#include "af_irda.h"
|
|
#include "winnt.h"
|
|
#define USE_WC_PREFIX /* For CMSG_DATA */
|
|
#include "iphlpapi.h"
|
|
#include "ip2string.h"
|
|
#include "wine/afd.h"
|
|
#include "wine/server.h"
|
|
#include "wine/debug.h"
|
|
#include "wine/exception.h"
|
|
#include "wine/unicode.h"
|
|
#include "wine/heap.h"
|
|
|
|
#define DECLARE_CRITICAL_SECTION(cs) \
|
|
static CRITICAL_SECTION cs; \
|
|
static CRITICAL_SECTION_DEBUG cs##_debug = \
|
|
{ 0, 0, &cs, { &cs##_debug.ProcessLocksList, &cs##_debug.ProcessLocksList }, \
|
|
0, 0, { (DWORD_PTR)(__FILE__ ": " # cs) }}; \
|
|
static CRITICAL_SECTION cs = { &cs##_debug, -1, 0, 0, 0, 0 }
|
|
|
|
static const char magic_loopback_addr[] = {127, 12, 34, 56};
|
|
|
|
union generic_unix_sockaddr
|
|
{
|
|
struct sockaddr addr;
|
|
char data[128]; /* should be big enough for all families */
|
|
};
|
|
|
|
int convert_eai_u2w( int ret ) DECLSPEC_HIDDEN;
|
|
unsigned int ws_sockaddr_ws2u( const struct WS_sockaddr *win_addr, int win_addr_len,
|
|
union generic_unix_sockaddr *unix_addr ) DECLSPEC_HIDDEN;
|
|
|
|
const char *debugstr_sockaddr( const struct WS_sockaddr *addr ) DECLSPEC_HIDDEN;
|
|
|
|
UINT sock_get_error( int err ) DECLSPEC_HIDDEN;
|
|
|
|
struct per_thread_data
|
|
{
|
|
HANDLE sync_event; /* event to wait on for synchronous ioctls */
|
|
int opentype;
|
|
struct WS_hostent *he_buffer;
|
|
struct WS_servent *se_buffer;
|
|
struct WS_protoent *pe_buffer;
|
|
int he_len;
|
|
int se_len;
|
|
int pe_len;
|
|
char ntoa_buffer[16]; /* 4*3 digits + 3 '.' + 1 '\0' */
|
|
};
|
|
|
|
extern int num_startup;
|
|
|
|
struct per_thread_data *get_per_thread_data(void) DECLSPEC_HIDDEN;
|
|
|
|
struct unix_funcs
|
|
{
|
|
int (CDECL *getaddrinfo)( const char *node, const char *service, const struct WS(addrinfo) *hints,
|
|
struct WS(addrinfo) *info, unsigned int *size );
|
|
int (CDECL *gethostbyaddr)( const void *addr, int len, int family,
|
|
struct WS(hostent) *host, unsigned int *size );
|
|
int (CDECL *gethostbyname)( const char *name, struct WS(hostent) *host, unsigned int *size );
|
|
};
|
|
|
|
extern const struct unix_funcs *unix_funcs;
|
|
|
|
#endif
|