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.

493 lines
18 KiB

  1. #ifndef _WINSCNST_H_
  2. #define _WINSCNST_H_
  3. /*
  4. macros
  5. */
  6. //
  7. // Default values for the various time intervals
  8. //
  9. #define FORTY_MTS 2400
  10. #define TWO_HOURS 7200
  11. #define TWO_DAYS (172800)
  12. #define ONEDAY (TWO_DAYS/2)
  13. #define FOUR_DAYS (TWO_DAYS * 2)
  14. #define SIX_DAYS (TWO_DAYS * 3)
  15. #define EIGHT_DAYS (TWO_DAYS * 4)
  16. #define TWELVE_DAYS (TWO_DAYS * 6)
  17. #define TWENTY_FOUR_DAYS (TWO_DAYS * 12)
  18. #define WINSCNF_TIME_INT_W_SELF_FND_PNRS TWO_HOURS
  19. //
  20. // Minimum number of updates that must be there before a push notification is
  21. // sent
  22. //
  23. #define WINSCNF_MIN_VALID_UPDATE_CNT 20 //the minimum no of updates
  24. //after which a notification
  25. //can be sent. Adjustable
  26. //via the registry
  27. //
  28. // This is the minimum valid Rpl interval. All the scavenging time intervals
  29. // are derived from it.
  30. //
  31. // refer WAIT_TIME_BEFORE_EXITING in rplpush.c
  32. //
  33. #define WINSCNF_MIN_VALID_RPL_INTVL (600) // 10 mts
  34. // this is the minimum valid consistency check interval between the last time
  35. // consistency check finished and the next one starts.
  36. #define WINSCNF_MIN_VALID_INTER_CC_INTVL (3*60*60) // 3 hours.
  37. //
  38. // default name of the db file that will contain the name-address mappings
  39. //
  40. #define WINSCNF_DB_NAME TEXT(".\\wins\\wins.mdb")
  41. #define WINSCNF_DB_NAME_ASCII ".\\wins\\wins.mdb"
  42. //
  43. // NOTE NOTE NOTE
  44. //
  45. // If you change this define to a string that does not have an unexpanded
  46. // string of the form %<string>% make a corresponding change in
  47. // GetNamesOfDataFiles() in winscnf.c.
  48. //
  49. #define WINSCNF_STATIC_DATA_NAME TEXT("%SystemRoot%\\system32\\drivers\\etc\\lmhosts")
  50. //
  51. // Max. size of a file name
  52. //
  53. #define WINS_MAX_FILENAME_SZ 255
  54. //
  55. // Max. size of a line
  56. //
  57. // Used in winsprs.c
  58. //
  59. #define WINS_MAX_LINE_SZ 80
  60. //
  61. // names of values stored under the Parameters key for WINS configuration
  62. //
  63. #if defined(DBGSVC) && !defined(WINS_INTERACTIVE)
  64. #define WINSCNF_DBGFLAGS_NM TEXT("DBGFLAGS")
  65. #endif
  66. #define WINSCNF_FILTER1BREQUESTS_NM TEXT("Filter1BRequests")
  67. #define WINSCNF_ADD1BTO1CQUERIES_NM TEXT("Prepend1BTo1CQueries")
  68. #define WINSCNF_LOG_DETAILED_EVTS_NM TEXT("LogDetailedEvents")
  69. #define WINSCNF_REFRESH_INTVL_NM TEXT("RefreshInterval")
  70. #define WINSCNF_INIT_CHL_RETRY_INTVL_NM TEXT("InitChlRetryInterval")
  71. #define WINSCNF_CHL_MAX_RETRIES_NM TEXT("ChlMaxNoOfRetries")
  72. #define WINSCNF_TOMBSTONE_INTVL_NM TEXT("TombstoneInterval")
  73. #define WINSCNF_TOMBSTONE_TMOUT_NM TEXT("TombstoneTimeout")
  74. #define WINSCNF_VERIFY_INTVL_NM TEXT("VerifyInterval")
  75. #define WINSCNF_DB_FILE_NM TEXT("DbFileNm")
  76. #define WINSCNF_DB_FILE_NM_ASCII "DbFileNm"
  77. #define WINSCNF_STATIC_INIT_FLAG_NM TEXT("DoStaticDataInit")
  78. #define WINSCNF_INIT_VERSNO_VAL_LW_NM TEXT("VersCounterStartVal_LowWord")
  79. #define WINSCNF_INIT_VERSNO_VAL_HW_NM TEXT("VersCounterStartVal_HighWord")
  80. #define WINSCNF_BACKUP_DIR_PATH_NM TEXT("BackupDirPath")
  81. #define WINSCNF_PRIORITY_CLASS_HIGH_NM TEXT("PriorityClassHigh")
  82. #define WINSCNF_MAX_NO_WRK_THDS_NM TEXT("NoOfWrkThds")
  83. #define WINSCNF_INIT_TIME_PAUSE_NM TEXT("InitTimePause")
  84. #define WINSCNF_CLUSTER_RESOURCE_NM TEXT( "ClusterResourceName")
  85. //
  86. // To allow WINS to revert back to 351 jet and db
  87. //
  88. #define WINSCNF_USE_351DB_NM TEXT("Use351Db")
  89. #define WINSCNF_USE_4DB_NM TEXT("Use4Db")
  90. #if MCAST > 0
  91. #define WINSCNF_USE_SELF_FND_PNRS_NM TEXT("UseSelfFndPnrs")
  92. #define WINSCNF_SELF_FND_NM TEXT("SelfFnd")
  93. #define WINSCNF_MCAST_TTL_NM TEXT("McastTtl")
  94. #define WINSCNF_MCAST_INTVL_NM TEXT("McastIntvl")
  95. #endif
  96. #define WINSCNF_WINS_PORT_NO_NM TEXT("PortNo")
  97. // persona grata/non-grata registry names have to be ASCII. The registry is queried
  98. // through RegQueryValueExA() calls (see GetOwnerList() from winscnf.c)
  99. #define PERSMODE_NON_GRATA 0
  100. #define PERSMODE_GRATA 1
  101. #define WINSCNF_PERSONA_MODE_NM "PersonaMode"
  102. #define WINSCNF_PERSONA_NON_GRATA_NM "PersonaNonGrata"
  103. #define WINSCNF_PERSONA_GRATA_NM "PersonaGrata"
  104. #if PRSCONN
  105. #define WINSCNF_PRS_CONN_NM TEXT("PersistentRplOn")
  106. #endif
  107. //
  108. // Spoof reg/ref
  109. //
  110. #define WINSCNF_BURST_HANDLING_NM TEXT("BurstHandling")
  111. #define WINSCNF_BURST_QUE_SIZE_NM TEXT("BurstQueSize")
  112. // to enable round-robin list of 1C member addresses
  113. #define WINSCNF_RANDOMIZE_1C_LIST_NM TEXT("Randomize1CList")
  114. //
  115. // NOTE NOTE NOTE
  116. //
  117. // This should never be set to FALSE in the registry unless we notice
  118. // a major bug in WINS that is resulting in replication to stop. This
  119. // parameter is a hatch door at best to get around an insidious bug
  120. // that may escape us during our testing -- Good insurance policy
  121. //
  122. #define WINSCNF_NO_RPL_ON_ERR_NM TEXT("NoRplOnErr")
  123. //
  124. // FUTURES - remove when JetBackup is internationalized. Also, update
  125. // WinsCnfReadWinsInfo.
  126. //
  127. #define WINSCNF_ASCII_BACKUP_DIR_PATH_NM "BackupDirPath"
  128. #define WINSCNF_INT_VERSNO_NEXTTIME_LW_NM TEXT("WinsInternalVersNoNextTime_LW")
  129. #define WINSCNF_INT_VERSNO_NEXTTIME_HW_NM TEXT("WinsInternalVersNoNextTime_HW")
  130. #define WINSCNF_DO_BACKUP_ON_TERM_NM TEXT("DoBackupOnTerm")
  131. #define WINSCNF_MIGRATION_ON_NM TEXT("MigrateOn")
  132. #define WINSCNF_REG_QUE_MAX_LEN_NM TEXT("RegQueMaxLen")
  133. //
  134. // Names to use in the registry for values of the PUSH/PULL sub-keys
  135. //
  136. #define WINSCNF_ADDCHG_TRIGGER_NM TEXT("RplOnAddressChg")
  137. #define WINSCNF_RETRY_COUNT_NM TEXT("CommRetryCount")
  138. //
  139. // Under IP address of a Push pnr
  140. //
  141. #define WINSCNF_SP_TIME_NM TEXT("SpTime")
  142. #define WINSCNF_RPL_INTERVAL_NM TEXT("TimeInterval")
  143. #define WINSCNF_MEMBER_PREC_NM TEXT("MemberPrecedence")
  144. //
  145. // Under IP address of a Pull pnr
  146. //
  147. #define WINSCNF_UPDATE_COUNT_NM TEXT("UpdateCount")
  148. //
  149. // Both pull/push pnr
  150. //
  151. #define WINSCNF_ONLY_DYN_RECS_NM TEXT("OnlyDynRecs")
  152. //
  153. // Value of the PULL/PUSH key
  154. //
  155. #define WINSCNF_INIT_TIME_RPL_NM TEXT("InitTimeReplication")
  156. //
  157. // Value of the PUSH key
  158. //
  159. #define WINSCNF_PROP_NET_UPD_NTF TEXT("PropNetUpdNtf")
  160. //
  161. // Indicate whether propagation is to be done or not
  162. //
  163. #define DO_PROP_NET_UPD_NTF TRUE
  164. #define DONT_PROP_NET_UPD_NTF FALSE
  165. //
  166. // if "OnlyWithCnfPnrs" is set to TRUE, replication will be performed only
  167. // with those partners that are listed under the Pull/Push key. If not
  168. // set to TRUE, replication can be initiated even with unlisted partners
  169. // as a result of administrative action or as a result of receiving an
  170. // update notification
  171. //
  172. #define WINSCNF_RPL_ONLY_W_CNF_PNRS_NM TEXT("RplOnlyWCnfPnrs")
  173. //
  174. // This DWORD can be under the Partners, Partners\Pull,
  175. // Partners\Push keys or under a partner's ip address key. If it is in more
  176. // than in one place in the key heirarchy, the lower one overrides the upper
  177. // one.
  178. //
  179. // Each bit indicates the kind of replication we want/don't want.
  180. // If no bit is set or if this parameter is not defined, it means
  181. // replicate everything (unless WINSCNF_ONLY_DYN_RECS_NM is defined - ideally
  182. // that should be represented by a bit in this DWORD but that is river under
  183. // the bridge and I don't want to get rid of that parameter since folks are
  184. // used to it, it being in the doc set and all). Currently the following is
  185. // defined
  186. //
  187. // All replication under the constraint of WINSCNF_ONLY_DYN_RECS_NM if defined
  188. //
  189. #define WINSCNF_RPL_DEFAULT_TYPE 0x0
  190. //
  191. // LSB - Replicate only the special group names (special groups - domains and
  192. // user defined special groups)
  193. //
  194. #define WINSCNF_RPL_SPEC_GRPS_N_PDC 0x1
  195. #define WINSCNF_RPL_ONLY_DYN_RECS 0x80000000
  196. #define WINSCNF_RPL_TYPE_NM TEXT("ReplicationType")
  197. //
  198. // Path to log file
  199. //
  200. #define WINSCNF_LOG_FLAG_NM TEXT("LoggingOn")
  201. #define WINSCNF_LOG_FILE_PATH_NM TEXT("LogFilePath")
  202. #define WINSCNF_MAX_CHL_RETRIES 3 //max. # of retries RFC 1002
  203. //page 83
  204. #if 0
  205. #define WINSCNF_CHL_RETRY_INTERVAL 250 //Time interval (in msecs)
  206. //between retries -- RFC 1002
  207. //page 83
  208. #endif
  209. #define WINSCNF_CHL_RETRY_INTERVAL 500 //Time interval (in msecs)
  210. #define WINSCNF_PROC_HIGH_PRIORITY_CLASS HIGH_PRIORITY_CLASS
  211. #define WINSCNF_PROC_PRIORITY_CLASS NORMAL_PRIORITY_CLASS
  212. #define WINSCNF_SCV_PRIORITY_LVL THREAD_PRIORITY_BELOW_NORMAL
  213. //
  214. // The Retry timeout is kept as 10 secs. It will be typically << the time
  215. // interval for replication, allowing us to retry a number of times
  216. // prior to the next replication cycle.
  217. //
  218. //
  219. // The Retry Time Interval is not used presently. We are using the
  220. // replication time interval for retries. This makes things simpler
  221. //
  222. #define WINSCNF_RETRY_TIME_INT 10 //time interval for retries
  223. //if there is a comm failure
  224. #define WINSCNF_MAX_COMM_RETRIES 3 //max. number of retries before
  225. //giving up trying to set up
  226. //communications with a WINS
  227. //
  228. // Precedence of remote members (of special groups) registered by a WINS
  229. // relative to the same registered by other WINS servers (used during
  230. // pull replication)
  231. //
  232. // Locally registered members always have high precedence
  233. //
  234. // Make sure that WINSCNF_LOW_PREC < WINSCNF_HIGH_PREC (this fact is used in
  235. // nmsnmh.c- UnionGrps())
  236. //
  237. //
  238. #define WINSCNF_LOW_PREC 0
  239. #define WINSCNF_HIGH_PREC 1
  240. //
  241. // After replication with a WINS has stopped because of persistent
  242. // communication failure (i.e. after all retries have been exhausted),
  243. // WINS will wait until the following number of replication time intervals
  244. // have elapsed before starting the retries again. If replication
  245. // got stopped with more than one WINS partner with the same time interval
  246. // (for pulling from it), then retry will be done for all these WINS when
  247. // it is done for one (in other words, resumption of replication for a WINS
  248. // may happen sooner than you think).
  249. //
  250. // We need to keep this number at least 2 since if we have not been able to
  251. // communicate with the WINS server for WINSCNF_MAX_COMM_RETRIES times
  252. // in the past WINSCNF_MAX_COMM_RETRIES * replication interval for the WINS,
  253. // then it is highly probable that the WINS server is down for good. We
  254. // retry again after the 'backoff' time. Hopefully, by then the admin would
  255. // have corrected the problem. Now, it is possible (unlikely though) that
  256. // the WINS server happened to be down only at the times this WINS tried to
  257. // contact it. We have no way to determine that.
  258. //
  259. //
  260. // This can be made a registry parameter. This can be called the sleep time
  261. // between successive rounds of retries.
  262. //
  263. #define WINSCNF_RETRY_AFTER_THIS_MANY_RPL 2
  264. //
  265. // if the time interval for periodic replication with a partner with which
  266. // a WINS server has had consecutive comm. failures is more than the
  267. // following amount, we don't back off as explained above
  268. //
  269. //
  270. #define WINSCNF_MAX_WAIT_BEFORE_RETRY_RPL ONEDAY //1 day
  271. //
  272. // The max. number of comcurrent static initializations that can be
  273. // happening. These may be due to commands from the admin. tool or
  274. // due to registry notifications.
  275. //
  276. #define WINSCNF_MAX_CNCRNT_STATIC_INITS 3
  277. //
  278. // No of records to handle at one time (used by the scavenger thread). This
  279. // number determines the size of the memory block that will be allocated
  280. // by NmsDbGetDataRecs().
  281. //
  282. //#define WINSCNF_SCV_CHUNK 1000
  283. #define WINSCNF_SCV_CHUNK 3000
  284. //
  285. // defines
  286. //
  287. //
  288. // Refresh interval - time period after which the state of an ACTIVE entry in
  289. // the db is set to NMSDB_E_RELEASED if it has not
  290. // been refreshed
  291. //
  292. #define WINSCNF_MIN_REFRESH_INTERVAL FORTY_MTS
  293. #define WINSCNF_DEF_REFRESH_INTERVAL SIX_DAYS //FOUR_DAYS
  294. #define REF_MULTIPLIER_FOR_ACTIVE 2
  295. //
  296. // The Tombstone Interval (the interval a record stays released) should be
  297. // a multiple of the RefreshInterval by at least the following amount
  298. //
  299. // With 2 as the value and refresh time interval being 4 days, TombInterval
  300. // is max(8 days, 2 * MaxRplInterval) i.e at least 8 days.
  301. //
  302. #define REF_MULTIPLIER_FOR_TOMB 2
  303. //
  304. // Challenge Retry interval
  305. //
  306. #define WINSCNF_MIN_INIT_CHL_RETRY_INTVL 250
  307. #define WINSCNF_DEF_INIT_CHL_RETRY_INTVL 500
  308. //
  309. // Challenge Max. No. of Retries
  310. //
  311. #define WINSCNF_MIN_CHL_MAX_RETRIES 1
  312. #define WINSCNF_DEF_CHL_MAX_RETRIES 3
  313. //
  314. // Also the min. tombstone timeout should be
  315. // max(RefreshInterval, RPL_MULTIPLIER_FOR_TOMBTMOUT * MaxRplInterval)
  316. //
  317. // With Refresh Interval being 4 days, this will be atleast 4 days.
  318. //
  319. #define RPL_MULTIPLIER_FOR_TOMBTMOUT 4
  320. //
  321. // The verify interval should be a multiple of the tombstone time
  322. // interval by at least the following amount. Keep the total time high
  323. //
  324. // With with the min. tombstone interval being at least 8 days, it will be at
  325. // least (3 * 8 = 24 days)
  326. //
  327. #define TOMB_MULTIPLIER_FOR_VERIFY 3
  328. //
  329. // Tombstone interval - time period after which the state of a released
  330. // entry is changed to NMSDB_E_TOMBSTONE if it has not
  331. // been refreshed
  332. //
  333. #define WINSCNF_MIN_TOMBSTONE_INTERVAL (WINSCNF_MIN_REFRESH_INTERVAL * REF_MULTIPLIER_FOR_TOMB)
  334. //
  335. // Time period after which the tombstone should be deleted. The min. value
  336. // is 1 days. This is to cut down on the possibility of a
  337. // tombstone getting deleted prior to it getting replicated to another WINS.
  338. //
  339. #define WINSCNF_MIN_TOMBSTONE_TIMEOUT max(WINSCNF_MIN_REFRESH_INTERVAL, ONEDAY)
  340. //
  341. // Minimum time period for doing verifications of the replicas in the db
  342. //
  343. // Should be atleast 24 days.
  344. //
  345. #define WINSCNF_MIN_VERIFY_INTERVAL max(TWENTY_FOUR_DAYS, (WINSCNF_MIN_TOMBSTONE_INTERVAL * TOMB_MULTIPLIER_FOR_VERIFY))
  346. #define WINSCNF_CC_INTVL_NM TEXT("TimeInterval")
  347. #define WINSCNF_CC_MAX_RECS_AAT_NM TEXT("MaxRecsAtATime")
  348. #define WINSCNF_CC_USE_RPL_PNRS_NM TEXT("UseRplPnrs")
  349. #define WINSCNF_CC_DEF_INTERVAL ONEDAY
  350. #define WINSCNF_CC_MIN_INTERVAL (ONEDAY/4)
  351. #define WINSCNF_DEF_CC_SP_HR 2 //02 hrs - 2am
  352. #define WINSCNF_CC_MIN_RECS_AAT 1000
  353. #define WINSCNF_CC_DEF_RECS_AAT 30000
  354. #define WINSCNF_CC_DEF_USE_RPL_PNRS 0
  355. #if 0
  356. //
  357. // Make the refresh interval equal to twice the max. replication time interval
  358. // if that is greater than the refresh interval.
  359. //
  360. #define WINSCNF_MAKE_REF_INTVL_M(RefreshInterval, MaxRplIntvl) max(REF_MULTIPLIER_FOR_ACTIVE * (MaxRplIntvl), RefreshInterval)
  361. #endif
  362. //
  363. // The Tombstone interval should never be allowed to go over 4 days. We
  364. // don't want a record to remain released for longer than that. It should
  365. // turn into a tombstone so that it gets replicated.
  366. //
  367. // The reason we change the state of a record to released is to avoid
  368. // replication if the reason for the release is a temporary shutdown of
  369. // the pc. We have to consider a long weekend (3 days). We however
  370. // also need to consider the fact that if the refresh interval is 40 mts or
  371. // some such low value, then we should not keep the record in the released
  372. // state for more than a day at the most. Consider a situation where
  373. // a node registers with the backup because the primary is down and then
  374. // goes back to the primary when it comes up. The primary does not
  375. // increment the version number because the record is stil active. The
  376. // record gets released at the backup and stays that way until it becomes
  377. // a tombstone which results in replication and the backup again getting
  378. // the active record from the primary. For the above situaion, we should
  379. // make sure of two things: first - the record does not have an overly large
  380. // tombstone interval; second - the replication time interval is small. We
  381. // don't want to change the replication time interval set by the admin. but
  382. // we can do something about the former.
  383. //
  384. // As long as the user sticks with the default refresh interval, the tombstone
  385. // interval will be the same as that.
  386. //
  387. // For the case where the user specifies a different refresh interval, we use
  388. // a max. of the refresh interval and a multiple of the max. rpl. interval.
  389. //
  390. //
  391. #define WINSCNF_MAKE_TOMB_INTVL_M(RefreshInterval, MaxRplIntvl) min(max(REF_MULTIPLIER_FOR_TOMB * (MaxRplIntvl), RefreshInterval), FOUR_DAYS)
  392. #define WINSCNF_MAKE_TOMB_INTVL_0_M(RefreshInterval) min(RefreshInterval, FOUR_DAYS)
  393. //
  394. // macro to get the minimum tombstone timeout based on the maximum replication
  395. // time interval.
  396. //
  397. #define WINSCNF_MAKE_TOMBTMOUT_INTVL_M(MaxRplIntvl) max(WINSCNF_MIN_TOMBSTONE_TIMEOUT,(RPL_MULTIPLIER_FOR_TOMBTMOUT * (MaxRplIntvl)))
  398. //
  399. // Macro to get the minimum verify interval based on tombstone interval
  400. //
  401. // Should be atleast 8 days.
  402. //
  403. #define WINSCNF_MAKE_VERIFY_INTVL_M(TombstoneInterval) max(TWENTY_FOUR_DAYS, (TOMB_MULTIPLIER_FOR_VERIFY * (TombstoneInterval)))
  404. //
  405. // Min. Mcast TTL
  406. //
  407. #define WINSCNF_MIN_MCAST_TTL TTL_SUBNET_ONLY
  408. #define WINSCNF_DEF_MCAST_TTL TTL_REASONABLE_REACH
  409. #define WINSCNF_MAX_MCAST_TTL 32
  410. #define WINSCNF_MIN_MCAST_INTVL FORTY_MTS
  411. #define WINSCNF_DEF_MCAST_INTVL FORTY_MTS
  412. #define WINS_QUEUE_HWM 500
  413. #define WINS_QUEUE_HWM_MAX 5000
  414. #define WINS_QUEUE_HWM_MIN 50
  415. #endif _WINSCNST_H_