Changeset 1372 for trunk/src/wsock32/wsock32.cpp
- Timestamp:
- Oct 20, 1999, 12:03:55 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wsock32/wsock32.cpp
r1367 r1372 1 /* $Id: wsock32.cpp,v 1. 5 1999-10-20 01:18:31phaller Exp $ */1 /* $Id: wsock32.cpp,v 1.6 1999-10-20 10:03:53 phaller Exp $ */ 2 2 3 3 /* … … 55 55 #include <sys/time.h> 56 56 #include <win32type.h> 57 #include "wsock32const.h" 57 58 #include "wsock32.h" 58 59 #include "misc.h" … … 1482 1483 1483 1484 1484 // The following 6 calls need to start a new thread, perform1485 // the operation, copy ALL the info to the buffer provided then1486 // notify the sender.1487 1488 /*****************************************************************************1489 * Name :1490 * Purpose :1491 * Parameters:1492 * Variables :1493 * Result :1494 * Remark :1495 * Status : UNTESTED STUB1496 *1497 * Author : Patrick Haller [Tue, 1998/06/16 23:00]1498 *****************************************************************************/1499 1500 ODINFUNCTION6(LHANDLE,OS2WSAAsyncGetServByName,HWND, hWnd,1501 u_int, wMsg,1502 const char*, name,1503 const char*, proto,1504 char*, buf,1505 int, buflen)1506 {1507 WSAStruct *wsa;1508 PFNTHREAD pfnAsyncThread = &WSAFunct; /* Address of thread program */1509 ULONG ulThreadParm = 100; /* Parameter to thread routine */1510 APIRET rc = NO_ERROR; /* Return code */1511 TID tid;1512 1513 1514 OS2WSASetLastError(WSAEWOULDBLOCK);1515 return 0;1516 1517 dprintf(("WSOCK32: WSAAsyncGetServByName. name: %s, proto: %s \n",1518 name,1519 proto));1520 1521 wsa = (WSAStruct *)malloc(sizeof(WSAStruct));1522 if(wsa == NULL)1523 {1524 OS2WSASetLastError(WSAEWOULDBLOCK);1525 return 0;1526 }1527 1528 wsa->CallingWhat = GETSERVBYNAME;1529 wsa->hw = hWnd;1530 wsa->msg = wMsg;1531 wsa->carg1 = strdup(name);1532 wsa->carg2 = strdup(proto);1533 wsa->buf = buf;1534 wsa->buflen = buflen;1535 1536 ulThreadParm = (ULONG)wsa;1537 1538 rc = DosCreateThread(&tid, /* Thread ID (returned by function) */1539 pfnAsyncThread, /* Address of thread program */1540 ulThreadParm, /* Parameter passed to ThreadProc */1541 CREATE_READY | /* Thread is ready when created */1542 STACK_SPARSE, /* Do not pre-commit stack pages */1543 8192L); /* Stack size, rounded to page bdy */1544 if (rc != NO_ERROR)1545 {1546 dprintf(("WSOCK32: DosCreateThread error in WSAAsyncGetServByName: return code = %u\n",1547 rc));1548 OS2WSASetLastError(rc);1549 free(wsa);1550 return 0;1551 }1552 1553 dprintf(("WSOCK32 THREAD: DosCreateThread's tid: %lu, ThreadParm = %p\n",1554 (unsigned long)tid,1555 ulThreadParm));1556 dprintf(("WSOCK32 THREAD: hwnd: %p\n",wsa->hw));1557 1558 return (LHANDLE)tid; //WSAAsyncGetServByName(hWnd,wMsg,name,proto,buf,buflen);1559 }1560 1561 1562 /*****************************************************************************1563 * Name :1564 * Purpose :1565 * Parameters:1566 * Variables :1567 * Result :1568 * Remark :1569 * Status : UNTESTED STUB1570 *1571 * Author : Patrick Haller [Tue, 1998/06/16 23:00]1572 *****************************************************************************/1573 1574 ODINFUNCTION6(LHANDLE,OS2WSAAsyncGetServByPort,HWND, hWnd,1575 u_int, wMsg,1576 int, port,1577 const char*, proto,1578 char*, buf,1579 int, buflen)1580 {1581 dprintf(("WSOCK32: WSAAsyncGetServByPort unimplemented\n"));1582 1583 return -5000; //WSAAsyncGetServByPort(hWnd,wMsg,port,proto,buf,buflen);1584 }1585 1586 1587 /*****************************************************************************1588 * Name :1589 * Purpose :1590 * Parameters:1591 * Variables :1592 * Result :1593 * Remark :1594 * Status : UNTESTED STUB1595 *1596 * Author : Patrick Haller [Tue, 1998/06/16 23:00]1597 *****************************************************************************/1598 1599 ODINFUNCTION5(LHANDLE,OS2WSAAsyncGetProtoByName,HWND, hWnd,1600 u_int, wMsg,1601 const char*, name,1602 char *, buf,1603 int, buflen)1604 {1605 dprintf(("WSOCK32: WSAAsyncGetProtoByName unimplemented\n"));1606 return -5000; //WSAAsyncGetProtoByName(hWnd,wMsg,name,buf,buflen);1607 }1608 1609 1610 /*****************************************************************************1611 * Name :1612 * Purpose :1613 * Parameters:1614 * Variables :1615 * Result :1616 * Remark :1617 * Status : UNTESTED STUB1618 *1619 * Author : Patrick Haller [Tue, 1998/06/16 23:00]1620 *****************************************************************************/1621 1622 ODINFUNCTION5(LHANDLE,OS2WSAAsyncGetProtoByNumber,HWND, hWnd,1623 u_int, wMsg,1624 int, number,1625 char *, buf,1626 int, buflen)1627 {1628 dprintf(("WSOCK32: WSAAsyncGetProtoByNumber unimplemented\n"));1629 return -5000; //WSAAsyncGetProtoByNumber(hWnd,wMsg,number,buf,buflen);1630 }1631 1632 1633 /*****************************************************************************1634 * Name :1635 * Purpose :1636 * Parameters:1637 * Variables :1638 * Result :1639 * Remark :1640 * Status : UNTESTED STUB1641 *1642 * Author : Patrick Haller [Tue, 1998/06/16 23:00]1643 *****************************************************************************/1644 1645 ODINFUNCTION5(LHANDLE,OS2WSAAsyncGetHostByName,HWND, hWnd,1646 u_int, wMsg,1647 const char *, name,1648 char *, buf,1649 int, buflen)1650 {1651 dprintf(("WSOCK32: WSAAsyncGetHostByName unimplemented\n"));1652 return -5000; //WSAAsyncGetHostByName(hWnd,wMsg,name,buf,buflen);1653 }1654 1655 1656 /*****************************************************************************1657 * Name :1658 * Purpose :1659 * Parameters:1660 * Variables :1661 * Result :1662 * Remark :1663 * Status : UNTESTED STUB1664 *1665 * Author : Patrick Haller [Tue, 1998/06/16 23:00]1666 *****************************************************************************/1667 1668 ODINFUNCTION7(LHANDLE, OS2WSAAsyncGetHostByAddr, HWND, hWnd,1669 u_int, wMsg,1670 const char*, addr,1671 int, len,1672 int, type,1673 char*, buf,1674 int, buflen)1675 {1676 dprintf(("WSOCK32: WSAAsyncGetHostByAddr unimplemented\n"));1677 1678 return -5000; //WSAAsyncGetHostByAddr(hWnd,wMsg,addr,len,type,buf,buflen);1679 }1680 1681 1682 /*****************************************************************************1683 * Name :1684 * Purpose :1685 * Parameters:1686 * Variables :1687 * Result :1688 * Remark :1689 * Status : UNTESTED STUB1690 *1691 * Author : Patrick Haller [Tue, 1998/06/16 23:00]1692 *****************************************************************************/1693 1694 ODINFUNCTION1(int, OS2WSACancelAsyncRequest,LHANDLE,hAsyncTaskHandle)1695 {1696 TID tid;1697 APIRET rc;1698 1699 dprintf(("WSOCK32: WSACancelAsyncRequest unimplemented\n"));1700 1701 tid = (LHANDLE)hAsyncTaskHandle;1702 if(tid == 0)1703 rc = WSAEINVAL;1704 else1705 rc = DosKillThread(tid);1706 1707 switch(rc)1708 {1709 case 0: // SUCCESS!!1710 return 0;1711 case 170:1712 rc = WSAEINPROGRESS;1713 break;1714 case 309:1715 rc = WSAEINVAL;1716 break;1717 default:1718 rc = -5000;1719 break;1720 } // end switch1721 1722 OS2WSASetLastError(rc);1723 return SOCKET_ERROR; // ERROR!1724 }1725 1726 1727 1485 /***************************************************************************** 1728 1486 * Name :
Note:
See TracChangeset
for help on using the changeset viewer.