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.

334 lines
8.9 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. /*[in]*/ LONG CollectionPropertyId,
  52. /*[in]*/ LPWSTR CreateClassId,
  53. /*[in]*/ IDataStoreContainer* pDSContainer
  54. );
  55. ////////////////////////////////////////////////////////////////////////
  56. HRESULT PutComponentProperty(
  57. /*[in]*/ LONG Id,
  58. /*[in]*/ VARIANT* pValue
  59. );
  60. ////////////////////////////////////////////////////////////////////////
  61. HRESULT ChangePropertyDefault(
  62. /*[in]*/ LONG Id,
  63. /*[in]*/ VARIANT* pValue
  64. );
  65. ////////////////////////////////////////////////////////////////////////
  66. IDataStoreObject* GetComponentDataStore(void) const
  67. { return m_pDSObject; }
  68. ////////////////////////////////////////////////////////////////////////
  69. ISdoMachine* GetMachineSdo(void) const
  70. { return m_pAttachedMachine; }
  71. private:
  72. CSdoComponent(const CSdoComponent& rhs);
  73. CSdoComponent& operator = (CSdoComponent& rhs);
  74. CComponentCfg* m_pComponentCfg;
  75. ISdoMachine* m_pAttachedMachine;
  76. };
  77. typedef CComObjectNoLock<CSdoComponent> SDO_COMPONENT_OBJ;
  78. typedef CComObjectNoLock<CSdoComponent>* PSDO_COMPONENT_OBJ;
  79. /////////////////////////////////////////////////////////////////////////////
  80. // The Base Componet Configureation Class (Envelope )
  81. /////////////////////////////////////////////////////////////////////////////
  82. class CComponentCfgAuth;
  83. class CComponentCfgRADIUS;
  84. class CComponentCfgAccounting;
  85. class CComponentCfgNoOp;
  86. ///////////////////////////////////////////
  87. // Dummy class used for letter construction
  88. //
  89. struct DummyConstructor
  90. {
  91. DummyConstructor(int=0) { }
  92. };
  93. /////////////////////////////////////////////////////////////////////////////
  94. // This class is in place to handle loading and saving component
  95. // configuration data to the registry
  96. /////////////////////////////////////////////////////////////////////////////
  97. class CComponentCfg
  98. {
  99. public:
  100. //////////////////////////////////////////////////////////////////////////
  101. CComponentCfg(LONG lComponentId);
  102. //////////////////////////////////////////////////////////////////////////
  103. virtual ~CComponentCfg()
  104. {
  105. // if m_pComponent is not NULL then the envelope is being destroyed
  106. //
  107. if ( m_pComponentCfg )
  108. delete m_pComponentCfg;
  109. }
  110. //////////////////////////////////////////////////////////////////////////
  111. virtual HRESULT Initialize(CSdoComponent* pSdoComponent)
  112. {
  113. return m_pComponentCfg->Initialize(pSdoComponent);
  114. }
  115. //////////////////////////////////////////////////////////////////////////
  116. virtual HRESULT Load(CSdoComponent* pSdoComponent)
  117. {
  118. return m_pComponentCfg->Load(pSdoComponent);
  119. }
  120. //////////////////////////////////////////////////////////////////////////
  121. virtual HRESULT Save(CSdoComponent* pSdoComponent)
  122. {
  123. return m_pComponentCfg->Save(pSdoComponent);
  124. }
  125. //////////////////////////////////////////////////////////////////////////
  126. virtual HRESULT Validate (CSdoComponent* pSdoComponent)
  127. {
  128. return m_pComponentCfg->Validate (pSdoComponent);
  129. }
  130. //////////////////////////////////////////////////////////////////////////
  131. LONG GetId(void) const
  132. { return m_lComponentId; }
  133. protected:
  134. // Invoked explicitly by derived (letter) classes
  135. //
  136. CComponentCfg(LONG lComponentId, DummyConstructor theDummy)
  137. : m_lComponentId(lComponentId),
  138. m_pComponentCfg(NULL) { }
  139. private:
  140. // No default constructor since we would'nt know what
  141. // type of component configurator to build by default
  142. //
  143. CComponentCfg();
  144. // No copy or assignment of component configurators
  145. //
  146. CComponentCfg(const CComponentCfg& theComponent);
  147. CComponentCfg& operator = (CComponentCfg& theComponent);
  148. LONG m_lComponentId;
  149. CComponentCfg* m_pComponentCfg;
  150. };
  151. /////////////////////////////////////////////////////////////////////////////
  152. // The Derived Componet Configureation Class (Letters)
  153. /////////////////////////////////////////////////////////////////////////////
  154. //////////////////////////////////////////////////////////////////////////////
  155. class CComponentCfgNoOp : public CComponentCfg
  156. {
  157. // By default we load the component configuration from the default
  158. // configuration source (.mdb file) - the do nothing case
  159. //
  160. public:
  161. HRESULT Initialize(CSdoComponent* pSdoComponent)
  162. { return S_OK; }
  163. HRESULT Load(CSdoComponent* pSdoComponent)
  164. { return S_OK; }
  165. HRESULT Save(CSdoComponent* pSdoComponent)
  166. { return S_OK; }
  167. HRESULT Validate(CSdoComponent* pSdoComponent)
  168. { return S_OK; }
  169. private:
  170. friend CComponentCfg;
  171. CComponentCfgNoOp(LONG lComponentId)
  172. : CComponentCfg(lComponentId, DummyConstructor()) { }
  173. // No copy or assignment of component configurators
  174. //
  175. CComponentCfgNoOp();
  176. CComponentCfgNoOp(const CComponentCfgNoOp& theComponent);
  177. CComponentCfgNoOp& operator = (CComponentCfgNoOp& theComponent);
  178. };
  179. //////////////////////////////////////////////////////////////////////////////
  180. #define IAS_NTSAM_AUTH_ALLOW_LM L"Allow LM Authentication"
  181. class CComponentCfgAuth : public CComponentCfg
  182. {
  183. // Since we have no UI for request handlers we allow the
  184. // CPW1 parameter to be set via the registry
  185. //
  186. public:
  187. HRESULT Initialize(CSdoComponent* pSdoComponent)
  188. { return S_OK; }
  189. HRESULT Load(CSdoComponent* pSdoComponent);
  190. HRESULT Save(CSdoComponent* pSdoComponent)
  191. { return S_OK; }
  192. HRESULT Validate(CSdoComponent* pSdoComponent)
  193. { return S_OK; }
  194. private:
  195. friend CComponentCfg;
  196. CComponentCfgAuth(LONG lComponentId)
  197. : CComponentCfg(lComponentId, DummyConstructor()) { }
  198. // No copy or assignment of component configurators
  199. //
  200. CComponentCfgAuth();
  201. CComponentCfgAuth(const CComponentCfgAuth& rhs);
  202. CComponentCfgAuth& operator = (CComponentCfgAuth& rhs);
  203. };
  204. //////////////////////////////////////////////////////////////////////////////
  205. class CComponentCfgRADIUS : public CComponentCfg
  206. {
  207. // Need to initialize and configure the clients collection
  208. // of the RADIUS protocol component.
  209. //
  210. public:
  211. HRESULT Initialize(CSdoComponent* pSdoComponent);
  212. HRESULT Load(CSdoComponent* pSdoComponent)
  213. { return S_OK; }
  214. HRESULT Save(CSdoComponent* pSdoComponent)
  215. { return S_OK; }
  216. HRESULT Validate(CSdoComponent* pSdoComponent);
  217. private:
  218. HRESULT ValidatePort (PWCHAR pwszPortInfo);
  219. friend CComponentCfg;
  220. CComponentCfgRADIUS(LONG lComponentId)
  221. : CComponentCfg(lComponentId, DummyConstructor()) { }
  222. // No copy or assignment of component configurators
  223. //
  224. CComponentCfgRADIUS();
  225. CComponentCfgRADIUS(const CComponentCfgRADIUS& rhs);
  226. CComponentCfgRADIUS& operator = (CComponentCfgRADIUS& rhs);
  227. };
  228. //////////////////////////////////////////////////////////////////////////////
  229. class CComponentCfgAccounting : public CComponentCfg
  230. {
  231. public:
  232. HRESULT Initialize(CSdoComponent* pSdoComponent);
  233. HRESULT Load(CSdoComponent* pSdoComponent)
  234. { return S_OK; }
  235. HRESULT Save(CSdoComponent* pSdoComponent)
  236. { return S_OK; }
  237. HRESULT Validate(CSdoComponent* pSdoComponent)
  238. { return S_OK; }
  239. private:
  240. friend CComponentCfg;
  241. CComponentCfgAccounting(LONG lComponentId)
  242. : CComponentCfg(lComponentId, DummyConstructor()) { }
  243. // No copy or assignment of component configurators
  244. //
  245. CComponentCfgAccounting();
  246. CComponentCfgAccounting(const CComponentCfgAccounting& rhs);
  247. CComponentCfgAccounting& operator = (CComponentCfgAccounting& rhs);
  248. };
  249. #endif // _INC_IAS_SDO_COMPONENT_H_