|
|
|
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 |
|
/* WINSOCK.H--definitions to be used with the WINSOCK.DLL |
16 |
|
* Copyright (c) Microsoft Corporation. All rights reserved. |
17 |
|
* |
18 |
|
* This header file corresponds to version 1.1 of the Windows Sockets specification. |
19 |
|
* |
20 |
|
* This file includes parts which are Copyright (c) 1982-1986 Regents |
21 |
|
* of the University of California. All rights reserved. The |
22 |
|
* Berkeley Software License Agreement specifies the terms and |
23 |
|
* conditions for redistribution. |
24 |
|
* |
25 |
|
*/ |
26 |
|
|
27 |
|
#ifndef _WINSOCKAPI_ |
28 |
|
#define _WINSOCKAPI_ |
29 |
|
|
30 |
|
#if _MSC_VER > 1000 |
31 |
|
#pragma once |
32 |
|
#endif |
33 |
|
|
34 |
|
/* |
35 |
|
* Pull in WINDOWS.H if necessary |
36 |
|
*/ |
37 |
|
#ifndef _INC_WINDOWS |
38 |
|
#include <windows.h> |
39 |
|
#endif /* _INC_WINDOWS */ |
40 |
|
|
41 |
|
/* |
42 |
|
* Basic system type definitions, taken from the BSD file sys/types.h. |
43 |
|
*/ |
44 |
|
typedef unsigned char u_char; |
45 |
|
typedef unsigned short u_short; |
46 |
|
typedef unsigned int u_int; |
47 |
|
typedef unsigned long u_long; |
48 |
|
|
49 |
|
/* |
50 |
|
* The new type to be used in all |
669 |
|
|
670 |
|
/* |
671 |
|
* Compatibility macros. |
672 |
|
*/ |
673 |
|
|
674 |
|
|
675 |
|
#define h_errno WSAGetLastError() |
676 |
|
#define HOST_NOT_FOUND WSAHOST_NOT_FOUND |
677 |
|
#define TRY_AGAIN WSATRY_AGAIN |
678 |
|
#define NO_RECOVERY WSANO_RECOVERY |
679 |
|
#define NO_DATA WSANO_DATA |
680 |
|
/* no address, look for MX record */ |
681 |
|
#define WSANO_ADDRESS WSANO_DATA |
682 |
|
#define NO_ADDRESS WSANO_ADDRESS |
683 |
|
|
684 |
|
/* |
685 |
|
* Windows Sockets errors redefined as regular Berkeley error constants. |
686 |
|
* These are commented out in Windows NT to avoid conflicts with errno.h. |
687 |
|
* Use the WSA constants instead. |
688 |
|
*/ |
689 |
|
#if 0 |
690 |
|
#define EWOULDBLOCK WSAEWOULDBLOCK |
691 |
|
#define EINPROGRESS WSAEINPROGRESS |
692 |
|
#define EALREADY WSAEALREADY |
693 |
|
#define ENOTSOCK WSAENOTSOCK |
694 |
|
#define EDESTADDRREQ WSAEDESTADDRREQ |
695 |
|
#define EMSGSIZE WSAEMSGSIZE |
696 |
|
#define EPROTOTYPE WSAEPROTOTYPE |
697 |
|
#define ENOPROTOOPT WSAENOPROTOOPT |
698 |
|
#define EPROTONOSUPPORT WSAEPROTONOSUPPORT |
699 |
|
#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT |
700 |
|
#define EOPNOTSUPP WSAEOPNOTSUPP |
701 |
|
#define EPFNOSUPPORT WSAEPFNOSUPPORT |
702 |
|
#define EAFNOSUPPORT WSAEAFNOSUPPORT |
703 |
|
#define EADDRINUSE WSAEADDRINUSE |
704 |
|
#define EADDRNOTAVAIL WSAEADDRNOTAVAIL |
705 |
|
#define ENETDOWN WSAENETDOWN |
706 |
|
#define ENETUNREACH WSAENETUNREACH |
707 |
|
#define ENETRESET WSAENETRESET |
708 |
|
#define ECONNABORTED WSAECONNABORTED |
709 |
|
#define ECONNRESET WSAECONNRESET |
710 |
|
#define ENOBUFS WSAENOBUFS |
711 |
|
#define EISCONN WSAEISCONN |
712 |
|
#define ENOTCONN WSAENOTCONN |
713 |
|
#define ESHUTDOWN WSAESHUTDOWN |
714 |
|
#define ETOOMANYREFS WSAETOOMANYREFS |
715 |
|
#define ETIMEDOUT WSAETIMEDOUT |
716 |
|
#define ECONNREFUSED WSAECONNREFUSED |
717 |
|
#define ELOOP WSAELOOP |
718 |
|
#define ENAMETOOLONG WSAENAMETOOLONG |
719 |
|
#define EHOSTDOWN WSAEHOSTDOWN |
720 |
|
#define EHOSTUNREACH WSAEHOSTUNREACH |
721 |
|
#define ENOTEMPTY WSAENOTEMPTY |
722 |
|
#define EPROCLIM WSAEPROCLIM |
723 |
|
#define EUSERS WSAEUSERS |
724 |
|
#define EDQUOT WSAEDQUOT |
725 |
|
#define ESTALE WSAESTALE |
726 |
|
#define EREMOTE WSAEREMOTE |
727 |
|
#endif |
728 |
|
|
729 |
|
/* Socket function prototypes */ |
730 |
|
|
731 |
|
#ifdef __cplusplus |
732 |
|
extern "C" { |
733 |
|
#endif |
734 |
|
|
735 |
|
SOCKET PASCAL FAR accept ( |
736 |
|
IN SOCKET s, |
737 |
|
OUT struct sockaddr FAR *addr, |
738 |
|
IN OUT int FAR *addrlen); |
739 |
|
|
740 |
|
int PASCAL FAR bind ( |
741 |
|
IN SOCKET s, |
742 |
|
IN const struct sockaddr FAR *addr, |
743 |
|
IN int namelen); |
744 |
|
|
745 |
|
int PASCAL FAR closesocket ( IN SOCKET s); |
746 |
|
|
747 |
|
int PASCAL FAR connect ( |
748 |
|
IN SOCKET s, |
749 |
|
IN const struct sockaddr FAR *name, |
750 |
|
IN int namelen); |
751 |
|
|
752 |
|
int PASCAL FAR ioctlsocket ( |
753 |
|
IN SOCKET s, |
754 |
|
IN long cmd, |
755 |
|
IN OUT u_long FAR *argp); |
756 |
|
|
757 |
|
int PASCAL FAR getpeername ( |
758 |
|
IN SOCKET s, |
759 |
|
OUT struct sockaddr FAR *name, |
760 |
|
IN OUT int FAR * namelen); |
761 |
|
|
762 |
|
int PASCAL FAR getsockname ( |
763 |
|
IN SOCKET s, |
764 |
|
OUT struct sockaddr FAR *name, |
765 |
|
IN OUT int FAR * namelen); |
766 |
|
|
767 |
|
int PASCAL FAR getsockopt ( |
768 |
|
IN SOCKET s, |
769 |
|
IN int level, |
770 |
|
IN int optname, |
771 |
|
__out_bcount(*optlen) char FAR * optval, |
1030 |
|
typedef struct timeval FAR *LPTIMEVAL; |
1031 |
|
|
1032 |
|
/* |
1033 |
|
* Windows message parameter composition and decomposition |
1034 |
|
* macros. |
1035 |
|
* |
1036 |
|
* WSAMAKEASYNCREPLY is intended for use by the Windows Sockets implementation |
1037 |
|
* when constructing the response to a WSAAsyncGetXByY() routine. |
1038 |
|
*/ |
1039 |
|
#define WSAMAKEASYNCREPLY(buflen,error) MAKELONG(buflen,error) |
1040 |
|
/* |
1041 |
|
* WSAMAKESELECTREPLY is intended for use by the Windows Sockets implementation |
1042 |
|
* when constructing the response to WSAAsyncSelect(). |
1043 |
|
*/ |
1044 |
|
#define WSAMAKESELECTREPLY(event,error) MAKELONG(event,error) |
1045 |
|
/* |
1046 |
|
* WSAGETASYNCBUFLEN is intended for use by the Windows Sockets application |
1047 |
|
* to extract the buffer length from the lParam in the response |
1048 |
|
* to a WSAGetXByY(). |
1049 |
|
*/ |
1050 |
|
#define WSAGETASYNCBUFLEN(lParam) LOWORD(lParam) |
1051 |
|
/* |
1052 |
|
* WSAGETASYNCERROR is intended for use by the Windows Sockets application |
1053 |
|
* to extract the error code from the lParam in the response |
1054 |
|
* to a WSAGetXByY(). |
1055 |
|
*/ |
1056 |
|
#define WSAGETASYNCERROR(lParam) HIWORD(lParam) |
1057 |
|
/* |
1058 |
|
* WSAGETSELECTEVENT is intended for use by the Windows Sockets application |
1059 |
|
* to extract the event code from the lParam in the response |
1060 |
|
* to a WSAAsyncSelect(). |
1061 |
|
*/ |
1062 |
|
#define WSAGETSELECTEVENT(lParam) LOWORD(lParam) |
1063 |
|
/* |
1064 |
|
* WSAGETSELECTERROR is intended for use by the Windows Sockets application |
1065 |
|
* to extract the error code from the lParam in the response |
1066 |
|
* to a WSAAsyncSelect(). |
1067 |
|
*/ |
1068 |
|
#define WSAGETSELECTERROR(lParam) HIWORD(lParam) |
1069 |
|
|
1070 |
|
#if(_WIN32_WINNT >= 0x0501) |
1071 |
|
#ifdef IPV6STRICT |
1072 |
|
#error WINSOCK2 required. |
1073 |
|
#endif // IPV6STRICT |
1074 |
|
#endif //(_WIN32_WINNT >= 0x0501) |
1075 |
|
|
1076 |
|
#endif /* _WINSOCKAPI_ */ |
1077 |
|
|
1078 |
|
|
|
|
|