|
|
|
| 1 |
|
//$TAG BIZDEV |
| 2 |
|
// $IPCategory: |
| 3 |
|
// $DealPointID: 118736 |
| 4 |
|
// $AgreementName: berkeley software distribution license |
| 5 |
|
// $AgreementType: oss license |
| 6 |
|
// $ExternalOrigin: regents of the university of california |
| 7 |
|
//$ENDTAG |
| 8 |
|
|
| 9 |
|
//$TAG ENGR |
| 10 |
|
// $Owner: vadime |
| 11 |
|
// $Module: published_inc |
| 12 |
|
// |
| 13 |
|
//$ENDTAG |
| 14 |
|
|
| 15 |
|
/* Winsock2.h -- definitions to be used with the WinSock 2 DLL and |
| 16 |
|
* WinSock 2 applications. |
| 17 |
|
* |
| 18 |
|
* This header file corresponds to version 2.2.x of the WinSock API |
| 19 |
|
* specification. |
| 20 |
|
* |
| 21 |
|
* This file includes parts which are Copyright (c) 1982-1986 Regents |
| 22 |
|
* of the University of California. All rights reserved. The |
| 23 |
|
* Berkeley Software License Agreement specifies the terms and |
| 24 |
|
* conditions for redistribution. |
| 25 |
|
*/ |
| 26 |
|
|
| 27 |
|
#ifndef _WINSOCK2API_ |
| 28 |
|
#define _WINSOCK2API_ |
| 29 |
|
#define _WINSOCKAPI_ /* Prevent inclusion of winsock.h in windows.h */ |
| 30 |
|
|
| 31 |
|
#pragma once |
| 32 |
|
|
| 33 |
|
/* |
| 34 |
|
* Ensure structures are packed consistently. |
| 35 |
|
* Not necessary for WIN32, it is already packed >=4 and there are |
| 36 |
|
* no structures in this header that have alignment requirement |
| 37 |
|
* higher than 4. |
| 38 |
|
* For WIN64 we do not have compatibility requirement because it is |
| 39 |
|
* not possible to mix 32/16 bit code with 64 bit code in the same |
| 40 |
|
* process. |
| 41 |
|
*/ |
| 42 |
|
|
| 43 |
|
#if (!defined(_WIN64) && !defined(WIN32)) |
| 44 |
|
#include <pshpack4.h> |
| 45 |
|
/* WIN32 can be defined between here and the required poppack |
| 46 |
|
so define this special macro to ensure poppack */ |
| 47 |
|
#define _NEED_POPPACK |
| 48 |
|
#endif |
| 49 |
|
|
| 50 |
|
/* |
| 748 |
|
/* |
| 749 |
|
* Compatibility macros. |
| 750 |
|
*/ |
| 751 |
|
|
| 752 |
|
#define h_errno WSAGetLastError() |
| 753 |
|
#define HOST_NOT_FOUND WSAHOST_NOT_FOUND |
| 754 |
|
#define TRY_AGAIN WSATRY_AGAIN |
| 755 |
|
#define NO_RECOVERY WSANO_RECOVERY |
| 756 |
|
#define NO_DATA WSANO_DATA |
| 757 |
|
/* no address, look for MX record */ |
| 758 |
|
#define WSANO_ADDRESS WSANO_DATA |
| 759 |
|
#define NO_ADDRESS WSANO_ADDRESS |
| 760 |
|
|
| 761 |
|
|
| 762 |
|
|
| 763 |
|
/* |
| 764 |
|
* Windows Sockets errors redefined as regular Berkeley error constants. |
| 765 |
|
* These are commented out in Windows NT to avoid conflicts with errno.h. |
| 766 |
|
* Use the WSA constants instead. |
| 767 |
|
*/ |
| 768 |
|
#if 0 |
| 769 |
|
#define EWOULDBLOCK WSAEWOULDBLOCK |
| 770 |
|
#define EINPROGRESS WSAEINPROGRESS |
| 771 |
|
#define EALREADY WSAEALREADY |
| 772 |
|
#define ENOTSOCK WSAENOTSOCK |
| 773 |
|
#define EDESTADDRREQ WSAEDESTADDRREQ |
| 774 |
|
#define EMSGSIZE WSAEMSGSIZE |
| 775 |
|
#define EPROTOTYPE WSAEPROTOTYPE |
| 776 |
|
#define ENOPROTOOPT WSAENOPROTOOPT |
| 777 |
|
#define EPROTONOSUPPORT WSAEPROTONOSUPPORT |
| 778 |
|
#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT |
| 779 |
|
#define EOPNOTSUPP WSAEOPNOTSUPP |
| 780 |
|
#define EPFNOSUPPORT WSAEPFNOSUPPORT |
| 781 |
|
#define EAFNOSUPPORT WSAEAFNOSUPPORT |
| 782 |
|
#define EADDRINUSE WSAEADDRINUSE |
| 783 |
|
#define EADDRNOTAVAIL WSAEADDRNOTAVAIL |
| 784 |
|
#define ENETDOWN WSAENETDOWN |
| 785 |
|
#define ENETUNREACH WSAENETUNREACH |
| 786 |
|
#define ENETRESET WSAENETRESET |
| 787 |
|
#define ECONNABORTED WSAECONNABORTED |
| 788 |
|
#define ECONNRESET WSAECONNRESET |
| 789 |
|
#define ENOBUFS WSAENOBUFS |
| 790 |
|
#define EISCONN WSAEISCONN |
| 791 |
|
#define ENOTCONN WSAENOTCONN |
| 792 |
|
#define ESHUTDOWN WSAESHUTDOWN |
| 793 |
|
#define ETOOMANYREFS WSAETOOMANYREFS |
| 794 |
|
#define ETIMEDOUT WSAETIMEDOUT |
| 795 |
|
#define ECONNREFUSED WSAECONNREFUSED |
| 796 |
|
#define ELOOP WSAELOOP |
| 797 |
|
#define ENAMETOOLONG WSAENAMETOOLONG |
| 798 |
|
#define EHOSTDOWN WSAEHOSTDOWN |
| 799 |
|
#define EHOSTUNREACH WSAEHOSTUNREACH |
| 800 |
|
#define ENOTEMPTY WSAENOTEMPTY |
| 801 |
|
#define EPROCLIM WSAEPROCLIM |
| 802 |
|
#define EUSERS WSAEUSERS |
| 803 |
|
#define EDQUOT WSAEDQUOT |
| 804 |
|
#define ESTALE WSAESTALE |
| 805 |
|
#define EREMOTE WSAEREMOTE |
| 806 |
|
#endif |
| 807 |
|
|
| 808 |
|
/* |
| 809 |
|
* WinSock 2 extension -- new error codes and type definition |
| 810 |
|
*/ |
| 811 |
|
|
| 812 |
|
#ifdef WIN32 |
| 813 |
|
|
| 814 |
|
#define WSAAPI FAR PASCAL |
| 815 |
|
#define WSAEVENT HANDLE |
| 816 |
|
#define LPWSAEVENT LPHANDLE |
| 817 |
|
#define WSAOVERLAPPED OVERLAPPED |
| 818 |
|
typedef struct _OVERLAPPED * LPWSAOVERLAPPED; |
| 819 |
|
|
| 820 |
|
#define WSA_IO_PENDING (ERROR_IO_PENDING) |
| 821 |
|
#define WSA_IO_INCOMPLETE (ERROR_IO_INCOMPLETE) |
| 822 |
|
#define WSA_INVALID_HANDLE (ERROR_INVALID_HANDLE) |
| 823 |
|
#define WSA_INVALID_PARAMETER (ERROR_INVALID_PARAMETER) |
| 824 |
|
#define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY) |
| 825 |
|
#define WSA_OPERATION_ABORTED (ERROR_OPERATION_ABORTED) |
| 826 |
|
|
| 827 |
|
#define WSA_INVALID_EVENT ((WSAEVENT)NULL) |
| 828 |
|
#define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS) |
| 829 |
|
#define WSA_WAIT_FAILED (WAIT_FAILED) |
| 830 |
|
#define WSA_WAIT_EVENT_0 (WAIT_OBJECT_0) |
| 831 |
|
#define WSA_WAIT_IO_COMPLETION (WAIT_IO_COMPLETION) |
| 832 |
|
#define WSA_WAIT_TIMEOUT (WAIT_TIMEOUT) |
| 833 |
|
#define WSA_INFINITE (INFINITE) |
| 834 |
|
|
| 835 |
|
#else /* WIN16 */ |
| 836 |
|
|
| 837 |
|
#define WSAAPI FAR PASCAL |
| 838 |
|
typedef DWORD WSAEVENT, FAR * LPWSAEVENT; |
| 839 |
|
|
| 840 |
|
typedef struct _WSAOVERLAPPED { |
| 841 |
|
DWORD Internal; |
| 842 |
|
DWORD InternalHigh; |
| 843 |
|
DWORD Offset; |
| 844 |
|
DWORD OffsetHigh; |
| 845 |
|
WSAEVENT hEvent; |
| 846 |
|
} WSAOVERLAPPED, FAR * LPWSAOVERLAPPED; |
| 847 |
|
|
| 848 |
|
#define WSA_IO_PENDING (WSAEWOULDBLOCK) |
| 849 |
|
#define WSA_IO_INCOMPLETE (WSAEWOULDBLOCK) |
| 850 |
|
#define WSA_INVALID_HANDLE (WSAENOTSOCK) |
| 3877 |
|
*/ |
| 3878 |
|
#define WSAMAKEASYNCREPLY(buflen,error) MAKELONG(buflen,error) |
| 3879 |
|
/* |
| 3880 |
|
* WSAMAKESELECTREPLY is intended for use by the Windows Sockets implementation |
| 3881 |
|
* when constructing the response to WSAAsyncSelect(). |
| 3882 |
|
*/ |
| 3883 |
|
#define WSAMAKESELECTREPLY(event,error) MAKELONG(event,error) |
| 3884 |
|
/* |
| 3885 |
|
* WSAGETASYNCBUFLEN is intended for use by the Windows Sockets application |
| 3886 |
|
* to extract the buffer length from the lParam in the response |
| 3887 |
|
* to a WSAAsyncGetXByY(). |
| 3888 |
|
*/ |
| 3889 |
|
#define WSAGETASYNCBUFLEN(lParam) LOWORD(lParam) |
| 3890 |
|
/* |
| 3891 |
|
* WSAGETASYNCERROR is intended for use by the Windows Sockets application |
| 3892 |
|
* to extract the error code from the lParam in the response |
| 3893 |
|
* to a WSAGetXByY(). |
| 3894 |
|
*/ |
| 3895 |
|
#define WSAGETASYNCERROR(lParam) HIWORD(lParam) |
| 3896 |
|
/* |
| 3897 |
|
* WSAGETSELECTEVENT is intended for use by the Windows Sockets application |
| 3898 |
|
* to extract the event code from the lParam in the response |
| 3899 |
|
* to a WSAAsyncSelect(). |
| 3900 |
|
*/ |
| 3901 |
|
#define WSAGETSELECTEVENT(lParam) LOWORD(lParam) |
| 3902 |
|
/* |
| 3903 |
|
* WSAGETSELECTERROR is intended for use by the Windows Sockets application |
| 3904 |
|
* to extract the error code from the lParam in the response |
| 3905 |
|
* to a WSAAsyncSelect(). |
| 3906 |
|
*/ |
| 3907 |
|
#define WSAGETSELECTERROR(lParam) HIWORD(lParam) |
| 3908 |
|
|
| 3909 |
|
#ifdef __cplusplus |
| 3910 |
|
} |
| 3911 |
|
#endif |
| 3912 |
|
|
| 3913 |
|
#ifdef _NEED_POPPACK |
| 3914 |
|
#include <poppack.h> |
| 3915 |
|
#endif |
| 3916 |
|
|
| 3917 |
|
#if(_WIN32_WINNT >= 0x0501) |
| 3918 |
|
#ifdef IPV6STRICT |
| 3919 |
|
#include <wsipv6ok.h> |
| 3920 |
|
#endif // IPV6STRICT |
| 3921 |
|
#endif //(_WIN32_WINNT >= 0x0501) |
| 3922 |
|
|
| 3923 |
|
#endif /* _WINSOCK2API_ */ |
| 3924 |
|
|
| 3925 |
|
|
|
|
|