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.

449 lines
18 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. perrepsr.h
  5. Abstract:
  6. This header file contains definitions of data structures used by the
  7. functions in the perrepsr.c file.
  8. Author:
  9. Rohan Kumar [rohank] 13-Sept-1998
  10. Environment:
  11. User Mode Service
  12. Revision History:
  13. --*/
  14. #ifndef _PERREPSR_H_
  15. #define _PERREPSR_H_
  16. #include <NTreppch.h>
  17. #pragma hdrstop
  18. #include <wchar.h>
  19. #include <frs.h>
  20. //
  21. // Used in the RegEnumValue function
  22. //
  23. #define SIZEOFVALUENAME 10
  24. #define SIZEOFVALUEDATA 10000
  25. #define INVALIDKEY 0
  26. #define HASHTABLESIZE sizeof(QHASH_ENTRY)*100
  27. #define PERFMON_MAX_INSTANCE_LENGTH 1024
  28. #define REPSETOBJSUBKEY L"SYSTEM\\CurrentControlSet\\Services\\FileReplicaSet"
  29. #define REPSETPERFSUBKEY L"SYSTEM\\CurrentControlSet\\Services\\FileReplicaSet\\Performance"
  30. #define REPSETLINSUBKEY L"SYSTEM\\CurrentControlSet\\Services\\FileReplicaSet\\Linkage"
  31. #define REPSETOPENFN L"OpenReplicaSetPerformanceData"
  32. #define REPSETCLOSEFN L"CloseReplicaSetPerformanceData"
  33. #define REPSETCOLLECTFN L"CollectReplicaSetPerformanceData"
  34. #define REPSETINI L"lodctr %SystemRoot%\\system32\\NTFRSREP.ini"
  35. #define REPSETUNLD L"unlodctr FileReplicaSet"
  36. #define REPCONNOBJSUBKEY L"SYSTEM\\CurrentControlSet\\Services\\FileReplicaConn"
  37. #define REPCONNPERFSUBKEY L"SYSTEM\\CurrentControlSet\\Services\\FileReplicaConn\\Performance"
  38. #define REPCONNLINSUBKEY L"SYSTEM\\CurrentControlSet\\Services\\FileReplicaConn\\Linkage"
  39. #define REPCONNOPENFN L"OpenReplicaConnPerformanceData"
  40. #define REPCONNCLOSEFN L"CloseReplicaConnPerformanceData"
  41. #define REPCONNCOLLECTFN L"CollectReplicaConnPerformanceData"
  42. #define REPCONNINI L"lodctr %SystemRoot%\\system32\\NTFRSCON.ini"
  43. #define REPCONNUNLD L"unlodctr FileReplicaConn"
  44. #define PERFDLLDIRECTORY L"%SystemRoot%\\system32\\NTFRSPRF.dll"
  45. //
  46. // Name of the Total Instance
  47. //
  48. #define TOTAL_NAME L"_Total"
  49. //
  50. // Macros used for incrementing or setting counter values for Replica Set
  51. // objects, connection objects and Service total counters.
  52. //
  53. //
  54. // Increment a replica set counter value.
  55. //
  56. #define PM_INC_CTR_REPSET(_Replica_, _Ctr_, _Value_) \
  57. { \
  58. if (((_Replica_) != NULL) && \
  59. ((_Replica_)->PerfRepSetData != NULL) && \
  60. ((_Replica_)->PerfRepSetData->oid != NULL)) { \
  61. \
  62. (_Replica_)->PerfRepSetData->FRSCounter._Ctr_ += (_Value_); \
  63. } \
  64. }
  65. //
  66. // Set a new value for a replica set perfmon counter.
  67. //
  68. #define PM_SET_CTR_REPSET(_Replica_, _Ctr_, _Value_) \
  69. { \
  70. if (((_Replica_) != NULL) && \
  71. ((_Replica_)->PerfRepSetData != NULL) && \
  72. ((_Replica_)->PerfRepSetData->oid != NULL)) { \
  73. \
  74. (_Replica_)->PerfRepSetData->FRSCounter._Ctr_ = (_Value_); \
  75. } \
  76. }
  77. //
  78. // Read the value for a replica set perfmon counter.
  79. //
  80. #define PM_READ_CTR_REPSET(_Replica_, _Ctr_) \
  81. ( \
  82. (((_Replica_) != NULL) && \
  83. ((_Replica_)->PerfRepSetData != NULL) && \
  84. ((_Replica_)->PerfRepSetData->oid != NULL)) ? \
  85. ((_Replica_)->PerfRepSetData->FRSCounter._Ctr_) : 0 \
  86. )
  87. //
  88. // Increment a Cxtion counter value.
  89. //
  90. #define PM_INC_CTR_CXTION(_Cxtion_, _Ctr_, _Value_) \
  91. { \
  92. if (((_Cxtion_) != NULL) && \
  93. ((_Cxtion_)->PerfRepConnData != NULL) && \
  94. ((_Cxtion_)->PerfRepConnData->oid != NULL)) { \
  95. (_Cxtion_)->PerfRepConnData->FRCCounter._Ctr_ += (_Value_); \
  96. } \
  97. }
  98. //
  99. // Set a new value for a Cxtion perfmon counter.
  100. //
  101. #define PM_SET_CTR_CXTION(_Cxtion_, _Ctr_, _Value_) \
  102. { \
  103. if (((_Cxtion_) != NULL) && \
  104. ((_Cxtion_)->PerfRepConnData != NULL) && \
  105. ((_Cxtion_)->PerfRepConnData->oid != NULL)) { \
  106. (_Cxtion_)->PerfRepConnData->FRCCounter._Ctr_ = (_Value_); \
  107. } \
  108. }
  109. //
  110. // Read the value for a Cxtion perfmon counter.
  111. //
  112. #define PM_READ_CTR_CXTION(_Cxtion_, _Ctr_) \
  113. ( \
  114. (((_Cxtion_) != NULL) && \
  115. ((_Cxtion_)->PerfRepConnData != NULL) && \
  116. ((_Cxtion_)->PerfRepConnData->oid != NULL)) ? \
  117. ((_Cxtion_)->PerfRepConnData->FRCCounter._Ctr_) : 0 \
  118. )
  119. //
  120. // Increment a Service Wide Total counter value.
  121. //
  122. #define PM_INC_CTR_SERVICE(_Total_, _Ctr_, _Value_) \
  123. { \
  124. if (((_Total_) != NULL) && ((_Total_)->oid != NULL)) { \
  125. (_Total_)->FRSCounter._Ctr_ += (_Value_); \
  126. } \
  127. }
  128. //
  129. // Set a new value for a Service Wide Total counter value.
  130. //
  131. #define PM_SET_CTR_SERVICE(_Total_, _Ctr_, _Value_) \
  132. { \
  133. if (((_Total_) != NULL) && ((_Total_)->oid != NULL)) { \
  134. (_Total_)->FRSCounter._Ctr_ = (_Value_); \
  135. } \
  136. }
  137. //
  138. // Read the value for a Service Wide Total counter.
  139. //
  140. #define PM_READ_CTR_SERVICE(_Total_, _Ctr_) \
  141. ( \
  142. (((_Total_) != NULL) && ((_Total_)->oid != NULL)) ? \
  143. ((_Total_)->FRSCounter._Ctr_) : 0 \
  144. )
  145. //
  146. // The global variables below are used to synchronize access to the variables
  147. // FRS_dwOpenCount and FRC_dwOpenCount respectively.
  148. //
  149. CRITICAL_SECTION FRS_ThrdCounter;
  150. CRITICAL_SECTION FRC_ThrdCounter;
  151. //
  152. // Code for Eventlogging is enabled only if INCLLOGGING is defined.
  153. //
  154. #define INCLLOGGING 1
  155. #ifdef INCLLOGGING
  156. //
  157. // EventLog Handle and flag which checks if logging should be done.
  158. //
  159. extern HANDLE hEventLog;
  160. extern BOOLEAN DoLogging;
  161. //
  162. // Macro to filter eventlog messages
  163. //
  164. #define FilterAndPrintToEventLog(_x_, _y_) \
  165. { \
  166. if (DoLogging) { \
  167. if (_x_) { \
  168. ReportEvent( \
  169. hEventLog, \
  170. EVENTLOG_ERROR_TYPE, \
  171. 0, \
  172. _y_, \
  173. (PSID)NULL, \
  174. 0, \
  175. 0, \
  176. NULL, \
  177. (PVOID)NULL \
  178. ); \
  179. _x_ = FALSE; \
  180. } \
  181. } \
  182. }
  183. #else
  184. #define FilterAndPrintToEventLog(_x_, _y_)
  185. #endif // INCLLOGGING
  186. //
  187. // This is used in the Open function where memory gets allocated.
  188. // If memory allocation fails, just return failure.
  189. //
  190. #define NTFRS_MALLOC_TEST(_x_, _y_, _z_) \
  191. { \
  192. if ((_x_) == NULL) { \
  193. if (_z_) { \
  194. RpcBindingFree(&Handle); \
  195. } \
  196. _y_; \
  197. return ERROR_NO_SYSTEM_RESOURCES; \
  198. } \
  199. }
  200. //
  201. // Object Types
  202. //
  203. enum object { REPLICASET, REPLICACONN };
  204. //
  205. // The PERFMON_OBJECT_ID data structure
  206. //
  207. typedef struct _PERFMON_OBJECT_ID {
  208. PWCHAR name; // name of the Instance
  209. ULONGLONG key; // The Instances's Unique Key
  210. } PERFMON_OBJECT_ID, *PPERFMON_OBJECT_ID;
  211. //
  212. // WARNING !!!! The fields in the structure below should be changed
  213. // if any new counters are to be added or deleted for the REPLICASET Object
  214. // The counter structure for the ReplicaSet Object Instance
  215. //
  216. typedef struct _REPLICASET_COUNTERS {
  217. ULONGLONG SFGeneratedB; // Bytes of Staging Generated
  218. ULONGLONG SFFetchedB; // Bytes of Staging Fetched
  219. ULONGLONG SFReGeneratedB; // Bytes of Staging Regenerated
  220. ULONGLONG FInstalledB; // Bytes of Files Installed
  221. ULONGLONG SSInUseKB; // KB of Staging Space In Use
  222. ULONGLONG SSFreeKB; // KB of Staging Space Free
  223. ULONGLONG PacketsRcvdBytes; // Packets Received in Bytes
  224. ULONGLONG PacketsSentBytes; // Packets Sent in Bytes
  225. ULONGLONG FetBSentBytes; // Fetch Blocks Sent in Bytes
  226. ULONGLONG FetBRcvdBytes; // Fetch Blocks Received in Bytes
  227. ULONG SFGenerated; // Staging Files Generated
  228. ULONG SFGeneratedError; // Staging Files Generated with Error
  229. ULONG SFFetched; // Staging Files Fetched
  230. ULONG SFReGenerated; // Staging Files Regenerated
  231. ULONG FInstalled; // Files Installed
  232. ULONG FInstalledError; // Files Installed with Error
  233. ULONG COIssued; // Change Orders Issued
  234. ULONG CORetired; // Change Orders Retired
  235. ULONG COAborted; // Change Orders Aborted
  236. ULONG CORetried; // Change Orders Retried
  237. ULONG CORetriedGen; // Change Orders Retried at Generate
  238. ULONG CORetriedFet; // Change Orders Retried at Fetch
  239. ULONG CORetriedIns; // Change Orders Retried at Install
  240. ULONG CORetriedRen; // Change Orders Retried at Rename
  241. ULONG COMorphed; // Change Orders Morphed
  242. ULONG COPropagated; // Change Orders Propagated
  243. ULONG COReceived; // Change Orders Received
  244. ULONG COSent; // Change Orders Sent
  245. ULONG COEvaporated; // Change Orders Evaporated
  246. ULONG LCOIssued; // Local Change Orders Issued
  247. ULONG LCORetired; // Local Change Orders Retired
  248. ULONG LCOAborted; // Local Change Orders Aborted
  249. ULONG LCORetried; // Local Change Orders Retried
  250. ULONG LCORetriedGen; // Local Change Orders Retried at Generate
  251. ULONG LCORetriedFet; // Local Change Orders Retried at Fetch
  252. ULONG LCORetriedIns; // Local Change Orders Retried at Install
  253. ULONG LCORetriedRen; // Local Change Orders Retried at Rename
  254. ULONG LCOMorphed; // Local Change Orders Morphed
  255. ULONG LCOPropagated; // Local Change Orders Propagated
  256. ULONG LCOSent; // Local Change Orders Sent
  257. ULONG LCOSentAtJoin; // Local Change Orders Sent At Join
  258. ULONG RCOIssued; // Remote Change Orders Issued
  259. ULONG RCORetired; // Remote Change Orders Retired
  260. ULONG RCOAborted; // Remote Change Orders Aborted
  261. ULONG RCORetried; // Remote Change Orders Retried
  262. ULONG RCORetriedGen; // Remote Change Orders Retried at Generate
  263. ULONG RCORetriedFet; // Remote Change Orders Retried at Fetch
  264. ULONG RCORetriedIns; // Remote Change Orders Retried at Install
  265. ULONG RCORetriedRen; // Remote Change Orders Retried at Rename
  266. ULONG RCOMorphed; // Remote Change Orders Morphed
  267. ULONG RCOPropagated; // Remote Change Orders Propagated
  268. ULONG RCOSent; // Remote Change Orders Sent
  269. ULONG RCOReceived; // Remote Change Orders Received
  270. ULONG InCODampned; // Inbound Change Orders Dampened
  271. ULONG OutCODampned; // Outbound Change Orders Dampened
  272. ULONG UsnReads; // Usn Reads
  273. ULONG UsnRecExamined; // Usn Records Examined
  274. ULONG UsnRecAccepted; // Usn Records Accepted
  275. ULONG UsnRecRejected; // Usn Records Rejected
  276. ULONG PacketsRcvd; // Packets Received
  277. ULONG PacketsRcvdError; // Packets Received in Error
  278. ULONG PacketsSent; // Packets Sent
  279. ULONG PacketsSentError; // Packets Sent in Error
  280. ULONG CommTimeouts; // Communication Timeouts
  281. ULONG FetRSent; // Fetch Requests Sent
  282. ULONG FetRReceived; // Fetch Requests Received
  283. ULONG FetBSent; // Fetch Blocks Sent
  284. ULONG FetBRcvd; // Fetch Blocks Received
  285. ULONG JoinNSent; // Join Notifications Sent
  286. ULONG JoinNRcvd; // Join Notifications Received
  287. ULONG Joins; // Joins
  288. ULONG Unjoins; // Unjoins
  289. ULONG Bindings; // Bindings
  290. ULONG BindingsError; // Bindings in Error
  291. ULONG Authentications; // Authentications
  292. ULONG AuthenticationsError; // Authentications in Error
  293. ULONG DSPolls; // DS Polls
  294. ULONG DSPollsWOChanges; // DS Polls without Changes
  295. ULONG DSPollsWChanges; // DS Polls with Changes
  296. ULONG DSSearches; // DS Searches
  297. ULONG DSSearchesError; // DS Searches in Error
  298. ULONG DSObjects; // DS Objects
  299. ULONG DSObjectsError; // DS Objects in Error
  300. ULONG DSBindings; // DS Bindings
  301. ULONG DSBindingsError; // DS Bindings in Error
  302. ULONG RSCreated; // Replica Sets Created
  303. ULONG RSDeleted; // Replica Sets Deleted
  304. ULONG RSRemoved; // Replica Sets Removed
  305. ULONG RSStarted; // Replica Sets Started
  306. // ULONG RSRepaired; // Replica Sets Repaired
  307. // ULONG Threads; // Threads
  308. ULONG ThreadsStarted; // Threads started
  309. ULONG ThreadsExited; // Threads exited
  310. } ReplicaSetCounters, *PReplicaSetCounters;
  311. //
  312. // Size of the structure above
  313. //
  314. #define SIZEOF_REPSET_COUNTER_DATA sizeof(ReplicaSetCounters)
  315. //
  316. // The data structure for the ReplicaSet Object Instance
  317. //
  318. typedef struct _HASHTABLEDATA_REPLICASET {
  319. PPERFMON_OBJECT_ID oid; // The Instance ID
  320. PREPLICA RepBackPtr; // Back pointer to the replica structure
  321. ReplicaSetCounters FRSCounter; // The counter structure
  322. } HT_REPLICA_SET_DATA, *PHT_REPLICA_SET_DATA;
  323. //
  324. // The Total Instance
  325. //
  326. extern PHT_REPLICA_SET_DATA PMTotalInst;
  327. //
  328. // WARNING !!!! The fields in the structure below should be changed
  329. // if any new counters are to be added or deleted for the REPLICACONN Object
  330. // The counter structure for the ReplicaConn Object Instance
  331. //
  332. typedef struct _REPLICACONN_COUNTERS {
  333. ULONGLONG PacketsSentBytes; // Packets Sent in Bytes
  334. ULONGLONG FetBSentBytes; // Fetch Blocks Sent in Bytes
  335. ULONGLONG FetBRcvdBytes; // Fetch Blocks Received in Bytes
  336. ULONG LCOSent; // Local Change Orders Sent
  337. ULONG LCOSentAtJoin; // Local Change Orders Sent At Join
  338. ULONG RCOSent; // Remote Change Orders Sent
  339. ULONG RCOReceived; // Remote Change Orders Received
  340. ULONG InCODampned; // Inbound Change Orders Dampened
  341. ULONG OutCODampned; // Outbound Change Orders Dampened
  342. ULONG PacketsSent; // Packets Sent
  343. ULONG PacketsSentError; // Packets Sent in Error
  344. ULONG CommTimeouts; // Communication Timeouts
  345. ULONG FetRSent; // Fetch Requests Sent
  346. ULONG FetRReceived; // Fetch Requests Received
  347. ULONG FetBSent; // Fetch Blocks Sent
  348. ULONG FetBRcvd; // Fetch Blocks Received
  349. ULONG JoinNSent; // Join Notifications Sent
  350. ULONG JoinNRcvd; // Join Notifications Received
  351. ULONG Joins; // Joins
  352. ULONG Unjoins; // Unjoins
  353. ULONG Bindings; // Bindings
  354. ULONG BindingsError; // Bindings in Error
  355. ULONG Authentications; // Authentications
  356. ULONG AuthenticationsError; // Authentications in Error
  357. } ReplicaConnCounters, *PReplicaConnCounters;
  358. //
  359. // Size of the structure above
  360. //
  361. #define SIZEOF_REPCONN_COUNTER_DATA sizeof(ReplicaConnCounters)
  362. //
  363. // The data structure for the ReplicaConn Object Instance
  364. //
  365. typedef struct _HASHTABLEDATA_REPLICACONN {
  366. PPERFMON_OBJECT_ID oid; // The Instance ID
  367. ReplicaConnCounters FRCCounter; // The counter structure
  368. } HT_REPLICA_CONN_DATA, *PHT_REPLICA_CONN_DATA;
  369. //
  370. // Signature's of exported functions defined in the perrepsr.c file
  371. //
  372. VOID
  373. InitializePerfmonServer (
  374. VOID
  375. );
  376. VOID
  377. ShutdownPerfmonServer (
  378. VOID
  379. );
  380. ULONG
  381. AddPerfmonInstance (
  382. IN DWORD ObjectType,
  383. IN PVOID addr,
  384. IN PWCHAR InstanceName
  385. );
  386. DWORD
  387. DeletePerfmonInstance(
  388. IN DWORD ObjectType,
  389. IN PVOID addr
  390. );
  391. #endif // perrepsr.h