Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

313 lines
4.5 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. ws2help.h
  5. Abstract:
  6. Contains declarations for the interface to the OS-specific
  7. WinSock 2.0 helper routines.
  8. Author:
  9. Keith Moore (keithmo) 19-Jun-1995
  10. Revision History:
  11. --*/
  12. #ifndef _WS2HELP_H_
  13. #define _WS2HELP_H_
  14. #if defined __cplusplus
  15. extern "C" {
  16. #endif
  17. #if !defined(_WS2HELP_)
  18. #define WS2HELPAPI DECLSPEC_IMPORT
  19. #else
  20. #define WS2HELPAPI
  21. #endif
  22. //
  23. // APC functions.
  24. //
  25. WS2HELPAPI
  26. DWORD
  27. WINAPI
  28. WahOpenApcHelper(
  29. OUT LPHANDLE HelperHandle
  30. );
  31. WS2HELPAPI
  32. DWORD
  33. WINAPI
  34. WahCloseApcHelper(
  35. IN HANDLE HelperHandle
  36. );
  37. WS2HELPAPI
  38. DWORD
  39. WINAPI
  40. WahOpenCurrentThread(
  41. IN HANDLE HelperHandle,
  42. OUT LPWSATHREADID ThreadId
  43. );
  44. WS2HELPAPI
  45. DWORD
  46. WINAPI
  47. WahCloseThread(
  48. IN HANDLE HelperHandle,
  49. IN LPWSATHREADID ThreadId
  50. );
  51. WS2HELPAPI
  52. DWORD
  53. WINAPI
  54. WahQueueUserApc(
  55. IN HANDLE HelperHandle,
  56. IN LPWSATHREADID ThreadId,
  57. IN LPWSAUSERAPC ApcRoutine,
  58. IN ULONG_PTR ApcContext OPTIONAL
  59. );
  60. //
  61. // Context functions.
  62. //
  63. typedef struct _CONTEXT_TABLE FAR * LPCONTEXT_TABLE;
  64. #define WAH_CONTEXT_FLAG_SERIALIZE 0x00000001
  65. WS2HELPAPI
  66. DWORD
  67. WINAPI
  68. WahCreateContextTable(
  69. LPCONTEXT_TABLE FAR * Table,
  70. DWORD Flags
  71. );
  72. WS2HELPAPI
  73. DWORD
  74. WINAPI
  75. WahDestroyContextTable(
  76. LPCONTEXT_TABLE Table
  77. );
  78. WS2HELPAPI
  79. DWORD
  80. WINAPI
  81. WahSetContext(
  82. LPCONTEXT_TABLE Table,
  83. SOCKET Socket,
  84. LPVOID Context
  85. );
  86. WS2HELPAPI
  87. DWORD
  88. WINAPI
  89. WahGetContext(
  90. LPCONTEXT_TABLE Table,
  91. SOCKET Socket,
  92. LPVOID FAR * Context
  93. );
  94. WS2HELPAPI
  95. DWORD
  96. WINAPI
  97. WahRemoveContext(
  98. LPCONTEXT_TABLE Table,
  99. SOCKET Socket
  100. );
  101. WS2HELPAPI
  102. DWORD
  103. WINAPI
  104. WahRemoveContextEx(
  105. LPCONTEXT_TABLE Table,
  106. SOCKET Socket,
  107. LPVOID Context
  108. );
  109. // Handle function
  110. WS2HELPAPI
  111. DWORD
  112. WINAPI
  113. WahOpenHandleHelper(
  114. OUT LPHANDLE HelperHandle
  115. );
  116. WS2HELPAPI
  117. DWORD
  118. WINAPI
  119. WahCloseHandleHelper(
  120. IN HANDLE HelperHandle
  121. );
  122. WS2HELPAPI
  123. DWORD
  124. WINAPI
  125. WahCreateSocketHandle(
  126. IN HANDLE HelperHandle,
  127. OUT SOCKET *s
  128. );
  129. WS2HELPAPI
  130. DWORD
  131. WINAPI
  132. WahCloseSocketHandle(
  133. IN HANDLE HelperHandle,
  134. IN SOCKET s
  135. );
  136. WS2HELPAPI
  137. DWORD
  138. WINAPI
  139. WahCompleteRequest(
  140. IN HANDLE HelperHandle,
  141. IN SOCKET s,
  142. IN LPWSAOVERLAPPED lpOverlapped,
  143. IN DWORD dwError,
  144. IN DWORD cbTransferred
  145. );
  146. WS2HELPAPI
  147. DWORD
  148. WINAPI
  149. WahEnableNonIFSHandleSupport (
  150. VOID
  151. );
  152. WS2HELPAPI
  153. DWORD
  154. WINAPI
  155. WahDisableNonIFSHandleSupport (
  156. VOID
  157. );
  158. // Notification handle functions
  159. WS2HELPAPI
  160. DWORD
  161. WINAPI
  162. WahOpenNotificationHandleHelper(
  163. OUT LPHANDLE HelperHandle
  164. );
  165. WS2HELPAPI
  166. DWORD
  167. WINAPI
  168. WahCloseNotificationHandleHelper(
  169. IN HANDLE HelperHandle
  170. );
  171. WS2HELPAPI
  172. DWORD
  173. WINAPI
  174. WahCreateNotificationHandle(
  175. IN HANDLE HelperHandle,
  176. OUT HANDLE *h
  177. );
  178. WS2HELPAPI
  179. DWORD
  180. WINAPI
  181. WahWaitForNotification(
  182. IN HANDLE HelperHandle,
  183. IN HANDLE h,
  184. IN LPWSAOVERLAPPED lpOverlapped,
  185. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  186. );
  187. WS2HELPAPI
  188. DWORD
  189. WINAPI
  190. WahNotifyAllProcesses (
  191. IN HANDLE HelperHandle
  192. );
  193. //
  194. // New handle -> context lookup functions
  195. //
  196. typedef struct _WSHANDLE_CONTEXT {
  197. LONG RefCount; // Context reference count
  198. HANDLE Handle; // Handle that corresponds to context
  199. } WSHANDLE_CONTEXT, FAR * LPWSHANDLE_CONTEXT;
  200. WS2HELPAPI
  201. DWORD
  202. WINAPI
  203. WahCreateHandleContextTable(
  204. LPCONTEXT_TABLE FAR * Table
  205. );
  206. WS2HELPAPI
  207. DWORD
  208. WINAPI
  209. WahDestroyHandleContextTable(
  210. LPCONTEXT_TABLE Table
  211. );
  212. WS2HELPAPI
  213. LPWSHANDLE_CONTEXT
  214. WINAPI
  215. WahReferenceContextByHandle(
  216. LPCONTEXT_TABLE Table,
  217. HANDLE Handle
  218. );
  219. WS2HELPAPI
  220. LPWSHANDLE_CONTEXT
  221. WINAPI
  222. WahInsertHandleContext(
  223. LPCONTEXT_TABLE Table,
  224. LPWSHANDLE_CONTEXT HContext
  225. );
  226. WS2HELPAPI
  227. DWORD
  228. WINAPI
  229. WahRemoveHandleContext(
  230. LPCONTEXT_TABLE Table,
  231. LPWSHANDLE_CONTEXT HContext
  232. );
  233. typedef
  234. BOOL
  235. (WINAPI * LPFN_CONTEXT_ENUMERATOR)(
  236. LPVOID EnumCtx,
  237. LPWSHANDLE_CONTEXT HContext
  238. );
  239. WS2HELPAPI
  240. BOOL
  241. WINAPI
  242. WahEnumerateHandleContexts(
  243. LPCONTEXT_TABLE Table,
  244. LPFN_CONTEXT_ENUMERATOR Enumerator,
  245. LPVOID EnumCtx
  246. );
  247. #define WahReferenceHandleContext(_ctx) InterlockedIncrement(&(_ctx)->RefCount)
  248. #define WahDereferenceHandleContext(_ctx) InterlockedDecrement(&(_ctx)->RefCount)
  249. #if defined __cplusplus
  250. } // extern "C"
  251. #endif
  252. #endif // _WS2HELP_H_