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.

216 lines
8.7 KiB

  1. // Copyright (c) 1996-1999 Microsoft Corporation
  2. //+============================================================================
  3. //
  4. // wksconfig.hxx
  5. //
  6. // This file provides the configuration info for the trkwks service.
  7. // All of these values have defaults but can be configured with registry
  8. // settings. Some of these values can be updated at run-time.
  9. //
  10. //+============================================================================
  11. #ifndef _TRKWKS_CONFIG_HXX_
  12. #define _TRKWKS_CONFIG_HXX_
  13. // The following are configuration parameter numers
  14. #define REFRESH_PERIOD_CONFIG 0
  15. #define REFRESH_HESITATION_CONFIG 1
  16. #define REFRESH_RETRY_MIN_CONFIG 2
  17. #define REFRESH_RETRY_MAX_CONFIG 3
  18. #define PORT_THREAD_KEEP_ALIVE_TIME_CONFIG 4
  19. #define MAX_REFERRALS_CONFIG 5
  20. #define PORT_NOTIFY_ERROR_CONFIG 6
  21. #define MIN_LOG_KB_CONFIG 7
  22. #define MAX_LOG_KB_CONFIG 8
  23. #define LOG_DELTA_KB_CONFIG 9
  24. #define LOG_OVERWRITE_AGE_CONFIG 10
  25. #define LOG_FILE_OPEN_TIME_CONFIG 11
  26. #define VOL_FREQUENT_TASKS_PERIOD_CONFIG 12
  27. #define VOL_INFREQUENT_TASKS_PERIOD_CONFIG 13
  28. #define VOL_INIT_INITIAL_DELAY_CONFIG 14
  29. #define VOL_INIT_RETRY_DELAY1_CONFIG 15
  30. #define VOL_INIT_RETRY_DELAY2_CONFIG 16
  31. #define VOL_INIT_LIFETIME_CONFIG 17
  32. #define VOL_NOT_OWNED_EXPIRE_LIMIT_CONFIG 18
  33. #define VOL_PERIODIC_TASKS_HESITATION_CONFIG 19
  34. #define MOVE_NOTIFY_TIMEOUT_CONFIG 20
  35. #define MIN_MOVE_NOTIFY_RETRY_CONFIG 21
  36. #define MAX_MOVE_NOTIFY_RETRY_CONFIG 22
  37. #define MAX_MOVE_NOTIFY_LIFETIME_CONFIG 23
  38. #define OBJID_INDEX_REOPEN_CONFIG 24
  39. #define OBJID_INDEX_REOPEN_RETRY_MAX_CONFIG 25
  40. #define OBJID_INDEX_REOPEN_RETRY_MIN_CONFIG 26
  41. #define OBJID_INDEX_REOPEN_LIFETIME_CONFIG 27
  42. #define IGNORE_MOVES_AND_DELETES_CONFIG 28
  43. #define BREAK_ON_ERRORS_CONFIG 29
  44. #define DELETE_NOTIFY_TIMEOUT_CONFIG 30
  45. #define MAX_TUNNEL_DELAY_CONFIG 31
  46. #define MAX_SENDS_PER_MOVE_NOTIFY_CONFIG 32
  47. #define WKS_MAX_RPC_CALLS_CONFIG 33
  48. #define VOLCACHE_TIME_TO_LIVE_CONFIG 34
  49. #define MAX_DELETE_NOTIFY_QUEUE_CONFIG 35
  50. #define MAX_DELETE_NOTIFY_ATTEMPTS_CONFIG 36
  51. #define MAX_TRKWKS_CONFIG 36
  52. //+----------------------------------------------------------------------------
  53. //
  54. // CTrkWksConfiguration
  55. //
  56. // This class maintains the trkwks service configuration information.
  57. // All parameters are defaulted, but may be modified via registry
  58. // values, and some may be modified dynamically at run-time.
  59. //
  60. //+----------------------------------------------------------------------------
  61. class CTrkWksConfiguration : public CTrkConfiguration
  62. {
  63. public:
  64. CTrkWksConfiguration()
  65. {
  66. memset( this, 0, sizeof(*this) );
  67. }
  68. ~CTrkWksConfiguration()
  69. {
  70. UnInitialize();
  71. }
  72. public:
  73. void Initialize( BOOL fPersitable = FALSE );
  74. void UnInitialize();
  75. public:
  76. inline DWORD GetParameter( DWORD dwParameter ) const;
  77. inline const TCHAR * GetParameterName( DWORD dwParameter) const;
  78. inline DWORD GetParameterCount() const;
  79. inline BOOL IsParameterDynamic( DWORD dwParameter ) const;
  80. BOOL SetParameter( DWORD dwParameter, DWORD dwValue );
  81. BOOL PersistParameter( DWORD dwParameter, DWORD dwValue );
  82. private:
  83. // Dbgout an error and raise an exception
  84. void ProcessInvalidParameter( DWORD dwParameter ) const;
  85. // For backwards-compatibility with the old CTrkWksConfiguration implementation
  86. public:
  87. DWORD GetRefreshPeriod() const { return _Parameters[ REFRESH_PERIOD_CONFIG ].dwValue; }
  88. DWORD GetPortNotifyError() const { return _Parameters[ PORT_NOTIFY_ERROR_CONFIG ].dwValue; }
  89. DWORD GetPortThreadKeepAliveTime() const { return _Parameters[ PORT_THREAD_KEEP_ALIVE_TIME_CONFIG ].dwValue; }
  90. DWORD GetMaxReferrals() const { return _Parameters[ MAX_REFERRALS_CONFIG ].dwValue; }
  91. DWORD GetRefreshRetryMin() const { return _Parameters[ REFRESH_RETRY_MIN_CONFIG ].dwValue; }
  92. DWORD GetRefreshRetryMax() const { return _Parameters[ REFRESH_RETRY_MAX_CONFIG ].dwValue; }
  93. DWORD GetRefreshHesitation() const { return _Parameters[ REFRESH_HESITATION_CONFIG ].dwValue; }
  94. DWORD GetMinLogKB() const { return _Parameters[ MIN_LOG_KB_CONFIG ].dwValue; }
  95. DWORD GetMaxLogKB() const { return _Parameters[ MAX_LOG_KB_CONFIG ].dwValue; }
  96. DWORD GetLogDeltaKB() const { return _Parameters[ LOG_DELTA_KB_CONFIG ].dwValue; }
  97. DWORD GetLogOverwriteAge() const { return _Parameters[ LOG_OVERWRITE_AGE_CONFIG ].dwValue; }
  98. DWORD GetLogFileOpenTime() const { return _Parameters[ LOG_FILE_OPEN_TIME_CONFIG ].dwValue; }
  99. DWORD GetVolFrequentTasksPeriod() const { return _Parameters[ VOL_FREQUENT_TASKS_PERIOD_CONFIG ].dwValue; }
  100. DWORD GetVolInfrequentTasksPeriod() const { return _Parameters[ VOL_INFREQUENT_TASKS_PERIOD_CONFIG ].dwValue; }
  101. DWORD GetVolInitInitialDelay() const { return _Parameters[ VOL_INIT_INITIAL_DELAY_CONFIG ].dwValue; }
  102. DWORD GetVolInitRetryDelay1() const { return _Parameters[ VOL_INIT_RETRY_DELAY1_CONFIG ].dwValue; }
  103. DWORD GetVolInitRetryDelay2() const { return _Parameters[ VOL_INIT_RETRY_DELAY2_CONFIG ].dwValue; }
  104. DWORD GetVolInitLifetime() const { return _Parameters[ VOL_INIT_LIFETIME_CONFIG ].dwValue; }
  105. DWORD GetVolNotOwnedExpireLimit() const { return _Parameters[ VOL_NOT_OWNED_EXPIRE_LIMIT_CONFIG ].dwValue; }
  106. DWORD GetBreakOnErrors() const { return _Parameters[ BREAK_ON_ERRORS_CONFIG ].dwValue; }
  107. DWORD GetVolPeriodicTasksHesitation() const { return _Parameters[ VOL_PERIODIC_TASKS_HESITATION_CONFIG ].dwValue; }
  108. DWORD GetObjIdIndexReopen() const { return _Parameters[ OBJID_INDEX_REOPEN_CONFIG ].dwValue; }
  109. DWORD GetObjIdIndexReopenRetryMax() const { return _Parameters[ OBJID_INDEX_REOPEN_RETRY_MAX_CONFIG ].dwValue; }
  110. DWORD GetObjIdIndexReopenRetryMin() const { return _Parameters[ OBJID_INDEX_REOPEN_RETRY_MIN_CONFIG ].dwValue; }
  111. DWORD GetObjIdIndexReopenLifetime() const { return _Parameters[ OBJID_INDEX_REOPEN_LIFETIME_CONFIG ].dwValue; }
  112. DWORD GetDeleteNotifyTimeout() const { return _Parameters[ DELETE_NOTIFY_TIMEOUT_CONFIG ].dwValue; }
  113. DWORD GetMaxTunnelDelay() const { return _Parameters[ MAX_TUNNEL_DELAY_CONFIG ].dwValue; }
  114. DWORD GetMaxSendsPerMoveNotify() const { return _Parameters[ MAX_SENDS_PER_MOVE_NOTIFY_CONFIG ].dwValue; }
  115. DWORD GetWksMaxRpcCalls() const { return _Parameters[ WKS_MAX_RPC_CALLS_CONFIG ].dwValue; }
  116. DWORD GetIgnoreMovesAndDeletes() const { return _Parameters[ IGNORE_MOVES_AND_DELETES_CONFIG ].dwValue; };
  117. private:
  118. static STrkConfigRecord _Parameters[];
  119. public:
  120. BOOL _fInitialized:1;
  121. // Run-time parameters
  122. BOOL _fIsWorkgroup:1;
  123. ULONG _cParameters;
  124. };
  125. // --------------------------------------
  126. // CTrkWksConfiguration::GetParameter
  127. // Get a parameter value given its index.
  128. // --------------------------------------
  129. inline DWORD
  130. CTrkWksConfiguration::GetParameter( DWORD dwParameter ) const
  131. {
  132. if( dwParameter >= _cParameters )
  133. {
  134. ProcessInvalidParameter( dwParameter ); // Raises
  135. return( 0 );
  136. }
  137. return _Parameters[ dwParameter ].dwValue;
  138. }
  139. // ----------------------------------------------
  140. // CTrkWksConfiguration::GetParameterName
  141. // Get a parameter value's name, given its index.
  142. // ----------------------------------------------
  143. inline const TCHAR *
  144. CTrkWksConfiguration::GetParameterName( DWORD dwParameter) const
  145. {
  146. return _Parameters[ dwParameter ].ptszName;
  147. }
  148. // ---------------------------------------
  149. // CTrkWksConfiguration::GetParameterCount
  150. // Get the total number of parameters
  151. // ---------------------------------------
  152. inline DWORD
  153. CTrkWksConfiguration::GetParameterCount() const
  154. {
  155. return _cParameters;
  156. }
  157. // ------------------------------------------------
  158. // CTrkWksConfiguration::IsParameterDynamic
  159. // Determine if a parameter may be set at run-time.
  160. // ------------------------------------------------
  161. inline BOOL
  162. CTrkWksConfiguration::IsParameterDynamic( DWORD dwParameter ) const
  163. {
  164. if( dwParameter >= _cParameters )
  165. {
  166. ProcessInvalidParameter( dwParameter );
  167. return( FALSE );
  168. }
  169. return( 0 != (_Parameters[ dwParameter ].dwFlags & TRKCONFIG_DYNAMIC) );
  170. }
  171. #endif // #ifndef _TRKWKS_CONFIG_HXX_