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.

351 lines
9.8 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. confcall.h
  5. Abstract:
  6. Declaration of the CIPConfMSPCall
  7. Author:
  8. Mu Han (muhan) 5-September-1998
  9. --*/
  10. #ifndef __CONFCALL_H_
  11. #define __CONFCALL_H_
  12. #if _MSC_VER >= 1000
  13. #pragma once
  14. #endif // _MSC_VER >= 1000
  15. #include <confpdu.h>
  16. const DWORD MAX_PAYLOAD_TYPES = 10;
  17. typedef struct _STREAMSETTINGS
  18. {
  19. DWORD dwNumPayloadTypes;
  20. DWORD PayloadTypes[MAX_PAYLOAD_TYPES];
  21. DWORD dwMSPerPacket; // milliseconds per packet.
  22. DWORD dwQOSLevel;
  23. DWORD dwTTL;
  24. DWORD dwIPLocal; // local interface to bind to.
  25. DWORD dwIPRemote; // remote IP address in host byte order.
  26. WORD wRTPPortRemote; // remote port number in host byte order.
  27. HANDLE *phRTPSession; // the shared RTP session cookie
  28. BOOL fCIF; // if CIF is used for video.
  29. MULTICAST_LOOPBACK_MODE LoopbackMode;
  30. LONG lBandwidth;
  31. WCHAR *pApplicationID;
  32. WCHAR *pApplicationGUID;
  33. WCHAR *pSubIDs;
  34. } STREAMSETTINGS, *PSTREAMSETTINGS;
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CIPConfMSPCall
  37. /////////////////////////////////////////////////////////////////////////////
  38. class ATL_NO_VTABLE CIPConfMSPCall :
  39. public CMSPCallMultiGraph,
  40. public IDispatchImpl<ITParticipantControl, &__uuidof(ITParticipantControl),
  41. &LIBID_IPConfMSPLib>,
  42. public IDispatchImpl<ITLocalParticipant, &__uuidof(ITLocalParticipant),
  43. &LIBID_IPConfMSPLib>,
  44. public IDispatchImpl<IMulticastControl, &__uuidof(IMulticastControl),
  45. &LIBID_IPConfMSPLib>,
  46. public IDispatchImpl<ITQOSApplicationID, &__uuidof(ITQOSApplicationID),
  47. &LIBID_IPConfMSPLib>,
  48. public ITCallQualityControl,
  49. public IInnerCallQualityControl,
  50. public CMSPObjectSafetyImpl
  51. {
  52. public:
  53. BEGIN_COM_MAP(CIPConfMSPCall)
  54. COM_INTERFACE_ENTRY(ITParticipantControl)
  55. COM_INTERFACE_ENTRY(ITLocalParticipant)
  56. COM_INTERFACE_ENTRY(IMulticastControl)
  57. COM_INTERFACE_ENTRY(ITQOSApplicationID)
  58. COM_INTERFACE_ENTRY2(IDispatch, ITStreamControl)
  59. COM_INTERFACE_ENTRY(ITCallQualityControl)
  60. COM_INTERFACE_ENTRY(IInnerCallQualityControl)
  61. COM_INTERFACE_ENTRY(IObjectSafety)
  62. COM_INTERFACE_ENTRY_CHAIN(CMSPCallMultiGraph)
  63. END_COM_MAP()
  64. CIPConfMSPCall();
  65. ~CIPConfMSPCall();
  66. // ITStreamControl methods, called by the app.
  67. STDMETHOD (CreateStream) (
  68. IN long lMediaType,
  69. IN TERMINAL_DIRECTION Direction,
  70. IN OUT ITStream ** ppStream
  71. );
  72. STDMETHOD (RemoveStream) (
  73. IN ITStream * pStream
  74. );
  75. // ITParticipantControl methods, called by the app.
  76. STDMETHOD (EnumerateParticipants) (
  77. OUT IEnumParticipant ** ppEnumParticipants
  78. );
  79. STDMETHOD (get_Participants) (
  80. OUT VARIANT * pVariant
  81. );
  82. // IMulticastControl methods, called by the app.
  83. STDMETHOD (get_LoopbackMode) (
  84. OUT MULTICAST_LOOPBACK_MODE * pMode
  85. );
  86. STDMETHOD (put_LoopbackMode) (
  87. IN MULTICAST_LOOPBACK_MODE mode
  88. );
  89. // ITLocalParticipant methods, called by the app.
  90. STDMETHOD (get_LocalParticipantTypedInfo) (
  91. IN PARTICIPANT_TYPED_INFO InfoType,
  92. OUT BSTR * ppInfo
  93. );
  94. STDMETHOD (put_LocalParticipantTypedInfo) (
  95. IN PARTICIPANT_TYPED_INFO InfoType,
  96. IN BSTR pInfo
  97. );
  98. //ITQOSApplicationID methods, called by the app.
  99. STDMETHOD (SetQOSApplicationID) (
  100. IN BSTR pApplicationID,
  101. IN BSTR pApplicationGUID,
  102. IN BSTR pSubIDs
  103. );
  104. // methods called by the MSPAddress object.
  105. HRESULT Init(
  106. IN CMSPAddress * pMSPAddress,
  107. IN MSP_HANDLE htCall,
  108. IN DWORD dwReserved,
  109. IN DWORD dwMediaType
  110. );
  111. HRESULT ShutDown();
  112. HRESULT ReceiveTSPCallData(
  113. IN PBYTE pBuffer,
  114. IN DWORD dwSize
  115. );
  116. // medthod called by the worker thread.
  117. static DWORD WINAPI WorkerCallbackDispatcher(VOID *pContext);
  118. virtual VOID HandleGraphEvent(
  119. IN MSPSTREAMCONTEXT * pContext
  120. );
  121. DWORD ProcessWorkerCallBack(
  122. IN PBYTE pBuffer,
  123. IN DWORD dwSize
  124. );
  125. HRESULT InternalShutDown();
  126. DWORD MSPCallAddRef()
  127. {
  128. return MSPAddRefHelper(this);
  129. }
  130. DWORD MSPCallRelease()
  131. {
  132. return MSPReleaseHelper(this);
  133. }
  134. // medthod called by the streams for participants
  135. HRESULT NewParticipant(
  136. IN ITStream * pITStream,
  137. IN DWORD dwSSRC,
  138. IN DWORD dwSendRecv,
  139. IN DWORD dwMediaType,
  140. IN WCHAR * szCName,
  141. OUT ITParticipant ** pITParticipant
  142. );
  143. HRESULT ParticipantLeft(
  144. IN ITParticipant * pITParticipant
  145. );
  146. void SendParticipantEvent(
  147. IN PARTICIPANT_EVENT Event,
  148. IN ITParticipant * pITParticipant,
  149. IN ITSubStream * pITSubStream = NULL
  150. ) const;
  151. HRESULT SendTSPMessage(
  152. IN TSP_MSP_COMMAND command,
  153. IN DWORD dwParam1 = 0,
  154. IN DWORD dwParam2 = 0
  155. ) const;
  156. // this function is called at the call init time.
  157. void SetIPInterface(DWORD dwIPInterface)
  158. { m_dwIPInterface = dwIPInterface; }
  159. // ITCallQualityControl methods
  160. STDMETHOD (GetRange) (
  161. IN CallQualityProperty Property,
  162. OUT long *plMin,
  163. OUT long *plMax,
  164. OUT long *plSteppingDelta,
  165. OUT long *plDefault,
  166. OUT TAPIControlFlags *plFlags
  167. );
  168. STDMETHOD (Get) (
  169. IN CallQualityProperty Property,
  170. OUT long *plValue,
  171. OUT TAPIControlFlags *plFlags
  172. );
  173. STDMETHOD (Set) (
  174. IN CallQualityProperty Property,
  175. IN long lValue,
  176. IN TAPIControlFlags lFlags
  177. );
  178. // IInnerCallQualityControl methods
  179. STDMETHOD_(ULONG, InnerCallAddRef) (VOID);
  180. STDMETHOD_(ULONG, InnerCallRelease) (VOID);
  181. STDMETHOD (RegisterInnerStreamQC) (
  182. IN IInnerStreamQualityControl *pIInnerStreamQC
  183. );
  184. STDMETHOD (DeRegisterInnerStreamQC) (
  185. IN IInnerStreamQualityControl *pIInnerStreamQC
  186. );
  187. STDMETHOD (ProcessQCEvent) (
  188. IN QCEvent event,
  189. IN DWORD dwParam
  190. );
  191. protected:
  192. HRESULT InitializeLocalParticipant();
  193. virtual HRESULT CreateStreamObject(
  194. IN DWORD dwMediaType,
  195. IN TERMINAL_DIRECTION Direction,
  196. IN IMediaEvent * pGraph,
  197. IN ITStream ** ppStream
  198. );
  199. HRESULT ProcessMediaItem(
  200. IN ITMedia * pITMedia,
  201. IN DWORD dwMediaTypeMask,
  202. OUT DWORD * pdwMediaType,
  203. OUT WORD * pwPort,
  204. OUT DWORD * pdwPayloadTypes,
  205. IN OUT DWORD * pdwNumPayLoadType
  206. );
  207. DWORD FindInterfaceByName(
  208. IN WCHAR * pMachineName
  209. );
  210. HRESULT CheckOrigin(
  211. IN ITSdp * pITSdp,
  212. OUT BOOL * pFlag,
  213. OUT DWORD * pdwIP
  214. );
  215. HRESULT ConfigStreamsBasedOnSDP(
  216. IN ITSdp * pITSdp,
  217. IN DWORD dwAudioQOSLevel,
  218. IN DWORD dwVideoQOSLevel
  219. );
  220. HRESULT ParseSDP(
  221. IN WCHAR * pSDP,
  222. IN DWORD dwAudioQOSLevel,
  223. IN DWORD dwVideoQOSLevel
  224. );
  225. HRESULT CheckUnusedStreams();
  226. HRESULT InitFullDuplexControler();
  227. protected:
  228. // The list of participant in the call.
  229. CParticipantList m_Participants;
  230. // call quality control relay
  231. CCallQualityControlRelay *m_pCallQCRelay;
  232. // the information items for local participant. The index is the
  233. // value of RTP_SDES_* - 1, see MSRTP.h.
  234. WCHAR * m_InfoItems[NUM_SDES_ITEMS];
  235. BOOL m_fLocalInfoRetrieved;
  236. // The critical section to protect the participant list.
  237. CMSPCritSection m_ParticipantLock;
  238. BOOL m_fShutDown;
  239. DWORD m_dwIPInterface;
  240. HANDLE m_hAudioRTPSession;
  241. HANDLE m_hVideoRTPSession;
  242. IAudioDuplexController * m_pIAudioDuplexController;
  243. MULTICAST_LOOPBACK_MODE m_LoopbackMode;
  244. BOOL m_fCallStarted;
  245. BSTR m_pApplicationID;
  246. BSTR m_pApplicationGUID;
  247. BSTR m_pSubIDs;
  248. BOOL m_fEnableAEC;
  249. };
  250. typedef struct _CALLWORKITEM
  251. {
  252. CIPConfMSPCall *pCall;
  253. DWORD dwLen;
  254. BYTE Buffer[1];
  255. } CALLWORKITEM, *PCALLWORKITEM;
  256. // some debug support
  257. const char * const ParticipantEventString[] =
  258. {
  259. "NEW_PARTICIPANT",
  260. "INFO_CHANGE",
  261. "PARTICIPANT_LEAVE",
  262. "NEW_SUBSTREAM",
  263. "SUBSTREAM_REMOVED",
  264. "SUBSTREAM_MAPPED",
  265. "SUBSTREAM_UNMAPPED",
  266. "PARTICIPANT_TIMEOUT",
  267. "PARTICIPANT_RECOVERED",
  268. "PARTICIPANT_ACTIVE",
  269. "PARTICIPANT_INACTIVE",
  270. "LOCAL_TALKING",
  271. "LOCAL_SILENT"
  272. };
  273. #endif //__CONFCALL_H_