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.

186 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. uspud.h
  5. Abstract:
  6. Contains structures and declarations for SPUD. SPUD stands for the
  7. Special Purpose Utility Driver. This driver enhances the performance
  8. of IIS.
  9. Author:
  10. John Ballard (jballard) 21-Oct-1996
  11. Revision History:
  12. Keith Moore (keithmo) 02-Feb-1998
  13. Merged with private\inc\spud.h.
  14. --*/
  15. #ifndef _USPUD_H_
  16. #define _USPUD_H_
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. //
  21. // The current SPUD interface version number. This number is passed by
  22. // the user-mode code into SPUDInitialize() and *must* match the number
  23. // expected by the driver.
  24. //
  25. // IIS4 (aka K2, NTOP 4.0, etc) shipped with version 0x00010000
  26. //
  27. // NT5 will ship with 0x00020000
  28. //
  29. #define SPUD_VERSION 0x00020000
  30. //
  31. // Oplock break notification types. This is a bad attempt to make the
  32. // standard NTIO notification types more readable.
  33. //
  34. // SPUD_OPLOCK_BREAK_OPEN is issued after an oplock has been successfully
  35. // acquired and a subsequent open is issued on the target file. This is
  36. // our clue to close the file as soon as practicable. (The thread that issued
  37. // the subsequent open will remain blocked until our file handle is closed,
  38. // thus we must be expeditious in closing the handle.)
  39. //
  40. // SPUD_OPLOCK_BREAK_CLOSE is issued after an oplock has been successfully
  41. // acquired and the target file handle is closed. Think of this as
  42. // STATUS_CANCELLED for oplock IRPs.
  43. //
  44. #define SPUD_OPLOCK_BREAK_OPEN FILE_OPLOCK_BROKEN_TO_LEVEL_2
  45. #define SPUD_OPLOCK_BREAK_CLOSE FILE_OPLOCK_BROKEN_TO_NONE
  46. //
  47. // Request type & context, used for batched (XxxAndRecv) APIs.
  48. //
  49. typedef enum {
  50. TransmitFileAndRecv,
  51. SendAndRecv
  52. } REQ_TYPE, *PREQ_TYPE;
  53. typedef struct _SPUD_REQ_CONTEXT {
  54. REQ_TYPE ReqType;
  55. IO_STATUS_BLOCK IoStatus1;
  56. IO_STATUS_BLOCK IoStatus2;
  57. PVOID KernelReqInfo;
  58. } SPUD_REQ_CONTEXT, *PSPUD_REQ_CONTEXT;
  59. //
  60. // File information returned by SPUDCreateFile().
  61. //
  62. typedef struct _SPUD_FILE_INFORMATION {
  63. FILE_BASIC_INFORMATION BasicInformation;
  64. FILE_STANDARD_INFORMATION StandardInformation;
  65. } SPUD_FILE_INFORMATION, *PSPUD_FILE_INFORMATION;
  66. //
  67. // Activity counters.
  68. //
  69. typedef struct _SPUD_COUNTERS {
  70. ULONG CtrTransmitfileAndRecv;
  71. ULONG CtrTransRecvFastTrans;
  72. ULONG CtrTransRecvFastRecv;
  73. ULONG CtrTransRecvSlowTrans;
  74. ULONG CtrTransRecvSlowRecv;
  75. ULONG CtrSendAndRecv;
  76. ULONG CtrSendRecvFastSend;
  77. ULONG CtrSendRecvFastRecv;
  78. ULONG CtrSendRecvSlowSend;
  79. ULONG CtrSendRecvSlowRecv;
  80. } SPUD_COUNTERS, *PSPUD_COUNTERS;
  81. //
  82. // Exported APIs.
  83. //
  84. NTSTATUS
  85. NTAPI
  86. SPUDInitialize(
  87. IN ULONG Version,
  88. IN HANDLE hPort
  89. );
  90. NTSTATUS
  91. NTAPI
  92. SPUDTerminate(
  93. VOID
  94. );
  95. NTSTATUS
  96. NTAPI
  97. SPUDTransmitFileAndRecv(
  98. IN HANDLE hSocket,
  99. IN struct _AFD_TRANSMIT_FILE_INFO *transmitInfo,
  100. IN struct _AFD_RECV_INFO *recvInfo,
  101. IN PSPUD_REQ_CONTEXT reqContext
  102. );
  103. NTSTATUS
  104. NTAPI
  105. SPUDSendAndRecv(
  106. IN HANDLE hSocket,
  107. IN struct _AFD_SEND_INFO *sendInfo,
  108. IN struct _AFD_RECV_INFO *recvInfo,
  109. IN PSPUD_REQ_CONTEXT reqContext
  110. );
  111. NTSTATUS
  112. NTAPI
  113. SPUDCancel(
  114. IN PSPUD_REQ_CONTEXT reqContext
  115. );
  116. NTSTATUS
  117. NTAPI
  118. SPUDGetCounts(
  119. OUT PSPUD_COUNTERS SpudCounts
  120. );
  121. NTSTATUS
  122. NTAPI
  123. SPUDCreateFile(
  124. OUT PHANDLE FileHandle,
  125. IN POBJECT_ATTRIBUTES ObjectAttributes,
  126. OUT PIO_STATUS_BLOCK IoStatusBlock,
  127. IN ULONG FileAttributes,
  128. IN ULONG ShareAccess,
  129. IN ULONG CreateOptions,
  130. IN SECURITY_INFORMATION SecurityInformation,
  131. OUT PSECURITY_DESCRIPTOR SecDescBuffer,
  132. IN ULONG SecDescLength,
  133. OUT PULONG SecDescLengthNeeded,
  134. IN PVOID OplockContext,
  135. IN LARGE_INTEGER OplockMaxFileSize,
  136. OUT PBOOLEAN OplockGranted,
  137. OUT PSPUD_FILE_INFORMATION FileInfo
  138. );
  139. #ifdef __cplusplus
  140. }
  141. #endif
  142. #endif // _USPUD_H_