- Timestamp:
- Oct 20, 1999, 10:11:03 PM (26 years ago)
- Location:
- trunk/src/wsock32
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wsock32/async.cpp
r1374 r1384 1 /* $Id: async.cpp,v 1. 4 1999-10-20 11:04:12phaller Exp $ */1 /* $Id: async.cpp,v 1.5 1999-10-20 20:10:55 phaller Exp $ */ 2 2 3 3 /* … … 30 30 #include <nerrno.h> 31 31 #include <sys/socket.h> 32 #include <sys/ioctl.h> 33 #include <sys/select.h> 34 #include <unistd.h> 35 32 36 #include <wsock32const.h> 33 37 … … 140 144 void asyncGetServByName (PASYNCREQUEST pRequest); 141 145 void asyncGetServByPort (PASYNCREQUEST pRequest); 146 void asyncSelect (PASYNCREQUEST pRequest); 142 147 143 148 // public members … … 595 600 struct hostent* pHostent; 596 601 USHORT usLength; 597 ULONG wParam;598 ULONG lParam;599 602 USHORT rc; 600 603 … … 650 653 struct hostent* pHostent; 651 654 USHORT usLength; 652 ULONG wParam;653 ULONG lParam;654 655 USHORT rc; 655 656 … … 703 704 struct protoent* pProtoent; 704 705 USHORT usLength; 705 ULONG wParam;706 ULONG lParam;707 706 USHORT rc; 708 707 … … 756 755 struct protoent* pProtoent; 757 756 USHORT usLength; 758 ULONG wParam;759 ULONG lParam;760 757 USHORT rc; 761 758 … … 809 806 struct servent* pServent; 810 807 USHORT usLength; 811 ULONG wParam;812 ULONG lParam;813 808 USHORT rc; 814 809 … … 863 858 struct servent* pServent; 864 859 USHORT usLength; 865 ULONG wParam;866 ULONG lParam;867 860 USHORT rc; 868 861 … … 899 892 // M$ says, if PostMessageA fails, spin as long as window exists 900 893 } 894 895 896 897 /***************************************************************************** 898 * Name : WSAAsyncWorker::asyncSelect 899 * Purpose : 900 * Parameters: 901 * Variables : 902 * Result : 903 * Remark : 904 * Status : UNTESTED 905 * 906 * Author : Patrick Haller [Tue, 1998/06/16 23:00] 907 *****************************************************************************/ 908 909 typedef int SOCKET; 910 911 void WSAAsyncWorker::asyncSelect(PASYNCREQUEST pRequest) 912 { 913 ULONG wParam; 914 ULONG lParam; 915 int irc; 916 int iUnknown; 917 918 SOCKET sockWin; 919 ULONG ulEvent; 920 USHORT usResult = 0; 921 922 dprintf(("WSOCK32-ASYNC: WSAAsyncWorker::asyncSelect (%08xh, %08xh) not correctly implemented\n", 923 this, 924 pRequest)); 925 926 927 // setup variables 928 sockWin = (SOCKET)pRequest->ul1; 929 ulEvent = (ULONG) pRequest->ul2; 930 931 //@@@PH how to implement other events? 932 933 // finally do the select! 934 irc = os2_select(&sockWin, 935 (ulEvent & FD_READ), 936 (ulEvent & FD_WRITE), 937 (ulEvent & FD_OOB), 938 10000); // @@@PH timeout 939 if (irc < 0) /* an error occurred */ 940 { 941 lParam = sock_errno(); /* raise error condition */ 942 if (lParam == SOCENOTSOCK) 943 { 944 usResult = FD_CLOSE; 945 lParam = 0; 946 } 947 } 948 else 949 if (irc == 0) /* this means timeout */ 950 { 951 lParam = WSAETIMEDOUT; /* raise error condition */ 952 } 953 else 954 { 955 //@@@PH check the socket for any event and report! 956 usResult = 0; 957 958 // readiness for reading bytes ? 959 irc = ioctl(sockWin, FIONREAD, &iUnknown, sizeof(iUnknown)); 960 if ( (irc == 0) && (iUnknown > 0)) 961 usResult |= FD_READ; 962 } 963 964 // post result 965 PostMessageA(pRequest->hwnd, 966 pRequest->ulMessage, 967 (WPARAM)sockWin, 968 (LPARAM)((lParam << 16) | usResult)); 969 970 // M$ says, if PostMessageA fails, spin as long as window exists 971 } 972 901 973 902 974 … … 1262 1334 return(wsaWorker->isBlocking()); 1263 1335 } 1336 1337 1338 /***************************************************************************** 1339 * Name : 1340 * Purpose : 1341 * Parameters: 1342 * Variables : 1343 * Result : 1344 * Remark : 1345 * Status : UNTESTED STUB 1346 * 1347 * Author : Patrick Haller [Tue, 1998/06/16 23:00] 1348 *****************************************************************************/ 1349 // the real function calls 1350 ODINFUNCTION4(HANDLE, WSAAsyncSelect,SOCKET, s, 1351 HWND, hwnd, 1352 unsigned int, wMsg, 1353 long, lEvent) 1354 { 1355 PASYNCREQUEST pRequest = wsaWorker->createRequest(WSAASYNC_SELECT, 1356 (HWND) hwnd, 1357 (ULONG)wMsg, 1358 (PVOID)NULL, 1359 (ULONG)0, 1360 (ULONG)s, 1361 (ULONG)lEvent); 1362 wsaWorker->pushRequest(pRequest); 1363 return (HANDLE)pRequest; 1364 } 1365 -
trunk/src/wsock32/makefile
r1372 r1384 1 # $Id: makefile,v 1. 9 1999-10-20 10:03:53phaller Exp $1 # $Id: makefile,v 1.10 1999-10-20 20:10:57 phaller Exp $ 2 2 3 3 # … … 29 29 $(LD) $(LDFLAGS) -Fm -Fe$@ $(OBJS) $(TARGET).def \ 30 30 $(PDWIN32_LIB)\pmwinx.lib $(PDWIN32_LIB)\user32.lib \ 31 tcp 32dll.lib so32dll.lib $(PDWIN32_LIB)\kernel32.lib \31 tcpip32.lib tcp32dll.lib so32dll.lib $(PDWIN32_LIB)\kernel32.lib \ 32 32 $(PDWIN32_LIB)/odincrt.lib OS2386.LIB $(RTLLIB_O) 33 33 $(CP) $@ $(PDWIN32_BIN) -
trunk/src/wsock32/wsock32.cpp
r1374 r1384 1 /* $Id: wsock32.cpp,v 1. 7 1999-10-20 11:04:13phaller Exp $ */1 /* $Id: wsock32.cpp,v 1.8 1999-10-20 20:10:58 phaller Exp $ */ 2 2 3 3 /* … … 1475 1475 *****************************************************************************/ 1476 1476 1477 ODINFUNCTION4(int, OS2WSAAsyncSelect, SOCKET, s,1478 HWND, hWnd,1479 u_int, wMsg,1480 long, lEvent)1481 {1482 PFNTHREAD pfnAsyncThread = &AsyncLoop; /* Address of thread program */1483 ULONG ulThreadParm = 100; /* Parameter to thread routine */1484 APIRET rc = NO_ERROR; /* Return code */1485 unsigned long ii;1486 AsyncStatus *as;1487 1488 as = FindASY(s);1489 if(as == NULL)1490 return 0;1491 1492 CheckThreads(as);1493 1494 as->hwnd = hWnd;1495 as->msg = wMsg;1496 as->event = lEvent;1497 1498 ulThreadParm = (ULONG)as;1499 1500 rc = DosCreateThread(&(as->threadID), /* Thread ID (returned by function) */1501 pfnAsyncThread, /* Address of thread program */1502 ulThreadParm, /* Parameter passed to ThreadProc */1503 CREATE_READY | /* Thread is ready when created */1504 STACK_SPARSE, /* Do not pre-commit stack pages */1505 8192L); /* Stack size, rounded to page bdy */1506 if (rc != NO_ERROR)1507 {1508 dprintf(("WSOCK32: DosCreateThread error: return code = %u\n",1509 rc));1510 OS2WSASetLastError(rc);1511 return 0;1512 }1513 1514 return 1; //WSAAsyncSelect(s,hWnd,wMsg,lEvent);1515 }1516 1517 1518 /*****************************************************************************1519 * Name :1520 * Purpose :1521 * Parameters:1522 * Variables :1523 * Result :1524 * Remark :1525 * Status : UNTESTED STUB1526 *1527 * Author : Patrick Haller [Tue, 1998/06/16 23:00]1528 *****************************************************************************/1529 1530 1477 ODINFUNCTION4(int, OS2WSARecvEx, SOCKET, s, 1531 1478 char FAR*, buf, -
trunk/src/wsock32/wsock32.def
r1374 r1384 1 ; $Id: wsock32.def,v 1. 7 1999-10-20 11:04:13phaller Exp $1 ; $Id: wsock32.def,v 1.8 1999-10-20 20:11:01 phaller Exp $ 2 2 3 3 ;Created by BLAST for IBM's compiler … … 49 49 send = _OS2send@16 @19 50 50 sendto = _OS2sendto@24 @20 51 setsockopt = _OS2setsockopt@20@2151 setsockopt = _OS2setsockopt@20 @21 52 52 shutdown = _OS2shutdown@8 @22 53 53 socket = _OS2socket@12 @23 … … 61 61 gethostname = _OS2gethostname@8 @57 62 62 63 WSAAsyncSelect = _ OS2WSAAsyncSelect@16@10163 WSAAsyncSelect = _WSAAsyncSelect@16 @101 64 64 65 65 WSAAsyncGetHostByAddr = _WSAAsyncGetHostByAddr@28 @102 -
trunk/src/wsock32/wsock32const.h
r1372 r1384 1 /* $Id: wsock32const.h,v 1. 1 1999-10-20 10:03:55phaller Exp $ */1 /* $Id: wsock32const.h,v 1.2 1999-10-20 20:11:03 phaller Exp $ */ 2 2 3 3 /* WSOCK32.H--definitions & conversions for Odin's wsock32.dll. … … 20 20 * taken from the BSD file sys/socket.h. 21 21 */ 22 23 /* WSAAsyncSelect flags */ 24 #define FD_READ 0x01 25 #define FD_WRITE 0x02 26 #define FD_OOB 0x04 27 #define FD_ACCEPT 0x08 28 #define FD_CONNECT 0x10 29 #define FD_CLOSE 0x20 30 22 31 23 32 /*
Note:
See TracChangeset
for help on using the changeset viewer.