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.

369 lines
6.8 KiB

  1. /*Copyright (c) 1994 Microsoft Corporation
  2. Module Name:
  3. database.h
  4. Abstract:
  5. Author:
  6. Revision History:
  7. --*/
  8. #ifndef _DATABASE_
  9. #define _DATABASE_
  10. #define cszWLANMonInstanceName "WLANMON"
  11. //
  12. // database constants.
  13. //
  14. #define DB_TABLE_SIZE 10 // table size in 4K pages.
  15. #define DB_TABLE_DENSITY 80 // page density
  16. #define DB_LANGID 0x0409 // language id
  17. #define DB_CP 1252 // code page
  18. /***************** New Added **********************/
  19. #include "wzcmon.h"
  20. #define DBFILENAMEPREFIX "windir"
  21. #define DBFILENAMESUFFIX "\\tracing\\wzcmon\\"
  22. #define DBFILENAME "amlog.mdb"
  23. #define LOG_RECORD_TABLE "LogTable"
  24. #define RECORD_IDX_STR "RecordIndex"
  25. #define RECORD_ID_STR "RecordID"
  26. #define COMPONENT_ID_STR "ComponentID"
  27. #define CATEGORY_STR "Category"
  28. #define TIMESTAMP_STR "TimeStamp"
  29. #define MESSAGE_STR "Message"
  30. #define INTERFACE_MAC_STR "InterfaceMAC"
  31. #define DEST_MAC_STR "DestMac"
  32. #define SSID_STR "SSID"
  33. #define CONTEXT_STR "Context"
  34. #define RECORD_IDX_IDX 0
  35. #define RECORD_ID_IDX 1
  36. #define COMPONENT_ID_IDX 2
  37. #define CATEGORY_IDX 3
  38. #define TIMESTAMP_IDX 4
  39. #define MESSAGE_IDX 5
  40. #define INTERFACE_MAC_IDX 6
  41. #define DEST_MAC_IDX 7
  42. #define SSID_IDX 8
  43. #define CONTEXT_IDX 9
  44. #define MAX_CHECK_POINT_DEPTH (20*1024*1024)
  45. #define MAX_RECORD_NUM 5000
  46. #define MAX_SUMMARY_MESSAGE_SIZE 80
  47. #define MAX_SESSION_NUM 5
  48. /*************************************************/
  49. typedef struct _TABLE_INFO {
  50. CHAR * ColName;
  51. JET_COLUMNID ColHandle;
  52. JET_COLTYP ColType;
  53. DWORD dwJetBit;
  54. } TABLE_INFO, * PTABLE_INFO;
  55. typedef struct _SESSION_CONTAINER {
  56. DWORD_PTR SessionID;
  57. DWORD_PTR DbID;
  58. DWORD_PTR TableID;
  59. struct _SESSION_CONTAINER * pNext;
  60. } SESSION_CONTAINER, * PSESSION_CONTAINER;
  61. /********************* New added functions **************/
  62. typedef struct _WZC_RW_LOCK {
  63. CRITICAL_SECTION csExclusive;
  64. BOOL bInitExclusive;
  65. CRITICAL_SECTION csShared;
  66. BOOL bInitShared;
  67. LONG lReaders;
  68. HANDLE hReadDone;
  69. DWORD dwCurExclusiveOwnerThreadId;
  70. } WZC_RW_LOCK, * PWZC_RW_LOCK;
  71. DWORD
  72. InitWZCDbGlobals(
  73. BOOL bLoggingEnabled
  74. );
  75. VOID
  76. DeInitWZCDbGlobals(
  77. );
  78. DWORD
  79. WZCSetLoggingState(
  80. BOOL bLoggingEnabled
  81. );
  82. DWORD
  83. WZCMapJetError(
  84. JET_ERR JetError,
  85. LPSTR CallerInfo OPTIONAL
  86. );
  87. DWORD
  88. WZCCreateDatabase(
  89. JET_SESID JetServerSession,
  90. CHAR * Connect,
  91. JET_DBID * pJetDatabaseHandle,
  92. JET_GRBIT JetBits
  93. );
  94. DWORD
  95. WZCOpenDatabase(
  96. JET_SESID JetServerSession,
  97. CHAR * Connect,
  98. JET_DBID * pJetDatabaseHandle,
  99. JET_GRBIT JetBits
  100. );
  101. DWORD
  102. WZCInitializeDatabase(
  103. JET_SESID * pJetServerSession
  104. );
  105. VOID
  106. WZCTerminateJet(
  107. JET_SESID * pJetServerSession
  108. );
  109. DWORD
  110. WZCJetBeginTransaction(
  111. JET_SESID JetServerSession
  112. );
  113. DWORD
  114. WZCJetRollBack(
  115. JET_SESID JetServerSession
  116. );
  117. DWORD
  118. WZCJetCommitTransaction(
  119. JET_SESID JetServerSession,
  120. JET_TABLEID JetTableHandle
  121. );
  122. DWORD
  123. WZCJetPrepareUpdate(
  124. JET_SESID JetServerSession,
  125. JET_TABLEID JetTableHandle,
  126. char * ColumnName,
  127. PVOID Key,
  128. DWORD KeySize,
  129. BOOL NewRecord
  130. );
  131. DWORD
  132. WZCJetCommitUpdate(
  133. JET_SESID JetServerSession,
  134. JET_TABLEID JetTableHandle
  135. );
  136. DWORD
  137. WZCJetSetValue(
  138. JET_SESID JetServerSession,
  139. JET_TABLEID JetTableHandle,
  140. JET_COLUMNID KeyColumnId,
  141. PVOID Data,
  142. DWORD DataSize
  143. );
  144. DWORD
  145. WZCJetPrepareSearch(
  146. JET_SESID JetServerSession,
  147. JET_TABLEID JetTableHandle,
  148. char * ColumnName,
  149. BOOL SearchFromStart,
  150. PVOID Key,
  151. DWORD KeySize
  152. );
  153. DWORD
  154. WZCJetNextRecord(
  155. JET_SESID JetServerSession,
  156. JET_TABLEID JetTableHandle
  157. );
  158. DWORD
  159. WZCCreateTableData(
  160. JET_SESID JetServerSession,
  161. JET_DBID JetDatabaseHandle,
  162. JET_TABLEID * pJetTableHandle
  163. );
  164. DWORD
  165. WZCOpenTableData(
  166. JET_SESID JetServerSession,
  167. JET_DBID JetDatabaseHandle,
  168. JET_TABLEID * pJetTableHandle
  169. );
  170. DWORD
  171. WZCJetGetValue(
  172. JET_SESID JetServerSession,
  173. JET_TABLEID JetTableHandle,
  174. JET_COLUMNID ColumnId,
  175. PVOID pvData,
  176. DWORD dwSize,
  177. PDWORD pdwRequiredSize
  178. );
  179. DWORD
  180. CreateSessionCont(
  181. PSESSION_CONTAINER * ppSessionCont
  182. );
  183. DWORD
  184. IniOpenWZCDbLogSession(
  185. PSESSION_CONTAINER pSessionCont
  186. );
  187. VOID
  188. FreeSessionCont(
  189. PSESSION_CONTAINER pSessionCont
  190. );
  191. DWORD
  192. GetSessionContainer(
  193. HANDLE hSession,
  194. PSESSION_CONTAINER * ppSessionCont
  195. );
  196. DWORD
  197. IniCloseWZCDbLogSession(
  198. PSESSION_CONTAINER pSessionCont
  199. );
  200. VOID
  201. RemoveSessionCont(
  202. PSESSION_CONTAINER pSessionCont
  203. );
  204. VOID
  205. DestroySessionContList(
  206. PSESSION_CONTAINER pSessionContList
  207. );
  208. DWORD
  209. WZCOpenAppendSession(
  210. PSESSION_CONTAINER pSessionCont
  211. );
  212. DWORD
  213. WZCCloseAppendSession(
  214. PSESSION_CONTAINER pSessionCont
  215. );
  216. DWORD
  217. IniEnumWZCDbLogRecords(
  218. PSESSION_CONTAINER pSessionCont,
  219. PBOOL pbEnumFromStart,
  220. DWORD dwPreferredNumEntries,
  221. PWZC_DB_RECORD * ppWZCRecords,
  222. LPDWORD pdwNumRecords
  223. );
  224. VOID
  225. FreeWZCRecords(
  226. PWZC_DB_RECORD pWZCRecords,
  227. DWORD dwNumRecords
  228. );
  229. DWORD
  230. IniFlushWZCDbLog(
  231. );
  232. DWORD
  233. CloseAllTableSessions(
  234. PSESSION_CONTAINER pSessionContList
  235. );
  236. DWORD
  237. OpenAllTableSessions(
  238. PSESSION_CONTAINER pSessionContList
  239. );
  240. DWORD
  241. WZCGetTableDataHandle(
  242. JET_SESID * pMyJetServerSession,
  243. JET_DBID * pMyJetDatabaseHandle,
  244. JET_TABLEID * pMyClientTableHandle
  245. );
  246. BOOL
  247. IsDBOpened(
  248. );
  249. DWORD
  250. IniEnumWZCDbLogRecordsSummary(
  251. PSESSION_CONTAINER pSessionCont,
  252. PBOOL pbEnumFromStart,
  253. DWORD dwPreferredNumEntries,
  254. PWZC_DB_RECORD * ppWZCRecords,
  255. LPDWORD pdwNumRecords
  256. );
  257. DWORD
  258. EnumWZCDbLogRecordsSummary(
  259. HANDLE hSession,
  260. PWZC_DB_RECORD pTemplateRecord,
  261. PBOOL pbEnumFromStart,
  262. DWORD dwPreferredNumEntries,
  263. PWZC_DB_RECORD * ppWZCRecords,
  264. LPDWORD pdwNumRecords,
  265. LPVOID pvReserved
  266. );
  267. DWORD
  268. GetWZCDbLogRecord(
  269. HANDLE hSession,
  270. PWZC_DB_RECORD pTemplateRecord,
  271. PWZC_DB_RECORD * ppWZCRecords,
  272. LPVOID pvReserved
  273. );
  274. DWORD
  275. IniGetWZCDbLogRecord(
  276. PSESSION_CONTAINER pSessionCont,
  277. PWZC_DB_RECORD pTemplateRecord,
  278. PWZC_DB_RECORD * ppWZCRecords
  279. );
  280. DWORD
  281. WZCSeekRecordOnIndexTime(
  282. JET_SESID JetServerSession,
  283. JET_TABLEID JetTableHandle,
  284. DWORD dwIndex,
  285. FILETIME ftTimeStamp
  286. );
  287. /*******************************************************/
  288. #endif // _DATABASE_