/* WINSOCK.H--definitions to be used with the WINSOCK.DLL
*
* This header file corresponds to version 1.1 of the Windows Sockets
* specification.
*
* Copyright (C) the Wine project
*
* 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
*/
/*
* Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Oracle elects to use only
* the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
* a choice of LGPL license versions is made available with the language indicating
* that LGPLv2 or any later version may be used, or where a choice of which version
* of the LGPL is applied is otherwise unspecified.
*/
#ifdef __WINESRC__
# ifndef __WINE_WINSOCK2__
# endif
#endif
#ifndef __WINE_WINSOCKAPI_STDLIB_H
#define __WINE_WINSOCKAPI_STDLIB_H
/*
* This section defines the items that conflict with the Unix headers.
*/
#ifndef USE_WS_PREFIX
/* We are not using the WS_ prefix we risk getting conflicts for
* everything related to select.
*/
# ifdef FD_CLR
* This means select and all the related stuff is already defined and we
* cannot override types and function prototypes.
* All we can do is disable all these symbols so that they are not used
* inadvertently.
*/
# elif defined(RLIM_INFINITY)
/* On Darwin stdlib.h includes sys/resource.h which defines timeval but not the fd_set macros */
# include <time.h>
# include <stdlib.h>
# else /* FD_CLR */
/* stdlib.h has not been included yet so it's not too late. Include it now
* making sure that none of the select symbols is affected. Then we can
* define them with our own values.
*/
# include <time.h>
# include <stdlib.h>
# define WS_DEFINE_SELECT
# endif /* FD_CLR */
#else
# define WS_DEFINE_SELECT
# include <stdlib.h>
#endif /* !USE_WS_PREFIX */
#endif /* __WINE_WINSOCKAPI_STDLIB_H */
#ifndef __WINESRC__
# include <windows.h>
#else
# include <windef.h>
#endif
#ifndef _WINSOCKAPI_
#define _WINSOCKAPI_
#ifdef USE_WS_PREFIX
typedef unsigned char WS_u_char;
typedef unsigned short WS_u_short;
typedef unsigned int WS_u_int;
#elif (defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__)) && !defined(_BSDTYPES_DEFINED)
/* MinGW doesn't define the u_xxx types */
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
#define _BSDTYPES_DEFINED
#else
#endif
#ifdef USE_WS_PREFIX
#else
# define WS(x) x
#endif
#ifdef __cplusplus
extern "C" {
#endif /* defined(__cplusplus) */
/*
* Address families
*/
#ifndef USE_WS_PREFIX
#define AF_UNSPEC 0
#else /* USE_WS_PREFIX */
#define WS_AF_UNSPEC 0
#endif /* USE_WS_PREFIX */
/*
* Types
*/
#ifndef USE_WS_PREFIX
#else /* USE_WS_PREFIX */
#endif /* USE_WS_PREFIX */
/*
* Protocols
*/
#ifndef USE_WS_PREFIX
#define IPPROTO_IP 0
#else /* USE_WS_PREFIX */
#define WS_IPPROTO_IP 0
#endif /* USE_WS_PREFIX */
{
char* p_name;
char** p_aliases;
short p_proto;
/*
* Networks
*/
{
};
/*
* Services
*/
#ifndef USE_WS_PREFIX
#else /* USE_WS_PREFIX */
#endif /* USE_WS_PREFIX */
{
#ifdef _WIN64
#else
#endif
/*
* Hosts
*/
{
/*
* Sockets
*/
/*
* This is used instead of -1, since the
* SOCKET type is unsigned.
*/
{
{
/*
* Select
*/
#ifdef WS_DEFINE_SELECT
/* Define our own version of select and the associated types and macros */
# ifndef USE_WS_PREFIX
# ifndef FD_SETSIZE
# endif
# else
# ifndef WS_FD_SETSIZE
# endif
# endif
{
# ifndef USE_WS_PREFIX
# else
# endif
#ifndef _TIMEVAL_DEFINED
#define _TIMEVAL_DEFINED
{
#endif
unsigned int __i; \
{ \
{ \
{ \
__i++; \
} \
break; \
} \
} \
} while(0)
} while(0)
/* This version checks if the filedesc is already in the list, and appends it
* only if it's not the case
*/
unsigned int __i; \
{ \
break; \
} \
{ \
} \
} while(0)
#ifndef __WINE_WINSOCK2__
#else
#endif
#ifndef USE_WS_PREFIX
#else
#endif
#endif /* WS_DEFINE_SELECT */
#ifndef USE_WS_PREFIX
#ifdef WORDS_BIGENDIAN
#else /* WORDS_BIGENDIAN */
{
return (s >> 8) | (s << 8);
}
{
}
#endif /* WORDS_BIGENDIAN */
#endif /* USE_WS_PREFIX */
/*
* Internet address (old style... should be updated)
*/
#ifndef USE_WS_PREFIX
#else
#endif /* USE_WS_PREFIX */
#ifndef USE_WS_PREFIX
#else
#endif /* USE_WS_PREFIX */
{
union {
struct {
} S_un_b;
struct {
} S_un_w;
} S_un;
#ifndef USE_WS_PREFIX
#else
#endif /* USE_WS_PREFIX */
{
short sin_family;
/*
* Multicast group information
*/
#if !defined(__WINE_WINSOCK2__)
{
};
#endif
/*
* WSAStartup
*/
{
#ifdef _WIN64
char *lpVendorInfo;
#else
char *lpVendorInfo;
#endif
/*
* {get,set}sockopt
*/
#ifndef USE_WS_PREFIX
#else
#endif
/* IPPROTO_TCP options */
#ifndef USE_WS_PREFIX
#else
#endif
/* IPPROTO_IP options */
#ifndef __WINE_WINSOCK2__ /* WinSock2 has different values for the IP_ constants */
# ifndef USE_WS_PREFIX
# else
# endif
#endif
/*
* Socket I/O flags (supported by spec 1.1)
*/
#ifndef USE_WS_PREFIX
#else
#endif
/*
* Maximum queue length specifiable by listen.
*/
#ifndef USE_WS_PREFIX
#else /* USE_WS_PREFIX */
#endif /* USE_WS_PREFIX */
/*
* Define constant based on rfc883, used by gethostbyxxxx() calls.
*/
#ifndef USE_WS_PREFIX
#else
#endif
/*
* Define flags to be used with the WSAAsyncSelect() call.
*/
/* internal per-socket flags */
#ifdef __WINESRC__
#endif
/*
* All Windows Sockets error constants are biased by WSABASEERR from
* the "normal". They are also defined in winerror.h.
*/
/*
* Windows Sockets definitions of regular Microsoft C error constants
*/
/*
* Windows Sockets definitions of regular Berkeley error constants
*/
/*
* Extended Windows Sockets error constant definitions
*/
/*
* Error return codes from gethostbyname() and gethostbyaddr()
* (when using the resolver). Note that these errors are
* retrieved via WSAGetLastError() and must therefore follow
* the rules for avoiding clashes with error numbers from
* specific implementations or language run-time systems.
* For this reason the codes are based at WSABASEERR+1001.
* Note also that [WSA]NO_ADDRESS is defined only for
* compatibility purposes.
*/
#ifndef USE_WS_PREFIX
#else
#endif
/* Authoritative Answer: Host not found */
/* Non-Authoritative: Host not found, or SERVERFAIL */
/* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
/* Valid name, no data record of requested type */
/* no address, look for MX record */
#ifndef USE_WS_PREFIX
#endif /* USE_WS_PREFIX */
/*
* Windows message parameter composition and decomposition
* macros.
*/
/*
* WSAMAKEASYNCREPLY is intended for use by the Windows Sockets implementation
* when constructing the response to a WSAAsyncGetXByY() routine.
*/
/*
* WSAMAKESELECTREPLY is intended for use by the Windows Sockets implementation
* when constructing the response to WSAAsyncSelect().
*/
/*
* WSAGETASYNCBUFLEN is intended for use by the Windows Sockets application
* to extract the buffer length from the lParam in the response
* to a WSAGetXByY().
*/
/*
* WSAGETASYNCERROR is intended for use by the Windows Sockets application
* to extract the error code from the lParam in the response
* to a WSAGetXByY().
*/
/*
* WSAGETSELECTEVENT is intended for use by the Windows Sockets application
* to extract the event code from the lParam in the response
* to a WSAAsyncSelect().
*/
/*
* WSAGETSELECTERROR is intended for use by the Windows Sockets application
* to extract the error code from the lParam in the response
* to a WSAAsyncSelect().
*/
/*
* Prototypes
*
* Remember to keep this section in sync with the
* "Winsock Function Typedefs" section in winsock2.h.
*/
#if !defined(__WINE_WINSOCK2__) || WS_API_PROTOTYPES
int WINAPI WSACancelBlockingCall(void);
int WINAPI WSACleanup(void);
int WINAPI WSAGetLastError(void);
void WINAPI WSASetLastError(int);
int WINAPI WSAUnhookBlockingHook(void);
/* gethostname not defined because of conflicts with unistd.h */
#ifdef WS_DEFINE_SELECT
#endif
#endif /* !defined(__WINE_WINSOCK2__) || WS_API_PROTOTYPES */
#ifdef __cplusplus
}
#endif
#ifndef __WINE_WINSOCK2__
#endif
#endif /* _WINSOCKAPI_ */