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.

206 lines
5.4 KiB

  1. /***************************************************************************/
  2. /** Microsoft Windows **/
  3. /** Copyright(c) Microsoft Corp., 1995-1996 **/
  4. /***************************************************************************/
  5. //
  6. // The COutgoingCall class is defined, which is used while placing calls
  7. //
  8. #ifndef _ICALL_H_
  9. #define _ICALL_H_
  10. #include <nameres.h> // need for RN_
  11. #include "cncodes.h" // needed for CNSTATUS and CN_
  12. class CConfObject;
  13. class COutgoingCall : public INmCall, public DllRefCount,
  14. public CConnectionPointContainer
  15. {
  16. private:
  17. enum CNODESTATE
  18. {
  19. CNS_IDLE,
  20. CNS_SEARCHING, // dummy state to keep compatible with NM2.X
  21. CNS_CONNECTING_H323,
  22. CNS_WAITING_T120_OPEN,
  23. CNS_QUERYING_REMOTE,
  24. CNS_CREATING_LOCAL,
  25. CNS_INVITING_REMOTE,
  26. CNS_TERMINATING_AFTER_INVITE,
  27. CNS_QUERYING_REMOTE_AFTER_INVITE,
  28. CNS_JOINING_REMOTE,
  29. CNS_COMPLETE
  30. };
  31. // Attributes:
  32. CNODESTATE m_cnState;
  33. CConfObject* m_pConfObject;
  34. REQUEST_HANDLE m_hRequest;
  35. IH323Endpoint * m_pH323Connection;
  36. BOOL m_fCanceled;
  37. // User Info
  38. BSTR m_bstrName;
  39. LPTSTR m_pszAddr;
  40. BSTR m_bstrAlias;
  41. BSTR m_bstrConfToJoin;
  42. BSTR m_bstrPassword;
  43. BSTR m_bstrUserString;
  44. NM_ADDR_TYPE m_addrType;
  45. DWORD m_dwFlags;
  46. // Info that we obtain during processing
  47. CNSTATUS m_cnResult;
  48. BOOL m_fService;
  49. // Protected Methods:
  50. BOOL ReportError(CNSTATUS cns);
  51. CNSTATUS MapAudioSummaryToCNStatus(DWORD dwSummary);
  52. CNSTATUS StartT120Call();
  53. CNSTATUS ConnectH323();
  54. VOID SetCallState(CNODESTATE cnState);
  55. BOOL IsDataOnly() { return (0 == ((CRPCF_AUDIO | CRPCF_VIDEO) & m_dwFlags)); }
  56. HRESULT Connect(
  57. PSOCKADDR_IN psin,
  58. P_H323ALIASLIST pAliasList,
  59. LPCWSTR pcwszPSTNAddress,
  60. P_APP_CALL_SETUP_DATA lpvMNMData,
  61. GUID PIDofProtocolType,
  62. IH323Endpoint * *ppConnection);
  63. public:
  64. COutgoingCall(CConfObject* pco, DWORD dwFlags, NM_ADDR_TYPE addrType, BSTR bstrName,
  65. BSTR bstrDest, BSTR bstrAlias, BSTR bstrConference, BSTR bstrPassword, BSTR bstrUserString);
  66. ~COutgoingCall();
  67. // Methods:
  68. VOID PlaceCall(void);
  69. VOID CallComplete(void);
  70. HRESULT _Cancel(BOOL fLeaving);
  71. // Properties:
  72. DWORD GetFlags() { return m_dwFlags; }
  73. REQUEST_HANDLE GetCurrentRequestHandle() { return m_hRequest; }
  74. IH323Endpoint * GetH323Connection() { return m_pH323Connection; }
  75. BOOL FCanceled() { return m_fCanceled; }
  76. BOOL FIsComplete() { return (CNS_COMPLETE == m_cnState); }
  77. BOOL MatchActiveCallee(LPCTSTR pszDest, BSTR bstrAlias, BSTR bstrConference);
  78. // Event Handlers:
  79. // Received by only this COutgoingCall object
  80. BOOL OnQueryRemoteResult(HRESULT ncsResult,
  81. BOOL fMCU,
  82. PWSTR pwszConfNames[],
  83. PT120PRODUCTVERSION pVersion,
  84. PWSTR pwszConfDescriptors[]);
  85. BOOL OnInviteResult(HRESULT ncsResult, UINT uNodeID);
  86. // Received by all COutgoingCall objects sharing the same conference
  87. BOOL OnConferenceEnded();
  88. // Received by all COutgoingCall objects
  89. BOOL OnConferenceStarted(CONF_HANDLE hNewConf,
  90. HRESULT ncsResult);
  91. BOOL OnH323Connected(IH323Endpoint * pConnection);
  92. BOOL OnH323Disconnected(IH323Endpoint * pConnection);
  93. BOOL OnT120ChannelOpen(ICommChannel *pIChannel, DWORD dwStatus);
  94. STDMETHODIMP_(ULONG) AddRef(void);
  95. STDMETHODIMP_(ULONG) Release(void);
  96. STDMETHODIMP QueryInterface(REFIID riid, PVOID *ppvObj);
  97. STDMETHODIMP IsIncoming(void);
  98. STDMETHODIMP GetState(NM_CALL_STATE *pState);
  99. STDMETHODIMP GetName(BSTR *pbstr);
  100. STDMETHODIMP GetAddr(BSTR *pbstr, NM_ADDR_TYPE *puType);
  101. STDMETHODIMP GetUserData(REFGUID rguid, BYTE **ppb, ULONG *pcb);
  102. STDMETHODIMP GetConference(INmConference **ppConference);
  103. STDMETHODIMP Accept(void);
  104. STDMETHODIMP Reject(void);
  105. STDMETHODIMP Cancel(void);
  106. };
  107. class COprahNCUI;
  108. class COutgoingCallManager
  109. {
  110. private:
  111. COBLIST m_CallList;
  112. UINT GetNodeCount();
  113. COutgoingCall* FindCall(IH323Endpoint * lpConnection);
  114. BOOL MatchActiveCallee(LPCTSTR pszDest, BSTR bstrAlias, BSTR bstrConference);
  115. public:
  116. COutgoingCallManager();
  117. ~COutgoingCallManager();
  118. UINT GetCallCount();
  119. BOOL RemoveFromList(COutgoingCall* pCall);
  120. HRESULT Call( INmCall **ppCall,
  121. COprahNCUI* pManager,
  122. DWORD dwFlags,
  123. NM_ADDR_TYPE addrType,
  124. BSTR bstrName,
  125. BSTR bstrSetup,
  126. BSTR bstrDest,
  127. BSTR bstrAlias,
  128. BSTR bstrURL,
  129. BSTR bstrConference,
  130. BSTR bstrPassword,
  131. BSTR bstrUserString);
  132. BOOL OnH323Connected(IH323Endpoint * lpConnection);
  133. BOOL OnH323Disconnected(IH323Endpoint * lpConnection);
  134. VOID OnT120ChannelOpen( ICommChannel *pIChannel,
  135. IH323Endpoint * lpConnection,
  136. DWORD dwStatus);
  137. VOID OnConferenceStarted(CONF_HANDLE hConference, HRESULT hResult);
  138. VOID OnQueryRemoteResult( PVOID pvCallerContext,
  139. HRESULT hResult,
  140. BOOL fMCU,
  141. PWSTR* ppwszConferenceNames,
  142. PT120PRODUCTVERSION pVersion,
  143. PWSTR* ppwszConfDescriptors);
  144. VOID OnInviteResult( CONF_HANDLE hConference,
  145. REQUEST_HANDLE hRequest,
  146. UINT uNodeID,
  147. HRESULT hResult,
  148. PT120PRODUCTVERSION pVersion);
  149. VOID OnConferenceEnded(CONF_HANDLE hConference);
  150. VOID CancelCalls();
  151. };
  152. #endif // _ICALL_H_