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.

123 lines
3.7 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // attrdef.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // Declares the class AttributeDefinition.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 03/01/1999 Original version.
  16. //
  17. ///////////////////////////////////////////////////////////////////////////////
  18. #ifndef ATTRDEF_H
  19. #define ATTRDEF_H
  20. #if _MSC_VER >= 1000
  21. #pragma once
  22. #endif
  23. class SdoDictionary;
  24. ///////////////////////////////////////////////////////////////////////////////
  25. //
  26. // CLASS
  27. //
  28. // AttributeDefinition
  29. //
  30. // DESCRIPTION
  31. //
  32. // Encapsulates all the information about an attribute in the dictionary.
  33. //
  34. ///////////////////////////////////////////////////////////////////////////////
  35. class AttributeDefinition
  36. {
  37. public:
  38. void AddRef() const throw ()
  39. { InterlockedIncrement(&refCount); }
  40. void Release() const throw ();
  41. // Retrieve attribute information based on the ATTRIBUTEINFO enum.
  42. HRESULT getInfo(
  43. ATTRIBUTEINFO infoId,
  44. VARIANT* pVal
  45. ) const throw ();
  46. // Retrieve attribute information based on the SDO property ID.
  47. HRESULT getProperty(
  48. LONG propId,
  49. VARIANT* pVal
  50. ) const throw ();
  51. // Create a new, empty definition.
  52. static HRESULT createInstance(AttributeDefinition** newDef) throw ();
  53. ///////
  54. // Functions for indexing attributes with qsort/bsearch.
  55. ///////
  56. static int __cdecl searchById(
  57. const ULONG* key,
  58. const AttributeDefinition* const* def
  59. ) throw ();
  60. static int __cdecl sortById(
  61. const AttributeDefinition* const* def1,
  62. const AttributeDefinition* const* def2
  63. ) throw ();
  64. static int __cdecl searchByName(
  65. PCWSTR key,
  66. const AttributeDefinition* const* def
  67. ) throw ();
  68. static int __cdecl sortByName(
  69. const AttributeDefinition* const* def1,
  70. const AttributeDefinition* const* def2
  71. ) throw ();
  72. static int __cdecl searchByLdapName(
  73. PCWSTR key,
  74. const AttributeDefinition* const* def
  75. ) throw ();
  76. static int __cdecl sortByLdapName(
  77. const AttributeDefinition* const* def1,
  78. const AttributeDefinition* const* def2
  79. ) throw ();
  80. protected:
  81. AttributeDefinition() throw ();
  82. ~AttributeDefinition() throw ();
  83. public:
  84. /////////
  85. // I made these public for two reasons:
  86. // (1) I'm lazy.
  87. // (2) The SdoDictionary class only gives out const pointers to
  88. // AttributeDefinition's, so they will be read-only anyway.
  89. /////////
  90. ULONG id; // Internal attribute ID.
  91. ULONG syntax; // Syntax.
  92. ULONG restrictions; // ATTRIBUTERESTRICTIONS flags.
  93. ULONG vendor; // Vendor ID -- zero if RADIUS standard.
  94. BSTR name; // Display name.
  95. BSTR description; // Description.
  96. BSTR ldapName; // LDAP name (used for persisting attribute).
  97. LPSAFEARRAY enumNames; // Array of enum names (null if not enumerable).
  98. LPSAFEARRAY enumValues; // Array of enum values.
  99. private:
  100. mutable LONG refCount; // Reference count.
  101. // Not implemented.
  102. AttributeDefinition(const AttributeDefinition&);
  103. AttributeDefinition& operator=(const AttributeDefinition&);
  104. };
  105. #endif // ATTRDEF_H