| 1 | /* $Id: wsock32.cpp,v 1.1 1999-11-22 08:18:04 phaller Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | *
|
|---|
| 5 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 6 | *
|
|---|
| 7 | * Win32 SOCK32 for OS/2
|
|---|
| 8 | *
|
|---|
| 9 | * Copyright (C) 1999 Patrick Haller <phaller@gmx.net>
|
|---|
| 10 | *
|
|---|
| 11 | */
|
|---|
| 12 |
|
|---|
| 13 | /* Remark:
|
|---|
| 14 | * 1999/11/21 experimental rewrite using IBM's PMWSock only
|
|---|
| 15 | * -> some structural differences remain! (hostent)
|
|---|
| 16 | * -> this cannot work yet!
|
|---|
| 17 | */
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 | /*****************************************************************************
|
|---|
| 21 | * Includes *
|
|---|
| 22 | *****************************************************************************/
|
|---|
| 23 |
|
|---|
| 24 | #include <pmwsock.h>
|
|---|
| 25 | #include <odin.h>
|
|---|
| 26 | #include <odinwrap.h>
|
|---|
| 27 | #include <os2sel.h>
|
|---|
| 28 | #include <misc.h>
|
|---|
| 29 |
|
|---|
| 30 | #include <wsock32.h>
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 | ODINDEBUGCHANNEL(WSOCK32-WSOCK32)
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 | /*****************************************************************************
|
|---|
| 37 | * Local variables *
|
|---|
| 38 | *****************************************************************************/
|
|---|
| 39 |
|
|---|
| 40 | #define ERROR_SUCCESS 0
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 | #if 0
|
|---|
| 44 | static WSOCKTHREADDATA wstdFallthru; // for emergency only
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 | /*****************************************************************************
|
|---|
| 48 | * Name :
|
|---|
| 49 | * Purpose :
|
|---|
| 50 | * Parameters:
|
|---|
| 51 | * Variables :
|
|---|
| 52 | * Result :
|
|---|
| 53 | * Remark : free memory when thread dies
|
|---|
| 54 | * Status : UNTESTED STUB
|
|---|
| 55 | *
|
|---|
| 56 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
|---|
| 57 | *****************************************************************************/
|
|---|
| 58 |
|
|---|
| 59 | PWSOCKTHREADDATA iQueryWsockThreadData(void)
|
|---|
| 60 | {
|
|---|
| 61 | struct _THDB* pThreadDB = (struct _THDB*)GetThreadTHDB();
|
|---|
| 62 | PWSOCKTHREADDATA pwstd;
|
|---|
| 63 |
|
|---|
| 64 | // check for existing pointer
|
|---|
| 65 | if (pThreadDB != NULL)
|
|---|
| 66 | {
|
|---|
| 67 | if (pThreadDB->pWsockData == NULL)
|
|---|
| 68 | {
|
|---|
| 69 | // allocate on demand + initialize
|
|---|
| 70 | pwstd = (PWSOCKTHREADDATA)HEAP_malloc (sizeof(WSOCKTHREADDATA));
|
|---|
| 71 | pThreadDB->pWsockData = (LPVOID)pwstd;
|
|---|
| 72 | }
|
|---|
| 73 | else
|
|---|
| 74 | // use already allocated memory
|
|---|
| 75 | pwstd = (PWSOCKTHREADDATA)pThreadDB->pWsockData;
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 | if (pwstd == NULL)
|
|---|
| 79 | pwstd = &wstdFallthru; // no memory and not allocated already
|
|---|
| 80 |
|
|---|
| 81 | return pwstd;
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 | /*****************************************************************************
|
|---|
| 86 | * Name :
|
|---|
| 87 | * Purpose :
|
|---|
| 88 | * Parameters:
|
|---|
| 89 | * Variables :
|
|---|
| 90 | * Result :
|
|---|
| 91 | * Remark :
|
|---|
| 92 | * Status : UNTESTED STUB
|
|---|
| 93 | *
|
|---|
| 94 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
|---|
| 95 | *****************************************************************************/
|
|---|
| 96 |
|
|---|
| 97 | #define CASEERR2(a) case SOC##a: case a: return WSA##a;
|
|---|
| 98 | #define CASEERR1(a) case SOC##a: return WSA##a;
|
|---|
| 99 |
|
|---|
| 100 | int iTranslateSockErrToWSock(int iError)
|
|---|
| 101 | {
|
|---|
| 102 | switch(iError)
|
|---|
| 103 | {
|
|---|
| 104 | CASEERR2(EINTR)
|
|---|
| 105 | CASEERR2(EBADF)
|
|---|
| 106 | CASEERR2(EACCES)
|
|---|
| 107 | CASEERR2(EINVAL)
|
|---|
| 108 | CASEERR2(EMFILE)
|
|---|
| 109 |
|
|---|
| 110 | CASEERR1(EWOULDBLOCK)
|
|---|
| 111 | CASEERR1(EINPROGRESS)
|
|---|
| 112 | CASEERR1(EALREADY)
|
|---|
| 113 | CASEERR1(ENOTSOCK)
|
|---|
| 114 | // CASEERR1(EDESTADRREQ)
|
|---|
| 115 | CASEERR1(EMSGSIZE)
|
|---|
| 116 | CASEERR1(EPROTOTYPE)
|
|---|
| 117 | CASEERR1(ENOPROTOOPT)
|
|---|
| 118 | CASEERR1(EPROTONOSUPPORT)
|
|---|
| 119 | CASEERR1(ESOCKTNOSUPPORT)
|
|---|
| 120 | CASEERR1(EOPNOTSUPP)
|
|---|
| 121 | CASEERR1(EPFNOSUPPORT)
|
|---|
| 122 | CASEERR1(EAFNOSUPPORT)
|
|---|
| 123 | CASEERR1(EADDRINUSE)
|
|---|
| 124 | CASEERR1(EADDRNOTAVAIL)
|
|---|
| 125 | CASEERR1(ENETDOWN)
|
|---|
| 126 | CASEERR1(ENETUNREACH)
|
|---|
| 127 | CASEERR1(ENETRESET)
|
|---|
| 128 | CASEERR1(ECONNABORTED)
|
|---|
| 129 | CASEERR1(ECONNRESET)
|
|---|
| 130 | CASEERR1(ENOBUFS)
|
|---|
| 131 | CASEERR1(EISCONN)
|
|---|
| 132 | CASEERR1(ENOTCONN)
|
|---|
| 133 | CASEERR1(ESHUTDOWN)
|
|---|
| 134 | CASEERR1(ETOOMANYREFS)
|
|---|
| 135 | CASEERR1(ETIMEDOUT)
|
|---|
| 136 | CASEERR1(ECONNREFUSED)
|
|---|
| 137 | CASEERR1(ELOOP)
|
|---|
| 138 | CASEERR1(ENAMETOOLONG)
|
|---|
| 139 | CASEERR1(EHOSTDOWN)
|
|---|
| 140 | CASEERR1(EHOSTUNREACH)
|
|---|
| 141 |
|
|---|
| 142 | CASEERR1(ENOTEMPTY)
|
|---|
| 143 | // CASEERR(EPROCLIM)
|
|---|
| 144 | // CASEERR(EUSERS)
|
|---|
| 145 | // CASEERR(EDQUOT)
|
|---|
| 146 | // CASEERR(ESTALE)
|
|---|
| 147 | // CASEERR(EREMOTE)
|
|---|
| 148 | // CASEERR(EDISCON)
|
|---|
| 149 |
|
|---|
| 150 |
|
|---|
| 151 | default:
|
|---|
| 152 | dprintf(("WSOCK32: Unknown error condition: %d\n",
|
|---|
| 153 | iError));
|
|---|
| 154 | return iError;
|
|---|
| 155 | }
|
|---|
| 156 | }
|
|---|
| 157 |
|
|---|
| 158 | #endif
|
|---|
| 159 |
|
|---|
| 160 |
|
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 | ODINPROCEDURE1(OS2WSASetLastError,
|
|---|
| 168 | int,iError)
|
|---|
| 169 | {
|
|---|
| 170 | WSASetLastError(iError);
|
|---|
| 171 | }
|
|---|
| 172 |
|
|---|
| 173 |
|
|---|
| 174 | ODINFUNCTION0(int,OS2WSAGetLastError)
|
|---|
| 175 | {
|
|---|
| 176 | return WSAGetLastError();
|
|---|
| 177 | }
|
|---|
| 178 |
|
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 | ODINFUNCTION2(int,OS2__WSAFDIsSet,SOCKET, s,
|
|---|
| 183 | fd_set*,fds)
|
|---|
| 184 | {
|
|---|
| 185 | return (__WSAFDIsSet(s,fds));
|
|---|
| 186 | }
|
|---|
| 187 |
|
|---|
| 188 |
|
|---|
| 189 | ODINFUNCTION3(SOCKET,OS2accept, SOCKET, s,
|
|---|
| 190 | struct Wsockaddr *,addr,
|
|---|
| 191 | int *, addrlen)
|
|---|
| 192 | {
|
|---|
| 193 | //@@@PH translate Wsockaddr to sockaddr
|
|---|
| 194 | return(accept(s,addr,addrlen));
|
|---|
| 195 | }
|
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 | ODINFUNCTION3(int,OS2bind,
|
|---|
| 199 | SOCKET ,s,
|
|---|
| 200 | const struct Wsockaddr *,addr,
|
|---|
| 201 | int, namelen)
|
|---|
| 202 | {
|
|---|
| 203 | //@@@PH translate Wsockaddr to sockaddr
|
|---|
| 204 | return(bind(s,addr,namelen));
|
|---|
| 205 | }
|
|---|
| 206 |
|
|---|
| 207 |
|
|---|
| 208 | ODINFUNCTION1(int,OS2closesocket,SOCKET, s)
|
|---|
| 209 | {
|
|---|
| 210 | return(closesocket(s));
|
|---|
| 211 | }
|
|---|
| 212 |
|
|---|
| 213 |
|
|---|
| 214 | ODINFUNCTION3(int,OS2connect,
|
|---|
| 215 | SOCKET, s,
|
|---|
| 216 | const struct Wsockaddr *,name,
|
|---|
| 217 | int, namelen)
|
|---|
| 218 | {
|
|---|
| 219 | //@@@PH translate Wsockaddr to sockaddr
|
|---|
| 220 | return(connect(s,name,namelen));
|
|---|
| 221 | }
|
|---|
| 222 |
|
|---|
| 223 |
|
|---|
| 224 | ODINFUNCTION3(int,OS2ioctlsocket,
|
|---|
| 225 | SOCKET,s,
|
|---|
| 226 | long, cmd,
|
|---|
| 227 | u_long *,argp)
|
|---|
| 228 | {
|
|---|
| 229 | return(ioctlsocket(s,cmd,argp));
|
|---|
| 230 | }
|
|---|
| 231 |
|
|---|
| 232 |
|
|---|
| 233 | ODINFUNCTION3(int,OS2getpeername,
|
|---|
| 234 | SOCKET, s,
|
|---|
| 235 | struct Wsockaddr *,name,
|
|---|
| 236 | int *, namelen)
|
|---|
| 237 | {
|
|---|
| 238 | //@@@PH translate Wsockaddr to sockaddr
|
|---|
| 239 | return(getpeername(s,name,namelen));
|
|---|
| 240 | }
|
|---|
| 241 |
|
|---|
| 242 |
|
|---|
| 243 | ODINFUNCTION3(int,OS2getsockname,
|
|---|
| 244 | SOCKET,s,
|
|---|
| 245 | struct Wsockaddr *,name,
|
|---|
| 246 | int *, namelen)
|
|---|
| 247 | {
|
|---|
| 248 | //@@@PH translate Wsockaddr to sockaddr
|
|---|
| 249 | return(getsockname(s,name,namelen));
|
|---|
| 250 | }
|
|---|
| 251 |
|
|---|
| 252 |
|
|---|
| 253 | ODINFUNCTION5(int,OS2getsockopt,
|
|---|
| 254 | SOCKET, s,
|
|---|
| 255 | int, level,
|
|---|
| 256 | int, optname,
|
|---|
| 257 | char *, optval,
|
|---|
| 258 | int *,optlen)
|
|---|
| 259 | {
|
|---|
| 260 | return(getsockopt(s,
|
|---|
| 261 | level,
|
|---|
| 262 | optname,
|
|---|
| 263 | optval,
|
|---|
| 264 | optlen));
|
|---|
| 265 | }
|
|---|
| 266 |
|
|---|
| 267 |
|
|---|
| 268 | ODINFUNCTION1(u_long,OS2htonl,
|
|---|
| 269 | u_long,hostlong)
|
|---|
| 270 | {
|
|---|
| 271 | return(htonl(hostlong));
|
|---|
| 272 | }
|
|---|
| 273 |
|
|---|
| 274 |
|
|---|
| 275 | ODINFUNCTION1(u_short,OS2htons,
|
|---|
| 276 | u_short,hostshort)
|
|---|
| 277 | {
|
|---|
| 278 | return(htons(hostshort));
|
|---|
| 279 | }
|
|---|
| 280 |
|
|---|
| 281 |
|
|---|
| 282 | ODINFUNCTION1(unsigned long,OS2inet_addr,
|
|---|
| 283 | const char *, cp)
|
|---|
| 284 | {
|
|---|
| 285 | dprintf(("WSOCK32: OS2inet_addr(%s)\n",
|
|---|
| 286 | cp));
|
|---|
| 287 |
|
|---|
| 288 | return (inet_addr(cp));
|
|---|
| 289 | }
|
|---|
| 290 |
|
|---|
| 291 |
|
|---|
| 292 | ODINFUNCTION1(char *,OS2inet_ntoa,
|
|---|
| 293 | struct in_addr, in)
|
|---|
| 294 | {
|
|---|
| 295 | return(inet_ntoa(in));
|
|---|
| 296 | }
|
|---|
| 297 |
|
|---|
| 298 |
|
|---|
| 299 | ODINFUNCTION2(int,OS2listen,
|
|---|
| 300 | SOCKET, s,
|
|---|
| 301 | int, backlog)
|
|---|
| 302 | {
|
|---|
| 303 | return(listen(s,backlog));
|
|---|
| 304 | }
|
|---|
| 305 |
|
|---|
| 306 |
|
|---|
| 307 | ODINFUNCTION1(u_long,OS2ntohl,
|
|---|
| 308 | u_long,netlong)
|
|---|
| 309 | {
|
|---|
| 310 | return(ntohl(netlong));
|
|---|
| 311 | }
|
|---|
| 312 |
|
|---|
| 313 |
|
|---|
| 314 | ODINFUNCTION1(u_short,OS2ntohs,
|
|---|
| 315 | u_short,netshort)
|
|---|
| 316 | {
|
|---|
| 317 | return(ntohs(netshort));
|
|---|
| 318 | }
|
|---|
| 319 |
|
|---|
| 320 |
|
|---|
| 321 | ODINFUNCTION4(int,OS2recv,
|
|---|
| 322 | SOCKET,s,
|
|---|
| 323 | char *,buf,
|
|---|
| 324 | int,len,
|
|---|
| 325 | int,flags)
|
|---|
| 326 | {
|
|---|
| 327 | return(recv(s,
|
|---|
| 328 | buf,
|
|---|
| 329 | len,
|
|---|
| 330 | flags));
|
|---|
| 331 | }
|
|---|
| 332 |
|
|---|
| 333 |
|
|---|
| 334 | ODINFUNCTION6(int,OS2recvfrom,
|
|---|
| 335 | SOCKET,s,
|
|---|
| 336 | char *,buf,
|
|---|
| 337 | int,len,
|
|---|
| 338 | int,flags,
|
|---|
| 339 | struct sockaddr *,from,
|
|---|
| 340 | int *,fromlen)
|
|---|
| 341 | {
|
|---|
| 342 | return(recvfrom(s,
|
|---|
| 343 | buf,
|
|---|
| 344 | len,
|
|---|
| 345 | flags,
|
|---|
| 346 | from,
|
|---|
| 347 | fromlen));
|
|---|
| 348 | }
|
|---|
| 349 |
|
|---|
| 350 |
|
|---|
| 351 | ODINFUNCTION5(int,OS2select,
|
|---|
| 352 | int,nfds,
|
|---|
| 353 | fd_set *,readfds,
|
|---|
| 354 | fd_set *,writefds,
|
|---|
| 355 | fd_set *,exceptfds,
|
|---|
| 356 | const struct timeval *,timeout)
|
|---|
| 357 | {
|
|---|
| 358 | return(select(nfds,
|
|---|
| 359 | readfds,
|
|---|
| 360 | writefds,
|
|---|
| 361 | exceptfds,
|
|---|
| 362 | timeout));
|
|---|
| 363 | }
|
|---|
| 364 |
|
|---|
| 365 |
|
|---|
| 366 | ODINFUNCTION4(int,OS2send,
|
|---|
| 367 | SOCKET,s,
|
|---|
| 368 | const char *,buf,
|
|---|
| 369 | int,len,
|
|---|
| 370 | int,flags)
|
|---|
| 371 | {
|
|---|
| 372 | return(send(s,
|
|---|
| 373 | buf,
|
|---|
| 374 | len,
|
|---|
| 375 | flags));
|
|---|
| 376 | }
|
|---|
| 377 |
|
|---|
| 378 |
|
|---|
| 379 | ODINFUNCTION6(int,OS2sendto,
|
|---|
| 380 | SOCKET,s,
|
|---|
| 381 | const char *,buf,
|
|---|
| 382 | int,len,
|
|---|
| 383 | int,flags,
|
|---|
| 384 | const struct sockaddr *,to,
|
|---|
| 385 | int,tolen)
|
|---|
| 386 | {
|
|---|
| 387 | return(sendto(s,
|
|---|
| 388 | buf,
|
|---|
| 389 | len,
|
|---|
| 390 | flags,
|
|---|
| 391 | to,
|
|---|
| 392 | tolen));
|
|---|
| 393 | }
|
|---|
| 394 |
|
|---|
| 395 |
|
|---|
| 396 | ODINFUNCTION5(int,OS2setsockopt,
|
|---|
| 397 | SOCKET,s,
|
|---|
| 398 | int,level,
|
|---|
| 399 | int,optname,
|
|---|
| 400 | const char *,optval,
|
|---|
| 401 | int,optlen)
|
|---|
| 402 | {
|
|---|
| 403 | struct Wlinger *yy;
|
|---|
| 404 | struct linger xx;
|
|---|
| 405 | int rc;
|
|---|
| 406 |
|
|---|
| 407 | if(level == SOL_SOCKET &&
|
|---|
| 408 | optname == SO_LINGER)
|
|---|
| 409 | {
|
|---|
| 410 | yy = (struct Wlinger *)optval;
|
|---|
| 411 | xx.l_onoff = (int)yy->l_onoff;
|
|---|
| 412 | xx.l_linger = (int)yy->l_linger;
|
|---|
| 413 |
|
|---|
| 414 | rc = setsockopt(s,level,optname,(char *)&xx,optlen);
|
|---|
| 415 | }
|
|---|
| 416 | else
|
|---|
| 417 | rc = setsockopt(s,level,optname,(char *)optval,optlen);
|
|---|
| 418 |
|
|---|
| 419 | if (rc == SOCKET_ERROR)
|
|---|
| 420 | //OS2WSASetLastError(iTranslateSockErrToWSock(sock_errno()));
|
|---|
| 421 | OS2WSASetLastError(WSAEINVAL);
|
|---|
| 422 | else
|
|---|
| 423 | OS2WSASetLastError(ERROR_SUCCESS);
|
|---|
| 424 |
|
|---|
| 425 | return rc;
|
|---|
| 426 | }
|
|---|
| 427 |
|
|---|
| 428 |
|
|---|
| 429 | ODINFUNCTION2(int,OS2shutdown,
|
|---|
| 430 | SOCKET,s,
|
|---|
| 431 | int,how)
|
|---|
| 432 | {
|
|---|
| 433 | return(shutdown(s,
|
|---|
| 434 | how));
|
|---|
| 435 | }
|
|---|
| 436 |
|
|---|
| 437 |
|
|---|
| 438 | ODINFUNCTION3(SOCKET,OS2socket,
|
|---|
| 439 | int,af,
|
|---|
| 440 | int,type,
|
|---|
| 441 | int,protocol)
|
|---|
| 442 | {
|
|---|
| 443 | return(socket(af,
|
|---|
| 444 | type,
|
|---|
| 445 | protocol));
|
|---|
| 446 | }
|
|---|
| 447 |
|
|---|
| 448 |
|
|---|
| 449 | /* Database function prototypes */
|
|---|
| 450 | ODINFUNCTION3(struct Whostent *,OS2gethostbyaddr,
|
|---|
| 451 | const char *,addr,
|
|---|
| 452 | int,len,
|
|---|
| 453 | int,type)
|
|---|
| 454 | {
|
|---|
| 455 | return(gethostbyaddr(addr,
|
|---|
| 456 | len,
|
|---|
| 457 | type));
|
|---|
| 458 | }
|
|---|
| 459 |
|
|---|
| 460 |
|
|---|
| 461 | ODINFUNCTION1(struct Whostent *,OS2gethostbyname,
|
|---|
| 462 | const char *,name)
|
|---|
| 463 | {
|
|---|
| 464 | return(gethostbyname(name));
|
|---|
| 465 | }
|
|---|
| 466 |
|
|---|
| 467 |
|
|---|
| 468 | ODINFUNCTION2(int,OS2gethostname,
|
|---|
| 469 | char *,name,
|
|---|
| 470 | int,namelen)
|
|---|
| 471 | {
|
|---|
| 472 | return(gethostname(name,
|
|---|
| 473 | namelen));
|
|---|
| 474 | }
|
|---|
| 475 |
|
|---|
| 476 |
|
|---|
| 477 | ODINFUNCTION2(struct Wservent *,OS2getservbyport,
|
|---|
| 478 | int,port,
|
|---|
| 479 | const char *, proto)
|
|---|
| 480 | {
|
|---|
| 481 | return(getservbyport(port,
|
|---|
| 482 | proto));
|
|---|
| 483 | }
|
|---|
| 484 |
|
|---|
| 485 |
|
|---|
| 486 | ODINFUNCTION2(struct Wservent *,OS2getservbyname,
|
|---|
| 487 | const char *,name,
|
|---|
| 488 | const char *,proto)
|
|---|
| 489 | {
|
|---|
| 490 | return(getservbyname(name,
|
|---|
| 491 | proto));
|
|---|
| 492 | }
|
|---|
| 493 |
|
|---|
| 494 |
|
|---|
| 495 | ODINFUNCTION1(struct Wprotoent *,OS2getprotobynumber,
|
|---|
| 496 | int,proto)
|
|---|
| 497 | {
|
|---|
| 498 | return(getprotobynumber(proto));
|
|---|
| 499 | }
|
|---|
| 500 |
|
|---|
| 501 |
|
|---|
| 502 | ODINFUNCTION1(struct protoent *,OS2getprotobyname,
|
|---|
| 503 | const char *,name)
|
|---|
| 504 | {
|
|---|
| 505 | return(getprotobyname(name));
|
|---|
| 506 | }
|
|---|
| 507 |
|
|---|
| 508 |
|
|---|
| 509 |
|
|---|
| 510 | /* Microsoft Windows Extension function prototypes */
|
|---|
| 511 | ODINFUNCTION2(int,OS2WSAStartup,
|
|---|
| 512 | USHORT,wVersionRequired,
|
|---|
| 513 | LPWSADATA,lpWSAData)
|
|---|
| 514 | {
|
|---|
| 515 | return(WSAStartup(wVersionRequired,
|
|---|
| 516 | lpWSAData));
|
|---|
| 517 | }
|
|---|
| 518 |
|
|---|
| 519 |
|
|---|
| 520 | ODINFUNCTION0(int,OS2WSACleanup)
|
|---|
| 521 | {
|
|---|
| 522 | return(WSACleanup());
|
|---|
| 523 | }
|
|---|
| 524 |
|
|---|
| 525 |
|
|---|
| 526 | ODINFUNCTION0(BOOL,OS2WSAIsBlocking)
|
|---|
| 527 | {
|
|---|
| 528 | return WSAIsBlocking();
|
|---|
| 529 | }
|
|---|
| 530 |
|
|---|
| 531 |
|
|---|
| 532 | ODINFUNCTION0(int,OS2WSAUnhookBlockingHook)
|
|---|
| 533 | {
|
|---|
| 534 | return WSAUnhookBlockingHook();
|
|---|
| 535 | }
|
|---|
| 536 |
|
|---|
| 537 |
|
|---|
| 538 | ODINFUNCTION1(PFN,OS2WSASetBlockingHook,
|
|---|
| 539 | PFN,lpBlockFunc)
|
|---|
| 540 | {
|
|---|
| 541 | return(WSASetBlockingHook(lpBlockFunc));
|
|---|
| 542 | }
|
|---|
| 543 |
|
|---|
| 544 |
|
|---|
| 545 | ODINFUNCTION0(int,OS2WSACancelBlockingCall)
|
|---|
| 546 | {
|
|---|
| 547 | return(WSACancelBlockingCall());
|
|---|
| 548 | }
|
|---|
| 549 |
|
|---|
| 550 |
|
|---|
| 551 | ODINFUNCTION6(LHANDLE,OS2WSAAsyncGetServByName,
|
|---|
| 552 | HWND,hWnd,
|
|---|
| 553 | u_int,wMsg,
|
|---|
| 554 | const char *,name,
|
|---|
| 555 | const char *,proto,
|
|---|
| 556 | char *,buf,
|
|---|
| 557 | int,buflen)
|
|---|
| 558 | {
|
|---|
| 559 | return(WSAAsyncGetServByName(hWnd,
|
|---|
| 560 | wMsg,
|
|---|
| 561 | name,
|
|---|
| 562 | proto,
|
|---|
| 563 | buf,
|
|---|
| 564 | buflen));
|
|---|
| 565 | }
|
|---|
| 566 |
|
|---|
| 567 |
|
|---|
| 568 | ODINFUNCTION6(LHANDLE,OS2WSAAsyncGetServByPort,
|
|---|
| 569 | HWND,hWnd,
|
|---|
| 570 | u_int,wMsg,
|
|---|
| 571 | int,port,
|
|---|
| 572 | const char *,proto,
|
|---|
| 573 | char *,buf,
|
|---|
| 574 | int,buflen)
|
|---|
| 575 | {
|
|---|
| 576 | return(WSAAsyncGetServByPort(hWnd,
|
|---|
| 577 | wMsg,
|
|---|
| 578 | port,
|
|---|
| 579 | proto,
|
|---|
| 580 | buf,
|
|---|
| 581 | buflen));
|
|---|
| 582 | }
|
|---|
| 583 |
|
|---|
| 584 |
|
|---|
| 585 | ODINFUNCTION5(LHANDLE,OS2WSAAsyncGetProtoByName,
|
|---|
| 586 | HWND,hWnd,
|
|---|
| 587 | u_int,wMsg,
|
|---|
| 588 | const char *,name,
|
|---|
| 589 | char *,buf,
|
|---|
| 590 | int,buflen)
|
|---|
| 591 | {
|
|---|
| 592 | return(WSAAsyncGetProtoByName(hWnd,
|
|---|
| 593 | wMsg,
|
|---|
| 594 | name,
|
|---|
| 595 | buf,
|
|---|
| 596 | buflen));
|
|---|
| 597 | }
|
|---|
| 598 |
|
|---|
| 599 |
|
|---|
| 600 | ODINFUNCTION5(LHANDLE,OS2WSAAsyncGetProtoByNumber,
|
|---|
| 601 | HWND,hWnd,
|
|---|
| 602 | u_int,wMsg,
|
|---|
| 603 | int,number,
|
|---|
| 604 | char *,buf,
|
|---|
| 605 | int,buflen)
|
|---|
| 606 | {
|
|---|
| 607 | return(WSAAsyncGetProtoByNumber(hWnd,
|
|---|
| 608 | wMsg,
|
|---|
| 609 | number,
|
|---|
| 610 | buf,
|
|---|
| 611 | buflen));
|
|---|
| 612 | }
|
|---|
| 613 |
|
|---|
| 614 |
|
|---|
| 615 | ODINFUNCTION5(LHANDLE,OS2WSAAsyncGetHostByName,
|
|---|
| 616 | HWND,hWnd,
|
|---|
| 617 | u_int,wMsg,
|
|---|
| 618 | const char *,name,
|
|---|
| 619 | char *,buf,
|
|---|
| 620 | int,buflen)
|
|---|
| 621 | {
|
|---|
| 622 | return(WSAAsyncGetHostByName(hWnd,
|
|---|
| 623 | wMsg,
|
|---|
| 624 | name,
|
|---|
| 625 | buf,
|
|---|
| 626 | buflen));
|
|---|
| 627 | }
|
|---|
| 628 |
|
|---|
| 629 |
|
|---|
| 630 | ODINFUNCTION7(LHANDLE,OS2WSAAsyncGetHostByAddr,
|
|---|
| 631 | HWND,hWnd,
|
|---|
| 632 | u_int,wMsg,
|
|---|
| 633 | const char *,addr,
|
|---|
| 634 | int,len,
|
|---|
| 635 | int,type,
|
|---|
| 636 | char *,buf,
|
|---|
| 637 | int,buflen)
|
|---|
| 638 | {
|
|---|
| 639 | return(WSAAsyncGetHostByAddr(hWnd,
|
|---|
| 640 | wMsg,
|
|---|
| 641 | addr,
|
|---|
| 642 | len,
|
|---|
| 643 | type,
|
|---|
| 644 | buf,
|
|---|
| 645 | buflen));
|
|---|
| 646 | }
|
|---|
| 647 |
|
|---|
| 648 |
|
|---|
| 649 | ODINFUNCTION1(int,OS2WSACancelAsyncRequest,
|
|---|
| 650 | LHANDLE,hAsyncTaskHandle)
|
|---|
| 651 | {
|
|---|
| 652 | return(WSACancelAsyncRequest(hAsyncTaskHandle));
|
|---|
| 653 | }
|
|---|
| 654 |
|
|---|
| 655 |
|
|---|
| 656 | ODINFUNCTION4(int,OS2WSAAsyncSelect,
|
|---|
| 657 | SOCKET,s,
|
|---|
| 658 | HWND,hWnd,
|
|---|
| 659 | u_int,wMsg,
|
|---|
| 660 | long,lEvent)
|
|---|
| 661 | {
|
|---|
| 662 | return (WSAAsyncSelect(s,
|
|---|
| 663 | hWnd,
|
|---|
| 664 | wMsg,
|
|---|
| 665 | lEvent));
|
|---|
| 666 | }
|
|---|