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.

214 lines
4.9 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. lmorepld.hxx
  7. Class declarations for the REPL_DIR_BASE class.
  8. REPL_DIR_BASE is an abstract superclass that contains common methods
  9. and data members shared between the REPL_EDIR_? and REPL_IDIR_?
  10. classes.
  11. The classes are structured as follows:
  12. LOC_LM_OBJ
  13. |
  14. \---REPL_DIR_BASE
  15. |
  16. +---REPL_EDIR
  17. | |
  18. | \---REPL_EDIR_0
  19. | |
  20. | \---REPL_EDIR_1
  21. | |
  22. | \---REPL_EDIR_2
  23. |
  24. \---REPL_IDIR
  25. |
  26. \---REPL_IDIR_0
  27. |
  28. \---REPL_IDIR_1
  29. FILE HISTORY:
  30. KeithMo 20-Feb-1992 Created for the Server Manager.
  31. */
  32. #ifndef _LMOREPLD_HXX_
  33. #define _LMOREPLD_HXX_
  34. #include "string.hxx"
  35. #include "strlst.hxx"
  36. #include "lmobj.hxx"
  37. /*************************************************************************
  38. NAME: REPL_DIR_BASE
  39. SYNOPSIS: Abstract superclass for the Replicator Export/Import
  40. Directory classes.
  41. INTERFACE: REPL_DIR_BASE - Class constructor.
  42. ~REPL_DIR_BASE - Class destructor.
  43. QueryDirName - Returns the directory name.
  44. SetDirName - Sets the directory name.
  45. QueryName - Returns the target server's name.
  46. QueryReplInfoLevel - Returns the info-level this
  47. object represents.
  48. QueryReplBufferSize - Returns the size (in BYTEs) of
  49. the info structure used by this
  50. object.
  51. PARENT: LOC_LM_OBJ
  52. USES: NLS_STR
  53. HISTORY:
  54. KeithMo 20-Feb-1992 Created for the Server Manager.
  55. **************************************************************************/
  56. DLL_CLASS REPL_DIR_BASE : public LOC_LM_OBJ
  57. {
  58. private:
  59. //
  60. // These data members cache the values retrieved
  61. // from the REPL_DIR_BASE_INFO_0 structure.
  62. //
  63. NLS_STR _nlsDirName;
  64. //
  65. // This is the API info-level this object represents.
  66. //
  67. UINT _nInfoLevel;
  68. //
  69. // This is the size of the NetReplXxx data structure
  70. // used for this object. We need this so that we can
  71. // put a common I_CreateNew method here and not sprinkle
  72. // many copies around the class heirarchy.
  73. //
  74. UINT _cbBuffer;
  75. //
  76. // This is the "lock bias". This data member's initial
  77. // value is zero. Everytime LockDirectory() is called,
  78. // this value is incremented. Everytime UnlockDirectory()
  79. // is called, this value is decremented. At I_WriteInfo()
  80. // and I_WriteNew() time, this value is used to determine
  81. // how many NetReplXxxDirLock() & NetReplXxxDirUnlock()
  82. // APIs to invoke.
  83. //
  84. INT _nLockBias;
  85. //
  86. // This private virtual callback extracts & caches any
  87. // data from an API buffer which must be "persistant".
  88. //
  89. virtual APIERR W_CacheApiData( const BYTE * pbBuffer ) = 0;
  90. protected:
  91. //
  92. // These protected accessors should only be invoked
  93. // by this class or derived subclasses.
  94. //
  95. APIERR SetDirName( const TCHAR * pszDirName );
  96. //
  97. // These methods access the current info-level.
  98. //
  99. UINT QueryReplInfoLevel( VOID ) const
  100. { return _nInfoLevel; }
  101. VOID SetReplInfoLevel( UINT nInfoLevel )
  102. { _nInfoLevel = nInfoLevel; }
  103. //
  104. // These methods access the current buffer size.
  105. //
  106. UINT QueryReplBufferSize( VOID ) const
  107. { return _cbBuffer; }
  108. VOID SetReplBufferSize( UINT cbBuffer )
  109. { _cbBuffer = cbBuffer; }
  110. //
  111. // This virtual callback is called by NEW_LM_OBJ to
  112. // create a new object. This method will call the
  113. // W_CreateNew helper, then initialize the API buffer.
  114. // This method does not invoke any network API.
  115. //
  116. virtual APIERR I_CreateNew( VOID );
  117. //
  118. // This virtual helper is called by I_WriteInfo and
  119. // I_WriteNew to setup the necessary data structures
  120. // before the network API is invoked.
  121. //
  122. virtual APIERR W_Write( VOID ) = 0;
  123. //
  124. // Since this is an abstract superclass, its constructor
  125. // is protected.
  126. //
  127. REPL_DIR_BASE( const TCHAR * pszServerName,
  128. const TCHAR * pszDirName );
  129. public:
  130. ~REPL_DIR_BASE( VOID );
  131. //
  132. // Accessor methods.
  133. //
  134. const TCHAR * QueryDirName( VOID ) const
  135. { return _nlsDirName.QueryPch(); }
  136. INT QueryLockBias( VOID ) const
  137. { return _nLockBias; }
  138. VOID SetLockBias( ULONG lLockBias )
  139. { _nLockBias = lLockBias; }
  140. //
  141. // Provide access to the target server's name.
  142. //
  143. const TCHAR * QueryName( VOID ) const
  144. { return LOC_LM_OBJ::QueryServer(); }
  145. //
  146. // Lock/Unlock the directory.
  147. //
  148. APIERR LockDirectory( VOID )
  149. { _nLockBias++; return NERR_Success; }
  150. APIERR UnlockDirectory( VOID )
  151. { _nLockBias--; return NERR_Success; }
  152. }; // class REPL_DIR_BASE
  153. #endif // _LMOREPLD_HXX_