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.

122 lines
3.9 KiB

  1. #pragma once
  2. #define TRC_NAME TEXT("WZCTrace")
  3. #ifdef DBG
  4. extern UINT g_nLineNo;
  5. extern LPSTR g_szFileName;
  6. #define DbgPrint(params) _DebugPrint params
  7. #define DbgAssert(params) \
  8. { g_nLineNo = __LINE__; \
  9. g_szFileName = __FILE__; \
  10. _DebugAssert params; \
  11. }
  12. #define DbgBinPrint(params) _DebugBinary params
  13. #else
  14. #define DbgPrint(params)
  15. #define DbgAssert(params)
  16. #define DbgBinPrint(params)
  17. #endif
  18. #define TRC_GENERIC 0x00010000 // logs generic events that did not fit in any other category
  19. #define TRC_TRACK 0x00020000 // logs the code path
  20. #define TRC_MEM 0x00040000 // logs the memory allocations / releases
  21. #define TRC_ERR 0x00080000 // logs error conditions
  22. #define TRC_HASH 0x00100000 // logs hash related stuff
  23. #define TRC_NOTIF 0x00200000 // logs notifications
  24. #define TRC_STORAGE 0x00400000 // logs storage related stuff
  25. #define TRC_SYNC 0x00800000 // logs synchronization related stuff
  26. #define TRC_STATE 0x01000000 // logs state machine related stuff
  27. #define TRC_DATABASE 0x02000000 // logs for database logging
  28. // new log types to be added here.
  29. #define TRC_ASSERT 0x80000000 // logs failed assert conditions
  30. // trace identifier
  31. extern DWORD g_TraceLog;
  32. extern HANDLE g_hWzcEventLog;
  33. // debug utility calls
  34. VOID _DebugPrint(DWORD dwFlags, LPCSTR lpFormat, ...);
  35. VOID _DebugAssert(BOOL bChecked, LPCSTR lpFormat, ...);
  36. VOID _DebugBinary(DWORD dwFlags, LPCSTR lpMessage, LPBYTE pBuffer, UINT nBuffLen);
  37. VOID TrcInitialize();
  38. VOID TrcTerminate();
  39. // event logging utility calls
  40. VOID EvtInitialize();
  41. VOID EvtTerminate();
  42. VOID EvtLogWzcError(DWORD dwMsgId, DWORD dwErrCode);
  43. //---------------------------------------------
  44. // Database logging functions
  45. //
  46. #define WZCSVC_DLL "wzcsvc.dll"
  47. typedef struct _Wzc_Db_Record *PWZC_DB_RECORD;
  48. DWORD _DBRecord (
  49. DWORD eventID,
  50. PWZC_DB_RECORD pDbRecord,
  51. va_list *pvaList);
  52. typedef struct _INTF_CONTEXT *PINTF_CONTEXT;
  53. DWORD DbLogWzcError (
  54. DWORD eventID,
  55. PINTF_CONTEXT pIntfContext,
  56. ...
  57. );
  58. DWORD DbLogWzcInfo (
  59. DWORD eventID,
  60. PINTF_CONTEXT pIntfContext,
  61. ...
  62. );
  63. // number of buffers available for log params formatting
  64. #define DBLOG_SZFMT_BUFFS 10
  65. // lenght of each buffer used to format log params
  66. #define DBLOG_SZFMT_SIZE 256
  67. // utility macro to convert a hexa digit into its value
  68. #define HEX2WCHAR(c) ((c)<=9 ? L'0'+ (c) : L'A' + (c) - 10)
  69. // separator char to be used when formatting a MAC address
  70. #define MAC_SEPARATOR L'-'
  71. // Initializes the WZC_DB_RECORD
  72. DWORD DbLogInitDbRecord(
  73. DWORD dwCategory,
  74. PINTF_CONTEXT pIntfContext,
  75. PWZC_DB_RECORD pDbRecord
  76. );
  77. // Formats an SSID in the given formatting buffer
  78. LPWSTR DbLogFmtSSID(
  79. UINT nBuff, // index of the format buffer to use (0 .. DBLOG_SZFMT_BUFFS)
  80. PNDIS_802_11_SSID pndSSid);
  81. // Formats a BSSID (MAC address) in the given formatting buffer
  82. LPWSTR DbLogFmtBSSID(
  83. UINT nBuff,
  84. NDIS_802_11_MAC_ADDRESS ndBSSID);
  85. // Formats the INTF_CONTEXT::dwCtlFlags field for logging
  86. DWORD DbLogFmtFlags(
  87. LPWSTR wszBuffer, // buffer to place the result into
  88. LPDWORD pnchBuffer, // in: num of chars in the buffer; out: number of chars written to the buffer
  89. DWORD dwFlags); // interface flags to log
  90. // Formats a WZC_WLAN_CONFIG structure for logging
  91. DWORD DbLogFmtWConfig(
  92. LPWSTR wszBuffer, // buffer to place the result into
  93. LPDWORD pnchBuffer, // in: num of chars in the buffer; out: number of chars written to the buffer
  94. PWZC_WLAN_CONFIG pWzcCfg); // WZC_WLAN_CONFIG object to log