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.

298 lines
5.9 KiB

  1. #ifndef _LM_H
  2. #define _LM_H
  3. /*++
  4. Copyright (c) 1992 Microsoft Corporation
  5. Module Name:
  6. logman.h
  7. Abstract:
  8. Private header file for the cluster registry
  9. Author:
  10. John Vert (jvert) 15-Dec-1995
  11. Revision History:
  12. --*/
  13. //
  14. // Define interfaces used by the logger component
  15. //
  16. //
  17. // Well-known Resource Manager IDs
  18. //
  19. typedef DWORD RMTYPE; //the record type stored in the flags
  20. typedef DWORD LSN;
  21. typedef HANDLE HLOG;
  22. typedef int TRID;
  23. typedef HANDLE HXSACTION;
  24. typedef enum _RMID {
  25. RMPageEnd, // reserved - signifies end of a log page
  26. RMBeginChkPt, // reserved - signifies a start chkpoint record
  27. RMEndChkPt, // reserved - signifies the end chk point record
  28. RMInvalidated, // an invalidated record is marked at mount
  29. RMAny,
  30. RMRegistryMgr
  31. } RMID;
  32. typedef enum _TRTYPE {
  33. TTDontCare, //log management specific routines use this type
  34. TTStartXsaction,
  35. TTCommitXsaction,
  36. TTAbortXsaction,
  37. TTXsactionUnit,
  38. TTCompleteXsaction,
  39. }TRTYPE;
  40. typedef enum _TRSTATE{
  41. XsactionAborted,
  42. XsactionCommitted,
  43. XsactionUnknown
  44. }TRSTATE;
  45. #define LOG_MAX_FILENAME_LENGTH MAX_PATH
  46. #define NULL_LSN 0
  47. /****
  48. @typedef BOOL (WINAPI *PLOG_GETCHECKPOINT_CALLBACK) |
  49. Supplies the routine to be called back in order to obtain a check
  50. point file once the log manager is asked to record a checkpoint in
  51. the log file.
  52. @parm IN LPCWSTR | lpszPath | The path where to create the checkpoint file.
  53. @parm IN PVOID | Context| Supplies the checkpoint CallbackContext specified
  54. to LogCreate().
  55. @parm IN PVOID | pszFileName | Supplies the name of file to take the checkpt in.
  56. @parm OUT TRID | *pChkPtTransaction | Supplies the transaction identifier of the checkpoint.
  57. @xref <f LogCreate>
  58. ****/
  59. typedef
  60. DWORD
  61. (WINAPI *PLOG_GETCHECKPOINT_CALLBACK) (
  62. IN LPCWSTR lpszPath,
  63. IN PVOID pContext,
  64. IN LPWSTR pszChkPtFile,
  65. OUT TRID *pChkPtTransaction
  66. );
  67. HLOG
  68. LogCreate(
  69. IN LPWSTR lpFileName,
  70. IN DWORD dwMaxFileSize,
  71. IN PLOG_GETCHECKPOINT_CALLBACK CallbackRoutine,
  72. IN PVOID pGetChkPtContext,
  73. IN BOOL bForceCreate,
  74. OPTIONAL OUT LSN *pLastLsn
  75. );
  76. DWORD
  77. LogClose(
  78. IN HLOG LogFile
  79. );
  80. DWORD
  81. LogCommitSize(
  82. IN HLOG hLog,
  83. IN RMID ResourceId,
  84. IN DWORD dwDataSize
  85. );
  86. LSN
  87. LogWrite(
  88. IN HLOG LogFile,
  89. IN TRID TransactionId,
  90. IN TRTYPE TransactionType,
  91. IN RMID ResourceId,
  92. IN RMTYPE ResourceFlags,
  93. IN PVOID LogData,
  94. IN DWORD DataSize
  95. );
  96. LSN
  97. LogFlush(
  98. IN HLOG LogFile,
  99. IN LSN MinLsn
  100. );
  101. LSN
  102. LogRead(
  103. IN HLOG LogFile,
  104. IN LSN CurrentLsn,
  105. OUT RMID *Resource,
  106. OUT RMTYPE *ResourceFlags,
  107. OUT TRID *Transaction,
  108. OUT TRTYPE *TrType,
  109. OUT PVOID LogData,
  110. IN OUT DWORD *DataSize
  111. );
  112. typedef
  113. BOOL
  114. (WINAPI *PLOG_SCAN_CALLBACK) (
  115. IN PVOID Context,
  116. IN LSN Lsn,
  117. IN RMID Resource,
  118. IN RMTYPE ResourceFlags,
  119. IN TRID Transaction,
  120. IN TRTYPE TransactionType,
  121. IN const PVOID LogData,
  122. IN DWORD DataLength
  123. );
  124. typedef
  125. BOOL
  126. (WINAPI *PLOG_SCANXSACTION_CALLBACK) (
  127. IN PVOID Context,
  128. IN LSN Lsn,
  129. IN RMID Resource,
  130. IN RMTYPE ResourceFlags,
  131. IN TRID Transaction,
  132. IN const PVOID LogData,
  133. IN DWORD DataLength
  134. );
  135. DWORD
  136. LogScan(
  137. IN HLOG LogFile,
  138. IN LSN FirstLsn,
  139. IN BOOL ScanForward,
  140. IN PLOG_SCAN_CALLBACK CallbackRoutine,
  141. IN PVOID CallbackContext
  142. );
  143. DWORD
  144. LogCheckPoint(
  145. IN HLOG LogFile,
  146. IN BOOL bAllowReset,
  147. IN LPCWSTR lpszInChkPtFile,
  148. IN DWORD dwChkPtSeq
  149. );
  150. DWORD
  151. LogReset(
  152. IN HLOG LogFile
  153. );
  154. DWORD
  155. LogGetLastChkPoint(
  156. IN HLOG LogFile,
  157. IN LPWSTR pszChkPtFileName,
  158. OUT TRID *pTransaction,
  159. OUT LSN *pChkPtLsn
  160. );
  161. DWORD LogGetInfo(
  162. IN HLOG hLog,
  163. OUT LPWSTR szFileName,
  164. OUT LPDWORD pdwCurLogSize,
  165. OUT LPDWORD pdwMaxLogSize
  166. );
  167. DWORD LogSetInfo(
  168. IN HLOG hLog,
  169. IN DWORD dwMaxLogSize
  170. );
  171. //Local Xsaction related routines
  172. DWORD
  173. LogFindXsactionState(
  174. IN HLOG hLog,
  175. IN LSN Lsn,
  176. IN TRID TrId,
  177. OUT TRSTATE *pTrState
  178. );
  179. DWORD
  180. LogScanXsaction(
  181. IN HLOG hLog,
  182. IN LSN StartXsactionLsn,
  183. IN TRID StartXsactionId,
  184. IN PLOG_SCANXSACTION_CALLBACK CallbackRoutine,
  185. IN PVOID pContext
  186. );
  187. HXSACTION
  188. LogStartXsaction(
  189. IN HLOG hLog,
  190. IN TRID TrId,
  191. IN RMID ResourceId,
  192. IN RMTYPE ResourceFlags
  193. );
  194. DWORD WINAPI LogCommitXsaction(
  195. IN HLOG hLog,
  196. IN HXSACTION hXsaction,
  197. IN RMTYPE ResourceFlags
  198. );
  199. DWORD
  200. LogAbortXsaction(
  201. IN HLOG hLog,
  202. IN HXSACTION TrId,
  203. IN RMTYPE ResourceFlags
  204. );
  205. LSN
  206. LogWriteXsaction(
  207. IN HLOG hLog,
  208. IN HXSACTION hXsaction,
  209. IN RMTYPE ResourceFlags,
  210. IN PVOID pLogData,
  211. IN DWORD dwDataSize
  212. );
  213. //Logmanager initialization/shutdown
  214. DWORD LmInitialize();
  215. DWORD LmShutdown();
  216. //Timer Activity Functions- these are generic functions
  217. typedef
  218. void
  219. (WINAPI *PFN_TIMER_CALLBACK)(
  220. IN HANDLE hTimer,
  221. IN PVOID pContext
  222. );
  223. DWORD
  224. AddTimerActivity(
  225. IN HANDLE hTimer,
  226. IN DWORD dwInterval,
  227. IN LONG lPeriod,
  228. IN PFN_TIMER_CALLBACK pfnTimerCallback,
  229. IN PVOID pContext
  230. );
  231. DWORD
  232. RemoveTimerActivity(
  233. IN HANDLE hTimer
  234. );
  235. DWORD
  236. UnpauseTimerActivity(
  237. IN HANDLE hTimer
  238. );
  239. DWORD
  240. PauseTimerActivity(
  241. IN HANDLE hTimer
  242. );
  243. #endif //_LM_H