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.

114 lines
3.6 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. // debug utility calls
  33. VOID _DebugPrint(DWORD dwFlags, LPCSTR lpFormat, ...);
  34. VOID _DebugAssert(BOOL bChecked, LPCSTR lpFormat, ...);
  35. VOID _DebugBinary(DWORD dwFlags, LPCSTR lpMessage, LPBYTE pBuffer, UINT nBuffLen);
  36. VOID TrcInitialize();
  37. VOID TrcTerminate();
  38. //---------------------------------------------
  39. // Database logging functions
  40. //
  41. #define WZCSVC_DLL "wzcsvc.dll"
  42. typedef struct _Wzc_Db_Record *PWZC_DB_RECORD;
  43. DWORD _DBRecord (
  44. DWORD eventID,
  45. PWZC_DB_RECORD pDbRecord,
  46. va_list *pvaList);
  47. typedef struct _INTF_CONTEXT *PINTF_CONTEXT;
  48. DWORD DbLogWzcError (
  49. DWORD eventID,
  50. PINTF_CONTEXT pIntfContext,
  51. ...
  52. );
  53. DWORD DbLogWzcInfo (
  54. DWORD eventID,
  55. PINTF_CONTEXT pIntfContext,
  56. ...
  57. );
  58. // number of buffers available for log params formatting
  59. #define DBLOG_SZFMT_BUFFS 10
  60. // lenght of each buffer used to format log params
  61. #define DBLOG_SZFMT_SIZE 256
  62. // utility macro to convert a hexa digit into its value
  63. #define HEX2WCHAR(c) ((c)<=9 ? L'0'+ (c) : L'A' + (c) - 10)
  64. // separator char to be used when formatting a MAC address
  65. #define MAC_SEPARATOR L'-'
  66. // Initializes the WZC_DB_RECORD
  67. DWORD DbLogInitDbRecord(
  68. DWORD dwCategory,
  69. PINTF_CONTEXT pIntfContext,
  70. PWZC_DB_RECORD pDbRecord
  71. );
  72. // Formats an SSID in the given formatting buffer
  73. LPWSTR DbLogFmtSSID(
  74. UINT nBuff, // index of the format buffer to use (0 .. DBLOG_SZFMT_BUFFS)
  75. PNDIS_802_11_SSID pndSSid);
  76. // Formats a BSSID (MAC address) in the given formatting buffer
  77. LPWSTR DbLogFmtBSSID(
  78. UINT nBuff,
  79. NDIS_802_11_MAC_ADDRESS ndBSSID);
  80. // Formats the INTF_CONTEXT::dwCtlFlags field for logging
  81. DWORD DbLogFmtFlags(
  82. LPWSTR wszBuffer, // buffer to place the result into
  83. LPDWORD pnchBuffer, // in: num of chars in the buffer; out: number of chars written to the buffer
  84. DWORD dwFlags); // interface flags to log
  85. // Formats a WZC_WLAN_CONFIG structure for logging
  86. DWORD DbLogFmtWConfig(
  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. PWZC_WLAN_CONFIG pWzcCfg); // WZC_WLAN_CONFIG object to log