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.

120 lines
2.9 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) Microsoft Corporation
  4. //
  5. // SYNOPSIS
  6. //
  7. // Declares the class LogSchema
  8. //
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef LOGSCHEMA_H
  11. #define LOGSCHEMA_H
  12. #pragma once
  13. #include <hashmap.h>
  14. #include <nocopy.h>
  15. ///////////////////////////////////////////////////////////////////////////////
  16. //
  17. // CLASS
  18. //
  19. // LogField
  20. //
  21. // DESCRIPTION
  22. //
  23. // Describes a field in the logfile.
  24. //
  25. ///////////////////////////////////////////////////////////////////////////////
  26. class LogField
  27. {
  28. public:
  29. LogField() throw ()
  30. { }
  31. LogField(
  32. DWORD id,
  33. const wchar_t* attrName,
  34. DWORD order,
  35. BOOL shouldExclude
  36. ) throw ()
  37. : iasID(id),
  38. name(attrName),
  39. ordinal(order),
  40. excludeFromLog(shouldExclude),
  41. excludeFromDatabase(shouldExclude)
  42. {
  43. if ((id == RADIUS_ATTRIBUTE_USER_NAME) ||
  44. (id == RADIUS_ATTRIBUTE_NAS_IP_ADDRESS))
  45. {
  46. excludeFromDatabase = FALSE;
  47. }
  48. }
  49. bool operator<(const LogField& f) const throw ()
  50. { return ordinal < f.ordinal; }
  51. bool operator==(const LogField& f) const throw ()
  52. { return iasID == f.iasID; }
  53. DWORD hash() const throw ()
  54. { return iasID; }
  55. DWORD iasID;
  56. const wchar_t* name;
  57. DWORD ordinal;
  58. BOOL excludeFromLog;
  59. BOOL excludeFromDatabase;
  60. };
  61. ///////////////////////////////////////////////////////////////////////////////
  62. //
  63. // CLASS
  64. //
  65. // LogSchema
  66. //
  67. // DESCRIPTION
  68. //
  69. // This class reads the logfile schema from the dictionary and creates
  70. // a vector of DWORDs containing the attributes to be logged in column
  71. // order.
  72. //
  73. ///////////////////////////////////////////////////////////////////////////////
  74. class LogSchema : NonCopyable
  75. {
  76. public:
  77. LogSchema() throw ();
  78. ~LogSchema() throw ();
  79. DWORD getNumFields() const throw ()
  80. { return numFields; }
  81. // Returns TRUE if the given attribute ID should be excluded from the log.
  82. BOOL excludeFromLog(DWORD iasID) const throw ();
  83. // Returns the LogField data for a given attribute ID.
  84. const LogField* find(DWORD iasID) const throw ();
  85. // Return the ordinal for a given attribute ID. An ordinal of zero
  86. // indicates that the attribute should not be logged.
  87. DWORD getOrdinal(DWORD iasID) const throw ();
  88. // Initialize the dictionary for use.
  89. HRESULT initialize() throw ();
  90. // Shutdown the dictionary after use.
  91. void shutdown() throw ();
  92. protected:
  93. // Clear the schema.
  94. void clear() throw ();
  95. typedef hash_table < LogField > SchemaTable;
  96. SchemaTable schema;
  97. DWORD numFields; // Number of fields in the ODBC schema.
  98. DWORD refCount; // Initialization ref. count.
  99. };
  100. #endif // LOGSCHEMA_H