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.

275 lines
6.9 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. Confpart.h
  5. Abstract:
  6. Definitions for participant related classes..
  7. Author:
  8. Mu Han (muhan) 30-September-1998
  9. --*/
  10. #ifndef __CONFPART_H
  11. #define __CONFPART_H
  12. const DWORD PART_SEND = 0x0001;
  13. const DWORD PART_RECV = 0x0002;
  14. #define PESTREAM_FULLBITS 0xffffffff
  15. typedef enum PESTREAM_STATE
  16. {
  17. PESTREAM_RECOVER = 0x00000001,
  18. PESTREAM_TIMEOUT = 0x00000002
  19. } PESTREAM_STATE;
  20. typedef struct _STREAM_INFO
  21. {
  22. DWORD dwSSRC;
  23. DWORD dwSendRecv;
  24. DWORD dwState;
  25. } STREAM_INFO;
  26. #define NUM_SDES_ITEMS (RTPSDES_PRIV - RTPSDES_FIRST)
  27. class ATL_NO_VTABLE CParticipant :
  28. public CComObjectRootEx<CComMultiThreadModelNoCS>,
  29. public IDispatchImpl<ITParticipant, &__uuidof(ITParticipant), &LIBID_IPConfMSPLib>,
  30. public CMSPObjectSafetyImpl
  31. {
  32. public:
  33. BEGIN_COM_MAP(CParticipant)
  34. COM_INTERFACE_ENTRY(IDispatch)
  35. COM_INTERFACE_ENTRY(ITParticipant)
  36. COM_INTERFACE_ENTRY(IObjectSafety)
  37. COM_INTERFACE_ENTRY_AGGREGATE(__uuidof(IMarshal), m_pFTM)
  38. END_COM_MAP()
  39. DECLARE_GET_CONTROLLING_UNKNOWN()
  40. #ifdef DEBUG_REFCOUNT
  41. ULONG InternalAddRef();
  42. ULONG InternalRelease();
  43. #endif
  44. CParticipant();
  45. // methods of the CComObject
  46. virtual void FinalRelease();
  47. // ITParticipant methods, called by the app.
  48. STDMETHOD (get_ParticipantTypedInfo) (
  49. IN PARTICIPANT_TYPED_INFO InfoType,
  50. OUT BSTR * ppInfo
  51. );
  52. STDMETHOD (get_MediaTypes) (
  53. // IN TERMINAL_DIRECTION Direction,
  54. OUT long * plMediaTypes
  55. );
  56. STDMETHOD (put_Status) (
  57. IN ITStream * pITStream,
  58. IN VARIANT_BOOL fEnable
  59. );
  60. STDMETHOD (get_Status) (
  61. IN ITStream * pITStream,
  62. OUT VARIANT_BOOL * pStatus
  63. );
  64. STDMETHOD (get_Streams) (
  65. OUT VARIANT * pVariant
  66. );
  67. STDMETHOD (EnumerateStreams) (
  68. OUT IEnumStream ** ppEnumStream
  69. );
  70. // methods called by the call object.
  71. HRESULT Init(
  72. IN WCHAR * szCName,
  73. IN ITStream * pITStream,
  74. IN DWORD dwSSRC,
  75. IN DWORD dwSendRecv,
  76. IN DWORD dwMediaType
  77. );
  78. BOOL UpdateInfo(
  79. IN int Type,
  80. IN DWORD dwLen,
  81. IN WCHAR * szInfo
  82. );
  83. BOOL UpdateSSRC(
  84. IN ITStream * pITStream,
  85. IN DWORD dwSSRC,
  86. IN DWORD dwSendRecv
  87. );
  88. BOOL HasSSRC(
  89. IN ITStream * pITStream,
  90. IN DWORD dwSSRC
  91. );
  92. BOOL GetSSRC(
  93. IN ITStream * pITStream,
  94. OUT DWORD * pdwSSRC
  95. );
  96. HRESULT AddStream(
  97. IN ITStream * pITStream,
  98. IN DWORD dwSSRC,
  99. IN DWORD dwSendRecv,
  100. IN DWORD dwMediaType
  101. );
  102. HRESULT RemoveStream(
  103. IN ITStream * pITStream,
  104. IN DWORD dwSSRC,
  105. OUT BOOL * pbLast
  106. );
  107. DWORD GetSendRecvStatus(
  108. IN ITStream * pITStream
  109. );
  110. HRESULT SetStreamState (
  111. IN ITStream * pITStream,
  112. IN PESTREAM_STATE state
  113. );
  114. HRESULT GetStreamState (
  115. IN ITStream * pITStream,
  116. OUT DWORD * pdwState
  117. );
  118. INT GetStreamCount (DWORD dwSendRecv);
  119. INT GetStreamTimeOutCount (DWORD dwSendRecv);
  120. int CompareCName(IN const WCHAR * szCName) const
  121. { return lstrcmpW(m_InfoItems[RTPSDES_CNAME - 1], szCName); }
  122. const WCHAR * Name() const
  123. { return m_InfoItems[RTPSDES_CNAME - 1]; }
  124. protected:
  125. // Pointer to the free threaded marshaler.
  126. IUnknown * m_pFTM;
  127. // The lock that protects the participant object.
  128. CMSPCritSection m_lock;
  129. // The list of streams that the participant is rendering on.
  130. CMSPArray <ITStream *> m_Streams;
  131. // The list of SSRC for the partcipant in each stream.
  132. CMSPArray <STREAM_INFO> m_StreamInfo;
  133. // the information items for this participant. The index is the
  134. // value of RTP_SDES_* - 1, see MSRTP.h.
  135. WCHAR * m_InfoItems[NUM_SDES_ITEMS];
  136. // The media types that this participant is sending.
  137. DWORD m_dwSendingMediaTypes;
  138. // The media types that this participant is receiving.
  139. DWORD m_dwReceivingMediaTypes;
  140. };
  141. class CParticipantList : public CMSPArray<ITParticipant *>
  142. {
  143. public:
  144. BOOL HasSpace() const { return m_nSize < m_nAllocSize; }
  145. BOOL FindByCName(WCHAR *szCName, int *pIndex) const;
  146. BOOL InsertAt(int index, ITParticipant *pITParticipant);
  147. };
  148. class ATL_NO_VTABLE CParticipantEvent :
  149. public CComObjectRootEx<CComMultiThreadModel>,
  150. public IDispatchImpl<ITParticipantEvent, &__uuidof(ITParticipantEvent), &LIBID_IPConfMSPLib>,
  151. public CMSPObjectSafetyImpl
  152. {
  153. public:
  154. BEGIN_COM_MAP(CParticipantEvent)
  155. COM_INTERFACE_ENTRY(IDispatch)
  156. COM_INTERFACE_ENTRY(ITParticipantEvent)
  157. COM_INTERFACE_ENTRY(IObjectSafety)
  158. COM_INTERFACE_ENTRY_AGGREGATE(__uuidof(IMarshal), m_pFTM)
  159. END_COM_MAP()
  160. DECLARE_GET_CONTROLLING_UNKNOWN()
  161. CParticipantEvent();
  162. // methods of the CComObject
  163. virtual void FinalRelease();
  164. STDMETHOD (get_Event) (
  165. OUT PARTICIPANT_EVENT * pParticipantEvent
  166. );
  167. STDMETHOD (get_Participant) (
  168. OUT ITParticipant ** ppITParticipant
  169. );
  170. STDMETHOD (get_SubStream) (
  171. OUT ITSubStream** ppSubStream
  172. );
  173. // methods called by the call object.
  174. HRESULT Init(
  175. IN PARTICIPANT_EVENT Event,
  176. IN ITParticipant * pITParticipant,
  177. IN ITSubStream * pITSubStream
  178. );
  179. protected:
  180. // Pointer to the free threaded marshaler.
  181. IUnknown * m_pFTM;
  182. PARTICIPANT_EVENT m_Event;
  183. ITParticipant * m_pITParticipant;
  184. ITSubStream * m_pITSubStream;
  185. };
  186. class CIPConfMSPCall;
  187. HRESULT CreateParticipantEvent(
  188. IN PARTICIPANT_EVENT Event,
  189. IN ITParticipant * pITParticipant,
  190. IN ITSubStream * pITSubStream,
  191. OUT IDispatch ** pIDispatch
  192. );
  193. HRESULT CreateParticipantEnumerator(
  194. IN ITParticipant ** begin,
  195. IN ITParticipant ** end,
  196. OUT IEnumParticipant ** ppEnumParticipant
  197. );
  198. HRESULT CreateParticipantCollection(
  199. IN ITParticipant ** begin,
  200. IN ITParticipant ** end,
  201. IN int nSize,
  202. OUT VARIANT * pVariant
  203. );
  204. #endif // __CONFPART_H