* include/mswsock.h: New file.
* include/ws2tcpip.h: New file. * include/winsock.h (IPPROTO_IGMP): New define. (IPPROTO_GGP): Correct value. (SO_* macros): Remove mswsock defines. (TCP_BSDURGENT): Likewise. (IP_* macros): Add comment warning of WinSock2 incompatibility (WSARecvEx): Remove mswsock prototype. (TransmitFile): Likewise. (AcceptEx): Likewise. (GetAcceptExSockaddrs): Likewise. (struct _TRANSMIT_FILE_BUFFERS): Remove mswsock definition. (#include <mswsock.h>): Add directive and explanatory comment * include/winsock2.h (header guard): add guard for _WINSOCK_H (_WINSOCK_H): Define to prevent later inclusion of winsock.h (#include <winsock.h>): Replace directive with winsock.h file content The following changes apply to the merged file: (FD_SET): Keep winsock2.h definition, delete winsock.h definition (SOMAXCONN): Likewise (#include <nspapi.h>): Move - don't include until LPSOCKADDR defined (IP_* macros): Delete WinSock1 definitions (WinSock2 definitions now in ws2tcpip.h) (struct ip_mreq): Delete (now defined in ws2tcpip.h for WinSock2) (FD_*_BIT and FD_* defines): Place together and extend to FD_MAX_EVENTS 10 (AF* defines): Extend to AF_MAX 10 (WSAIsBlocking): #if 0 out prototype (N/A in WinSock2) (WSAUnhookBlockingHook): Likewise. (WSASetBlockingHook): Likewise. (WSACancelBlockingCall): Likewise. (WSAEINPROGRESS): Comment as not raised in WinSock2. (#include <mswsock.h>): Delete directive inherited from winsock.h (WSA_QOS* defines): Add QualityOfService error codes. (SIO_* defines): Add new macros * include/ipexport.h (IP_STATUS flags): Add definitions. (IP_FLAG_DF): Likewise. (IP_OPT_* ): Likewise. (struct ip_option_information): Likewise. (struct icmp_echo_reply): Likewise.
This commit is contained in:
parent
d53c723240
commit
b701af168c
@ -1,4 +1,46 @@
|
||||
|
||||
2001-02-21 Danny Smith <dannysmith@users.sourceforge.net>
|
||||
|
||||
* include/mswsock.h: New file.
|
||||
* include/ws2tcpip.h: New file.
|
||||
* include/winsock.h (IPPROTO_IGMP): New define.
|
||||
(IPPROTO_GGP): Correct value.
|
||||
(SO_* macros): Remove mswsock defines.
|
||||
(TCP_BSDURGENT): Likewise.
|
||||
(IP_* macros): Add comment warning of WinSock2 incompatibility
|
||||
(WSARecvEx): Remove mswsock prototype.
|
||||
(TransmitFile): Likewise.
|
||||
(AcceptEx): Likewise.
|
||||
(GetAcceptExSockaddrs): Likewise.
|
||||
(struct _TRANSMIT_FILE_BUFFERS): Remove mswsock definition.
|
||||
(#include <mswsock.h>): Add directive and explanatory comment
|
||||
* include/winsock2.h (header guard): add guard for _WINSOCK_H
|
||||
(_WINSOCK_H): Define to prevent later inclusion of winsock.h
|
||||
(#include <winsock.h>): Replace directive with winsock.h file content
|
||||
The following changes apply to the merged file:
|
||||
(FD_SET): Keep winsock2.h definition, delete winsock.h definition
|
||||
(SOMAXCONN): Likewise
|
||||
(#include <nspapi.h>): Move - don't include until LPSOCKADDR defined
|
||||
(IP_* macros): Delete WinSock1 definitions (WinSock2 definitions now
|
||||
in ws2tcpip.h)
|
||||
(struct ip_mreq): Delete (now defined in ws2tcpip.h for WinSock2)
|
||||
(FD_*_BIT and FD_* defines): Place together and extend to
|
||||
FD_MAX_EVENTS 10
|
||||
(AF* defines): Extend to AF_MAX 10
|
||||
(WSAIsBlocking): #if 0 out prototype (N/A in WinSock2)
|
||||
(WSAUnhookBlockingHook): Likewise.
|
||||
(WSASetBlockingHook): Likewise.
|
||||
(WSACancelBlockingCall): Likewise.
|
||||
(WSAEINPROGRESS): Comment as not raised in WinSock2.
|
||||
(#include <mswsock.h>): Delete directive inherited from winsock.h
|
||||
(WSA_QOS* defines): Add QualityOfService error codes.
|
||||
(SIO_* defines): Add new macros
|
||||
* include/ipexport.h (IP_STATUS flags): Add definitions.
|
||||
(IP_FLAG_DF): Likewise.
|
||||
(IP_OPT_* ): Likewise.
|
||||
(struct ip_option_information): Likewise.
|
||||
(struct icmp_echo_reply): Likewise.
|
||||
|
||||
2001-02-21 Danny Smith <dannysmith@users.sourceforge.net>
|
||||
|
||||
* include/commctrl.h: Revert TEXT change.
|
||||
|
@ -7,7 +7,65 @@ extern "C" {
|
||||
#define ANY_SIZE 1
|
||||
#endif
|
||||
#define MAX_ADAPTER_NAME 128
|
||||
/* IP STATUS flags */
|
||||
#define IP_STATUS_BASE 11000
|
||||
#define IP_SUCCESS 0
|
||||
#define IP_BUF_TOO_SMALL (IP_STATUS_BASE + 1)
|
||||
#define IP_DEST_NET_UNREACHABLE (IP_STATUS_BASE + 2)
|
||||
#define IP_DEST_HOST_UNREACHABLE (IP_STATUS_BASE + 3)
|
||||
#define IP_DEST_PROT_UNREACHABLE (IP_STATUS_BASE + 4)
|
||||
#define IP_DEST_PORT_UNREACHABLE (IP_STATUS_BASE + 5)
|
||||
#define IP_NO_RESOURCES (IP_STATUS_BASE + 6)
|
||||
#define IP_BAD_OPTION (IP_STATUS_BASE + 7)
|
||||
#define IP_HW_ERROR (IP_STATUS_BASE + 8)
|
||||
#define IP_PACKET_TOO_BIG (IP_STATUS_BASE + 9)
|
||||
#define IP_REQ_TIMED_OUT (IP_STATUS_BASE + 10)
|
||||
#define IP_BAD_REQ (IP_STATUS_BASE + 11)
|
||||
#define IP_BAD_ROUTE (IP_STATUS_BASE + 12)
|
||||
#define IP_TTL_EXPIRED_TRANSIT (IP_STATUS_BASE + 13)
|
||||
#define IP_TTL_EXPIRED_REASSEM (IP_STATUS_BASE + 14)
|
||||
#define IP_PARAM_PROBLEM (IP_STATUS_BASE + 15)
|
||||
#define IP_SOURCE_QUENCH (IP_STATUS_BASE + 16)
|
||||
#define IP_OPTION_TOO_BIG (IP_STATUS_BASE + 17)
|
||||
#define IP_BAD_DESTINATION (IP_STATUS_BASE + 18)
|
||||
#define IP_ADDR_DELETED (IP_STATUS_BASE + 19)
|
||||
#define IP_SPEC_MTU_CHANGE (IP_STATUS_BASE + 20)
|
||||
#define IP_MTU_CHANGE (IP_STATUS_BASE + 21)
|
||||
#define IP_UNLOAD (IP_STATUS_BASE + 22)
|
||||
#define IP_GENERAL_FAILURE (IP_STATUS_BASE + 50)
|
||||
#define MAX_IP_STATUS IP_GENERAL_FAILURE
|
||||
#define IP_PENDING (IP_STATUS_BASE + 255)
|
||||
/* IP header Flags values */
|
||||
#define IP_FLAG_DF 0x2
|
||||
/* IP Option types */
|
||||
#define IP_OPT_EOL 0
|
||||
#define IP_OPT_NOP 1
|
||||
#define IP_OPT_SECURITY 0x82
|
||||
#define IP_OPT_LSRR 0x83
|
||||
#define IP_OPT_SSRR 0x89
|
||||
#define IP_OPT_RR 0x7
|
||||
#define IP_OPT_TS 0x44
|
||||
#define IP_OPT_SID 0x88
|
||||
#define IP_OPT_ROUTER_ALERT 0x94
|
||||
#define MAX_OPT_SIZE 40
|
||||
|
||||
typedef unsigned long IPAddr, IPMask, IP_STATUS;
|
||||
typedef struct ip_option_information {
|
||||
unsigned char Ttl;
|
||||
unsigned char Tos;
|
||||
unsigned char Flags;
|
||||
unsigned char OptionsSize;
|
||||
unsigned char* OptionsData;
|
||||
}IP_OPTION_INFORMATION, *PIP_OPTION_INFORMATION;
|
||||
typedef struct icmp_echo_reply {
|
||||
IPAddr Address;
|
||||
unsigned long Status;
|
||||
unsigned long RoundTripTime;
|
||||
unsigned short DataSize;
|
||||
unsigned short Reserved;
|
||||
void* Data;
|
||||
struct ip_option_information Options;
|
||||
} ICMP_ECHO_REPLY, *PICMP_ECHO_REPLY;;
|
||||
typedef struct {
|
||||
ULONG Index;
|
||||
WCHAR Name[MAX_ADAPTER_NAME];
|
||||
|
59
winsup/w32api/include/mswsock.h
Normal file
59
winsup/w32api/include/mswsock.h
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* mswsock.h
|
||||
* MS-specific extensions to Windows Sockets 1.1, exported from mswsock.dll.
|
||||
* These functions are N/A on Windows9x.
|
||||
*
|
||||
* This file is part of a free library for the Win32 API.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _MSWSOCK_H
|
||||
#define _MSWSOCK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SO_CONNDATA 0x7000
|
||||
#define SO_CONNOPT 0x7001
|
||||
#define SO_DISCDATA 0x7002
|
||||
#define SO_DISCOPT 0x7003
|
||||
#define SO_CONNDATALEN 0x7004
|
||||
#define SO_CONNOPTLEN 0x7005
|
||||
#define SO_DISCDATALEN 0x7006
|
||||
#define SO_DISCOPTLEN 0x7007
|
||||
#define SO_OPENTYPE 0x7008
|
||||
#define SO_SYNCHRONOUS_ALERT 0x10
|
||||
#define SO_SYNCHRONOUS_NONALERT 0x20
|
||||
#define SO_MAXDG 0x7009
|
||||
#define SO_MAXPATHDG 0x700A
|
||||
#define SO_UPDATE_ACCEPT_CONTEXT 0x700B
|
||||
#define SO_CONNECT_TIME 0x700C
|
||||
#define TCP_BSDURGENT 0x7000
|
||||
|
||||
#define TF_DISCONNECT 1
|
||||
#define TF_REUSE_SOCKET 2
|
||||
#define TF_WRITE_BEHIND 4
|
||||
#define TF_USE_DEFAULT_WORKER 0
|
||||
#define TF_USE_SYSTEM_THREAD 16
|
||||
#define TF_USE_KERNEL_APC 32
|
||||
|
||||
typedef struct _TRANSMIT_FILE_BUFFERS {
|
||||
PVOID Head;
|
||||
DWORD HeadLength;
|
||||
PVOID Tail;
|
||||
DWORD TailLength;
|
||||
} TRANSMIT_FILE_BUFFERS, *PTRANSMIT_FILE_BUFFERS, *LPTRANSMIT_FILE_BUFFERS;
|
||||
|
||||
int PASCAL WSARecvEx(SOCKET,char*,int,int*);
|
||||
BOOL PASCAL TransmitFile(SOCKET,HANDLE,DWORD,DWORD,LPOVERLAPPED,LPTRANSMIT_FILE_BUFFERS,DWORD);
|
||||
BOOL PASCAL AcceptEx(SOCKET,SOCKET,PVOID,DWORD,DWORD,DWORD,LPDWORD,LPOVERLAPPED);
|
||||
VOID PASCAL GetAcceptExSockaddrs(PVOID,DWORD,DWORD,DWORD,struct sockaddr**, LPINT, struct sockaddr**, LPINT);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _MSWSOCK_H */
|
||||
|
@ -139,7 +139,8 @@ struct protoent {
|
||||
|
||||
#define IPPROTO_IP 0
|
||||
#define IPPROTO_ICMP 1
|
||||
#define IPPROTO_GGP 2
|
||||
#define IPPROTO_IGMP 2
|
||||
#define IPPROTO_GGP 3
|
||||
#define IPPROTO_TCP 6
|
||||
#define IPPROTO_PUP 12
|
||||
#define IPPROTO_UDP 17
|
||||
@ -245,27 +246,18 @@ typedef WSADATA *LPWSADATA;
|
||||
#define SO_RCVTIMEO 0x1006
|
||||
#define SO_ERROR 0x1007
|
||||
#define SO_TYPE 0x1008
|
||||
#define SO_CONNDATA 0x7000
|
||||
#define SO_CONNOPT 0x7001
|
||||
#define SO_DISCDATA 0x7002
|
||||
#define SO_DISCOPT 0x7003
|
||||
#define SO_CONNDATALEN 0x7004
|
||||
#define SO_CONNOPTLEN 0x7005
|
||||
#define SO_DISCDATALEN 0x7006
|
||||
#define SO_DISCOPTLEN 0x7007
|
||||
#define SO_OPENTYPE 0x7008
|
||||
#define SO_SYNCHRONOUS_ALERT 0x10
|
||||
#define SO_SYNCHRONOUS_NONALERT 0x20
|
||||
#define SO_MAXDG 0x7009
|
||||
#define SO_MAXPATHDG 0x700A
|
||||
#define SO_UPDATE_ACCEPT_CONTEXT 0x700B
|
||||
#define SO_CONNECT_TIME 0x700C
|
||||
#endif
|
||||
/*
|
||||
* Note that the next 5 IP defines are specific to WinSock 1.1 (wsock32.dll).
|
||||
* They will cause errors or unexpected results if used with the
|
||||
* (gs)etsockopts exported from the WinSock 2 lib, ws2_32.dll. Refer ws2tcpip.h.
|
||||
*/
|
||||
#define IP_MULTICAST_IF 2
|
||||
#define IP_MULTICAST_TTL 3
|
||||
#define IP_MULTICAST_LOOP 4
|
||||
#define IP_ADD_MEMBERSHIP 5
|
||||
#define IP_DROP_MEMBERSHIP 6
|
||||
|
||||
#define IP_DEFAULT_MULTICAST_TTL 1
|
||||
#define IP_DEFAULT_MULTICAST_LOOP 1
|
||||
#define IP_MAX_MEMBERSHIPS 20
|
||||
@ -281,7 +273,6 @@ struct ip_mreq {
|
||||
#define SOCK_RDM 4
|
||||
#define SOCK_SEQPACKET 5
|
||||
#define TCP_NODELAY 0x0001
|
||||
#define TCP_BSDURGENT 0x7000
|
||||
#define AF_UNSPEC 0
|
||||
#define AF_UNIX 1
|
||||
#define AF_INET 2
|
||||
@ -463,16 +454,6 @@ HANDLE PASCAL WSAAsyncGetHostByName(HWND,u_int,const char*,char*,int);
|
||||
HANDLE PASCAL WSAAsyncGetHostByAddr(HWND,u_int,const char*,int,int,char*,int);
|
||||
int PASCAL WSACancelAsyncRequest(HANDLE);
|
||||
int PASCAL WSAAsyncSelect(SOCKET,HWND,u_int,long);
|
||||
int PASCAL WSARecvEx(SOCKET,char*,int,int*);
|
||||
typedef struct _TRANSMIT_FILE_BUFFERS {
|
||||
PVOID Head;
|
||||
DWORD HeadLength;
|
||||
PVOID Tail;
|
||||
DWORD TailLength;
|
||||
} TRANSMIT_FILE_BUFFERS, *PTRANSMIT_FILE_BUFFERS, *LPTRANSMIT_FILE_BUFFERS;
|
||||
BOOL PASCAL TransmitFile(SOCKET,HANDLE,DWORD,DWORD,LPOVERLAPPED,LPTRANSMIT_FILE_BUFFERS,DWORD);
|
||||
BOOL PASCAL AcceptEx(SOCKET,SOCKET,PVOID,DWORD,DWORD,DWORD,LPDWORD,LPOVERLAPPED);
|
||||
VOID PASCAL GetAcceptExSockaddrs(PVOID,DWORD,DWORD,DWORD,struct sockaddr**, LPINT, struct sockaddr**, LPINT);
|
||||
#ifndef __INSIDE_CYGWIN__
|
||||
u_long PASCAL htonl(u_long);
|
||||
u_long PASCAL ntohl(u_long);
|
||||
@ -520,4 +501,19 @@ typedef struct timeval *LPTIMEVAL;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Recent MSDN docs indicate that the MS-specific extensions exported from
|
||||
* mswsock.dll (AcceptEx, TransmitFile. WSARecEx and GetAcceptExSockaddrs) are
|
||||
* declared in mswsock.h. These extensions are not supported on W9x or WinCE.
|
||||
* However, code using WinSock 1.1 API may expect the declarations and
|
||||
* associated defines to be in this header. Thus we include mswsock.h here.
|
||||
*
|
||||
* When linking against the WinSock 1.1 lib, wsock32.dll, the mswsock functions
|
||||
* are automatically routed to mswsock.dll (on platforms with support).
|
||||
* The WinSock 2 lib, ws2_32.dll, does not contain any references to
|
||||
* the mswsock extensions.
|
||||
*/
|
||||
|
||||
#include <mswsock.h>
|
||||
|
||||
#endif
|
||||
|
@ -10,66 +10,65 @@
|
||||
Portions Copyright (c) 1993 by Digital Equipment Corporation.
|
||||
*/
|
||||
|
||||
#ifndef _WINSOCK2_H
|
||||
#if !(defined _WINSOCK2_H || defined _WINSOCK_H)
|
||||
#define _WINSOCK2_H
|
||||
#define _WINSOCK_H /* to prevent later inclusion of winsock.h */
|
||||
#define _GNU_H_WINDOWS32_SOCKETS
|
||||
|
||||
/* Macros that are also defined in winsock.h, and need to be overridden.
|
||||
These will go away once we have a completely standalone winsock2.h. */
|
||||
#ifdef FD_SET
|
||||
#define _FD_SET_DEFINED
|
||||
#endif
|
||||
#include <winsock.h>
|
||||
#include <windows.h>
|
||||
|
||||
#ifndef _NSPAPI_H
|
||||
#include <nspapi.h>
|
||||
#endif
|
||||
#ifndef _WTYPES_H
|
||||
#include <wtypes.h>
|
||||
#include <wtypes.h> /* for BLOB */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ADDR_ANY INADDR_ANY
|
||||
|
||||
#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000)
|
||||
#define IN_CLASSD_NET 0xf0000000
|
||||
#define IN_CLASSD_NSHIFT 28
|
||||
#define IN_CLASSD_HOST 0x0fffffff
|
||||
#define IN_MULTICAST(i) IN_CLASSD(i)
|
||||
|
||||
#define FROM_PROTOCOL_INFO (-1)
|
||||
|
||||
#define SO_DONTLINGER (u_int)(~SO_LINGER)
|
||||
#define SO_GROUP_ID 0x2001
|
||||
#define SO_GROUP_PRIORITY 0x2002
|
||||
/* FIXME/TODO: need this because we also include winsock.h. */
|
||||
#undef SOMAXCONN
|
||||
#define SOMAXCONN 0x7fffffff
|
||||
#define SO_MAX_MSG_SIZE 0x2003
|
||||
#define SO_PROTOCOL_INFOA 0x2004
|
||||
#define SO_PROTOCOL_INFOW 0x2005
|
||||
#ifdef UNICODE
|
||||
#define SO_PROTOCOL_INFO SO_PROTOCOL_INFOW
|
||||
#else
|
||||
#define SO_PROTOCOL_INFO SO_PROTOCOL_INFOA
|
||||
/* Names common to Winsock1.1 and Winsock2 */
|
||||
#if !defined ( _BSDTYPES_DEFINED ) && !defined ( _SYS_TYPES_H )
|
||||
/* also defined in gmon.h and in cygwin's sys/types */
|
||||
typedef unsigned char u_char;
|
||||
typedef unsigned short u_short;
|
||||
typedef unsigned int u_int;
|
||||
typedef unsigned long u_long;
|
||||
#define _BSDTYPES_DEFINED
|
||||
#endif /* ndef _BSDTYPES_ _SYS_TYPES_H */
|
||||
typedef u_int SOCKET;
|
||||
#ifndef FD_SETSIZE
|
||||
#define FD_SETSIZE 64
|
||||
#endif
|
||||
#define PVD_CONFIG 0x3001
|
||||
|
||||
#define FD_READ_BIT 0
|
||||
#define FD_WRITE_BIT 1
|
||||
#define FD_OOB_BIT 2
|
||||
#define FD_ACCEPT_BIT 3
|
||||
#define FD_CONNECT_BIT 4
|
||||
#define FD_CLOSE_BIT 5
|
||||
#define FD_QOS_BIT 6
|
||||
#define FD_GROUP_QOS_BIT 7
|
||||
#define FD_MAX_EVENTS 8
|
||||
#define FD_ALL_EVENTS (255)
|
||||
/* shutdown() how types */
|
||||
#define SD_RECEIVE 0x00
|
||||
#define SD_SEND 0x01
|
||||
#define SD_BOTH 0x02
|
||||
|
||||
#if !defined(_FD_SET_DEFINED)
|
||||
#undef FD_SET
|
||||
#ifndef _SYS_TYPES_H
|
||||
/* fd_set may have been defined by the newlib <sys/types.h>. */
|
||||
#ifdef fd_set
|
||||
#undef fd_set
|
||||
#endif
|
||||
typedef struct fd_set {
|
||||
u_int fd_count;
|
||||
SOCKET fd_array[FD_SETSIZE];
|
||||
} fd_set;
|
||||
int PASCAL __WSAFDIsSet(SOCKET,fd_set*);
|
||||
#ifndef FD_CLR
|
||||
#define FD_CLR(fd,set) do { u_int __i;\
|
||||
for (__i = 0; __i < ((fd_set *)(set))->fd_count ; __i++) {\
|
||||
if (((fd_set *)(set))->fd_array[__i] == (fd)) {\
|
||||
while (__i < ((fd_set *)(set))->fd_count-1) {\
|
||||
((fd_set*)(set))->fd_array[__i] = ((fd_set*)(set))->fd_array[__i+1];\
|
||||
__i++;\
|
||||
}\
|
||||
((fd_set*)(set))->fd_count--;\
|
||||
break;\
|
||||
}\
|
||||
}\
|
||||
} while (0)
|
||||
#endif
|
||||
#ifndef FD_SET
|
||||
/* this differs from the define in winsock.h */
|
||||
#define FD_SET(fd, set) do { u_int __i;\
|
||||
for (__i = 0; __i < ((fd_set *)(set))->fd_count ; __i++) {\
|
||||
if (((fd_set *)(set))->fd_array[__i] == (fd)) {\
|
||||
@ -83,13 +82,479 @@ if (__i == ((fd_set *)(set))->fd_count) {\
|
||||
}\
|
||||
}\
|
||||
} while(0)
|
||||
#else
|
||||
#undef _FD_SET_DEFINED
|
||||
#endif
|
||||
#ifndef FD_ZERO
|
||||
#define FD_ZERO(set) (((fd_set *)(set))->fd_count=0)
|
||||
#endif
|
||||
#ifndef FD_ISSET
|
||||
#define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set *)(set))
|
||||
#endif
|
||||
#endif /* ndef _SYS_TYPES_H */
|
||||
#ifndef __INSIDE_CYGWIN__
|
||||
struct timeval {
|
||||
long tv_sec;
|
||||
long tv_usec;
|
||||
};
|
||||
struct hostent {
|
||||
char *h_name;
|
||||
char **h_aliases;
|
||||
short h_addrtype;
|
||||
short h_length;
|
||||
char **h_addr_list;
|
||||
#define h_addr h_addr_list[0]
|
||||
};
|
||||
struct linger {
|
||||
u_short l_onoff;
|
||||
u_short l_linger;
|
||||
};
|
||||
#endif /* ndef __INSIDE_CYGWIN__ */
|
||||
#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
|
||||
#define timercmp(tvp, uvp, cmp) \
|
||||
(((tvp)->tv_sec != (uvp)->tv_sec) ? \
|
||||
((tvp)->tv_sec cmp (uvp)->tv_sec) : \
|
||||
((tvp)->tv_usec cmp (uvp)->tv_usec))
|
||||
#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
|
||||
#define IOCPARM_MASK 0x7f
|
||||
#define IOC_VOID 0x20000000
|
||||
#define IOC_OUT 0x40000000
|
||||
#define IOC_IN 0x80000000
|
||||
#define IOC_INOUT (IOC_IN|IOC_OUT)
|
||||
|
||||
#ifndef __INSIDE_CYGWIN__
|
||||
#define _IO(x,y) (IOC_VOID|((x)<<8)|(y))
|
||||
#define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
|
||||
#define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
|
||||
#define FIONBIO _IOW('f', 126, u_long)
|
||||
#endif /* ndef __INSIDE_CYGWIN__ */
|
||||
|
||||
#define FIONREAD _IOR('f', 127, u_long)
|
||||
#define FIOASYNC _IOW('f', 125, u_long)
|
||||
#define SIOCSHIWAT _IOW('s', 0, u_long)
|
||||
#define SIOCGHIWAT _IOR('s', 1, u_long)
|
||||
#define SIOCSLOWAT _IOW('s', 2, u_long)
|
||||
#define SIOCGLOWAT _IOR('s', 3, u_long)
|
||||
#define SIOCATMARK _IOR('s', 7, u_long)
|
||||
|
||||
#ifndef __INSIDE_CYGWIN__
|
||||
struct netent {
|
||||
char * n_name;
|
||||
char **n_aliases;
|
||||
short n_addrtype;
|
||||
u_long n_net;
|
||||
};
|
||||
struct servent {
|
||||
char *s_name;
|
||||
char **s_aliases;
|
||||
short s_port;
|
||||
char *s_proto;
|
||||
};
|
||||
struct protoent {
|
||||
char *p_name;
|
||||
char **p_aliases;
|
||||
short p_proto;
|
||||
};
|
||||
#endif /* __INSIDE_CYGWIN__ */
|
||||
|
||||
#define IPPROTO_IP 0
|
||||
#define IPPROTO_ICMP 1
|
||||
#define IPPROTO_IGMP 2
|
||||
#define IPPROTO_GGP 3
|
||||
#define IPPROTO_TCP 6
|
||||
#define IPPROTO_PUP 12
|
||||
#define IPPROTO_UDP 17
|
||||
#define IPPROTO_IDP 22
|
||||
#define IPPROTO_ND 77
|
||||
#define IPPROTO_RAW 255
|
||||
#define IPPROTO_MAX 256
|
||||
#define IPPORT_ECHO 7
|
||||
#define IPPORT_DISCARD 9
|
||||
#define IPPORT_SYSTAT 11
|
||||
#define IPPORT_DAYTIME 13
|
||||
#define IPPORT_NETSTAT 15
|
||||
#define IPPORT_FTP 21
|
||||
#define IPPORT_TELNET 23
|
||||
#define IPPORT_SMTP 25
|
||||
#define IPPORT_TIMESERVER 37
|
||||
#define IPPORT_NAMESERVER 42
|
||||
#define IPPORT_WHOIS 43
|
||||
#define IPPORT_MTP 57
|
||||
#define IPPORT_TFTP 69
|
||||
#define IPPORT_RJE 77
|
||||
#define IPPORT_FINGER 79
|
||||
#define IPPORT_TTYLINK 87
|
||||
#define IPPORT_SUPDUP 95
|
||||
#define IPPORT_EXECSERVER 512
|
||||
#define IPPORT_LOGINSERVER 513
|
||||
#define IPPORT_CMDSERVER 514
|
||||
#define IPPORT_EFSSERVER 520
|
||||
#define IPPORT_BIFFUDP 512
|
||||
#define IPPORT_WHOSERVER 513
|
||||
#define IPPORT_ROUTESERVER 520
|
||||
#define IPPORT_RESERVED 1024
|
||||
#define IMPLINK_IP 155
|
||||
#define IMPLINK_LOWEXPER 156
|
||||
#define IMPLINK_HIGHEXPER 158
|
||||
struct in_addr {
|
||||
union {
|
||||
struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
|
||||
struct { u_short s_w1,s_w2; } S_un_w;
|
||||
u_long S_addr;
|
||||
} S_un;
|
||||
#define s_addr S_un.S_addr
|
||||
#define s_host S_un.S_un_b.s_b2
|
||||
#define s_net S_un.S_un_b.s_b1
|
||||
#define s_imp S_un.S_un_w.s_w2
|
||||
#define s_impno S_un.S_un_b.s_b4
|
||||
#define s_lh S_un.S_un_b.s_b3
|
||||
};
|
||||
#define IN_CLASSA(i) ((long)(i)&0x80000000)
|
||||
#define IN_CLASSA_NET 0xff000000
|
||||
#define IN_CLASSA_NSHIFT 24
|
||||
#define IN_CLASSA_HOST 0x00ffffff
|
||||
#define IN_CLASSA_MAX 128
|
||||
#define IN_CLASSB(i) (((long)(i)&0xc0000000)==0x80000000)
|
||||
#define IN_CLASSB_NET 0xffff0000
|
||||
#define IN_CLASSB_NSHIFT 16
|
||||
#define IN_CLASSB_HOST 0x0000ffff
|
||||
#define IN_CLASSB_MAX 65536
|
||||
#define IN_CLASSC(i) (((long)(i)&0xe0000000)==0xc0000000)
|
||||
#define IN_CLASSC_NET 0xffffff00
|
||||
#define IN_CLASSC_NSHIFT 8
|
||||
#define IN_CLASSC_HOST 0xff
|
||||
#define INADDR_ANY (u_long)0
|
||||
#define INADDR_LOOPBACK 0x7f000001
|
||||
#define INADDR_BROADCAST (u_long)0xffffffff
|
||||
#define INADDR_NONE 0xffffffff
|
||||
struct sockaddr_in {
|
||||
short sin_family;
|
||||
u_short sin_port;
|
||||
struct in_addr sin_addr;
|
||||
char sin_zero[8];
|
||||
};
|
||||
#define WSADESCRIPTION_LEN 256
|
||||
#define WSASYS_STATUS_LEN 128
|
||||
typedef struct WSAData {
|
||||
WORD wVersion;
|
||||
WORD wHighVersion;
|
||||
char szDescription[WSADESCRIPTION_LEN+1];
|
||||
char szSystemStatus[WSASYS_STATUS_LEN+1];
|
||||
unsigned short iMaxSockets;
|
||||
unsigned short iMaxUdpDg;
|
||||
char * lpVendorInfo;
|
||||
} WSADATA;
|
||||
typedef WSADATA *LPWSADATA;
|
||||
|
||||
#ifndef __INSIDE_CYGWIN__
|
||||
#define IP_OPTIONS 1
|
||||
#define SO_DEBUG 1
|
||||
#define SO_ACCEPTCONN 2
|
||||
#define SO_REUSEADDR 4
|
||||
#define SO_KEEPALIVE 8
|
||||
#define SO_DONTROUTE 16
|
||||
#define SO_BROADCAST 32
|
||||
#define SO_USELOOPBACK 64
|
||||
#define SO_LINGER 128
|
||||
#define SO_OOBINLINE 256
|
||||
#define SO_DONTLINGER (u_int)(~SO_LINGER)
|
||||
#define SO_SNDBUF 0x1001
|
||||
#define SO_RCVBUF 0x1002
|
||||
#define SO_SNDLOWAT 0x1003
|
||||
#define SO_RCVLOWAT 0x1004
|
||||
#define SO_SNDTIMEO 0x1005
|
||||
#define SO_RCVTIMEO 0x1006
|
||||
#define SO_ERROR 0x1007
|
||||
#define SO_TYPE 0x1008
|
||||
#endif
|
||||
|
||||
#define INVALID_SOCKET (SOCKET)(~0)
|
||||
#define SOCKET_ERROR (-1)
|
||||
#define SOCK_STREAM 1
|
||||
#define SOCK_DGRAM 2
|
||||
#define SOCK_RAW 3
|
||||
#define SOCK_RDM 4
|
||||
#define SOCK_SEQPACKET 5
|
||||
#define TCP_NODELAY 0x0001
|
||||
#define AF_UNSPEC 0
|
||||
#define AF_UNIX 1
|
||||
#define AF_INET 2
|
||||
#define AF_IMPLINK 3
|
||||
#define AF_PUP 4
|
||||
#define AF_CHAOS 5
|
||||
#define AF_IPX 6
|
||||
#define AF_NS 6
|
||||
#define AF_ISO 7
|
||||
#define AF_OSI AF_ISO
|
||||
#define AF_ECMA 8
|
||||
#define AF_DATAKIT 9
|
||||
#define AF_CCITT 10
|
||||
#define AF_SNA 11
|
||||
#define AF_DECnet 12
|
||||
#define AF_DLI 13
|
||||
#define AF_LAT 14
|
||||
#define AF_HYLINK 15
|
||||
#define AF_APPLETALK 16
|
||||
#define AF_NETBIOS 17
|
||||
#define AF_VOICEVIEW 18
|
||||
#define AF_FIREFOX 19
|
||||
#define AF_UNKNOWN1 20
|
||||
#define AF_BAN 21
|
||||
#define AF_ATM 22
|
||||
#define AF_INET6 23
|
||||
#define AF_CLUSTER 24
|
||||
#define AF_12844 25
|
||||
#define AF_IRDA 26
|
||||
#define AF_NETDES 28
|
||||
#ifndef __INSIDE_CYGWIN__
|
||||
#define AF_MAX 29
|
||||
struct sockaddr {
|
||||
u_short sa_family;
|
||||
char sa_data[14];
|
||||
};
|
||||
#endif /* ndef __INSIDE_CYGWIN__ */
|
||||
|
||||
struct sockproto {
|
||||
u_short sp_family;
|
||||
u_short sp_protocol;
|
||||
};
|
||||
#define PF_UNSPEC AF_UNSPEC
|
||||
#define PF_UNIX AF_UNIX
|
||||
#define PF_INET AF_INET
|
||||
#define PF_IMPLINK AF_IMPLINK
|
||||
#define PF_PUP AF_PUP
|
||||
#define PF_CHAOS AF_CHAOS
|
||||
#define PF_NS AF_NS
|
||||
#define PF_IPX AF_IPX
|
||||
#define PF_ISO AF_ISO
|
||||
#define PF_OSI AF_OSI
|
||||
#define PF_ECMA AF_ECMA
|
||||
#define PF_DATAKIT AF_DATAKIT
|
||||
#define PF_CCITT AF_CCITT
|
||||
#define PF_SNA AF_SNA
|
||||
#define PF_DECnet AF_DECnet
|
||||
#define PF_DLI AF_DLI
|
||||
#define PF_LAT AF_LAT
|
||||
#define PF_HYLINK AF_HYLINK
|
||||
#define PF_APPLETALK AF_APPLETALK
|
||||
#define PF_VOICEVIEW AF_VOICEVIEW
|
||||
#define PF_FIREFOX AF_FIREFOX
|
||||
#define PF_UNKNOWN1 AF_UNKNOWN1
|
||||
#define PF_BAN AF_BAN
|
||||
#define PF_ATM AF_ATM
|
||||
#define PF_INET6 AF_INET6
|
||||
#define PF_MAX AF_MAX
|
||||
#define SOL_SOCKET 0xffff
|
||||
#define SOMAXCONN 0x7fffffff /* (5) in WinSock1.1 */
|
||||
#ifndef __INSIDE_CYGWIN__
|
||||
#define MSG_OOB 1
|
||||
#define MSG_PEEK 2
|
||||
#define MSG_DONTROUTE 4
|
||||
#endif /* ndef __INSIDE_CYGWIN__ */
|
||||
#define MSG_MAXIOVLEN 16
|
||||
#define MSG_PARTIAL 0x8000
|
||||
#define MAXGETHOSTSTRUCT 1024
|
||||
|
||||
#define FD_READ_BIT 0
|
||||
#define FD_READ (1 << FD_READ_BIT)
|
||||
#define FD_WRITE_BIT 1
|
||||
#define FD_WRITE (1 << FD_WRITE_BIT)
|
||||
#define FD_OOB_BIT 2
|
||||
#define FD_OOB (1 << FD_OOB_BIT)
|
||||
#define FD_ACCEPT_BIT 3
|
||||
#define FD_ACCEPT (1 << FD_ACCEPT_BIT)
|
||||
#define FD_CONNECT_BIT 4
|
||||
#define FD_CONNECT (1 << FD_CONNECT_BIT)
|
||||
#define FD_CLOSE_BIT 5
|
||||
#define FD_CLOSE (1 << FD_CLOSE_BIT)
|
||||
/* winsock1.1 defines stop at FD_CLOSE (32) */
|
||||
#define FD_QOS_BIT 6
|
||||
#define FD_QOS (1 << FD_QOS_BIT)
|
||||
#define FD_GROUP_QOS_BIT 7
|
||||
#define FD_GROUP_QOS (1 << FD_GROUP_QOS_BIT)
|
||||
#define FD_ROUTING_INTERFACE_CHANGE_BIT 8
|
||||
#define FD_ROUTING_INTERFACE_CHANGE (1 << FD_ROUTING_INTERFACE_CHANGE_BIT)
|
||||
#define FD_ADDRESS_LIST_CHANGE_BIT 9
|
||||
#define FD_ADDRESS_LIST_CHANGE (1 << FD_ADDRESS_LIST_CHANGE_BIT)
|
||||
#define FD_MAX_EVENTS 10
|
||||
#define FD_ALL_EVENTS ((1 << FD_MAX_EVENTS) - 1)
|
||||
|
||||
#define WSABASEERR 10000
|
||||
#define WSAEINTR (WSABASEERR+4)
|
||||
#define WSAEBADF (WSABASEERR+9)
|
||||
#define WSAEACCES (WSABASEERR+13)
|
||||
#define WSAEFAULT (WSABASEERR+14)
|
||||
#define WSAEINVAL (WSABASEERR+22)
|
||||
#define WSAEMFILE (WSABASEERR+24)
|
||||
#define WSAEWOULDBLOCK (WSABASEERR+35)
|
||||
#define WSAEINPROGRESS (WSABASEERR+36) /* deprecated on WinSock2 */
|
||||
#define WSAEALREADY (WSABASEERR+37)
|
||||
#define WSAENOTSOCK (WSABASEERR+38)
|
||||
#define WSAEDESTADDRREQ (WSABASEERR+39)
|
||||
#define WSAEMSGSIZE (WSABASEERR+40)
|
||||
#define WSAEPROTOTYPE (WSABASEERR+41)
|
||||
#define WSAENOPROTOOPT (WSABASEERR+42)
|
||||
#define WSAEPROTONOSUPPORT (WSABASEERR+43)
|
||||
#define WSAESOCKTNOSUPPORT (WSABASEERR+44)
|
||||
#define WSAEOPNOTSUPP (WSABASEERR+45)
|
||||
#define WSAEPFNOSUPPORT (WSABASEERR+46)
|
||||
#define WSAEAFNOSUPPORT (WSABASEERR+47)
|
||||
#define WSAEADDRINUSE (WSABASEERR+48)
|
||||
#define WSAEADDRNOTAVAIL (WSABASEERR+49)
|
||||
#define WSAENETDOWN (WSABASEERR+50)
|
||||
#define WSAENETUNREACH (WSABASEERR+51)
|
||||
#define WSAENETRESET (WSABASEERR+52)
|
||||
#define WSAECONNABORTED (WSABASEERR+53)
|
||||
#define WSAECONNRESET (WSABASEERR+54)
|
||||
#define WSAENOBUFS (WSABASEERR+55)
|
||||
#define WSAEISCONN (WSABASEERR+56)
|
||||
#define WSAENOTCONN (WSABASEERR+57)
|
||||
#define WSAESHUTDOWN (WSABASEERR+58)
|
||||
#define WSAETOOMANYREFS (WSABASEERR+59)
|
||||
#define WSAETIMEDOUT (WSABASEERR+60)
|
||||
#define WSAECONNREFUSED (WSABASEERR+61)
|
||||
#define WSAELOOP (WSABASEERR+62)
|
||||
#define WSAENAMETOOLONG (WSABASEERR+63)
|
||||
#define WSAEHOSTDOWN (WSABASEERR+64)
|
||||
#define WSAEHOSTUNREACH (WSABASEERR+65)
|
||||
#define WSAENOTEMPTY (WSABASEERR+66)
|
||||
#define WSAEPROCLIM (WSABASEERR+67)
|
||||
#define WSAEUSERS (WSABASEERR+68)
|
||||
#define WSAEDQUOT (WSABASEERR+69)
|
||||
#define WSAESTALE (WSABASEERR+70)
|
||||
#define WSAEREMOTE (WSABASEERR+71)
|
||||
#define WSAEDISCON (WSABASEERR+101)
|
||||
#define WSASYSNOTREADY (WSABASEERR+91)
|
||||
#define WSAVERNOTSUPPORTED (WSABASEERR+92)
|
||||
#define WSANOTINITIALISED (WSABASEERR+93)
|
||||
#define WSAHOST_NOT_FOUND (WSABASEERR+1001)
|
||||
#define WSATRY_AGAIN (WSABASEERR+1002)
|
||||
#define WSANO_RECOVERY (WSABASEERR+1003)
|
||||
#define WSANO_DATA (WSABASEERR+1004)
|
||||
#define WSANO_ADDRESS WSANO_DATA
|
||||
#ifndef __INSIDE_CYGWIN__
|
||||
#define h_errno WSAGetLastError()
|
||||
#define HOST_NOT_FOUND WSAHOST_NOT_FOUND
|
||||
#define TRY_AGAIN WSATRY_AGAIN
|
||||
#define NO_RECOVERY WSANO_RECOVERY
|
||||
#define NO_DATA WSANO_DATA
|
||||
#define NO_ADDRESS WSANO_ADDRESS
|
||||
#endif
|
||||
SOCKET PASCAL accept(SOCKET,struct sockaddr*,int*);
|
||||
int PASCAL bind(SOCKET,const struct sockaddr*,int);
|
||||
int PASCAL closesocket(SOCKET);
|
||||
int PASCAL connect(SOCKET,const struct sockaddr*,int);
|
||||
int PASCAL ioctlsocket(SOCKET,long,u_long *);
|
||||
int PASCAL getpeername(SOCKET,struct sockaddr*,int*);
|
||||
int PASCAL getsockname(SOCKET,struct sockaddr*,int*);
|
||||
int PASCAL getsockopt(SOCKET,int,int,char*,int*);
|
||||
unsigned long PASCAL inet_addr(const char*);
|
||||
PASCAL char *inet_ntoa(struct in_addr);
|
||||
int PASCAL listen(SOCKET,int);
|
||||
int PASCAL recv(SOCKET,char*,int,int);
|
||||
int PASCAL recvfrom(SOCKET,char*,int,int,struct sockaddr*,int*);
|
||||
int PASCAL send(SOCKET,const char*,int,int);
|
||||
int PASCAL sendto(SOCKET,const char*,int,int,const struct sockaddr*,int);
|
||||
int PASCAL setsockopt(SOCKET,int,int,const char*,int);
|
||||
int PASCAL shutdown(SOCKET,int);
|
||||
SOCKET PASCAL socket(int,int,int);
|
||||
PASCAL struct hostent *gethostbyaddr(const char*,int,int);
|
||||
PASCAL struct hostent *gethostbyname(const char*);
|
||||
PASCAL struct servent *getservbyport(int,const char*);
|
||||
PASCAL struct servent *getservbyname(const char*,const char*);
|
||||
PASCAL struct protoent *getprotobynumber(int);
|
||||
PASCAL struct protoent *getprotobyname(const char*);
|
||||
int PASCAL WSAStartup(WORD,LPWSADATA);
|
||||
int PASCAL WSACleanup(void);
|
||||
void PASCAL WSASetLastError(int);
|
||||
int PASCAL WSAGetLastError(void);
|
||||
/*
|
||||
* Pesudo-blocking functions N/A in ws2_32.dll (use threads instead)
|
||||
*/
|
||||
#if 0
|
||||
BOOL PASCAL WSAIsBlocking(void);
|
||||
int PASCAL WSAUnhookBlockingHook(void);
|
||||
FARPROC PASCAL WSASetBlockingHook(FARPROC);
|
||||
int PASCAL WSACancelBlockingCall(void);
|
||||
#endif
|
||||
HANDLE PASCAL WSAAsyncGetServByName(HWND,u_int,const char*,const char*,char*,int);
|
||||
HANDLE PASCAL WSAAsyncGetServByPort(HWND,u_int,int,const char*,char*,int);
|
||||
HANDLE PASCAL WSAAsyncGetProtoByName(HWND,u_int,const char*,char*,int);
|
||||
HANDLE PASCAL WSAAsyncGetProtoByNumber(HWND,u_int,int,char*,int);
|
||||
HANDLE PASCAL WSAAsyncGetHostByName(HWND,u_int,const char*,char*,int);
|
||||
HANDLE PASCAL WSAAsyncGetHostByAddr(HWND,u_int,const char*,int,int,char*,int);
|
||||
int PASCAL WSACancelAsyncRequest(HANDLE);
|
||||
int PASCAL WSAAsyncSelect(SOCKET,HWND,u_int,long);
|
||||
#ifndef __INSIDE_CYGWIN__
|
||||
u_long PASCAL htonl(u_long);
|
||||
u_long PASCAL ntohl(u_long);
|
||||
u_short PASCAL htons(u_short);
|
||||
u_short PASCAL ntohs(u_short);
|
||||
int PASCAL select(int nfds,fd_set*,fd_set*,fd_set*,const struct timeval*);
|
||||
int PASCAL gethostname(char*,int);
|
||||
#endif /* ndef __INSIDE_CYGWIN__ */
|
||||
|
||||
#define WSAMAKEASYNCREPLY(b,e) MAKELONG(b,e)
|
||||
#define WSAMAKESELECTREPLY(e,error) MAKELONG(e,error)
|
||||
#define WSAGETASYNCBUFLEN(l) LOWORD(l)
|
||||
#define WSAGETASYNCERROR(l) HIWORD(l)
|
||||
#define WSAGETSELECTEVENT(l) LOWORD(l)
|
||||
#define WSAGETSELECTERROR(l) HIWORD(l)
|
||||
|
||||
typedef struct sockaddr SOCKADDR;
|
||||
typedef struct sockaddr *PSOCKADDR;
|
||||
typedef struct sockaddr *LPSOCKADDR;
|
||||
typedef struct sockaddr_in SOCKADDR_IN;
|
||||
typedef struct sockaddr_in *PSOCKADDR_IN;
|
||||
typedef struct sockaddr_in *LPSOCKADDR_IN;
|
||||
typedef struct linger LINGER;
|
||||
typedef struct linger *PLINGER;
|
||||
typedef struct linger *LPLINGER;
|
||||
typedef struct in_addr IN_ADDR;
|
||||
typedef struct in_addr *PIN_ADDR;
|
||||
typedef struct in_addr *LPIN_ADDR;
|
||||
typedef struct fd_set FD_SET;
|
||||
typedef struct fd_set *PFD_SET;
|
||||
typedef struct fd_set *LPFD_SET;
|
||||
typedef struct hostent HOSTENT;
|
||||
typedef struct hostent *PHOSTENT;
|
||||
typedef struct hostent *LPHOSTENT;
|
||||
typedef struct servent SERVENT;
|
||||
typedef struct servent *PSERVENT;
|
||||
typedef struct servent *LPSERVENT;
|
||||
typedef struct protoent PROTOENT;
|
||||
typedef struct protoent *PPROTOENT;
|
||||
typedef struct protoent *LPPROTOENT;
|
||||
typedef struct timeval TIMEVAL;
|
||||
typedef struct timeval *PTIMEVAL;
|
||||
typedef struct timeval *LPTIMEVAL;
|
||||
|
||||
/* winsock2 additions */
|
||||
#define ADDR_ANY INADDR_ANY
|
||||
|
||||
#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000)
|
||||
#define IN_CLASSD_NET 0xf0000000
|
||||
#define IN_CLASSD_NSHIFT 28
|
||||
#define IN_CLASSD_HOST 0x0fffffff
|
||||
#define IN_MULTICAST(i) IN_CLASSD(i)
|
||||
|
||||
#define FROM_PROTOCOL_INFO (-1)
|
||||
|
||||
#define SO_DONTLINGER (u_int)(~SO_LINGER)
|
||||
#define SO_GROUP_ID 0x2001
|
||||
#define SO_GROUP_PRIORITY 0x2002
|
||||
#define SO_MAX_MSG_SIZE 0x2003
|
||||
#define SO_PROTOCOL_INFOA 0x2004
|
||||
#define SO_PROTOCOL_INFOW 0x2005
|
||||
#ifdef UNICODE
|
||||
#define SO_PROTOCOL_INFO SO_PROTOCOL_INFOW
|
||||
#else
|
||||
#define SO_PROTOCOL_INFO SO_PROTOCOL_INFOA
|
||||
#endif
|
||||
#define PVD_CONFIG 0x3001
|
||||
|
||||
#define MSG_INTERRUPT 0x10
|
||||
#define MSG_MAXIOVLEN 16
|
||||
|
||||
/* WinSock2 specific error codes */
|
||||
#define WSAEDISCON (WSABASEERR+101)
|
||||
#define WSAENOMORE (WSABASEERR+102)
|
||||
#define WSAECANCELLED (WSABASEERR+103)
|
||||
@ -103,6 +568,36 @@ if (__i == ((fd_set *)(set))->fd_count) {\
|
||||
#define WSA_E_CANCELLED (WSABASEERR+111)
|
||||
#define WSAEREFUSED (WSABASEERR+112)
|
||||
|
||||
/* WS QualityofService errors */
|
||||
#define WSA_QOS_RECEIVERS (WSABASEERR + 1005)
|
||||
#define WSA_QOS_SENDERS (WSABASEERR + 1006)
|
||||
#define WSA_QOS_NO_SENDERS (WSABASEERR + 1007)
|
||||
#define WSA_QOS_NO_RECEIVERS (WSABASEERR + 1008)
|
||||
#define WSA_QOS_REQUEST_CONFIRMED (WSABASEERR + 1009)
|
||||
#define WSA_QOS_ADMISSION_FAILURE (WSABASEERR + 1010)
|
||||
#define WSA_QOS_POLICY_FAILURE (WSABASEERR + 1011)
|
||||
#define WSA_QOS_BAD_STYLE (WSABASEERR + 1012)
|
||||
#define WSA_QOS_BAD_OBJECT (WSABASEERR + 1013)
|
||||
#define WSA_QOS_TRAFFIC_CTRL_ERROR (WSABASEERR + 1014)
|
||||
#define WSA_QOS_GENERIC_ERROR (WSABASEERR + 1015)
|
||||
#define WSA_QOS_ESERVICETYPE (WSABASEERR + 1016)
|
||||
#define WSA_QOS_EFLOWSPEC (WSABASEERR + 1017)
|
||||
#define WSA_QOS_EPROVSPECBUF (WSABASEERR + 1018)
|
||||
#define WSA_QOS_EFILTERSTYLE (WSABASEERR + 1019)
|
||||
#define WSA_QOS_EFILTERTYPE (WSABASEERR + 1020)
|
||||
#define WSA_QOS_EFILTERCOUNT (WSABASEERR + 1021)
|
||||
#define WSA_QOS_EOBJLENGTH (WSABASEERR + 1022)
|
||||
#define WSA_QOS_EFLOWCOUNT (WSABASEERR + 1023)
|
||||
#define WSA_QOS_EUNKOWNPSOBJ (WSABASEERR + 1024)
|
||||
#define WSA_QOS_EPOLICYOBJ (WSABASEERR + 1025)
|
||||
#define WSA_QOS_EFLOWDESC (WSABASEERR + 1026)
|
||||
#define WSA_QOS_EPSFLOWSPEC (WSABASEERR + 1027)
|
||||
#define WSA_QOS_EPSFILTERSPEC (WSABASEERR + 1028)
|
||||
#define WSA_QOS_ESDMODEOBJ (WSABASEERR + 1029)
|
||||
#define WSA_QOS_ESHAPERATEOBJ (WSABASEERR + 1030)
|
||||
#define WSA_QOS_RESERVED_PETYPE (WSABASEERR + 1031)
|
||||
|
||||
|
||||
#define WSAAPI WINAPI
|
||||
#define WSAEVENT HANDLE
|
||||
#define LPWSAEVENT LPHANDLE
|
||||
@ -204,6 +699,12 @@ typedef struct _WSAVersion
|
||||
WSAECOMPARATOR ecHow;
|
||||
} WSAVERSION, *PWSAVERSION, *LPWSAVERSION;
|
||||
|
||||
/*
|
||||
* nspapi.h has definition of LPCSADDR_INFO, needed in WSAQuery
|
||||
* but itself needs LPSOCKADDR which is defined earlier in this file
|
||||
*/
|
||||
#include <nspapi.h>
|
||||
|
||||
typedef struct _WSAQuerySetA
|
||||
{
|
||||
DWORD dwSize;
|
||||
@ -456,6 +957,11 @@ typedef LPWSAPROTOCOL_INFOA LPWSAPROTOCOL_INFO;
|
||||
#define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
|
||||
#define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
|
||||
#define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
|
||||
#define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
|
||||
#define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
|
||||
#define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
|
||||
#define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
|
||||
#define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_WS2,24)
|
||||
#define TH_NETDEV 0x00000001
|
||||
#define TH_TAPI 0x00000002
|
||||
|
||||
|
138
winsup/w32api/include/ws2tcpip.h
Normal file
138
winsup/w32api/include/ws2tcpip.h
Normal file
@ -0,0 +1,138 @@
|
||||
/*
|
||||
* ws2tcpip.h : TCP/IP specific extensions in Windows Sockets 2
|
||||
*
|
||||
* Portions Copyright (c) 1980, 1983, 1988, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _WS2TCPIP_H
|
||||
#define _WS2TCPIP_H
|
||||
|
||||
#include <winsock2.h>
|
||||
|
||||
/*
|
||||
* The IP_* macros are also defined in winsock.h, but some values are different there.
|
||||
* The values defined in winsock.h for 1.1 and used in wsock32.dll are consistent
|
||||
* with the original values Steve Deering defined in his document "IP Multicast Extensions
|
||||
* for 4.3BSD UNIX related systems (MULTICAST 1.2 Release)." However, these conflicted with
|
||||
* the definitions for some IPPROTO_IP level socket options already assigned by BSD,
|
||||
* so Berkeley changed all the values by adding 7. WinSock2 (ws2_32.dll) uses
|
||||
* the BSD 4.4 compatible values defined here.
|
||||
*
|
||||
* See also: msdn kb article Q257460
|
||||
* http://support.microsoft.com/support/kb/articles/Q257/4/60.asp
|
||||
*/
|
||||
|
||||
/* This is also defined in winsock.h; value hasn't changed */
|
||||
#define IP_OPTIONS 1
|
||||
|
||||
#define IP_HDRINCL 2
|
||||
/*
|
||||
* These are also be defined in winsock.h,
|
||||
* but values have changed for WinSock2 interface
|
||||
*/
|
||||
#define IP_TOS 3 /* old (winsock 1.1) value 8 */
|
||||
#define IP_TTL 4 /* old value 7 */
|
||||
#define IP_MULTICAST_IF 9 /* old value 2 */
|
||||
#define IP_MULTICAST_TTL 10 /* old value 3 */
|
||||
#define IP_MULTICAST_LOOP 11 /* old value 4 */
|
||||
#define IP_ADD_MEMBERSHIP 12 /* old value 5 */
|
||||
#define IP_DROP_MEMBERSHIP 13 /* old value 6 */
|
||||
#define IP_DONTFRAGMENT 14 /* old value 9 */
|
||||
|
||||
#define IP_DEFAULT_MULTICAST_TTL 1
|
||||
#define IP_DEFAULT_MULTICAST_LOOP 1
|
||||
#define IP_MAX_MEMBERSHIPS 20
|
||||
|
||||
#define TCP_EXPEDITED_1122 2
|
||||
|
||||
#define UDP_NOCHECKSUM 1
|
||||
|
||||
#define IFF_UP 1
|
||||
#define IFF_BROADCAST 2
|
||||
#define IFF_LOOPBACK 4
|
||||
#define IFF_POINTTOPOINT 8
|
||||
#define IFF_MULTICAST 16
|
||||
|
||||
#define SIO_GET_INTERFACE_LIST _IOR('t', 127, u_long)
|
||||
|
||||
/*
|
||||
* ip_mreq also in winsock.h for WinSock1.1,
|
||||
* but online msdn docs say it is defined here for WinSock2.
|
||||
*/
|
||||
struct ip_mreq {
|
||||
struct in_addr imr_multiaddr;
|
||||
struct in_addr imr_interface;
|
||||
};
|
||||
|
||||
typedef struct _INTERFACE_INFO {
|
||||
u_long iiFlags;
|
||||
struct sockaddr iiAddress;
|
||||
struct sockaddr iiBroadcastAddress;
|
||||
struct sockaddr iiNetmask;
|
||||
} INTERFACE_INFO, *LPINTERFACE_INFO;
|
||||
|
||||
|
||||
/* ipv6 */
|
||||
|
||||
/*
|
||||
* According to online msdn documentation (12 Dec 2000), two separate implentations
|
||||
* of ipv6 are available (1) the Microsoft IPv6 Technology Preview (requires W2K SP1)
|
||||
* and (2) the MS Research IPV6 implementation (requires NT4 or W2K).
|
||||
* Neither are production level implementations.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* The following is based on what online msdn PSDK docs say as at 5 Dec 2000
|
||||
*/
|
||||
struct in_addr6 /* sic */ { u_char s6_addr[16]; };
|
||||
typedef struct in_addr6 IN6_ADDR, *PIN6_ADDR, *LPIN6_ADDR;
|
||||
|
||||
typedef struct sockaddr_in6 {
|
||||
short sin6_family;
|
||||
u_short sin6_port;
|
||||
u_long sin6_flowinfo;
|
||||
struct in_addr6 sin6_addr;
|
||||
} SOCKADDR_IN6, *PSOCKADDR_IN6, *LPSOCKADDR_IN6;
|
||||
|
||||
#elif 0
|
||||
/*
|
||||
* In the FAQ section of Microsoft IPv6 Technology Preview for Windows 2000
|
||||
* (dated 12 Dec 2000) it says that the Preview and the MS Research implemntation
|
||||
* support RFC 2553, and in particular, uses the sockaddr_in6 structure defined
|
||||
* in Section 3.3. That would look something like this:
|
||||
*/
|
||||
#include <stdint.h>
|
||||
struct in6_addr { /* this is the standard name */
|
||||
union {
|
||||
uint8_t _u6_addr8[16];
|
||||
uint16_t _u6_addr16[8];
|
||||
uint32_t _u6_addr32[4];
|
||||
/* uint64_t _u6_addr64[2];*/
|
||||
} _u6_addr;
|
||||
};
|
||||
typedef struct in6_addr IN6_ADDR, *PIN6_ADDR, *LPIN6_ADDR;
|
||||
#define s6_addr _u6_addr._u6_addr8
|
||||
|
||||
struct sockaddr_in6 {
|
||||
uint16_t sin6_family; /* AF_INET6 */
|
||||
uint16_t sin6_port; /* transport layer port # */
|
||||
uint32_t sin6_flowinfo; /* IPv6 traffic class & flow info */
|
||||
struct in6_addr sin6_addr; /* IPv6 address */
|
||||
uint32_t sin6_scope_id; /* set of interfaces for a scope */
|
||||
};
|
||||
typedef struct sockaddr_in6 SOCKADDR_IN6, *PSOCKADDR_IN6, *LPSOCKADDR_IN6;
|
||||
|
||||
/*
|
||||
* Watch this space.
|
||||
* These may get moved out to ipv6 specific header(s). along with other
|
||||
* standard structures and functions specified in RFC 2553.
|
||||
*/
|
||||
#endif
|
||||
|
||||
#endif /* _WS2TCPIP_H */
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user