Changeset 3229 for trunk/src/wsock32/wsock32.h
- Timestamp:
- Mar 24, 2000, 8:28:12 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wsock32/wsock32.h
r3200 r3229 1 / / $Id: wsock32.h,v 1.13 2000-03-22 20:11:04 sandervl Exp $1 /* $Id: wsock32.h,v 1.14 2000-03-24 19:28:11 sandervl Exp $ */ 2 2 3 3 /* WSOCK32.H--definitions & conversions for Odin's wsock32.dll. … … 16 16 #define _WINSOCK32CONST_ 17 17 18 #define TCPV40HDRS 19 #include <sys\socket.h> 20 #include <sys\ioctl.h> 21 #include <netdb.h> 22 #include <netinet\in.h> 23 #include <netinet\tcp.h> 24 #include <nerrno.h> 25 #include <sys\time.h> 26 27 #include <odinwrap.h> 28 29 /* 30 * Socket state bits. 31 */ 32 #define SS_NOFDREF 0x0001 /* no file table ref any more */ 33 #define SS_ISCONNECTED 0x0002 /* socket connected to a peer */ 34 #define SS_ISCONNECTING 0x0004 /* in process of connecting to peer */ 35 #define SS_ISDISCONNECTING 0x0008 /* in process of disconnecting */ 36 #define SS_CANTSENDMORE 0x0010 /* can't send more data to peer */ 37 #define SS_CANTRCVMORE 0x0020 /* can't receive more data from peer */ 38 #define SS_RCVATMARK 0x0040 /* at mark on input */ 39 40 #define SS_NBIO 0x0100 /* non-blocking ops */ 41 #define SS_ASYNC 0x0200 /* async i/o notify */ 42 #define SS_ISCONFIRMING 0x0400 /* deciding to accept connection req */ 43 44 #define SS_INCOMP 0x0800 /* unaccepted, incomplete connection */ 45 #define SS_COMP 0x1000 /* unaccepted, complete connection */ 46 #define SS_ISDISCONNECTED 0x2000 /* socket disconnected from peer */ 47 48 //socketopt options 49 #define SO_DONTLINGER (u_int)(~SO_LINGER) 50 51 #define WSAMAKESELECTREPLY(event,error) MAKELONG(event,error) 52 53 // WSAAsyncSelect flags 54 #define FD_READ 0x01 55 #define FD_WRITE 0x02 56 #define FD_OOB 0x04 57 #define FD_ACCEPT 0x08 58 #define FD_CONNECT 0x10 59 #define FD_CLOSE 0x20 60 61 #define SOCKET_ERROR -1 62 #define NO_ERROR 0 63 64 #define WSABASEERR 10000 65 66 #define WSAEINTR (WSABASEERR+4) 67 #define WSAEBADF (WSABASEERR+9) 68 #define WSAEACCES (WSABASEERR+13) 69 #define WSAEFAULT (WSABASEERR+14) 70 #define WSAEINVAL (WSABASEERR+22) 71 #define WSAEMFILE (WSABASEERR+24) 72 73 #define WSAEWOULDBLOCK (WSABASEERR+35) 74 #define WSAEINPROGRESS (WSABASEERR+36) 75 #define WSAEALREADY (WSABASEERR+37) 76 #define WSAENOTSOCK (WSABASEERR+38) 77 #define WSAEDESTADDRREQ (WSABASEERR+39) 78 #define WSAEMSGSIZE (WSABASEERR+40) 79 #define WSAEPROTOTYPE (WSABASEERR+41) 80 #define WSAENOPROTOOPT (WSABASEERR+42) 81 #define WSAEPROTONOSUPPORT (WSABASEERR+43) 82 #define WSAESOCKTNOSUPPORT (WSABASEERR+44) 83 #define WSAEOPNOTSUPP (WSABASEERR+45) 84 #define WSAEPFNOSUPPORT (WSABASEERR+46) 85 #define WSAEAFNOSUPPORT (WSABASEERR+47) 86 #define WSAEADDRINUSE (WSABASEERR+48) 87 #define WSAEADDRNOTAVAIL (WSABASEERR+49) 88 #define WSAENETDOWN (WSABASEERR+50) 89 #define WSAENETUNREACH (WSABASEERR+51) 90 #define WSAENETRESET (WSABASEERR+52) 91 #define WSAECONNABORTED (WSABASEERR+53) 92 #define WSAECONNRESET (WSABASEERR+54) 93 #define WSAENOBUFS (WSABASEERR+55) 94 #define WSAEISCONN (WSABASEERR+56) 95 #define WSAENOTCONN (WSABASEERR+57) 96 #define WSAESHUTDOWN (WSABASEERR+58) 97 #define WSAETOOMANYREFS (WSABASEERR+59) 98 #define WSAETIMEDOUT (WSABASEERR+60) 99 #define WSAECONNREFUSED (WSABASEERR+61) 100 #define WSAELOOP (WSABASEERR+62) 101 #define WSAENAMETOOLONG (WSABASEERR+63) 102 #define WSAEHOSTDOWN (WSABASEERR+64) 103 #define WSAEHOSTUNREACH (WSABASEERR+65) 104 #define WSAENOTEMPTY (WSABASEERR+66) 105 #define WSAEPROCLIM (WSABASEERR+67) 106 #define WSAEUSERS (WSABASEERR+68) 107 #define WSAEDQUOT (WSABASEERR+69) 108 #define WSAESTALE (WSABASEERR+70) 109 #define WSAEREMOTE (WSABASEERR+71) 110 #define WSASYSNOTREADY (WSABASEERR+91) 111 #define WSAVERNOTSUPPORTED (WSABASEERR+92) 112 #define WSANOTINITIALISED (WSABASEERR+93) 113 #define WSAHOST_NOT_FOUND (WSABASEERR+1001) 114 #define WSATRY_AGAIN (WSABASEERR+1002) 115 #define WSANO_RECOVERY (WSABASEERR+1003) 116 #define WSANO_DATA (WSABASEERR+1004) 117 #define WSANO_ADDRESS WSANO_DATA 118 119 typedef u_int SOCKET; 120 121 #define FD_SETSIZE 64 122 123 #pragma pack(1) 124 125 #define WSADESCRIPTION_LEN 256 126 #define WSASYS_STATUS_LEN 128 127 128 typedef struct WSAData { 129 USHORT wVersion; 130 USHORT wHighVersion; 131 char szDescription[WSADESCRIPTION_LEN+1]; 132 char szSystemStatus[WSASYS_STATUS_LEN+1]; 133 unsigned short iMaxSockets; 134 unsigned short iMaxUdpDg; 135 char * lpVendorInfo; 136 } WSADATA; 137 typedef WSADATA *PWSADATA; 138 typedef WSADATA *LPWSADATA; 139 140 typedef struct ws_fd_set { 141 u_int fd_count; 142 SOCKET fd_array[FD_SETSIZE]; 143 } _ws_fd_set; 18 144 19 145 /* 20 146 * Structure used for manipulating linger option. 21 147 */ 22 struct Wlinger {148 typedef struct ws_linger { 23 149 u_short l_onoff; /* option on/off */ 24 150 u_short l_linger; /* linger time */ 25 }; 26 151 } _ws_linger; 27 152 28 153 /* … … 32 157 */ 33 158 34 struct Whostent { 35 char * h_name; /* official name of host */ 36 char * * h_aliases; /* alias list */ 37 short h_addrtype; /* host address type */ 38 short h_length; /* length of address */ 39 char * * h_addr_list; /* list of addresses */ 40 #define h_addr h_addr_list[0] /* address, for backward compat */ 41 }; 42 43 /* 44 * It is assumed here that a network number 45 * fits in 32 bits. 46 */ 47 struct Wnetent { 48 char * n_name; /* official name of net */ 49 char * * n_aliases; /* alias list */ 50 short n_addrtype; /* net address type */ 51 u_long n_net; /* network # */ 52 }; 53 typedef struct Whostent WHOSTENT; 54 typedef WHOSTENT *PWHOSTENT; 55 56 struct Wservent { 57 char * s_name; /* official service name */ 58 char * * s_aliases; /* alias list */ 59 short s_port; /* port # */ 60 char * s_proto; /* protocol to use */ 61 }; 62 typedef struct Wservent WSERVENT; 63 typedef WSERVENT *PWSERVENT; 64 65 struct Wprotoent { 66 char * p_name; /* official protocol name */ 67 char * * p_aliases; /* alias list */ 68 short p_proto; /* protocol # */ 69 }; 70 typedef struct Wprotoent WPROTOENT; 71 typedef WPROTOENT *PWPROTOENT; 72 73 typedef struct tagWsockThreadData 74 { 75 int dwLastError; // Get/SetLastError 76 struct Whostent whsnt; // database conversion buffers 77 struct Wservent wsvnt; 78 struct Wprotoent wptnt; 79 struct Wnetent wntnt; 80 struct Wlinger wlinger; 81 } WSOCKTHREADDATA, *PWSOCKTHREADDATA; 82 83 // internal prototype 84 PWSOCKTHREADDATA iQueryWsockThreadData(void); 85 159 typedef struct ws_hostent 160 { 161 char * h_name; /* official name of host */ 162 char ** h_aliases; /* alias list */ 163 INT16 h_addrtype; /* host address type */ 164 INT16 h_length; /* length of address */ 165 char ** h_addr_list; /* list of addresses from name server */ 166 } _ws_hostent; 167 168 typedef struct ws_protoent 169 { 170 char * p_name; /* official protocol name */ 171 char ** p_aliases; /* alias list */ 172 INT16 p_proto; /* protocol # */ 173 } _ws_protoent; 174 175 typedef struct ws_servent 176 { 177 char * s_name; /* official service name */ 178 char ** s_aliases; /* alias list */ 179 INT16 s_port; /* port # */ 180 char * s_proto; /* protocol to use */ 181 } _ws_servent; 182 183 typedef struct ws_netent 184 { 185 char * n_name; /* official name of net */ 186 char ** n_aliases; /* alias list */ 187 INT16 n_addrtype; /* net address type */ 188 INT n_net; /* network # */ 189 } _ws_netent; 190 191 #pragma pack() 192 193 #define WS_MAX_SOCKETS_PER_PROCESS 128 /* reasonable guess */ 194 #define WS_MAX_UDP_DATAGRAM 1024 195 196 #define WSI_BLOCKINGCALL 0x00000001 /* per-thread info flags */ 197 #define WSI_BLOCKINGHOOK 0x00000002 /* 32-bit callback */ 198 199 typedef struct _WSINFO 200 { 201 DWORD dwThisThread; 202 struct _WSINFO *lpNextIData; 203 204 unsigned flags; 205 INT16 num_startup; /* reference counter */ 206 INT16 num_async_rq; 207 INT16 last_free; /* entry in the socket table */ 208 USHORT buflen; 209 char* buffer; /* allocated from char * heap */ 210 struct ws_hostent *he; 211 int helen; 212 struct ws_servent *se; 213 int selen; 214 struct ws_protoent *pe; 215 int pelen; 216 char* dbuffer; /* buffer for dummies (32 bytes) */ 217 218 DWORD blocking_hook; 219 } WSINFO, *LPWSINFO; 220 221 void WIN32API WSASetLastError(int iError); 222 int WIN32API WSAGetLastError(void); 223 int WIN32API WSAAsyncSelect(SOCKET s, HWND hWnd, u_int wMsg, long lEvent); 224 BOOL WIN32API WSAIsBlocking(void); 86 225 87 226 extern BOOL fWSAInitialized; 88 227 89 void WIN32API OS2WSASetLastError(int iError); 90 91 int WIN32API OS2WSAGetLastError(void); 92 93 BOOL WIN32API OS2WSAIsBlocking(void); 228 UINT wsaErrno(); 229 UINT wsaHerrno(); 230 231 #define CURRENT_THREAD -1 232 void WSASetBlocking(BOOL fBlock, HANDLE tid = CURRENT_THREAD); 233 234 void WINSOCK_DeleteIData(void); 235 BOOL WINSOCK_CreateIData(void); 236 LPWSINFO WINSOCK_GetIData(HANDLE tid = CURRENT_THREAD); 94 237 95 238 #endif /* _WINSOCK32CONST_ */
Note:
See TracChangeset
for help on using the changeset viewer.