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.

179 lines
4.3 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // request.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // Declares the class Request.
  12. //
  13. ///////////////////////////////////////////////////////////////////////////////
  14. #ifndef REQUEST_H
  15. #define REQUEST_H
  16. #if _MSC_VER >= 1000
  17. #pragma once
  18. #endif
  19. #include "resource.h"
  20. #include <iaspolcy.h>
  21. #include <sdoias.h>
  22. ///////////////////////////////////////////////////////////////////////////////
  23. //
  24. // CLASS
  25. //
  26. // Request
  27. //
  28. ///////////////////////////////////////////////////////////////////////////////
  29. class ATL_NO_VTABLE Request :
  30. public CComObjectRootEx<CComMultiThreadModel>,
  31. public CComCoClass<Request, &__uuidof(Request)>,
  32. public IRequest,
  33. public IAttributesRaw,
  34. public IRequestState
  35. {
  36. public:
  37. DECLARE_REGISTRY_RESOURCEID(IDR_Registry)
  38. DECLARE_NOT_AGGREGATABLE(Request)
  39. BEGIN_COM_MAP(Request)
  40. COM_INTERFACE_ENTRY_IID(__uuidof(IAttributesRaw), IAttributesRaw)
  41. COM_INTERFACE_ENTRY_IID(__uuidof(Request), Request)
  42. COM_INTERFACE_ENTRY_IID(__uuidof(IRequestState), IRequestState)
  43. COM_INTERFACE_ENTRY_IID(__uuidof(IRequest), IRequest)
  44. END_COM_MAP()
  45. /////////
  46. // Methods used by the Pipeline for routing requests.
  47. /////////
  48. IASREQUEST getRequest() const throw ()
  49. { return request; }
  50. IASPROVIDER getProvider() const throw ()
  51. {
  52. PIASATTRIBUTE attr = findFirst(IAS_ATTRIBUTE_PROVIDER_TYPE);
  53. return attr ? (IASPROVIDER)attr->Value.Enumerator : IAS_PROVIDER_NONE;
  54. }
  55. IASRESPONSE getResponse() const throw ()
  56. { return response; }
  57. IASREASON getReason() const throw ()
  58. { return reason; }
  59. void pushState(ULONG64 state) throw ()
  60. { *topOfStack++ = state; }
  61. ULONG64 popState() throw ()
  62. { return *--topOfStack; }
  63. void pushSource(IRequestSource* newVal) throw ()
  64. { pushState((ULONG64)source); source = newVal; }
  65. void popSource() throw ()
  66. { source = (IRequestSource*)popState(); }
  67. IASREQUEST getRoutingType() const throw ()
  68. { return routing; }
  69. void setRoutingType(IASREQUEST newVal) throw ()
  70. { routing = newVal; }
  71. PIASATTRIBUTE findFirst(DWORD id) const throw ();
  72. static Request* narrow(IUnknown* pUnk) throw ();
  73. /////////
  74. // IRequest
  75. /////////
  76. STDMETHOD(get_Source)(IRequestSource** pVal);
  77. STDMETHOD(put_Source)(IRequestSource* newVal);
  78. STDMETHOD(get_Protocol)(IASPROTOCOL *pVal);
  79. STDMETHOD(put_Protocol)(IASPROTOCOL newVal);
  80. STDMETHOD(get_Request)(LONG *pVal);
  81. STDMETHOD(put_Request)(LONG newVal);
  82. STDMETHOD(get_Response)(LONG *pVal);
  83. STDMETHOD(get_Reason)(LONG *pVal);
  84. STDMETHOD(SetResponse)(IASRESPONSE eResponse, LONG lReason);
  85. STDMETHOD(ReturnToSource)(IASREQUESTSTATUS eStatus);
  86. /////////
  87. // IAttributesRaw
  88. /////////
  89. STDMETHOD(AddAttributes)(
  90. DWORD dwPosCount,
  91. PATTRIBUTEPOSITION pPositions
  92. );
  93. STDMETHOD(RemoveAttributes)(
  94. DWORD dwPosCount,
  95. PATTRIBUTEPOSITION pPositions
  96. );
  97. STDMETHOD(RemoveAttributesByType)(
  98. DWORD dwAttrIDCount,
  99. DWORD *lpdwAttrIDs
  100. );
  101. STDMETHOD(GetAttributeCount)(
  102. DWORD *lpdwCount
  103. );
  104. STDMETHOD(GetAttributes)(
  105. DWORD *lpdwPosCount,
  106. PATTRIBUTEPOSITION pPositions,
  107. DWORD dwAttrIDCount,
  108. DWORD *lpdwAttrIDs
  109. );
  110. /////////
  111. // IRequestState
  112. /////////
  113. STDMETHOD(Push)(
  114. ULONG64 state
  115. );
  116. STDMETHOD(Pop)(
  117. ULONG64 *pState
  118. );
  119. STDMETHOD(Top)(
  120. ULONG64 *pState
  121. );
  122. protected:
  123. Request() throw ();
  124. ~Request() throw ();
  125. private:
  126. BOOL reserve(SIZE_T needed) throw ();
  127. // Properties.
  128. IRequestSource* source;
  129. IASPROTOCOL protocol;
  130. IASREQUEST request;
  131. IASRESPONSE response;
  132. IASREASON reason;
  133. // More specific request type used for routing.
  134. IASREQUEST routing;
  135. // Attribute collection.
  136. PIASATTRIBUTE* begin;
  137. PIASATTRIBUTE* end;
  138. PIASATTRIBUTE* capacity;
  139. // State stack.
  140. ULONG64 state[3];
  141. PULONG64 topOfStack;
  142. // Not implemented.
  143. Request(const Request&) throw ();
  144. Request& operator=(const Request&) throw ();
  145. };
  146. #endif // REQUEST_H