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.

445 lines
11 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. Csc.h
  5. Abstract:
  6. This module defines the clientside cacheing interface for the SMB mini rdr.
  7. Author:
  8. Joe Linn [JoeLinn] 7-Mar-1995
  9. Revision History:
  10. --*/
  11. #include "dfsfsctl.h"
  12. #ifndef __INCLUDED__SMBMRX_CSC__
  13. #define __INCLUDED__SMBMRX_CSC__
  14. extern BOOLEAN MRxSmbIsCscEnabled;
  15. extern BOOLEAN MRxSmbIsCscEnabledForDisconnected;
  16. extern BOOLEAN MRxSmbCscTransitionEnabledByDefault;
  17. extern BOOLEAN MRxSmbEnableDisconnectedRB;
  18. extern BOOLEAN MRxSmbCscAutoDialEnabled;
  19. extern LONG vcntTransportsForCSC;
  20. #define Shared_SmbFcbAcquire SmbFcb_HeldShared
  21. #define Exclusive_SmbFcbAcquire SmbFcb_HeldExclusive
  22. #define DroppingFcbLock_SmbFcbAcquire 0x80000000
  23. #define FailImmediately_SmbFcbAcquire 0x40000000
  24. //STATUS_DISCONNECTED is supposed to be server_internal but it's defined in privinc\status.h
  25. //don't use it!!!!
  26. #undef STATUS_DISCONNECTED
  27. #define STATUSx_NOT_IMPLEMENTED_FOR_DISCONNECTED (STATUS_NOT_IMPLEMENTED)
  28. #ifdef MRXSMB_BUILD_FOR_CSC
  29. #define MRXSMB_CSC_SYMLINK_NAME L"\\??\\Shadow"
  30. #define IF_NOT_MRXSMB_CSC_ENABLED if(FALSE)
  31. extern LONG MRxSmbSpecialCopyChunkAllocationSizeMarker;
  32. NTKERNELAPI
  33. NTSTATUS
  34. IoGetRequestorSessionId(
  35. PIRP Irp,
  36. PULONG pSessionId);
  37. NTSTATUS
  38. MRxSmbInitializeCSC (
  39. PUNICODE_STRING SmbMiniRedirectorName
  40. );
  41. VOID
  42. MRxSmbUninitializeCSC (
  43. void
  44. );
  45. NTSTATUS
  46. MRxSmbCscIoCtl (
  47. IN OUT PRX_CONTEXT RxContext
  48. );
  49. NTSTATUS
  50. MRxSmbCscAcquireSmbFcb (
  51. IN OUT PRX_CONTEXT RxContext,
  52. IN ULONG TypeOfAcquirePlusFlags,
  53. OUT SMBFCB_HOLDING_STATE *SmbFcbHoldingState
  54. );
  55. VOID
  56. MRxSmbCscReleaseSmbFcb (
  57. IN OUT PRX_CONTEXT RxContext,
  58. IN SMBFCB_HOLDING_STATE *SmbFcbHoldingState
  59. );
  60. NTSTATUS
  61. MRxSmbCscReadPrologue (
  62. IN OUT PRX_CONTEXT RxContext,
  63. OUT SMBFCB_HOLDING_STATE *SmbFcbHoldingState
  64. );
  65. VOID
  66. MRxSmbCscReadEpilogue (
  67. IN OUT PRX_CONTEXT RxContext,
  68. IN OUT PNTSTATUS Status
  69. );
  70. NTSTATUS
  71. MRxSmbCscWritePrologue (
  72. IN OUT PRX_CONTEXT RxContext,
  73. OUT SMBFCB_HOLDING_STATE *SmbFcbHoldingState
  74. );
  75. VOID
  76. MRxSmbCscWriteEpilogue (
  77. IN OUT PRX_CONTEXT RxContext,
  78. IN OUT PNTSTATUS Status
  79. );
  80. VOID
  81. MRxSmbCscSetFileInfoEpilogue (
  82. IN OUT PRX_CONTEXT RxContext,
  83. IN OUT PNTSTATUS Status
  84. );
  85. BOOLEAN
  86. MRxSmbCscIsThisACopyChunkOpen (
  87. IN PRX_CONTEXT RxContext,
  88. IN BOOLEAN *lpfAgentOpen
  89. );
  90. NTSTATUS
  91. MRxSmbCscPartOfCreateVNetRoot (
  92. IN PRX_CONTEXT RxContext,
  93. IN OUT PMRX_NET_ROOT NetRoot
  94. );
  95. NTSTATUS
  96. MRxSmbCscCreatePrologue (
  97. IN OUT PRX_CONTEXT RxContext,
  98. OUT SMBFCB_HOLDING_STATE *SmbFcbHoldingState
  99. );
  100. VOID
  101. MRxSmbCscCreateEpilogue (
  102. IN OUT PRX_CONTEXT RxContext,
  103. IN OUT PNTSTATUS Status,
  104. IN SMBFCB_HOLDING_STATE *SmbFcbHoldingState
  105. );
  106. VOID
  107. MRxSmbCscDeleteAfterCloseEpilogue (
  108. IN OUT PRX_CONTEXT RxContext,
  109. IN OUT PNTSTATUS Status
  110. );
  111. VOID
  112. MRxSmbCscRenameEpilogue (
  113. IN OUT PRX_CONTEXT RxContext,
  114. IN OUT PNTSTATUS Status
  115. );
  116. VOID
  117. MRxSmbCscCloseShadowHandle (
  118. IN OUT PRX_CONTEXT RxContext
  119. );
  120. VOID
  121. MRxSmbCscUpdateShadowFromClose (
  122. SMBPSE_ORDINARY_EXCHANGE_ARGUMENT_SIGNATURE
  123. );
  124. VOID
  125. MRxSmbCscTearDownCscNetRoot (
  126. IN OUT PSMBCEDB_NET_ROOT_ENTRY pNetRootEntry
  127. );
  128. VOID
  129. MRxSmbCscDeallocateForFcb (
  130. IN OUT PMRX_FCB pFcb
  131. );
  132. VOID
  133. MRxSmbCscAgentSynchronizationOnStart (
  134. IN OUT PRX_CONTEXT RxContext
  135. );
  136. VOID
  137. MRxSmbCscAgentSynchronizationOnStop (
  138. IN OUT PRX_CONTEXT RxContext
  139. );
  140. VOID
  141. MRxSmbCscSignalNetStatus(
  142. BOOLEAN NetPresent,
  143. BOOLEAN fFirstLast
  144. );
  145. VOID
  146. MRxSmbCscReleaseRxContextFromAgentWait (
  147. void
  148. );
  149. VOID
  150. MRxSmbCscReportFileOpens (
  151. void
  152. );
  153. NTSTATUS
  154. MRxSmbCscSetSecurityPrologue (
  155. IN OUT PRX_CONTEXT RxContext
  156. );
  157. VOID
  158. MRxSmbCscSetSecurityEpilogue (
  159. IN OUT PRX_CONTEXT RxContext,
  160. IN OUT PNTSTATUS Status
  161. );
  162. BOOLEAN
  163. CscIsServerOffline(
  164. PWCHAR ServerName);
  165. NTSTATUS
  166. CscTakeServerOffline(
  167. PWCHAR ServerName);
  168. NTSTATUS
  169. CscTransitionServerToOnline(
  170. ULONG hServer);
  171. NTSTATUS
  172. CscTransitionServerToOffline(
  173. ULONG SessionId,
  174. ULONG hServer,
  175. ULONG TransitionStatus);
  176. NTSTATUS
  177. CscTransitionServerEntryForDisconnectedOperation(
  178. PSMBCEDB_SERVER_ENTRY pServerEntry,
  179. PRX_CONTEXT pRxContext,
  180. NTSTATUS RemoteStatus,
  181. BOOLEAN fInvokeAutoDial
  182. );
  183. VOID
  184. CscPrepareServerEntryForOnlineOperationFull(
  185. PSMBCEDB_SERVER_ENTRY pServerEntry);
  186. VOID
  187. CscPrepareServerEntryForOnlineOperationPartial(
  188. PSMBCEDB_SERVER_ENTRY pServerEntry);
  189. NTSTATUS
  190. CscTransitionVNetRootForDisconnectedOperation(
  191. PRX_CONTEXT RxContext,
  192. PMRX_V_NET_ROOT pVNetRoot,
  193. NTSTATUS RemoteStatus);
  194. BOOLEAN
  195. CscPerformOperationInDisconnectedMode(
  196. PRX_CONTEXT RxContext);
  197. BOOLEAN
  198. CscGetServerNameWaitingToGoOffline(
  199. OUT PWCHAR ServerName,
  200. IN OUT LPDWORD lpdwBufferSize,
  201. OUT NTSTATUS *lpStatus
  202. );
  203. BOOLEAN
  204. CscShareIdToShareName(
  205. IN ULONG hShare,
  206. OUT PWCHAR ServerName,
  207. IN OUT LPDWORD lpdwBufferSize,
  208. OUT NTSTATUS *lpStatus
  209. );
  210. NTSTATUS
  211. CscPreProcessCreateIrp(
  212. PIRP pIrp);
  213. NTSTATUS
  214. MRxSmbCscNotifyChangeDirectory(
  215. IN OUT PRX_CONTEXT RxContext
  216. );
  217. NTSTATUS
  218. MRxSmbCscCleanupFobx(
  219. IN PRX_CONTEXT RxContext
  220. );
  221. NTSTATUS
  222. MRxSmbCscInitializeNetRootEntry(
  223. PSMBCEDB_NET_ROOT_ENTRY pNetRootEntry
  224. );
  225. VOID
  226. MRxSmbCscUninitializeNetRootEntry(
  227. PSMBCEDB_NET_ROOT_ENTRY pNetRootEntry
  228. );
  229. NTSTATUS
  230. CscInitializeServerEntryDfsRoot(
  231. PRX_CONTEXT pRxContext,
  232. PSMBCEDB_SERVER_ENTRY pServerEntry
  233. );
  234. PDFS_NAME_CONTEXT
  235. CscIsValidDfsNameContext(
  236. PVOID pFsContext);
  237. BOOL
  238. CSCCheckLocalOpens(
  239. PRX_CONTEXT pRxContext
  240. );
  241. #else
  242. #ifdef MRXSMB_BUILD_FOR_CSC_DCON
  243. #error....no build-for-csc-dcon w/o build-for-csc
  244. #undef MRXSMB_BUILD_FOR_CSC_DCON
  245. #endif //ifdef MRXSMB_BUILD_FOR_CSC_DCON
  246. #define IF_MRXSMB_CSC_ENABLED if(FALSE)
  247. #define IF_NOT_MRXSMB_CSC_ENABLED if(TRUE)
  248. #define MRxSmbInitializeCSC(__name) (STATUS_SUCCESS)
  249. #define MRxSmbUninitializeCSC() {NOTHING;}
  250. #define MRxSmbCscIoCtl(__rxcontext) (STATUS_INVALID_DEVICE_REQUEST)
  251. #define MRxSmbCscReleaseSmbFcb(__rxcontext,__holdstate) {NOTHING;}
  252. #define MRxSmbCscAcquireSmbFcb(__rxcontext,__flags,__holdstate) (STATUS_SUCCESS)
  253. #define MRxSmbCscReadPrologue(__rxcontext,__holdstate) (STATUS_MORE_PROCESSING_REQUIRED)
  254. #define MRxSmbCscReadEpilogue(__rxcontext,__status) {NOTHING;}
  255. #define MRxSmbCscWritePrologue(__rxcontext,__holdstate) (STATUS_MORE_PROCESSING_REQUIRED)
  256. #define MRxSmbCscWriteEpilogue(__rxcontext,__status) {NOTHING;}
  257. #define MRxSmbCscSetFileInfoEpilogue(__rxcontext,__status) {NOTHING;}
  258. #define MRxSmbCscIsThisACopyChunkOpen(__rxcontext) (FALSE)
  259. #define MRxSmbCscPartOfCreateVNetRoot(__rxcontext,__netroot) (STATUS_NOT_IMPLEMENTED)
  260. #define MRxSmbCscCreatePrologue(__rxcontext,__holdstate) (STATUS_MORE_PROCESSING_REQUIRED)
  261. #define MRxSmbCscCreateEpilogue(__rxcontext,__status,_holdstate) {NOTHING;}
  262. #define MRxSmbCscDeleteAfterCloseEpilogue(__rxcontext,__status) {NOTHING;}
  263. #define MRxSmbCscRenameEpilogue(__rxcontext,__status) {NOTHING;}
  264. #define MRxSmbCscCloseShadowHandle(__rxcontext) {NOTHING;}
  265. // this is interesting....altho there's 2 args to the function...it's
  266. // only one in macro land.........
  267. #define MRxSmbCscUpdateShadowFromClose(__SMBPSE_OE_ARGS) {NOTHING;}
  268. #define MRxSmbCscTearDownCscNetRoot(__smbnetrootentry) {NOTHING;}
  269. #define MRxSmbCscDeallocateForFcb(pFcb) {NOTHING;}
  270. #define MRxSmbCscAgentSynchronizationOnStart(__rxc) {NOTHING;}
  271. #define MRxSmbCscAgentSynchronizationOnStop(__rxc) {NOTHING;}
  272. #define MRxSmbCscSignalNetStatus(__Flags) {NOTHING};
  273. #define MRxSmbCscReleaseRxContextFromAgentWait(__unsetflags) {NOTHING;}
  274. #define MRxSmbCscReportFileOpens() {NOTHING;}
  275. #define CscTransitionServerEntryForDisconnectedOperation(__serverentry,__status) {NOTHING;}
  276. #define CscTransitionNetRootEntryForDisconnectedOperation(__serverentry,__netrootentry,__status) {NOTHING;}
  277. #define CscPerformOperationInDisconnectedMode(__rxcontext) FALSE
  278. #define CscPreProcessCreateIrp(__Irp__) STATUS_SUCCESS
  279. #endif //ifdef MRXSMB_BUILD_FOR_CSC
  280. #ifdef MRXSMB_BUILD_FOR_CSC_DCON
  281. #define IF_MRXSMB_BUILD_FOR_DISCONNECTED_CSC if(TRUE)
  282. #define IF_NOT_MRXSMB_BUILD_FOR_DISCONNECTED_CSC if(FALSE)
  283. NTSTATUS
  284. MRxSmbCscNegotiateDisconnected(
  285. PSMBCEDB_SERVER_ENTRY pServerEntry
  286. );
  287. VOID
  288. MRxSmbCscUninitForTranportSurrogate(
  289. PSMBCEDB_SERVER_ENTRY pServerEntry
  290. );
  291. VOID
  292. MRxSmbCscInitForTranportSurrogate(
  293. PSMBCEDB_SERVER_ENTRY pServerEntry,
  294. PNTSTATUS Status
  295. );
  296. NTSTATUS
  297. MRxSmbCscDisconnectedConnect (
  298. IN OUT PSMB_CONSTRUCT_NETROOT_EXCHANGE pNetRootExchange
  299. );
  300. NTSTATUS
  301. MRxSmbDCscExtendForCache (
  302. IN OUT struct _RX_CONTEXT * RxContext,
  303. IN PLARGE_INTEGER pNewFileSize,
  304. OUT PLARGE_INTEGER pNewAllocationSize
  305. );
  306. NTSTATUS
  307. MRxSmbDCscFlush (
  308. IN OUT struct _RX_CONTEXT * RxContext
  309. );
  310. NTSTATUS
  311. MRxSmbDCscQueryVolumeInformation (
  312. IN OUT struct _RX_CONTEXT * RxContext
  313. );
  314. NTSTATUS
  315. MRxSmbDCscQueryDirectory (
  316. IN OUT struct _RX_CONTEXT * RxContext
  317. );
  318. NTSTATUS
  319. MRxSmbDCscQueryFileInfo (
  320. IN OUT struct _RX_CONTEXT * RxContext
  321. );
  322. NTSTATUS
  323. MRxSmbDCscSetFileInfo (
  324. IN OUT struct _RX_CONTEXT * RxContext
  325. );
  326. NTSTATUS
  327. MRxSmbDCscIsValidDirectory(
  328. IN OUT struct _RX_CONTEXT *RxContext,
  329. IN PUNICODE_STRING DirectoryName);
  330. #else
  331. #define SmbCscCeIsSpecialCscTransport(pServerEntry) (FALSE)
  332. #define IF_MRXSMB_BUILD_FOR_DISCONNECTED_CSC if(FALSE)
  333. #define IF_NOT_MRXSMB_BUILD_FOR_DISCONNECTED_CSC if(TRUE)
  334. #define MRxSmbCscNegotiateDisconnected(__se) (STATUS_INVALID_HANDLE)
  335. #define MRxSmbCscUninitForTranportSurrogate(__se) {NOTHING;}
  336. #define MRxSmbCscInitForTranportSurrogate(__se,__status) {NOTHING;}
  337. #define MRxSmbCscDisconnectedConnect(__cnrex) (STATUS_SUCCESS)
  338. #define MRxSmbDCscExtendForCache(__rxcontext,__a,__b) ((STATUS_MORE_PROCESSING_REQUIRED))
  339. #define MRxSmbDCscFlush(__rxcontext) ((STATUS_MORE_PROCESSING_REQUIRED))
  340. #define MRxSmbDCscQueryVolumeInformation(__rxcontext) ((STATUS_MORE_PROCESSING_REQUIRED))
  341. #define MRxSmbDCscQueryDirectory(__rxcontext) ((STATUS_MORE_PROCESSING_REQUIRED))
  342. #define MRxSmbDCscQueryFileInfo(__rxcontext) ((STATUS_MORE_PROCESSING_REQUIRED))
  343. #define MRxSmbDCscSetFileInfo(__rxcontext) ((STATUS_MORE_PROCESSING_REQUIRED))
  344. #define MRxSmbDCscIsValidDirectory(__rxcontext, _directory_name) ((STATUS_MORE_PROCESSING_REQUIRED))
  345. #endif //ifdef MRXSMB_BUILD_FOR_CSC_DCON
  346. #endif //ifndef __INCLUDED__SMBMRX_CSC__