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.

312 lines
7.4 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. lmorepli.hxx
  7. Class declarations for the REPL_IDIR_BASE and REPL_IDIR_x classes.
  8. REPL_IDIR_BASE is an abstract superclass that contains common methods
  9. and data members shared between the REPL_IDIR_x classes.
  10. The REPL_IDIR_x classes each represent a different info-level "view"
  11. of an imported directory in the Replicator's import path.
  12. The classes are structured as follows:
  13. LOC_LM_OBJ
  14. |
  15. \---REPL_DIR_BASE
  16. |
  17. \---REPL_IDIR_BASE
  18. |
  19. \---REPL_IDIR_0
  20. |
  21. \---REPL_IDIR_1
  22. FILE HISTORY:
  23. KeithMo 20-Feb-1992 Created for the Server Manager.
  24. */
  25. #ifndef _LMOREPLI_HXX_
  26. #define _LMOREPLI_HXX_
  27. #include "lmorepld.hxx"
  28. /*************************************************************************
  29. NAME: REPL_IDIR_BASE
  30. SYNOPSIS: Abstract superclass for the Replicator Import Directory
  31. classes.
  32. INTERFACE: REPL_IDIR_BASE - Class constructor.
  33. ~REPL_IDIR_BASE - Class destructor.
  34. PARENT: REPL_DIR_BASE
  35. HISTORY:
  36. KeithMo 20-Feb-1992 Created for the Server Manager.
  37. **************************************************************************/
  38. DLL_CLASS REPL_IDIR_BASE : public REPL_DIR_BASE
  39. {
  40. protected:
  41. //
  42. // These virtual callbacks are called by NEW_LM_OBJ to
  43. // invoke any necessary NetReplImportDir{Get,Set}Info API.
  44. //
  45. virtual APIERR I_GetInfo( VOID );
  46. virtual APIERR I_WriteInfo( VOID );
  47. //
  48. // This virtual callback is invoked by NEW_LM_OBJ to
  49. // delete an existing object. This method will invoke
  50. // the NetReplImportDirDel API.
  51. //
  52. virtual APIERR I_Delete( UINT nForce );
  53. //
  54. // This virtual callback is invoked by NEW_LM_OBJ to
  55. // create a new object. This method will invoke the
  56. // NetReplImportDirAdd API.
  57. //
  58. virtual APIERR I_WriteNew( VOID );
  59. //
  60. // This virtual helper is called by I_WriteInfo and
  61. // I_WriteNew to setup the necessary data structures
  62. // before the network API is invoked.
  63. //
  64. virtual APIERR W_Write( VOID ) = 0;
  65. //
  66. // This private virtual callback extracts & caches any
  67. // data from an API buffer which must be "persistant".
  68. //
  69. virtual APIERR W_CacheApiData( const BYTE * pbBuffer ) = 0;
  70. //
  71. // This method will invoke the appropriate number of
  72. // NetReplImportDirLock() & NetReplImportDirUnlock() API
  73. // as required by the current lock bias (as stored in
  74. // REPL_DIR_BASE).
  75. //
  76. APIERR W_AdjustLocks( VOID );
  77. //
  78. // Since this is an abstract superclass, its constructor
  79. // is protected.
  80. //
  81. REPL_IDIR_BASE( const TCHAR * pszServerName,
  82. const TCHAR * pszDirName );
  83. public:
  84. ~REPL_IDIR_BASE( VOID );
  85. }; // class REPL_IDIR_BASE
  86. /*************************************************************************
  87. NAME: REPL_IDIR_0
  88. SYNOPSIS: Info-level 0 Replicator Import Directory class.
  89. INTERFACE: REPL_IDIR_0 - Class constructor.
  90. ~REPL_IDIR_0 - Class destructor.
  91. PARENT: REPL_IDIR_BASE
  92. HISTORY:
  93. KeithMo 20-Feb-1992 Created for the Server Manager.
  94. **************************************************************************/
  95. DLL_CLASS REPL_IDIR_0 : public REPL_IDIR_BASE
  96. {
  97. private:
  98. //
  99. // This helper function is called by I_WriteInfo and
  100. // I_WriteNew to setup the REPL_IDIR_INFO_0 structure.
  101. //
  102. virtual APIERR W_Write( VOID );
  103. protected:
  104. //
  105. // This virtual callback is called by I_CreateNew to
  106. // initialize the data members for a new object. This
  107. // method must always invoke its parent method before
  108. // anything else. This method does not invoke any
  109. // network API.
  110. //
  111. virtual APIERR W_CreateNew( VOID );
  112. //
  113. // This private virtual callback extracts & caches any
  114. // data from an API buffer which must be "persistant".
  115. //
  116. virtual APIERR W_CacheApiData( const BYTE * pbBuffer );
  117. public:
  118. //
  119. // Usual constructor/destructor goodies.
  120. //
  121. REPL_IDIR_0( const TCHAR * pszServerName,
  122. const TCHAR * pszDirName );
  123. ~REPL_IDIR_0( VOID );
  124. }; // class REPL_IDIR_0
  125. /*************************************************************************
  126. NAME: REPL_IDIR_1
  127. SYNOPSIS: Info-level 1 Replicator Import Directory class.
  128. INTERFACE: REPL_IDIR_1 - Class constructor.
  129. ~REPL_IDIR_1 - Class destructor.
  130. QueryState - Returns the directory state.
  131. SetState - Sets the directory state.
  132. QueryMasterName - Returns the name of the master
  133. (exporter) which most recently
  134. exported to this directory.
  135. SetMasterName - Sets the master name.
  136. QueryLastUpdateTime - Returns the number of seconds
  137. since the directory was last
  138. updated.
  139. SetLastUpdateTime - Sets the last update time.
  140. QueryLockCount - Returns the directory lock count.
  141. SetLockCount - Sets the directory lock count.
  142. QueryLockTime - Returns the number of seconds
  143. since the directory was last
  144. locked.
  145. SetLockTime - Sets the lock time.
  146. PARENT: REPL_IDIR_0
  147. HISTORY:
  148. KeithMo 20-Feb-1992 Created for the Server Manager.
  149. **************************************************************************/
  150. DLL_CLASS REPL_IDIR_1 : public REPL_IDIR_0
  151. {
  152. private:
  153. //
  154. // These data members cache the values retrieved
  155. // from the REPL_IDIR_INFO_1 structure.
  156. //
  157. ULONG _lState;
  158. NLS_STR _nlsMasterName;
  159. ULONG _lLastUpdateTime;
  160. ULONG _lLockCount;
  161. ULONG _lLockTime;
  162. //
  163. // This helper function is called by I_WriteInfo and
  164. // I_WriteNew to setup the REPL_IDIR_INFO_1 structure.
  165. //
  166. virtual APIERR W_Write( VOID );
  167. protected:
  168. //
  169. // This virtual callback is called by I_CreateNew to
  170. // initialize the data members for a new object. This
  171. // method must always invoke its parent method before
  172. // anything else. This method does not invoke any
  173. // network API.
  174. //
  175. virtual APIERR W_CreateNew( VOID );
  176. //
  177. // This private virtual callback extracts & caches any
  178. // data from an API buffer which must be "persistant".
  179. //
  180. virtual APIERR W_CacheApiData( const BYTE * pbBuffer );
  181. //
  182. // Since these fields are not dynamically settable,
  183. // their set methods are protected.
  184. //
  185. VOID SetState( ULONG lState )
  186. { _lState = lState; }
  187. APIERR SetMasterName( const TCHAR * pszMasterName );
  188. VOID SetLastUpdateTime( ULONG lLastUpdateTime )
  189. { _lLastUpdateTime = lLastUpdateTime; }
  190. VOID SetLockCount( ULONG lLockCount )
  191. { _lLockCount = lLockCount; }
  192. VOID SetLockTime( ULONG lLockTime )
  193. { _lLockTime = lLockTime; }
  194. public:
  195. //
  196. // Usual constructor/destructor goodies.
  197. //
  198. REPL_IDIR_1( const TCHAR * pszServerName,
  199. const TCHAR * pszDirName );
  200. ~REPL_IDIR_1( VOID );
  201. //
  202. // Accessor methods.
  203. //
  204. ULONG QueryState( VOID ) const
  205. { return _lState; }
  206. const TCHAR * QueryMasterName( VOID ) const
  207. { return _nlsMasterName.QueryPch(); }
  208. ULONG QueryLastUpdateTime( VOID ) const
  209. { return _lLastUpdateTime; }
  210. ULONG QueryLockCount( VOID ) const
  211. { return _lLockCount; }
  212. ULONG QueryLockTime( VOID ) const
  213. { return _lLockTime; }
  214. }; // class REPL_IDIR_1
  215. #endif // _LMOREPLI_HXX_