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.

264 lines
8.0 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. connect.h
  5. Abstract:
  6. defines for event/sink interface for IIS MetaBase.
  7. Author:
  8. Michael W. Thomas 04-Oct-96
  9. Revision History:
  10. --*/
  11. #if !defined(CONNECT_H)
  12. #define CONNECT_H
  13. #ifdef __cplusplus
  14. // Types that should be in OLE2.H
  15. #ifndef PPVOID
  16. typedef LPVOID* PPVOID;
  17. #endif
  18. // Convenient macros.
  19. #define RELEASE_INTERFACE(p)\
  20. {\
  21. IUnknown* pTmp = (IUnknown*)p;\
  22. p = NULL;\
  23. if (NULL != pTmp)\
  24. pTmp->Release();\
  25. }
  26. // An enumeration giving symbol names for the connection
  27. // points offered by the DllPaper component in this server.
  28. enum
  29. {
  30. MD_CONNPOINT_WRITESINK_A = 0,
  31. MD_CONNPOINT_WRITESINK_W
  32. };
  33. enum
  34. {
  35. // The maximum number of connection points offered by the DllPaper
  36. // component in this STOSERVE server. The number of items in the
  37. // connection point enumeration above.
  38. MAX_CONNECTION_POINTS = 2,
  39. // A constant for the number of connections to add to the allocation
  40. // of the dynamic connection array.
  41. ALLOC_CONNECTIONS = 256,
  42. // The start value for the connection key (cookie) counter.
  43. COOKIE_START_VALUE = 500
  44. };
  45. /*O+O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O
  46. ObjectClass: COEnumConnectionPoints
  47. Summary: COM object class for enumerating the Connection Points
  48. offered by a connectable object.
  49. Interfaces: IUnknown
  50. Standard interface providing COM object features.
  51. IEnumConnectionPoints
  52. Interface for connection point enumeration.
  53. Aggregation: COEnumConnectionPoints COM Objects are not aggregatable.
  54. O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O-O*/
  55. class COEnumConnectionPoints : public IEnumConnectionPoints
  56. {
  57. public:
  58. // Main Object Constructor & Destructor.
  59. COEnumConnectionPoints(IUnknown* pHostObj);
  60. ~COEnumConnectionPoints(void);
  61. // A general method for initializing this newly created object.
  62. // Creates any subordinate arrays, structures, or objects.
  63. HRESULT Init(
  64. ULONG cConnPts,
  65. IConnectionPoint** paConnPts,
  66. ULONG iEnumIndex);
  67. // IUnknown methods. Main object, non-delegating.
  68. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  69. STDMETHODIMP_(ULONG) AddRef(void);
  70. STDMETHODIMP_(ULONG) Release(void);
  71. // IEnumConnectionPoints methods.
  72. STDMETHODIMP Next(ULONG, IConnectionPoint**, ULONG*);
  73. STDMETHODIMP Skip(ULONG);
  74. STDMETHODIMP Reset(void);
  75. STDMETHODIMP Clone(IEnumConnectionPoints**);
  76. private:
  77. // Private data of COEnumConnectionPoints COM objects.
  78. // Main Object reference count.
  79. ULONG m_cRefs;
  80. // IUnknown pointer to host COM object being enumerated.
  81. IUnknown* m_pHostObj;
  82. // Connection Point index variable.
  83. ULONG m_iEnumIndex;
  84. // Number of Connection Points being enumerated.
  85. ULONG m_cConnPts;
  86. // Allocated array of Connection Point interface pointers.
  87. IConnectionPoint** m_paConnPts;
  88. };
  89. typedef COEnumConnectionPoints* PCOEnumConnectionPoints;
  90. /*O+O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O
  91. ObjectClass: COConnectionPoint
  92. Summary: Connection Point COM object class. Implements a native
  93. IConnectionPoint interface. The Advise, Unadvise, and
  94. EnumConnections methods use the CThreaded OwnThis mechanism
  95. to provide thread-safe mutually exclusive access to this
  96. connection point object.
  97. Interfaces: IUnknown
  98. Standard interface providing COM object features.
  99. IConnectionPoint
  100. Interface for connection point features.
  101. Aggregation: COConnectionPoint COM Objects are not aggregatable.
  102. O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O-O*/
  103. class COConnectionPoint : public IConnectionPoint
  104. {
  105. public:
  106. // Main Object Constructor & Destructor.
  107. COConnectionPoint(IUnknown* pHostObj);
  108. ~COConnectionPoint(void);
  109. // A general method for initializing this newly created object.
  110. // Creates any subordinate arrays, structures, or objects.
  111. HRESULT Init(REFIID riid);
  112. // IUnknown methods. Main object, non-delegating.
  113. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  114. STDMETHODIMP_(ULONG) AddRef(void);
  115. STDMETHODIMP_(ULONG) Release(void);
  116. // IConnectionPoint methods.
  117. STDMETHODIMP GetConnectionInterface(IID*);
  118. STDMETHODIMP GetConnectionPointContainer(IConnectionPointContainer**);
  119. STDMETHODIMP Advise(IUnknown*, DWORD*);
  120. STDMETHODIMP Unadvise(DWORD);
  121. STDMETHODIMP EnumConnections(IEnumConnections**);
  122. // Helper functions
  123. STDMETHODIMP InternalEnumSinks(
  124. CONNECTDATA **prgConnections,
  125. ULONG *pcConnections);
  126. private:
  127. // Private utility methods of COConnectionPoint.
  128. HRESULT GetSlot(UINT* puiFreeSlot);
  129. HRESULT FindSlot(DWORD dwCookie, UINT* puiSlot);
  130. // Private data of COConnectionPoint COM objects.
  131. // Main Object reference count.
  132. ULONG m_cRefs;
  133. // IUnknown pointer to host COM object offering this connection point.
  134. IUnknown* m_pHostObj;
  135. // The IID of the sink interface associated with this connection point.
  136. IID m_iidSink;
  137. // The current connection cookie (key) counter.
  138. DWORD m_dwNextCookie;
  139. // The current number of live sink connections to this connection point.
  140. UINT m_cConnections;
  141. // The current maximum index into the dynamic connection array.
  142. UINT m_uiMaxIndex;
  143. // The dynamic array of sink connections to this connection point.
  144. CONNECTDATA* m_paConnections;
  145. };
  146. typedef COConnectionPoint* PCOConnectionPoint;
  147. /*O+O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O
  148. ObjectClass: COEnumConnections
  149. Summary: COM object class for enumerating the connections of a
  150. connection point of a connectable object.
  151. Interfaces: IUnknown
  152. Standard interface providing COM object features.
  153. IEnumConnections
  154. Interface for connection enumeration features.
  155. Aggregation: COEnumConnections COM Objects are not aggregatable.
  156. O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O-O*/
  157. class COEnumConnections : public IEnumConnections
  158. {
  159. public:
  160. // Main Object Constructor & Destructor.
  161. COEnumConnections(IUnknown* pHostObj);
  162. ~COEnumConnections(void);
  163. // A general method for initializing this newly created object.
  164. // Creates any subordinate arrays, structures, or objects.
  165. HRESULT Init(
  166. ULONG cConnections,
  167. CONNECTDATA* paConnections,
  168. ULONG iEnumIndex);
  169. // IUnknown methods. Main object, non-delegating.
  170. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  171. STDMETHODIMP_(ULONG) AddRef(void);
  172. STDMETHODIMP_(ULONG) Release(void);
  173. // IEnumConnections methods.
  174. STDMETHODIMP Next(ULONG, CONNECTDATA*, ULONG*);
  175. STDMETHODIMP Skip(ULONG);
  176. STDMETHODIMP Reset(void);
  177. STDMETHODIMP Clone(IEnumConnections**);
  178. private:
  179. // Private data of COEnumConnections COM objects.
  180. // Main Object reference count.
  181. ULONG m_cRefs;
  182. // IUnknown pointer to host connection point COM object being
  183. // enumerated.
  184. IUnknown* m_pHostObj;
  185. // Connection index variable.
  186. ULONG m_iEnumIndex;
  187. // Number of Connections being enumerated.
  188. ULONG m_cConnections;
  189. // Allocated array of live Connections only.
  190. CONNECTDATA* m_paConnections;
  191. };
  192. typedef COEnumConnections* PCOEnumConnections;
  193. #endif // __cplusplus
  194. #endif // CONNECT_H
  195.