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.

361 lines
6.3 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. /*************************************************/
  48. typedef struct _TABLE_INFO {
  49. CHAR * ColName;
  50. JET_COLUMNID ColHandle;
  51. JET_COLTYP ColType;
  52. DWORD dwJetBit;
  53. } TABLE_INFO, * PTABLE_INFO;
  54. typedef struct _SESSION_CONTAINER {
  55. DWORD_PTR SessionID;
  56. DWORD_PTR DbID;
  57. DWORD_PTR TableID;
  58. struct _SESSION_CONTAINER * pNext;
  59. } SESSION_CONTAINER, * PSESSION_CONTAINER;
  60. /********************* New added functions **************/
  61. typedef struct _WZC_RW_LOCK {
  62. CRITICAL_SECTION csExclusive;
  63. BOOL bInitExclusive;
  64. CRITICAL_SECTION csShared;
  65. BOOL bInitShared;
  66. LONG lReaders;
  67. HANDLE hReadDone;
  68. DWORD dwCurExclusiveOwnerThreadId;
  69. } WZC_RW_LOCK, * PWZC_RW_LOCK;
  70. DWORD
  71. InitWZCDbGlobals(
  72. );
  73. VOID
  74. DeInitWZCDbGlobals(
  75. );
  76. DWORD
  77. WZCMapJetError(
  78. JET_ERR JetError,
  79. LPSTR CallerInfo OPTIONAL
  80. );
  81. DWORD
  82. WZCCreateDatabase(
  83. JET_SESID JetServerSession,
  84. CHAR * Connect,
  85. JET_DBID * pJetDatabaseHandle,
  86. JET_GRBIT JetBits
  87. );
  88. DWORD
  89. WZCOpenDatabase(
  90. JET_SESID JetServerSession,
  91. CHAR * Connect,
  92. JET_DBID * pJetDatabaseHandle,
  93. JET_GRBIT JetBits
  94. );
  95. DWORD
  96. WZCInitializeDatabase(
  97. JET_SESID * pJetServerSession
  98. );
  99. VOID
  100. WZCTerminateJet(
  101. JET_SESID * pJetServerSession
  102. );
  103. DWORD
  104. WZCJetBeginTransaction(
  105. JET_SESID JetServerSession
  106. );
  107. DWORD
  108. WZCJetRollBack(
  109. JET_SESID JetServerSession
  110. );
  111. DWORD
  112. WZCJetCommitTransaction(
  113. JET_SESID JetServerSession,
  114. JET_TABLEID JetTableHandle
  115. );
  116. DWORD
  117. WZCJetPrepareUpdate(
  118. JET_SESID JetServerSession,
  119. JET_TABLEID JetTableHandle,
  120. char * ColumnName,
  121. PVOID Key,
  122. DWORD KeySize,
  123. BOOL NewRecord
  124. );
  125. DWORD
  126. WZCJetCommitUpdate(
  127. JET_SESID JetServerSession,
  128. JET_TABLEID JetTableHandle
  129. );
  130. DWORD
  131. WZCJetSetValue(
  132. JET_SESID JetServerSession,
  133. JET_TABLEID JetTableHandle,
  134. JET_COLUMNID KeyColumnId,
  135. PVOID Data,
  136. DWORD DataSize
  137. );
  138. DWORD
  139. WZCJetPrepareSearch(
  140. JET_SESID JetServerSession,
  141. JET_TABLEID JetTableHandle,
  142. char * ColumnName,
  143. BOOL SearchFromStart,
  144. PVOID Key,
  145. DWORD KeySize
  146. );
  147. DWORD
  148. WZCJetNextRecord(
  149. JET_SESID JetServerSession,
  150. JET_TABLEID JetTableHandle
  151. );
  152. DWORD
  153. WZCCreateTableData(
  154. JET_SESID JetServerSession,
  155. JET_DBID JetDatabaseHandle,
  156. JET_TABLEID * pJetTableHandle
  157. );
  158. DWORD
  159. WZCOpenTableData(
  160. JET_SESID JetServerSession,
  161. JET_DBID JetDatabaseHandle,
  162. JET_TABLEID * pJetTableHandle
  163. );
  164. DWORD
  165. WZCJetGetValue(
  166. JET_SESID JetServerSession,
  167. JET_TABLEID JetTableHandle,
  168. JET_COLUMNID ColumnId,
  169. PVOID pvData,
  170. DWORD dwSize,
  171. PDWORD pdwRequiredSize
  172. );
  173. DWORD
  174. CreateSessionCont(
  175. PSESSION_CONTAINER * ppSessionCont
  176. );
  177. DWORD
  178. IniOpenWZCDbLogSession(
  179. PSESSION_CONTAINER pSessionCont
  180. );
  181. VOID
  182. FreeSessionCont(
  183. PSESSION_CONTAINER pSessionCont
  184. );
  185. DWORD
  186. GetSessionContainer(
  187. HANDLE hSession,
  188. PSESSION_CONTAINER * ppSessionCont
  189. );
  190. DWORD
  191. IniCloseWZCDbLogSession(
  192. PSESSION_CONTAINER pSessionCont
  193. );
  194. VOID
  195. RemoveSessionCont(
  196. PSESSION_CONTAINER pSessionCont
  197. );
  198. VOID
  199. DestroySessionContList(
  200. PSESSION_CONTAINER pSessionContList
  201. );
  202. DWORD
  203. WZCOpenAppendSession(
  204. PSESSION_CONTAINER pSessionCont
  205. );
  206. DWORD
  207. WZCCloseAppendSession(
  208. PSESSION_CONTAINER pSessionCont
  209. );
  210. DWORD
  211. IniEnumWZCDbLogRecords(
  212. PSESSION_CONTAINER pSessionCont,
  213. PBOOL pbEnumFromStart,
  214. DWORD dwPreferredNumEntries,
  215. PWZC_DB_RECORD * ppWZCRecords,
  216. LPDWORD pdwNumRecords
  217. );
  218. VOID
  219. FreeWZCRecords(
  220. PWZC_DB_RECORD pWZCRecords,
  221. DWORD dwNumRecords
  222. );
  223. DWORD
  224. IniFlushWZCDbLog(
  225. );
  226. DWORD
  227. CloseAllTableSessions(
  228. PSESSION_CONTAINER pSessionContList
  229. );
  230. DWORD
  231. OpenAllTableSessions(
  232. PSESSION_CONTAINER pSessionContList
  233. );
  234. DWORD
  235. WZCGetTableDataHandle(
  236. JET_SESID * pMyJetServerSession,
  237. JET_DBID * pMyJetDatabaseHandle,
  238. JET_TABLEID * pMyClientTableHandle
  239. );
  240. BOOL
  241. IsDBOpened(
  242. );
  243. DWORD
  244. IniEnumWZCDbLogRecordsSummary(
  245. PSESSION_CONTAINER pSessionCont,
  246. PBOOL pbEnumFromStart,
  247. DWORD dwPreferredNumEntries,
  248. PWZC_DB_RECORD * ppWZCRecords,
  249. LPDWORD pdwNumRecords
  250. );
  251. DWORD
  252. EnumWZCDbLogRecordsSummary(
  253. HANDLE hSession,
  254. PWZC_DB_RECORD pTemplateRecord,
  255. PBOOL pbEnumFromStart,
  256. DWORD dwPreferredNumEntries,
  257. PWZC_DB_RECORD * ppWZCRecords,
  258. LPDWORD pdwNumRecords,
  259. LPVOID pvReserved
  260. );
  261. DWORD
  262. GetWZCDbLogRecord(
  263. HANDLE hSession,
  264. PWZC_DB_RECORD pTemplateRecord,
  265. PWZC_DB_RECORD * ppWZCRecords,
  266. LPVOID pvReserved
  267. );
  268. DWORD
  269. IniGetWZCDbLogRecord(
  270. PSESSION_CONTAINER pSessionCont,
  271. PWZC_DB_RECORD pTemplateRecord,
  272. PWZC_DB_RECORD * ppWZCRecords
  273. );
  274. DWORD
  275. WZCSeekRecordOnIndexTime(
  276. JET_SESID JetServerSession,
  277. JET_TABLEID JetTableHandle,
  278. DWORD dwIndex,
  279. FILETIME ftTimeStamp
  280. );
  281. /*******************************************************/
  282. #endif // _DATABASE_