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.

211 lines
6.7 KiB

  1. //
  2. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  3. //
  4. // ***************************************************************************
  5. //
  6. // Original Author: Rajesh Rao
  7. //
  8. // $Author: rajeshr $
  9. // $Date: 6/11/98 4:43p $
  10. // $Workfile:ldapcach.h $
  11. //
  12. // $Modtime: 6/11/98 11:21a $
  13. // $Revision: 1 $
  14. // $Nokeywords: $
  15. //
  16. //
  17. // Description: Cache for LDAP Schema objects (Properties and Classes)
  18. //
  19. //***************************************************************************
  20. #ifndef LDAP_CACHE_H
  21. #define LDAP_CACHE_H
  22. class CLDAPCache
  23. {
  24. public:
  25. static DWORD dwLDAPCacheCount;
  26. //***************************************************************************
  27. //
  28. // CLDAPCache::CLDAPCache
  29. //
  30. // Purpose : Constructor. Fills in the cache with all the properties in LDAP.
  31. //
  32. // Parameters:
  33. // plogObject : Pointer to the ProvDebugLog object onto which logging will be done.
  34. //***************************************************************************
  35. CLDAPCache();
  36. //***************************************************************************
  37. //
  38. // CLDAPCache::~CLDAPCache
  39. //
  40. // Purpose : Destructor
  41. //
  42. //***************************************************************************
  43. ~CLDAPCache();
  44. //***************************************************************************
  45. //
  46. // CLDAPCache::IsInitialized
  47. //
  48. // Purpose : Indicates whether the cache was created and initialized succeddfully
  49. //
  50. // Parameters:
  51. // None
  52. //
  53. // Return value:
  54. // A boolean value indicating the status
  55. //
  56. //***************************************************************************
  57. BOOLEAN IsInitialized();
  58. //***************************************************************************
  59. //
  60. // CLDAPCache::GetProperty
  61. //
  62. // Purpose : Retreives the IDirectory interface of an LDAP property.
  63. //
  64. // Parameters:
  65. // lpszPropertyName : The name of the LDAP Property to be retreived
  66. // ppADSIProperty : The address of the pointer where the CADSIProperty object will be placed
  67. // bWBEMName : True if the lpszPropertyName is the WBEM name. False, if it is the LDAP name
  68. //
  69. // Return value:
  70. // The COM value representing the return status. The user should delete the returned object when done.
  71. //
  72. //***************************************************************************
  73. HRESULT GetProperty(LPCWSTR lpszPropertyName, CADSIProperty **ppADSIProperty, BOOLEAN bWBEMName);
  74. //***************************************************************************
  75. //
  76. // CLDAPCache::GetClass
  77. //
  78. // Purpose : Retreives the IDirectory interface of an LDAP Class
  79. //
  80. // Parameters:
  81. // lpszClassName : The name of the Class to be retreived.
  82. // ppADSIClass : The address of the pointer where the CADSIClass object will be placed
  83. //
  84. // Return value:
  85. // The COM value representing the return status. The user should delete the returned object when done.
  86. //
  87. //***************************************************************************
  88. HRESULT GetClass(LPCWSTR lpszWBEMClassName, LPCWSTR lpszClassName, CADSIClass **ppADSIClass);
  89. //***************************************************************************
  90. //
  91. // CLDAPCache::EnumerateClasses
  92. //
  93. // Purpose : Retreives the IDirectory interface of an LDAP Class
  94. //
  95. // Parameters:
  96. // lppszWBEMSuperClass : The WBEM name of the immediate superclass of the classes to be retreived. This is optional
  97. // and is ignored if NULL
  98. // bDeep : Indicates whether a deep enumeration is required. Otherwise a shallow enumeration is done
  99. // pppszClassNames : The address of the array of LPWSTR pointers where the resulting objects will be
  100. // placed. The user should deallocate this array as well as its contents when done with them.
  101. // pdwNumRows : The number of elements in the above array returned
  102. //
  103. // Return value:
  104. // The COM value representing the return status. The user should delete the returned object when done.
  105. //
  106. //***************************************************************************
  107. HRESULT EnumerateClasses(LPCWSTR lpszSuperclass,
  108. BOOLEAN bDeep,
  109. LPWSTR **pppADSIClasses,
  110. DWORD *pdwNumRows,
  111. BOOLEAN bArtificialClass
  112. );
  113. //***************************************************************************
  114. //
  115. // CLDAPCache::GetSchemaContainerSearch
  116. //
  117. // Purpose : To return the IDirectorySearch interface on the schema container
  118. //
  119. // Parameters:
  120. // ppDirectorySearch : The address where the pointer to the required interface will
  121. // be stored.
  122. //
  123. //
  124. // Return Value: The COM result representing the status. The user should release
  125. // the interface pointer when done with it.
  126. //***************************************************************************
  127. HRESULT GetSchemaContainerSearch(IDirectorySearch ** ppDirectorySearch);
  128. //***************************************************************************
  129. //
  130. // CLDAPCache::GetSchemaContainerObject
  131. //
  132. // Purpose : To return the IDirectoryObject interface on the schema container
  133. //
  134. // Parameters:
  135. // ppDirectoryObject : The address where the pointer to the required interface will
  136. // be stored.
  137. //
  138. //
  139. // Return Value: The COM result representing the status. The user should release
  140. // the interface pointer when done with it.
  141. //***************************************************************************
  142. HRESULT GetSchemaContainerObject(IDirectoryObject ** ppDirectorySearch);
  143. //***************************************************************************
  144. //
  145. // CLDAPCache :: CreateEmptyADSIClass
  146. //
  147. // Purpose: Creates a new ADSI class from a WBEM class
  148. //
  149. // Parameters:
  150. // lpszWBEMName : The WBEM Name of the class
  151. //
  152. //
  153. // Return Value:
  154. //
  155. //***************************************************************************
  156. HRESULT CreateEmptyADSIClass(
  157. LPCWSTR lpszWBEMName,
  158. CADSIClass **ppADSIClass);
  159. HRESULT FillInAProperty(CADSIProperty *pNextProperty, ADS_SEARCH_HANDLE hADSSearchOuter);
  160. private:
  161. // The storage for cached properties
  162. CObjectTree m_objectTree;
  163. // Whether the cache was created successfully
  164. BOOLEAN m_isInitialized;
  165. // These are the search preferences often used
  166. ADS_SEARCHPREF_INFO m_pSearchInfo[3];
  167. // The path to the schema container
  168. LPWSTR m_lpszSchemaContainerSuffix;
  169. LPWSTR m_lpszSchemaContainerPath;
  170. // The IDirectorySearch interface of the schema container
  171. IDirectorySearch *m_pDirectorySearchSchemaContainer;
  172. // Some other literals
  173. static LPCWSTR ROOT_DSE_PATH;
  174. static LPCWSTR SCHEMA_NAMING_CONTEXT;
  175. static LPCWSTR LDAP_PREFIX;
  176. static LPCWSTR LDAP_TOP_PREFIX;
  177. static LPCWSTR RIGHT_BRACKET;
  178. static LPCWSTR OBJECT_CATEGORY_EQUALS_ATTRIBUTE_SCHEMA;
  179. // A function to fill in the object tree
  180. // This can be called only after the m_pDirectorySearchSchemaContainer member
  181. // is initialized
  182. HRESULT InitializeObjectTree();
  183. };
  184. #endif /* LDAP_CACHE_H */