[DDK]
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 27 Mar 2010 21:27:37 +0000 (21:27 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 27 Mar 2010 21:27:37 +0000 (21:27 +0000)
ws2san.h :
- Introduce pragma once.
- Apply consistent formatting.
- Improve several existing definitions.
- Add several missing ones.

svn path=/branches/header-work/; revision=46496

include/ddk/ws2san.h

index 392085d..5288a84 100644 (file)
  *
  */
 
-#ifndef __WS2SAN_H
-#define __WS2SAN_H
+#pragma once
 
+/* FIXME
 #include <winsock2.h>
+*/
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#define WSPAPI WINAPI
-
-/* FIXME: Unknown definitions */
-typedef PVOID LPWSPDATA;
-typedef PDWORD LPWSATHREADID;
-typedef PVOID LPWSPPROC_TABLE;
-typedef struct _WSPUPCALLTABLEEX WSPUPCALLTABLEEX;
-typedef WSPUPCALLTABLEEX *LPWSPUPCALLTABLEEX;
-
 #define SO_MAX_RDMA_SIZE                  0x700D
 #define SO_RDMA_THRESHOLD_SIZE            0x700E
 
+#define MEM_READ                          1
+#define MEM_WRITE                         2
+#define MEM_READWRITE                     3
+
 #define WSAID_REGISTERMEMORY \
   {0xC0B422F5, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
 
@@ -59,184 +55,198 @@ typedef WSPUPCALLTABLEEX *LPWSPUPCALLTABLEEX;
 #define WSAID_RDMAREAD \
   {0xC0B422FA, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
 
+#if(_WIN32_WINNT >= 0x0501)
 #define WSAID_MEMORYREGISTRATIONCACHECALLBACK \
   {0xE5DA4AF8, 0xD824, 0x48CD, {0xA7, 0x99, 0x63, 0x37, 0xA9, 0x8E, 0xD2, 0xAF}}
+#endif
+
+typedef struct _WSPUPCALLTABLEEX {
+  LPWPUCLOSEEVENT lpWPUCloseEvent;
+  LPWPUCLOSESOCKETHANDLE lpWPUCloseSocketHandle;
+  LPWPUCREATEEVENT lpWPUCreateEvent;
+  LPWPUCREATESOCKETHANDLE lpWPUCreateSocketHandle;
+  LPWPUFDISSET lpWPUFDIsSet;
+  LPWPUGETPROVIDERPATH lpWPUGetProviderPath;
+  LPWPUMODIFYIFSHANDLE lpWPUModifyIFSHandle;
+  LPWPUPOSTMESSAGE lpWPUPostMessage;
+  LPWPUQUERYBLOCKINGCALLBACK lpWPUQueryBlockingCallback;
+  LPWPUQUERYSOCKETHANDLECONTEXT lpWPUQuerySocketHandleContext;
+  LPWPUQUEUEAPC lpWPUQueueApc;
+  LPWPURESETEVENT lpWPUResetEvent;
+  LPWPUSETEVENT lpWPUSetEvent;
+  LPWPUOPENCURRENTTHREAD lpWPUOpenCurrentThread;
+  LPWPUCLOSETHREAD lpWPUCloseThread;
+  LPWPUCOMPLETEOVERLAPPEDREQUEST lpWPUCompleteOverlappedRequest;
+} WSPUPCALLTABLEEX, FAR *LPWSPUPCALLTABLEEX;
 
 typedef struct _WSABUFEX {
-       u_long  len;
-       char FAR  *buf;
-       HANDLE  handle;
+  u_long len;
+  char FAR *buf;
+  HANDLE handle;
 } WSABUFEX, FAR * LPWSABUFEX;
 
-#if 0
-typedef struct _WSPUPCALLTABLEEX {
-       LPWPUCLOSEEVENT  lpWPUCloseEvent;
-       LPWPUCLOSESOCKETHANDLE  lpWPUCloseSocketHandle;
-       LPWPUCREATEEVENT  lpWPUCreateEvent;
-       LPWPUCREATESOCKETHANDLE  lpWPUCreateSocketHandle;
-       LPWPUFDISSET  lpWPUFDIsSet;
-       LPWPUGETPROVIDERPATH  lpWPUGetProviderPath;
-       LPWPUMODIFYIFSHANDLE  lpWPUModifyIFSHandle;
-       LPWPUPOSTMESSAGE  lpWPUPostMessage;
-       LPWPUQUERYBLOCKINGCALLBACK  lpWPUQueryBlockingCallback;
-       LPWPUQUERYSOCKETHANDLECONTEXT  lpWPUQuerySocketHandleContext;
-       LPWPUQUEUEAPC  lpWPUQueueApc;
-       LPWPURESETEVENT  lpWPUResetEvent;
-       LPWPUSETEVENT  lpWPUSetEvent;
-       LPWPUOPENCURRENTTHREAD  lpWPUOpenCurrentThread;
-       LPWPUCLOSETHREAD  lpWPUCloseThread;
-       LPWPUCOMPLETEOVERLAPPEDREQUEST lpWPUCompleteOverlappedRequest;
-} WSPUPCALLTABLEEX, FAR * LPWSPUPCALLTABLEEX;
+typedef int
+(WSPAPI *LPWSPSTARTUPEX)(
+  IN WORD wVersionRequested,
+  OUT LPWSPDATA lpWSPData,
+  IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
+  IN LPWSPUPCALLTABLEEX lpUpcallTable,
+  OUT LPWSPPROC_TABLE lpProcTable);
+
+typedef HANDLE
+(WSPAPI *LPFN_WSPREGISTERMEMORY)(
+  IN SOCKET s,
+  IN PVOID lpBuffer,
+  IN DWORD dwBufferLength,
+  IN DWORD dwFlags,
+  OUT LPINT lpErrno);
+
+typedef int
+(WSPAPI *LPFN_WSPDEREGISTERMEMORY)(
+  IN SOCKET s,
+  IN HANDLE Handle,
+  OUT LPINT lpErrno);
+
+typedef int
+(WSPAPI *LPFN_WSPREGISTERRDMAMEMORY)(
+  IN SOCKET s,
+  IN PVOID lpBuffer,
+  IN DWORD dwBufferLength,
+  IN DWORD dwFlags,
+  OUT LPVOID lpRdmaBufferDescriptor,
+  IN OUT LPDWORD lpdwDescriptorLength,
+  OUT LPINT lpErrno);
+
+typedef int
+(WSPAPI *LPFN_WSPDEREGISTERRDMAMEMORY)(
+  IN SOCKET s,
+  IN LPVOID lpRdmaBufferDescriptor,
+  IN DWORD dwDescriptorLength,
+  OUT LPINT lpErrno);
+
+typedef int
+(WSPAPI *LPFN_WSPRDMAWRITE)(
+  IN SOCKET s,
+  IN LPWSABUFEX lpBuffers,
+  IN DWORD dwBufferCount,
+  IN LPVOID lpTargetBufferDescriptor,
+  IN DWORD dwTargetDescriptorLength,
+  IN DWORD dwTargetBufferOffset,
+  OUT LPDWORD lpdwNumberOfBytesWritten,
+  IN DWORD dwFlags,
+  IN LPWSAOVERLAPPED lpOverlapped OPTIONAL,
+  IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL,
+  IN LPWSATHREADID lpThreadId,
+  OUT LPINT lpErrno);
+
+typedef int
+(WSPAPI *LPFN_WSPRDMAREAD)(
+  IN SOCKET s,
+  IN LPWSABUFEX lpBuffers,
+  IN DWORD dwBufferCount,
+  IN LPVOID lpTargetBufferDescriptor,
+  IN DWORD dwTargetDescriptorLength,
+  IN DWORD dwTargetBufferOffset,
+  OUT LPDWORD lpdwNumberOfBytesRead,
+  IN DWORD dwFlags,
+  IN LPWSAOVERLAPPED lpOverlapped OPTIONAL,
+  IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL,
+  IN LPWSATHREADID lpThreadId,
+  OUT LPINT lpErrno);
+
+#if(_WIN32_WINNT >= 0x0501)
+typedef int
+(WSPAPI *LPFN_WSPMEMORYREGISTRATIONCACHECALLBACK)(
+  IN PVOID lpvAddress,
+  IN SIZE_T Size,
+  OUT LPINT lpErrno);
 #endif
 
-int WSPAPI
+int
+WSPAPI
 WSPStartupEx(
-  IN WORD  wVersionRequested,
-  OUT LPWSPDATA  lpWSPData,
-  IN LPWSAPROTOCOL_INFOW  lpProtocolInfo,
-  IN LPWSPUPCALLTABLEEX  lpUpcallTable,
-  OUT LPWSPPROC_TABLE  lpProcTable);
-
-typedef int WSPAPI
-(*LPWSPSTARTUPEX)(
-  IN WORD  wVersionRequested,
-  OUT LPWSPDATA  lpWSPData,
-  IN LPWSAPROTOCOL_INFOW  lpProtocolInfo,
-  IN LPWSPUPCALLTABLEEX  lpUpcallTable,
-  OUT LPWSPPROC_TABLE  lpProcTable);
-
-#define MEM_READ                          1
-#define MEM_WRITE                         2
-#define MEM_READWRITE                     3
-
-int WSPAPI
+  IN WORD wVersionRequested,
+  OUT LPWSPDATA lpWSPData,
+  IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
+  IN LPWSPUPCALLTABLEEX lpUpcallTable,
+  OUT LPWSPPROC_TABLE lpProcTable);
+
+HANDLE
+WSPAPI
+WSPRegisterMemory(
+  IN SOCKET s,
+  IN PVOID lpBuffer,
+  IN DWORD dwBufferLength,
+  IN DWORD dwFlags,
+  OUT LPINT lpErrno);
+
+int
+WSPAPI
 WSPDeregisterMemory(
-  IN SOCKET  s,
-  IN HANDLE  Handle,
-  OUT LPINT  lpErrno);
+  IN SOCKET s,
+  IN HANDLE Handle,
+  OUT LPINT lpErrno);
 
-typedef int WSPAPI
-(*LPFN_WSPDEREGISTERMEMORY)(
-  IN SOCKET  s,
-  IN HANDLE  Handle,
-  OUT LPINT  lpErrno);
-
-int WSPAPI
+int
+WSPAPI
+WSPRegisterRdmaMemory(
+  IN SOCKET s,
+  IN PVOID lpBuffer,
+  IN DWORD dwBufferLength,
+  IN DWORD dwFlags,
+  OUT LPVOID lpRdmaBufferDescriptor,
+  IN OUT LPDWORD lpdwDescriptorLength,
+  OUT LPINT lpErrno);
+
+int
+WSPAPI
 WSPDeregisterRdmaMemory(
-  IN SOCKET  s,
-  IN LPVOID  lpRdmaBufferDescriptor,
-  IN DWORD  dwDescriptorLength,
-  OUT LPINT  lpErrno);
-
-typedef int WSPAPI
-(*LPFN_WSPDEREGISTERRDMAMEMORY)(
-  IN SOCKET  s,
-  IN LPVOID  lpRdmaBufferDescriptor,
-  IN DWORD  dwDescriptorLength,
-  OUT LPINT  lpErrno);
-
-int WSPAPI
-WSPMemoryRegistrationCacheCallback(
-  IN PVOID  lpvAddress,
-  IN SIZE_T  Size,
-  OUT LPINT  lpErrno);
-
-typedef int WSPAPI
-(*LPFN_WSPMEMORYREGISTRATIONCACHECALLBACK)(
-  IN PVOID  lpvAddress,
-  IN SIZE_T  Size,
-  OUT LPINT  lpErrno);
+  IN SOCKET s,
+  IN LPVOID lpRdmaBufferDescriptor,
+  IN DWORD dwDescriptorLength,
+  OUT LPINT lpErrno);
 
