xref: /reactos/sdk/include/reactos/winsock/ws2help.h (revision 34593d93)
1 /*
2  * COPYRIGHT:   See COPYING in the top level directory
3  * PROJECT:     ReactOS WinSock 2 Helper DLL
4  * FILE:        include/reactos/winsock/ws2help.h
5  * PURPOSE:     WinSock 2 Helper DLL header
6  */
7 
8 #ifndef __WS2HELP_H
9 #define __WS2HELP_H
10 
11 /* Types */
12 typedef struct _WSH_HANDLE
13 {
14     LONG RefCount;
15     HANDLE Handle;
16 } WSH_HANDLE, *PWAH_HANDLE;
17 
18 typedef struct _WSH_HASH_TABLE
19 {
20     DWORD Size;
21     PWAH_HANDLE Handles[1];
22 } WSH_HASH_TABLE, *PWAH_HASH_TABLE;
23 
24 typedef struct _WSH_SEARCH_TABLE
25 {
26     volatile PWAH_HASH_TABLE HashTable;
27     volatile PLONG CurrentCount;
28     LONG Count1;
29     LONG Count2;
30     LONG SpinCount;
31     BOOL Expanding;
32     CRITICAL_SECTION Lock;
33 } WSH_SEARCH_TABLE, *PWAH_SEARCH_TABLE;
34 
35 typedef struct _WSH_HANDLE_TABLE
36 {
37     DWORD Mask;
38     WSH_SEARCH_TABLE SearchTables[1];
39 } WSH_HANDLE_TABLE, *PWAH_HANDLE_TABLE;
40 
41 //typedef struct _WSH_HANDLE_TABLE *PWAH_HANDLE_TABLE;
42 
43 typedef BOOL
44 (WINAPI *PWAH_HANDLE_ENUMERATE_PROC)(
45     IN PVOID Context,
46     IN PWAH_HANDLE Handle
47 );
48 
49 PWAH_HANDLE
50 WINAPI
51 WahReferenceContextByHandle(
52     IN PWAH_HANDLE_TABLE Table,
53     IN HANDLE Handle
54 );
55 
56 DWORD
57 WINAPI
58 WahRemoveHandleContext(
59     IN PWAH_HANDLE_TABLE Table,
60     IN PWAH_HANDLE Handle
61 );
62 
63 DWORD
64 WINAPI
65 WahCloseSocketHandle(
66     IN HANDLE HelperHandle,
67     IN SOCKET Socket
68 );
69 
70 DWORD
71 WINAPI
72 WahOpenCurrentThread(
73     IN HANDLE HelperHandle,
74     OUT LPWSATHREADID ThreadId
75 );
76 
77 DWORD
78 WINAPI
79 WahCloseApcHelper(
80     IN HANDLE HelperHandle
81 );
82 
83 DWORD
84 WINAPI
85 WahCloseThread(
86     IN HANDLE HelperHandle,
87     IN LPWSATHREADID ThreadId
88 );
89 
90 DWORD
91 WINAPI
92 WahCloseHandleHelper(
93     IN HANDLE HelperHandle
94 );
95 
96 DWORD
97 WINAPI
98 WahCloseNotificationHandleHelper(
99     IN HANDLE HelperHandle
100 );
101 
102 DWORD
103 WINAPI
104 WahOpenNotificationHandleHelper(
105     OUT PHANDLE HelperHandle
106 );
107 
108 DWORD
109 WINAPI
110 WahCreateNotificationHandle(
111     IN HANDLE HelperHandle,
112     OUT PHANDLE NotificationHelperHandle
113 );
114 
115 INT
116 WINAPI
117 WahWaitForNotification(
118     IN HANDLE NotificationHelperHandle,
119     IN HANDLE lpNotificationHandle,
120     IN LPWSAOVERLAPPED lpOverlapped,
121     IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
122 );
123 
124 INT
125 WINAPI
126 WahNotifyAllProcesses(
127     IN HANDLE NotificationHelperHandle
128 );
129 
130 BOOL
131 WINAPI
132 WahEnumerateHandleContexts(
133     IN PWAH_HANDLE_TABLE Table,
134     IN PWAH_HANDLE_ENUMERATE_PROC Callback,
135     IN PVOID Context
136 );
137 
138 DWORD
139 WINAPI
140 WahCreateHandleContextTable(
141     OUT PWAH_HANDLE_TABLE *Table
142 );
143 
144 DWORD
145 WINAPI
146 WahDestroyHandleContextTable(
147     IN PWAH_HANDLE_TABLE Table
148 );
149 
150 PWAH_HANDLE
151 WINAPI
152 WahInsertHandleContext(
153     IN PWAH_HANDLE_TABLE Table,
154     IN PWAH_HANDLE Handle
155 );
156 
157 DWORD
158 WINAPI
159 WahOpenApcHelper(
160     OUT PHANDLE ApcHelperHandle
161 );
162 
163 #endif
164