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.

127 lines
3.3 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // pipeline.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // Declares the class Pipeline.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 01/28/2000 Original version.
  16. //
  17. ///////////////////////////////////////////////////////////////////////////////
  18. #ifndef PIPELINE_H
  19. #define PIPELINE_H
  20. #if _MSC_VER >= 1000
  21. #pragma once
  22. #endif
  23. #include <iascomp.h>
  24. #include <iaspolcy.h>
  25. #include <iastlb.h>
  26. #include "resource.h"
  27. class Request;
  28. class Stage;
  29. ///////////////////////////////////////////////////////////////////////////////
  30. //
  31. // CLASS
  32. //
  33. // Pipeline
  34. //
  35. ///////////////////////////////////////////////////////////////////////////////
  36. class ATL_NO_VTABLE Pipeline :
  37. public CComObjectRootEx<CComMultiThreadModelNoCS>,
  38. public CComCoClass<Pipeline, &__uuidof(Pipeline)>,
  39. public IDispatchImpl< IIasComponent,
  40. &__uuidof(IIasComponent),
  41. &__uuidof(IASCoreLib) >,
  42. public IDispatchImpl< IRequestHandler,
  43. &__uuidof(IRequestHandler),
  44. &__uuidof(IASCoreLib) >,
  45. public IRequestSource
  46. {
  47. public:
  48. DECLARE_NO_REGISTRY()
  49. DECLARE_NOT_AGGREGATABLE(Pipeline)
  50. BEGIN_COM_MAP(Pipeline)
  51. COM_INTERFACE_ENTRY_IID(__uuidof(IIasComponent), IIasComponent)
  52. COM_INTERFACE_ENTRY_IID(__uuidof(IRequestHandler), IRequestHandler)
  53. COM_INTERFACE_ENTRY_IID(__uuidof(IRequestSource), IRequestSource)
  54. END_COM_MAP()
  55. // IIasComponent
  56. STDMETHOD(InitNew)();
  57. STDMETHOD(Initialize)();
  58. STDMETHOD(Suspend)();
  59. STDMETHOD(Resume)();
  60. STDMETHOD(Shutdown)();
  61. STDMETHOD(GetProperty)(LONG Id, VARIANT* pValue);
  62. STDMETHOD(PutProperty)(LONG Id, VARIANT* pValue);
  63. // IRequestHandler
  64. STDMETHOD(OnRequest)(IRequest* pRequest);
  65. // IRequestSource
  66. STDMETHOD(OnRequestComplete)(
  67. IRequest* pRequest,
  68. IASREQUESTSTATUS eStatus
  69. );
  70. protected:
  71. Pipeline() throw ();
  72. ~Pipeline() throw ();
  73. private:
  74. DWORD tlsIndex; // Index into TLS for storing thread state.
  75. Stage* begin; // Beginning of the pipeline.
  76. Stage* end; // End of the pipeline.
  77. SAFEARRAY* handlers; // Handlers created and owned by the SDOs.
  78. ATTRIBUTEPOSITION proxy; // The provider for NAS-State requests.
  79. // Function type used with qsort.
  80. typedef int (__cdecl *CompFn)(const void*, const void*);
  81. // Determine the routing type of the request.
  82. void classify(Request& request) throw ();
  83. // Execute the request as much as possible.
  84. void execute(
  85. Request& request
  86. ) throw ();
  87. // Execute the next interested stage. Returns TRUE if more stages are ready
  88. // to execute.
  89. BOOL executeNext(
  90. Request& request
  91. ) throw ();
  92. // Read the stage configuration from the registry.
  93. LONG readConfiguration(HKEY key) throw ();
  94. // Initialize the stage's request handler.
  95. HRESULT initializeStage(Stage* stage) throw ();
  96. // Not implemented.
  97. Pipeline(const Pipeline&) throw ();
  98. Pipeline& operator=(const Pipeline&) throw ();
  99. };
  100. inline void Pipeline::execute(
  101. Request& request
  102. ) throw ()
  103. {
  104. while (executeNext(request)) { }
  105. }
  106. #endif // PIPELINE_H