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.

340 lines
9.7 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright(C) 1997-1998 Microsoft Corporation all rights reserved.
  4. //
  5. // Module: sdocomponent.h
  6. //
  7. // Project: Everest
  8. //
  9. // Description: IAS Server Data Object - IAS Component Class Definition
  10. //
  11. // Author: TLP 6/16/98
  12. //
  13. /////////////////////////////////////////////////////////////////////////////
  14. #ifndef _INC_IAS_SDO_COMPONENT_H_
  15. #define _INC_IAS_SDO_COMPONENT_H_
  16. #include "resource.h" // main symbols
  17. #include <ias.h>
  18. #include <sdoiaspriv.h>
  19. #include "sdobasedefs.h"
  20. #include "sdo.h"
  21. #include <sdofactory.h>
  22. class CComponentCfg; // Forward declaration
  23. /////////////////////////////////////////////////////////////////////////////
  24. // CSdoComponent
  25. /////////////////////////////////////////////////////////////////////////////
  26. class CSdoComponent : public CSdo
  27. {
  28. public:
  29. ////////////////////
  30. // ATL Interface Map
  31. ////////////////////
  32. BEGIN_COM_MAP(CSdoComponent)
  33. COM_INTERFACE_ENTRY(IDispatch)
  34. COM_INTERFACE_ENTRY(ISdo)
  35. END_COM_MAP()
  36. DECLARE_SDO_FACTORY(CSdoComponent);
  37. ////////////////////////////////////////////////////////////////////////
  38. CSdoComponent();
  39. virtual ~CSdoComponent();
  40. ////////////////////////////////////////////////////////////////////////
  41. HRESULT FinalInitialize(
  42. /*[in]*/ bool fInitNew,
  43. /*[in]*/ ISdoMachine* pAttachedMachine
  44. );
  45. ////////////////////////////////////////////////////////////////////////
  46. HRESULT Load(void);
  47. ////////////////////////////////////////////////////////////////////////
  48. HRESULT Save(void);
  49. ////////////////////////////////////////////////////////////////////////
  50. HRESULT InitializeComponentCollection(
  51. LONG CollectionPropertyId,
  52. LPWSTR CreateClassId,
  53. IDataStoreContainer* pDSContainer,
  54. DWORD maxSize = INFINITE
  55. );
  56. ////////////////////////////////////////////////////////////////////////
  57. HRESULT PutComponentProperty(
  58. /*[in]*/ LONG Id,
  59. /*[in]*/ VARIANT* pValue
  60. );
  61. ////////////////////////////////////////////////////////////////////////
  62. HRESULT ChangePropertyDefault(
  63. /*[in]*/ LONG Id,
  64. /*[in]*/ VARIANT* pValue
  65. );
  66. ////////////////////////////////////////////////////////////////////////
  67. IDataStoreObject* GetComponentDataStore(void) const
  68. { return m_pDSObject; }
  69. ////////////////////////////////////////////////////////////////////////
  70. ISdoMachine* GetMachineSdo(void) const
  71. { return m_pAttachedMachine; }
  72. protected:
  73. virtual HRESULT ValidateProperty(
  74. SDOPROPERTY* prop,
  75. VARIANT* value
  76. ) throw();
  77. private:
  78. CSdoComponent(const CSdoComponent& rhs);
  79. CSdoComponent& operator = (CSdoComponent& rhs);
  80. CComponentCfg* m_pComponentCfg;
  81. ISdoMachine* m_pAttachedMachine;
  82. };
  83. typedef CComObjectNoLock<CSdoComponent> SDO_COMPONENT_OBJ;
  84. typedef CComObjectNoLock<CSdoComponent>* PSDO_COMPONENT_OBJ;
  85. /////////////////////////////////////////////////////////////////////////////
  86. // The Base Componet Configureation Class (Envelope )
  87. /////////////////////////////////////////////////////////////////////////////
  88. class CComponentCfgAuth;
  89. class CComponentCfgRADIUS;
  90. class CComponentCfgAccounting;
  91. class CComponentCfgNoOp;
  92. ///////////////////////////////////////////
  93. // Dummy class used for letter construction
  94. //
  95. struct DummyConstructor
  96. {
  97. DummyConstructor(int=0) { }
  98. };
  99. /////////////////////////////////////////////////////////////////////////////
  100. // This class is in place to handle loading and saving component
  101. // configuration data to the registry
  102. /////////////////////////////////////////////////////////////////////////////
  103. class CComponentCfg
  104. {
  105. public:
  106. //////////////////////////////////////////////////////////////////////////
  107. CComponentCfg(LONG lComponentId);
  108. //////////////////////////////////////////////////////////////////////////
  109. virtual ~CComponentCfg()
  110. {
  111. // if m_pComponent is not NULL then the envelope is being destroyed
  112. //
  113. if ( m_pComponentCfg )
  114. delete m_pComponentCfg;
  115. }
  116. //////////////////////////////////////////////////////////////////////////
  117. virtual HRESULT Initialize(CSdoComponent* pSdoComponent)
  118. {
  119. return m_pComponentCfg->Initialize(pSdoComponent);
  120. }
  121. //////////////////////////////////////////////////////////////////////////
  122. virtual HRESULT Load(CSdoComponent* pSdoComponent)
  123. {
  124. return m_pComponentCfg->Load(pSdoComponent);
  125. }
  126. //////////////////////////////////////////////////////////////////////////
  127. virtual HRESULT Save(CSdoComponent* pSdoComponent)
  128. {
  129. return m_pComponentCfg->Save(pSdoComponent);
  130. }
  131. //////////////////////////////////////////////////////////////////////////
  132. virtual HRESULT Validate (CSdoComponent* pSdoComponent)
  133. {
  134. return m_pComponentCfg->Validate (pSdoComponent);
  135. }
  136. //////////////////////////////////////////////////////////////////////////
  137. LONG GetId(void) const
  138. { return m_lComponentId; }
  139. protected:
  140. // Invoked explicitly by derived (letter) classes
  141. //
  142. CComponentCfg(LONG lComponentId, DummyConstructor theDummy)
  143. : m_lComponentId(lComponentId),
  144. m_pComponentCfg(NULL) { }
  145. private:
  146. // No default constructor since we would'nt know what
  147. // type of component configurator to build by default
  148. //
  149. CComponentCfg();
  150. // No copy or assignment of component configurators
  151. //
  152. CComponentCfg(const CComponentCfg& theComponent);
  153. CComponentCfg& operator = (CComponentCfg& theComponent);
  154. LONG m_lComponentId;
  155. CComponentCfg* m_pComponentCfg;
  156. };
  157. /////////////////////////////////////////////////////////////////////////////
  158. // The Derived Componet Configureation Class (Letters)
  159. /////////////////////////////////////////////////////////////////////////////
  160. //////////////////////////////////////////////////////////////////////////////
  161. class CComponentCfgNoOp : public CComponentCfg
  162. {
  163. // By default we load the component configuration from the default
  164. // configuration source (.mdb file) - the do nothing case
  165. //
  166. public:
  167. HRESULT Initialize(CSdoComponent* pSdoComponent)
  168. { return S_OK; }
  169. HRESULT Load(CSdoComponent* pSdoComponent)
  170. { return S_OK; }
  171. HRESULT Save(CSdoComponent* pSdoComponent)
  172. { return S_OK; }
  173. HRESULT Validate(CSdoComponent* pSdoComponent)
  174. { return S_OK; }
  175. private:
  176. friend CComponentCfg;
  177. CComponentCfgNoOp(LONG lComponentId)
  178. : CComponentCfg(lComponentId, DummyConstructor()) { }
  179. // No copy or assignment of component configurators
  180. //
  181. CComponentCfgNoOp();
  182. CComponentCfgNoOp(const CComponentCfgNoOp& theComponent);
  183. CComponentCfgNoOp& operator = (CComponentCfgNoOp& theComponent);
  184. };
  185. //////////////////////////////////////////////////////////////////////////////
  186. #define IAS_NTSAM_AUTH_ALLOW_LM L"Allow LM Authentication"
  187. class CComponentCfgAuth : public CComponentCfg
  188. {
  189. // Since we have no UI for request handlers we allow the
  190. // CPW1 parameter to be set via the registry
  191. //
  192. public:
  193. HRESULT Initialize(CSdoComponent* pSdoComponent)
  194. { return S_OK; }
  195. HRESULT Load(CSdoComponent* pSdoComponent);
  196. HRESULT Save(CSdoComponent* pSdoComponent)
  197. { return S_OK; }
  198. HRESULT Validate(CSdoComponent* pSdoComponent)
  199. { return S_OK; }
  200. private:
  201. friend CComponentCfg;
  202. CComponentCfgAuth(LONG lComponentId)
  203. : CComponentCfg(lComponentId, DummyConstructor()) { }
  204. // No copy or assignment of component configurators
  205. //
  206. CComponentCfgAuth();
  207. CComponentCfgAuth(const CComponentCfgAuth& rhs);
  208. CComponentCfgAuth& operator = (CComponentCfgAuth& rhs);
  209. };
  210. //////////////////////////////////////////////////////////////////////////////
  211. class CComponentCfgRADIUS : public CComponentCfg
  212. {
  213. // Need to initialize and configure the clients collection
  214. // of the RADIUS protocol component.
  215. //
  216. public:
  217. HRESULT Initialize(CSdoComponent* pSdoComponent);
  218. HRESULT Load(CSdoComponent* pSdoComponent)
  219. { return S_OK; }
  220. HRESULT Save(CSdoComponent* pSdoComponent)
  221. { return S_OK; }
  222. HRESULT Validate(CSdoComponent* pSdoComponent)
  223. { return S_OK; }
  224. private:
  225. friend CComponentCfg;
  226. CComponentCfgRADIUS(LONG lComponentId)
  227. : CComponentCfg(lComponentId, DummyConstructor()) { }
  228. // No copy or assignment of component configurators
  229. //
  230. CComponentCfgRADIUS();
  231. CComponentCfgRADIUS(const CComponentCfgRADIUS& rhs);
  232. CComponentCfgRADIUS& operator = (CComponentCfgRADIUS& rhs);
  233. };
  234. //////////////////////////////////////////////////////////////////////////////
  235. class CComponentCfgAccounting : public CComponentCfg
  236. {
  237. public:
  238. HRESULT Initialize(CSdoComponent* pSdoComponent);
  239. HRESULT Load(CSdoComponent* pSdoComponent)
  240. { return S_OK; }
  241. HRESULT Save(CSdoComponent* pSdoComponent)
  242. { return S_OK; }
  243. HRESULT Validate(CSdoComponent* pSdoComponent)
  244. { return S_OK; }
  245. private:
  246. friend CComponentCfg;
  247. CComponentCfgAccounting(LONG lComponentId)
  248. : CComponentCfg(lComponentId, DummyConstructor()) { }
  249. // No copy or assignment of component configurators
  250. //
  251. CComponentCfgAccounting();
  252. CComponentCfgAccounting(const CComponentCfgAccounting& rhs);
  253. CComponentCfgAccounting& operator = (CComponentCfgAccounting& rhs);
  254. };
  255. #endif // _INC_IAS_SDO_COMPONENT_H_