Leaked source code of windows server 2003
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.

230 lines
5.1 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. smbtrsup.h
  5. Abstract:
  6. This module provides the interface to the kernel mode SmbTrace
  7. component within the LanMan server and redirector.
  8. The interface providing user-level access to SmbTrace is found in
  9. nt\private\inc\smbtrace.h
  10. Author:
  11. Stephan Mueller (t-stephm) 20-July-1992
  12. Revision History:
  13. 20-July-1992 t-stephm
  14. Created
  15. --*/
  16. #ifndef _SMBTRSUP_
  17. #define _SMBTRSUP_
  18. //
  19. // Selection of components in which SmbTrace will run.
  20. // Pass the appropriate value to SmbTraceStart and SmbTraceStop,
  21. // and test the appropriate element of SmbTraceActive and
  22. // SmbTraceTransitioning. The actual tracing calls do not require
  23. // a Component parameter as it is implied by the routine being called.
  24. //
  25. typedef enum _SMBTRACE_COMPONENT {
  26. SMBTRACE_SERVER,
  27. SMBTRACE_REDIRECTOR
  28. } SMBTRACE_COMPONENT;
  29. extern BOOLEAN SmbTraceActive[];
  30. //
  31. // SmbTrace support exported routines
  32. //
  33. //
  34. // Initialize the SMB tracing package
  35. //
  36. NTSTATUS
  37. SmbTraceInitialize (
  38. IN SMBTRACE_COMPONENT Component
  39. );
  40. //
  41. // Terminate the SMB tracing package
  42. //
  43. VOID
  44. SmbTraceTerminate (
  45. IN SMBTRACE_COMPONENT Component
  46. );
  47. //
  48. // Start tracing
  49. //
  50. NTSTATUS
  51. SmbTraceStart(
  52. IN ULONG InputBufferLength,
  53. IN ULONG OutputBufferLength,
  54. IN OUT PVOID ConfigInOut,
  55. IN PFILE_OBJECT FileObject,
  56. IN SMBTRACE_COMPONENT Component
  57. );
  58. //
  59. // Stop tracing
  60. //
  61. NTSTATUS
  62. SmbTraceStop(
  63. IN PFILE_OBJECT FileObject OPTIONAL,
  64. IN SMBTRACE_COMPONENT Component
  65. );
  66. //
  67. // VOID
  68. // SMBTRACE_SRV(
  69. // IN PMDL SmbMdl,
  70. // )
  71. //
  72. // Routine description:
  73. //
  74. // If SmbTrace is turned on, this macro calls SmbTraceCompleteSrv
  75. // to send the SMB to the smbtrace program in user mode. This routine
  76. // is specific to the LanMan server. Use it for tracing an SMB
  77. // contained in an Mdl.
  78. //
  79. // Arguments:
  80. //
  81. // SmbMdl - a pointer to the Mdl containing the SMB that is about
  82. // to be sent.
  83. //
  84. // Return Value:
  85. //
  86. // None
  87. //
  88. #define SMBTRACE_SRV(smbmdl) \
  89. if ( SmbTraceActive[SMBTRACE_SERVER] ) { \
  90. SmbTraceCompleteSrv( (smbmdl), NULL, 0 ); \
  91. }
  92. //
  93. // VOID
  94. // SMBTRACE_SRV2(
  95. // IN PVOID Smb,
  96. // IN ULONG SmbLength
  97. // )
  98. //
  99. // Routine description:
  100. //
  101. // If SmbTrace is turned on, this macro calls SmbTraceCompleteSrv
  102. // to send the SMB to the smbtrace program in user mode. This routine
  103. // is specific to the LanMan server. Use it for tracing an SMB
  104. // found in contiguous memory.
  105. //
  106. // Arguments:
  107. //
  108. // Smb - a pointer to the SMB that is about to be sent.
  109. //
  110. // SmbLength - the length of the SMB.
  111. //
  112. // Return Value:
  113. //
  114. // None
  115. //
  116. #define SMBTRACE_SRV2(smb,smblength) \
  117. if ( SmbTraceActive[SMBTRACE_SERVER] ) { \
  118. SmbTraceCompleteSrv( NULL, (smb), (smblength) ); \
  119. }
  120. //
  121. // Identify a packet for tracing in the server.
  122. // Do not call this routine directly, always use the SMBTRACE_SRV macro
  123. //
  124. VOID
  125. SmbTraceCompleteSrv (
  126. IN PMDL SmbMdl,
  127. IN PVOID Smb,
  128. IN CLONG SmbLength
  129. );
  130. //
  131. // VOID
  132. // SMBTRACE_RDR(
  133. // IN PMDL SmbMdl
  134. // )
  135. //
  136. // Routine description:
  137. //
  138. // If SmbTrace is turned on, this macro calls SmbTraceCompleteRdr
  139. // to send the SMB to the smbtrace program in user mode. This routine
  140. // is specific to the LanMan redirector. Use it for tracing an SMB
  141. // contained in an Mdl.
  142. //
  143. // Arguments:
  144. //
  145. // SmbMdl - a pointer to the Mdl containing the SMB that is about
  146. // to be sent.
  147. //
  148. // Return Value:
  149. //
  150. // None
  151. //
  152. #define SMBTRACE_RDR(smbmdl) \
  153. if ( SmbTraceActive[SMBTRACE_REDIRECTOR] ) { \
  154. SmbTraceCompleteRdr( (smbmdl), NULL, 0 ); \
  155. }
  156. //
  157. // VOID
  158. // SMBTRACE_RDR2(
  159. // IN PVOID Smb,
  160. // IN ULONG SmbLength
  161. // )
  162. //
  163. // Routine description:
  164. //
  165. // If SmbTrace is turned on, this macro calls SmbTraceCompleteRdr
  166. // to send the SMB to the smbtrace program in user mode. This routine
  167. // is specific to the LanMan redirector. Use it for tracing an SMB
  168. // found in contiguous memory.
  169. //
  170. // Arguments:
  171. //
  172. // Smb - a pointer to the SMB that is about to be sent.
  173. //
  174. // SmbLength - the length of the SMB.
  175. //
  176. // Return Value:
  177. //
  178. // None
  179. //
  180. #define SMBTRACE_RDR2(smb,smblength) \
  181. if ( SmbTraceActive[SMBTRACE_REDIRECTOR] ) { \
  182. SmbTraceCompleteRdr( NULL, (smb), (smblength) ); \
  183. }
  184. //
  185. // Identify a packet for tracing in the redirector.
  186. // Do not call this routine directly, always use one of the SMBTRACE_RDR
  187. // macros.
  188. //
  189. VOID
  190. SmbTraceCompleteRdr (
  191. IN PMDL SmbMdl,
  192. IN PVOID Smb,
  193. IN CLONG SmbLength
  194. );
  195. #endif // _SMBTRSUP_