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.

144 lines
3.6 KiB

  1. /*++
  2. Copyright (c) 2001, Microsoft Corporation
  3. Module Name:
  4. eltrace.h
  5. Abstract:
  6. Routines for database logging
  7. Revision History:
  8. sachins, September 05 2001, Created
  9. --*/
  10. #include "..\..\zeroconf\server\wzcsvc.h"
  11. #ifndef _ELTRACE_H_
  12. #define _ELTRACE_H_
  13. #define WMAC_SEPARATOR L'-'
  14. #define HEX2WCHAR(c) ((c)<=9 ? L'0'+ (c) : L'A' + (c) - 10)
  15. #define MAX_WMESG_SIZE MAX_RAW_DATA_SIZE/sizeof(WCHAR)
  16. extern WCHAR *EAPOLStates[];
  17. extern WCHAR *EAPOLAuthTypes[];
  18. extern WCHAR *EAPOLPacketTypes[];
  19. extern WCHAR *EAPOLEAPPacketTypes[];
  20. #define MACADDR_BYTE_TO_WSTR(bAddr, wszAddr) \
  21. { \
  22. DWORD i = 0, j = 0; \
  23. ZeroMemory ((PVOID)(wszAddr),3*SIZE_MAC_ADDR*sizeof(WCHAR)); \
  24. for (j = 0, i = 0; i < SIZE_MAC_ADDR; i++) \
  25. { \
  26. BYTE nHex; \
  27. nHex = (bAddr[i] & 0xf0) >> 4; \
  28. wszAddr[j++] = HEX2WCHAR(nHex); \
  29. nHex = (bAddr[i] & 0x0f); \
  30. wszAddr[j++] = HEX2WCHAR(nHex); \
  31. wszAddr[j++] = WMAC_SEPARATOR; \
  32. } \
  33. if (j > 0) \
  34. { \
  35. wszAddr[j-1] = L'\0'; \
  36. } \
  37. };
  38. VOID
  39. EapolTrace (
  40. IN CHAR* Format,
  41. ...
  42. );
  43. #define MAX_HASH_SIZE 20 // Certificate hash size
  44. #define MAX_HASH_LEN 20 // Certificate hash size
  45. typedef struct _EAPTLS_HASH
  46. {
  47. DWORD cbHash; // Number of bytes in the hash
  48. BYTE pbHash[MAX_HASH_SIZE]; // The hash of a certificate
  49. } EAPTLS_HASH;
  50. // EAP-TLS structure to weed out certificate details
  51. typedef struct _EAPTLS_USER_PROPERTIES
  52. {
  53. DWORD reserved; // Must be 0 (compare with EAPLOGONINFO)
  54. DWORD dwVersion;
  55. DWORD dwSize; // Number of bytes in this structure
  56. DWORD fFlags; // See EAPTLS_USER_FLAG_*
  57. EAPTLS_HASH Hash; // Hash for the user certificate
  58. WCHAR* pwszDiffUser; // The EAP Identity to send
  59. DWORD dwPinOffset; // Offset in abData
  60. WCHAR* pwszPin; // The smartcard PIN
  61. USHORT usLength; // Part of UnicodeString
  62. USHORT usMaximumLength; // Part of UnicodeString
  63. UCHAR ucSeed; // To unlock the UnicodeString
  64. WCHAR awszString[1]; // Storage for pwszDiffUser and pwszPin
  65. } EAPTLS_USER_PROPERTIES;
  66. typedef struct _EAPOL_CERT_NODE
  67. {
  68. WCHAR* pwszVersion;
  69. WCHAR* pwszSerialNumber;
  70. WCHAR* pwszIssuer;
  71. WCHAR* pwszFriendlyName;
  72. WCHAR* pwszDisplayName;
  73. WCHAR* pwszValidFrom;
  74. WCHAR* pwszValidTo;
  75. WCHAR* pwszThumbprint;
  76. WCHAR* pwszEKUUsage;
  77. } EAPOL_CERT_NODE, *PEAPOL_CERT_NODE;
  78. DWORD
  79. ElLogCertificateDetails (
  80. EAPOL_PCB *pPCB
  81. );
  82. DWORD
  83. DbLogPCBEvent (
  84. DWORD dwCategory,
  85. EAPOL_PCB *pPCB,
  86. DWORD dwEventId,
  87. ...
  88. );
  89. DWORD
  90. DbFormatEAPOLEventVA (
  91. WCHAR *pwszMessage,
  92. DWORD dwEventId,
  93. ...
  94. );
  95. DWORD
  96. DbFormatEAPOLEvent (
  97. WCHAR *pwszMessage,
  98. DWORD dwEventId,
  99. va_list *pargList
  100. );
  101. DWORD
  102. ElParsePacket (
  103. IN PBYTE pbPkt,
  104. IN DWORD dwLength,
  105. IN BOOLEAN fReceived
  106. );
  107. DWORD
  108. ElFormatPCBContext (
  109. IN EAPOL_PCB *pPCB,
  110. IN OUT WCHAR *pwszContext
  111. );
  112. DWORD
  113. ElDisplayCert (
  114. IN EAPOL_PCB *pPCB
  115. );
  116. #endif // _ELTRACE_H_