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.

320 lines
8.5 KiB

  1. //#--------------------------------------------------------------
  2. //
  3. // File: controller.h
  4. //
  5. // Synopsis: This file holds the declarations of the
  6. // CCollection class
  7. //
  8. //
  9. // History: 9/23/97 MKarki Created
  10. // 6/04/98 SBens Added the InfoBase class.
  11. //
  12. // Copyright (C) 1997-98 Microsoft Corporation
  13. // All rights reserved.
  14. //
  15. //#--------------------------------------------------------------
  16. #ifndef _CONTROLLER_H_
  17. #define _CONTROLLER_H_
  18. #include "radcommon.h"
  19. #include "iasradius.h"
  20. #include "resource.h"
  21. #include "dictionary.h"
  22. #include "prevalidator.h"
  23. #include "preprocessor.h"
  24. #include "packetreceiver.h"
  25. #include "hashmd5.h"
  26. #include "hashhmac.h"
  27. #include "packetsender.h"
  28. #include "reportevent.h"
  29. #include "sendtopipe.h"
  30. #include "tunnelpassword.h"
  31. #include "ports.h"
  32. class CController:
  33. public IDispatchImpl<IIasComponent,
  34. &__uuidof (IIasComponent),
  35. &__uuidof (IASRadiusLib)
  36. >,
  37. public IPersistPropertyBag2,
  38. public CComObjectRoot,
  39. public CComCoClass<RadiusProtocol,&__uuidof (RadiusProtocol)>,
  40. private IASTraceInitializer
  41. {
  42. public:
  43. //
  44. // registry declaration for the Radius Protocol
  45. //
  46. IAS_DECLARE_REGISTRY (RadiusProtocol, 1, 0, IASRadiusLib)
  47. //
  48. // this COM Component is not aggregatable
  49. //
  50. DECLARE_NOT_AGGREGATABLE(CController)
  51. //
  52. // MACROS for ATL required methods
  53. //
  54. BEGIN_COM_MAP(CController)
  55. COM_INTERFACE_ENTRY2(IDispatch, IIasComponent)
  56. COM_INTERFACE_ENTRY(IIasComponent)
  57. COM_INTERFACE_ENTRY(IPersistPropertyBag2)
  58. COM_INTERFACE_ENTRY_FUNC(__uuidof (IRequestSource), 0, &CController::QueryInterfaceReqSrc)
  59. END_COM_MAP()
  60. //
  61. // MACRO to declare Controlling IUnknown method
  62. //
  63. DECLARE_GET_CONTROLLING_UNKNOWN()
  64. CController (VOID);
  65. ~CController (VOID);
  66. public:
  67. //
  68. // methods of IPersistPropertyBag2 interface
  69. //
  70. STDMETHOD(Load) (
  71. /*[in]*/ IPropertyBag2 *pIPropertyBag,
  72. /*[in]*/ IErrorLog *pIErrLog
  73. );
  74. STDMETHOD(Save) (
  75. /*[in]*/ IPropertyBag2 *pIPropertyBag,
  76. /*[in]*/ BOOL bClearDirty,
  77. /*[in]*/ BOOL bSaveAllProperties
  78. );
  79. STDMETHOD(IsDirty)();
  80. //
  81. // IPersist Method
  82. //
  83. STDMETHOD (GetClassID) (
  84. /*[out]*/ CLSID *pClsid
  85. )
  86. {
  87. if (NULL == pClsid)
  88. return (E_FAIL);
  89. *pClsid = __uuidof (RadiusProtocol);
  90. return (S_OK);
  91. }
  92. //
  93. // IIasPropertyNotify method
  94. //
  95. STDMETHOD (OnPropertyChange)(
  96. /*[in]*/ ULONG ulProperties,
  97. /*[in]*/ ULONG *pulProperties,
  98. /*[in]*/ IPropertyBag2 *pIPropertyBag
  99. );
  100. //
  101. // methods of IIasComponent interface
  102. //
  103. STDMETHOD(Initialize)();
  104. STDMETHOD(Shutdown)();
  105. STDMETHOD(GetProperty)(
  106. /*[in]*/ LONG id,
  107. /*[out]*/ VARIANT *pValue
  108. );
  109. STDMETHOD(PutProperty)(
  110. /*[in]*/ LONG id,
  111. /*[in]*/ VARIANT *pValue
  112. );
  113. STDMETHOD(InitNew)();
  114. STDMETHOD (Suspend) ();
  115. STDMETHOD (Resume) ();
  116. private:
  117. CPacketReceiver *m_pCPacketReceiver;
  118. CRecvFromPipe *m_pCRecvFromPipe;
  119. CPreProcessor *m_pCPreProcessor;
  120. CPreValidator *m_pCPreValidator;
  121. CDictionary *m_pCDictionary;
  122. CClients *m_pCClients;
  123. CHashMD5 *m_pCHashMD5;
  124. CHashHmacMD5 *m_pCHashHmacMD5;
  125. CSendToPipe *m_pCSendToPipe;
  126. CPacketSender *m_pCPacketSender;
  127. CReportEvent *m_pCReportEvent;
  128. CTunnelPassword *m_pCTunnelPassword;
  129. VSAFilter *m_pCVSAFilter;
  130. IIasComponent *m_pInfoBase; // Auditor that tracks RADIUS events.
  131. CPorts m_objAuthPort;
  132. CPorts m_objAcctPort;
  133. //
  134. // here the Request servers
  135. //
  136. IRequestHandler *m_pIRequestHandler;
  137. //
  138. // here is the definition of the CRequestSource
  139. // which implements the method of the IRequestSource
  140. // interface
  141. //
  142. class CRequestSource : public IRequestSource
  143. {
  144. public:
  145. CRequestSource (CController *pCController);
  146. ~CRequestSource ();
  147. //
  148. // IUnknown methods - delegate to outer IUnknown
  149. //
  150. STDMETHOD(QueryInterface)(
  151. /*[in]*/ REFIID riid,
  152. /*[out]*/ void **ppv
  153. )
  154. {
  155. IUnknown *pUnknown = m_pCController->GetControllingUnknown();
  156. return (pUnknown->QueryInterface(riid,ppv));
  157. }
  158. STDMETHOD_(ULONG,AddRef)(void)
  159. {
  160. IUnknown *pUnknown = m_pCController->GetControllingUnknown();
  161. return (pUnknown->AddRef());
  162. }
  163. STDMETHOD_(ULONG,Release)(void)
  164. {
  165. IUnknown *pUnknown = m_pCController->GetControllingUnknown();
  166. return (pUnknown->Release());
  167. }
  168. //
  169. // IDispatch methods - delegate to outer class object
  170. //
  171. STDMETHOD(GetTypeInfoCount)(
  172. /*[out]*/ UINT *pctinfo
  173. )
  174. {
  175. return (m_pCController->GetTypeInfoCount (pctinfo));
  176. }
  177. STDMETHOD(GetTypeInfo)(
  178. /*[in]*/ UINT iTInfo,
  179. /*[in]*/ LCID lcid,
  180. /*[out]*/ ITypeInfo **ppTInfo
  181. )
  182. {
  183. return (m_pCController->GetTypeInfo (iTInfo, lcid, ppTInfo));
  184. }
  185. STDMETHOD(GetIDsOfNames)(
  186. /*[in]*/ const IID& riid,
  187. /*[in]*/ LPOLESTR *rgszNames,
  188. /*[in]*/ UINT cNames,
  189. /*[in]*/ LCID lcid,
  190. /*[out]*/ DISPID *rgDispId)
  191. {
  192. return (m_pCController->GetIDsOfNames (
  193. riid, rgszNames, cNames, lcid, rgDispId
  194. )
  195. );
  196. }
  197. STDMETHOD(Invoke)(
  198. /*[in]*/ DISPID dispIdMember,
  199. /*[in]*/ const IID& riid,
  200. /*[in]*/ LCID lcid,
  201. /*[in]*/ WORD wFlags,
  202. /*[in/out]*/DISPPARAMS *pDispParams,
  203. /*[out]*/ VARIANT *pVarResult,
  204. /*[out]*/ EXCEPINFO *pExcepInfo,
  205. /*[out]*/ UINT *puArgErr
  206. )
  207. {
  208. return (m_pCController->Invoke (
  209. dispIdMember,
  210. riid,
  211. lcid,
  212. wFlags,
  213. pDispParams,
  214. pVarResult,
  215. pExcepInfo,
  216. puArgErr
  217. )
  218. );
  219. }
  220. //
  221. // IRequestSource Interface method
  222. //
  223. STDMETHOD(OnRequestComplete)(
  224. /*[in]*/ IRequest *pIRequest,
  225. /*[in]*/ IASREQUESTSTATUS eStatus
  226. );
  227. private:
  228. CController* m_pCController;
  229. }; // End of nested class CRequestSource
  230. //
  231. // this method is called when somone whants the
  232. // IRequestHandlercallback interface
  233. //
  234. static HRESULT WINAPI QueryInterfaceReqSrc (
  235. VOID *pThis,
  236. REFIID riid,
  237. LPVOID *ppv,
  238. ULONG_PTR ulpValue
  239. );
  240. //
  241. // instantiate this nested class
  242. //
  243. CRequestSource m_objCRequestSource;
  244. //
  245. // now we can call into private methods of CController
  246. //
  247. friend class CRequestSource;
  248. typedef enum _component_state_
  249. {
  250. COMP_SHUTDOWN,
  251. COMP_UNINITIALIZED,
  252. COMP_INITIALIZED,
  253. COMP_SUSPENDED
  254. } COMPONENTSTATE, *PCOMPONENTSTATE;
  255. COMPONENTSTATE m_eRadCompState;
  256. //
  257. // this is the internal initialization method of CController class
  258. // object
  259. //
  260. HRESULT InternalInit (VOID);
  261. //
  262. // does the internal cleanup of resources
  263. //
  264. VOID InternalCleanup (VOID);
  265. };
  266. #endif // !define _CONTROLLER_H_