-int WSPAPI
-WSPRdmaRead(
-  IN SOCKET  s,
-  IN LPWSABUFEX  lpBuffers,
-  IN DWORD  dwBufferCount,
-  IN LPVOID  lpTargetBufferDescriptor,
-  IN DWORD  dwTargetDescriptorLength,
-  IN DWORD  dwTargetBufferOffset,
-  OUT LPDWORD  lpdwNumberOfBytesRead,
-  IN DWORD  dwFlags,
-  IN LPWSAOVERLAPPED  lpOverlapped,
-  IN LPWSAOVERLAPPED_COMPLETION_ROUTINE  lpCompletionRoutine,
-  IN LPWSATHREADID  lpThreadId,
-  OUT LPINT  lpErrno);
-
-typedef int WSPAPI
-(*LPFN_WSPRDMAREAD)(
-  IN SOCKET  s,
-  IN LPWSABUFEX  lpBuffers,
-  IN DWORD  dwBufferCount,
-  IN LPVOID  lpTargetBufferDescriptor,
-  IN DWORD  dwTargetDescriptorLength,
-  IN DWORD  dwTargetBufferOffset,
-  OUT LPDWORD  lpdwNumberOfBytesRead,
-  IN DWORD  dwFlags,
-  IN LPWSAOVERLAPPED  lpOverlapped,
-  IN LPWSAOVERLAPPED_COMPLETION_ROUTINE  lpCompletionRoutine,
-  IN LPWSATHREADID  lpThreadId,
-  OUT LPINT  lpErrno);
-
-int WSPAPI
+int
+WSPAPI
 WSPRdmaWrite(
-  IN SOCKET  s,
-  IN LPWSABUFEX  lpBuffers,
-  IN DWORD  dwBufferCount,
-  IN LPVOID  lpTargetBufferDescriptor,
-  IN DWORD  dwTargetDescriptorLength,
-  IN DWORD  dwTargetBufferOffset,
-  OUT LPDWORD  lpdwNumberOfBytesWritten,
-  IN DWORD  dwFlags,
-  IN LPWSAOVERLAPPED  lpOverlapped,
-  IN LPWSAOVERLAPPED_COMPLETION_ROUTINE  lpCompletionRoutine,
-  IN LPWSATHREADID  lpThreadId,
-  OUT LPINT  lpErrno);
-
-typedef int WSPAPI
-(*LPFN_WSPRDMAWRITE)(
-  IN SOCKET  s,
-  IN LPWSABUFEX  lpBuffers,
-  IN DWORD  dwBufferCount,
-  IN LPVOID  lpTargetBufferDescriptor,
-  IN DWORD  dwTargetDescriptorLength,
-  IN DWORD  dwTargetBufferOffset,
-  OUT LPDWORD  lpdwNumberOfBytesWritten,
-  IN DWORD  dwFlags,
-  IN LPWSAOVERLAPPED  lpOverlapped,
-  IN LPWSAOVERLAPPED_COMPLETION_ROUTINE  lpCompletionRoutine,
-  IN LPWSATHREADID  lpThreadId,
-  OUT LPINT  lpErrno);
-
-HANDLE WSPAPI
-WSPRegisterMemory(
-  IN SOCKET  s,
-  IN PVOID  lpBuffer,
-  IN DWORD  dwBufferLength,
-  IN DWORD  dwFlags,
-  OUT LPINT  lpErrno);
-
-int WSPAPI
-WSPRegisterRdmaMemory(
-  IN SOCKET  s,
-  IN PVOID  lpBuffer,
-  IN DWORD  dwBufferLength,
-  IN DWORD  dwFlags,
-  OUT LPVOID  lpRdmaBufferDescriptor,
-  IN OUT LPDWORD  lpdwDescriptorLength,
-  OUT LPINT  lpErrno);
-
-typedef int WSPAPI
-(*LPFN_WSPREGISTERRDMAMEMORY)(
-  IN SOCKET  s,
-  IN PVOID  lpBuffer,
-  IN DWORD  dwBufferLength,
-  IN DWORD  dwFlags,
-  OUT LPVOID  lpRdmaBufferDescriptor,
-  IN OUT LPDWORD  lpdwDescriptorLength,
-  OUT LPINT  lpErrno);
+  IN SOCKET s,
+  IN LPWSABUFEX lpBuffers,
+  IN DWORD dwBufferCount,
+  IN LPVOID lpTargetBufferDescriptor,
+  IN DWORD dwTargetDescriptorLength,
+  IN DWORD dwTargetBufferOffset,
+  OUT LPDWORD lpdwNumberOfBytesWritten,
+  IN DWORD dwFlags,
+  IN LPWSAOVERLAPPED lpOverlapped OPTIONAL,
+  IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL,
+  IN LPWSATHREADID lpThreadId,
+  OUT LPINT lpErrno);
+
+int
+WSPAPI
+WSPRdmaRead(
+  IN SOCKET s,
+  IN LPWSABUFEX lpBuffers,
+  IN DWORD dwBufferCount,
+  IN LPVOID lpTargetBufferDescriptor,
+  IN DWORD dwTargetDescriptorLength,
+  IN DWORD dwTargetBufferOffset,
+  OUT LPDWORD lpdwNumberOfBytesRead,
+  IN DWORD dwFlags,
+  IN LPWSAOVERLAPPED lpOverlapped OPTIONAL,
+  IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL,
+  IN LPWSATHREADID lpThreadId,
+  OUT LPINT lpErrno);
+
+#if(_WIN32_WINNT >= 0x0501)
+int
+WSPAPI
+WSPMemoryRegistrationCacheCallback(
+  IN PVOID lpvAddress,
+  IN SIZE_T Size,
+  OUT LPINT lpErrno);
+#endif
 
 #ifdef __cplusplus
 }
 #endif
-
-#endif /* __WS2SAN_H */