| 1 | /* $Id: wsock2.cpp,v 1.4 2001-10-21 13:43:51 sandervl Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | *
|
|---|
| 5 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 6 | *
|
|---|
| 7 | * Winsock 2.0 functions for OS/2
|
|---|
| 8 | *
|
|---|
| 9 | * Copyright (C) 2001 Achim Hasenmueller <achimha@innotek.de>
|
|---|
| 10 | *
|
|---|
| 11 | * Some parts based on Wine code: (dlls\winsock\socket.c)
|
|---|
| 12 | * (C) 1993,1994,1996,1997 John Brezak, Erik Bos, Alex Korobka.
|
|---|
| 13 | *
|
|---|
| 14 | */
|
|---|
| 15 |
|
|---|
| 16 | #include <odin.h>
|
|---|
| 17 | #include <debugtools.h>
|
|---|
| 18 | #include "wsock32.h"
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 | /***********************************************************************
|
|---|
| 22 | * WSAEventSelect (WS2_32.39)
|
|---|
| 23 | */
|
|---|
| 24 | int WINAPI WSAEventSelect(SOCKET s, WSAEVENT hEvent, LONG lEvent)
|
|---|
| 25 | {
|
|---|
| 26 | dprintf(("WS2_32: WSAEventSelect socket 0x%x, hEvent 0x%x, event 0x%x", s, hEvent, lEvent));
|
|---|
| 27 |
|
|---|
| 28 | // forward call to worker function in HEVENT notification mode
|
|---|
| 29 | return WSAAsyncSelectWorker(s, WSA_SELECT_HEVENT, (int)hEvent, 0, lEvent);
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | /***********************************************************************
|
|---|
| 33 | * WSAEnumNetworkEvents
|
|---|
| 34 | */
|
|---|
| 35 | int WINAPI WSAEnumNetworkEvents(SOCKET s, WSAEVENT hEvent, LPWSANETWORKEVENTS lpEvent)
|
|---|
| 36 | {
|
|---|
| 37 | // called too often in some apps, makes log file grow too fast
|
|---|
| 38 | dprintf2(("WSAEnumNetworkEvents 0x%x 0x%x 0x%x NOT CORRECTLY IMPLEMENTED", s, hEvent, lpEvent));
|
|---|
| 39 |
|
|---|
| 40 | if(!fWSAInitialized)
|
|---|
| 41 | {
|
|---|
| 42 | dprintf(("WSA sockets not initialized"));
|
|---|
| 43 | WSASetLastError(WSANOTINITIALISED);
|
|---|
| 44 | return SOCKET_ERROR;
|
|---|
| 45 | }
|
|---|
| 46 | else
|
|---|
| 47 | if(WSAIsBlocking())
|
|---|
| 48 | {
|
|---|
| 49 | dprintf(("blocking call in progress"));
|
|---|
| 50 | WSASetLastError(WSAEINPROGRESS); // blocking call in progress
|
|---|
| 51 | return SOCKET_ERROR;
|
|---|
| 52 | }
|
|---|
| 53 | else
|
|---|
| 54 | if (!lpEvent)
|
|---|
| 55 | {
|
|---|
| 56 | dprintf(("network event buffer NULL"));
|
|---|
| 57 | WSASetLastError(WSAEINVAL);
|
|---|
| 58 | return SOCKET_ERROR;
|
|---|
| 59 | }
|
|---|
| 60 | // TODO: check if lpEvent is in user address space! (Win32 does)
|
|---|
| 61 |
|
|---|
| 62 | // forward call to worker routine
|
|---|
| 63 | return WSAEnumNetworkEventsWorker(s, hEvent, lpEvent);
|
|---|
| 64 | }
|
|---|