ReactOS 0.4.15-dev-8096-ga0eec98
event.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS WinSock 2 API
4 * FILE: dll/win32/ws2_32/src/event.c
5 * PURPOSE: Socket Events
6 * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
7 */
8
9/* INCLUDES ******************************************************************/
10
11#include <ws2_32.h>
12
13#define NDEBUG
14#include <debug.h>
15
16/* FUNCTIONS *****************************************************************/
17
18/*
19 * @implemented
20 */
21BOOL
24{
26
27 /* Let the OS handle it */
29
30 /* We need a special WSA return error */
32
33 /* Return the Win32 Error */
34 return Success;
35}
36
37/*
38 * @implemented
39 */
43{
44 /* CreateEventW can only return the Event or 0 (WSA_INVALID_EVENT) */
45 return CreateEventW(NULL, TRUE, FALSE, NULL);
46}
47
48/*
49 * @implemented
50 */
51BOOL
54{
55 /* Call Win32 */
56 return ResetEvent(hEvent);
57}
58
59/*
60 * @implemented
61 */
62BOOL
65{
66 /* Call Win32 */
67 return SetEvent(hEvent);
68}
69
70/*
71 * @implemented
72 */
76 IN CONST WSAEVENT FAR* lphEvents,
77 IN BOOL fWaitAll,
79 IN BOOL fAlertable)
80{
81 /* Call Win32 */
82 return WaitForMultipleObjectsEx(cEvents,
83 lphEvents,
84 fWaitAll,
86 fAlertable);
87}
88
89/*
90 * @implemented
91 */
92INT
95 IN WSAEVENT hEventObject,
96 OUT LPWSANETWORKEVENTS lpNetworkEvents)
97{
98 PWSSOCKET Socket;
99 INT Status;
101 DPRINT("WSAEnumNetworkEvents: %lx\n", s);
102
103 /* Check for WSAStartup */
105 {
106 /* Get the Socket Context */
107 if ((Socket = WsSockGetSocket(s)))
108 {
109 /* Make the call */
111 hEventObject,
112 lpNetworkEvents,
113 &ErrorCode);
114 /* Deference the Socket Context */
115 WsSockDereference(Socket);
116
117 /* Return Provider Value */
118 if (Status == ERROR_SUCCESS) return Status;
119 }
120 else
121 {
122 /* No Socket Context Found */
124 }
125 }
126
127 /* Return with an Error */
129 return SOCKET_ERROR;
130}
131
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define SetLastError(x)
Definition: compat.h:752
#define FAR
Definition: zlib.h:34
VOID WSAAPI WSASetLastError(IN INT iError)
Definition: dllmain.c:123
BOOL WSAAPI WSAResetEvent(IN WSAEVENT hEvent)
Definition: event.c:53
BOOL WSAAPI WSACloseEvent(IN WSAEVENT hEvent)
Definition: event.c:23
INT WSAAPI WSAEnumNetworkEvents(IN SOCKET s, IN WSAEVENT hEventObject, OUT LPWSANETWORKEVENTS lpNetworkEvents)
Definition: event.c:94
BOOL WSAAPI WSASetEvent(IN WSAEVENT hEvent)
Definition: event.c:64
DWORD WSAAPI WSAWaitForMultipleEvents(IN DWORD cEvents, IN CONST WSAEVENT FAR *lphEvents, IN BOOL fWaitAll, IN DWORD dwTimeout, IN BOOL fAlertable)
Definition: event.c:75
@ Success
Definition: eventcreate.c:712
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
Status
Definition: gdiplustypes.h:25
GLdouble s
Definition: gl.h:2039
static HANDLE hEvent
Definition: comm.c:54
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define CONST
Definition: pedump.c:81
#define DPRINT
Definition: sndvol32.h:73
WSPPROC_TABLE Service
Definition: ws2_32p.h:80
LPWSPENUMNETWORKEVENTS lpWSPEnumNetworkEvents
Definition: ws2spi.h:470
PTPROVIDER Provider
Definition: ws2_32p.h:199
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:714
DWORD WINAPI WaitForMultipleObjectsEx(IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:169
int32_t INT
Definition: typedefs.h:58
#define IN
Definition: typedefs.h:39
#define OUT
Definition: typedefs.h:40
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD dwTimeout
Definition: wincrypt.h:6081
#define WSAENOTSOCK
Definition: winerror.h:1951
WINSOCK_API_LINKAGE WSAEVENT WSAAPI WSACreateEvent(void)
Definition: event.c:42
DWORD WSAEVENT
Definition: winsock2.h:606
#define WSA_INVALID_HANDLE
Definition: winsock2.h:618
#define WSAAPI
Definition: winsock2.h:605
UINT_PTR SOCKET
Definition: winsock.h:47
#define SOCKET_ERROR
Definition: winsock.h:333
FORCEINLINE DWORD WsQuickProlog(VOID)
Definition: ws2_32p.h:892
VOID WSAAPI WsSockDereference(IN PWSSOCKET Socket)
Definition: dsocket.c:205
PWSSOCKET WSAAPI WsSockGetSocket(IN SOCKET Handle)
Definition: dsocket.c:140