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.

224 lines
5.6 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 1995, Microsoft Corporation
  4. //
  5. //
  6. // File: service.hxx
  7. //
  8. // Contents: A CDfsService class to make things more modular. This class
  9. // represents each service associated with a volume object.
  10. //
  11. // Classes: CDfsService
  12. //
  13. // Functions: GetPktCacheRelationInfo
  14. // DeallocateCacheRelationInfo
  15. //
  16. //--------------------------------------------------------------------------
  17. #ifndef __DFS_SERVICE_INCLUDED
  18. #define __DFS_SERVICE_INCLUDED
  19. extern "C" {
  20. #include <nodetype.h>
  21. #include <dfsmrshl.h>
  22. #include <upkt.h>
  23. #include <ntddnfs.h>
  24. #include <dfsgluon.h>
  25. }
  26. #include "custring.hxx"
  27. #include "marshal.hxx"
  28. DWORD GetPktCacheRelationInfo(
  29. PDFS_PKT_ENTRY_ID peid,
  30. PDFS_PKT_RELATION_INFO RelationInfo);
  31. VOID DeallocateCacheRelationInfo(
  32. DFS_PKT_RELATION_INFO &);
  33. //+-------------------------------------------------------------------------
  34. //
  35. // Name: CDfsService
  36. //
  37. // Synopsis: Wrapper for each service associated with the volume object.
  38. // This class abstracts the notion of a service entirely.
  39. //
  40. // Methods: CDfsService
  41. // ~CDfsService
  42. // IsEqual
  43. // GetReplicaInfo
  44. // GetMarshalSize
  45. // Serialize
  46. // DeSerialize
  47. // CreateExitPoint
  48. // DeleteExitPoint
  49. // CreateLocalVolume
  50. // DeleteLocalVolume
  51. // ModifyPrefix
  52. //
  53. //--------------------------------------------------------------------------
  54. class CDfsService
  55. {
  56. friend class CDfsServiceList;
  57. private:
  58. DFS_SERVICE _DfsPktService;
  59. DFS_REPLICA_INFO _DfsReplicaInfo;
  60. CDfsService *Next, *Prev;
  61. FILETIME _ftModification;
  62. //
  63. // A private constructor called by DeSerialize.
  64. //
  65. CDfsService();
  66. DWORD DeSerialize(
  67. PBYTE buffer,
  68. ULONG size);
  69. BOOL SyncKnowledge();
  70. BOOL VerifyStgIdInUse(
  71. PUNICODE_STRING pustrStgId);
  72. FILETIME GetModificationTime() {
  73. return( _ftModification );
  74. }
  75. VOID SetModificationTime(
  76. FILETIME ft) {
  77. _ftModification = ft;
  78. }
  79. public:
  80. //
  81. // Destructor for Class
  82. //
  83. ~CDfsService();
  84. //
  85. // Constructors and initializers for Class
  86. //
  87. CDfsService(
  88. PDFS_REPLICA_INFO pReplicaInfo,
  89. BOOLEAN bCreatePktSvc,
  90. DWORD *pdwErr);
  91. DWORD InitializePktSvc();
  92. //
  93. // These methods simply manipulate the local state of this class -
  94. // they do not involve any operation on the remote server abstracted
  95. // by this class.
  96. //
  97. VOID SetCreateTime();
  98. BOOLEAN IsEqual(
  99. PDFS_REPLICA_INFO pReplicaInfo );
  100. PWCHAR GetServiceName() {
  101. return( _DfsReplicaInfo.pwszServerName );
  102. }
  103. PWCHAR GetShareName() {
  104. return( _DfsReplicaInfo.pwszShareName );
  105. }
  106. PDFS_REPLICA_INFO GetReplicaInfo() {
  107. return(&_DfsReplicaInfo);
  108. }
  109. PDFS_SERVICE GetDfsService() {
  110. return(&_DfsPktService);
  111. }
  112. DWORD GetNetStorageInfo(
  113. LPDFS_STORAGE_INFO pInfo,
  114. LPDWORD pcbInfo);
  115. //
  116. // Methods to support marshalling of Service Information.
  117. //
  118. ULONG GetMarshalSize();
  119. VOID Serialize(
  120. BYTE *buffer,
  121. ULONG size);
  122. static DWORD DeSerialize(
  123. PBYTE buffer,
  124. ULONG size,
  125. CDfsService **ppService);
  126. //
  127. // These are the remoted operations supported by this class.
  128. // i.e. these operations go over the net through I_NetDfsXXX calls
  129. // to do remote operations on the server abstracted by this class
  130. //
  131. DWORD CreateExitPoint(
  132. PDFS_PKT_ENTRY_ID peid,
  133. ULONG Type);
  134. DWORD DeleteExitPoint(
  135. PDFS_PKT_ENTRY_ID peid,
  136. ULONG Type);
  137. DWORD CreateLocalVolume(
  138. PDFS_PKT_ENTRY_ID peid,
  139. ULONG EntryType);
  140. DWORD DeleteLocalVolume(
  141. PDFS_PKT_ENTRY_ID peid);
  142. DWORD SetVolumeState(
  143. const PDFS_PKT_ENTRY_ID peid,
  144. const ULONG fState,
  145. const BOOL fRemoteOpMustSucceed);
  146. DWORD FixLocalVolume(
  147. PDFS_PKT_ENTRY_ID peid,
  148. ULONG EntryType);
  149. DWORD ModifyPrefix(
  150. PDFS_PKT_ENTRY_ID peid);
  151. };
  152. //+----------------------------------------------------------------------
  153. //
  154. // Member: CDfsService::GetMarshalSize, public
  155. //
  156. // Synopsis: Returns the size of a buffer required to marshall this
  157. // service.
  158. //
  159. // Arguments: None
  160. //
  161. // Returns: The Size of the buffer requuired.
  162. //
  163. // History: 12-May-93 SudK Created.
  164. //
  165. //-----------------------------------------------------------------------
  166. inline ULONG CDfsService::GetMarshalSize()
  167. {
  168. ULONG size = 0L;
  169. NTSTATUS status;
  170. status = DfsRtlSize(&MiFileTime, &_ftModification, &size);
  171. ASSERT( NT_SUCCESS(status) );
  172. status = DfsRtlSize(&MiDfsReplicaInfo, &_DfsReplicaInfo, &size);
  173. ASSERT(NT_SUCCESS(status));
  174. return(size);
  175. }
  176. #endif // __DFS_SERVICE_INCLUDED