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.

158 lines
4.2 KiB

  1. // File: call.h
  2. #ifndef _CALL_H_
  3. #define _CALL_H_
  4. #include "oblist.h"
  5. #include "SDKInternal.h"
  6. const HRESULT NM_CALLERR_NOT_REGISTERED = NM_E(0x01EF);
  7. class CDlgCall; // from dlgcall.h
  8. class CPopupMsg;
  9. class CCall : public RefCount, INmCallNotify2
  10. {
  11. private:
  12. INmCall* m_pInternalICall;// Call Object in core
  13. CPopupMsg* m_ppm; // Popup incomming call dialog
  14. LPTSTR m_pszDisplayName; // Display Name
  15. LPTSTR m_pszCallTo; // CallTo (original)
  16. BOOL m_fSelectedConference;
  17. BOOL m_fIncoming;
  18. BOOL m_fInRespond; // Responding to call dialog?
  19. NM_ADDR_TYPE m_nmAddrType;
  20. BOOL m_bAddToMru;
  21. POSITION m_pos; // position in g_pCallList
  22. DWORD m_dwTick; // tick count at call start
  23. DWORD m_dwCookie;
  24. CDlgCall * m_pDlgCall; // Outgoing call dialog
  25. VOID RemoveProgress(void);
  26. VOID ShowProgress(BOOL fShow);
  27. VOID LogCall(BOOL fAccepted);
  28. public:
  29. CCall(LPCTSTR pszCallTo, LPCTSTR pszDisplayName, NM_ADDR_TYPE nmAddrType, BOOL bAddToMru, BOOL fIncoming);
  30. ~CCall();
  31. // IUnknown methods
  32. STDMETHODIMP_(ULONG) AddRef(void);
  33. STDMETHODIMP_(ULONG) Release(void);
  34. STDMETHODIMP QueryInterface(REFIID riid, PVOID *ppv);
  35. // INmCallNotify methods
  36. STDMETHODIMP NmUI(CONFN uNotify);
  37. STDMETHODIMP StateChanged(NM_CALL_STATE uState);
  38. STDMETHODIMP Failed(ULONG uError);
  39. STDMETHODIMP Accepted(INmConference *pConference);
  40. // INmCallNotify3 methods
  41. STDMETHODIMP CallError(UINT cns);
  42. STDMETHODIMP RemoteConference(BOOL fMCU, BSTR *pwszConfNames, BSTR *pbstrConfToJoin);
  43. STDMETHODIMP RemotePassword(BSTR bstrConference, BSTR *pbstrPassword, PBYTE pb, DWORD cb, BOOL fIsService);
  44. // Internal methods
  45. VOID Update(void);
  46. BOOL FComplete(void);
  47. BOOL RemoveFromList(void);
  48. VOID OnRing(void);
  49. BOOL RespondToRinging(DWORD dwCLEF);
  50. HRESULT OnUIRemoteConference(BOOL fMCU, PWSTR* pwszConfNames, BSTR *pbstrConfToJoin);
  51. VOID SetNmCall(INmCall * pCall);
  52. HRESULT
  53. PlaceCall
  54. (
  55. DWORD dwFlags,
  56. NM_ADDR_TYPE addrType,
  57. const TCHAR * const setupAddress,
  58. const TCHAR * const destinationAddress,
  59. const TCHAR * const alias,
  60. const TCHAR * const url,
  61. const TCHAR * const conference,
  62. const TCHAR * const password,
  63. const TCHAR * const userData
  64. );
  65. VOID Cancel(BOOL fDisplayCancelMsg);
  66. INmCall * GetINmCall() {return m_pInternalICall;}
  67. LPTSTR GetPszName() {return m_pszDisplayName;}
  68. BOOL FIncoming() {return m_fIncoming;}
  69. NM_CALL_STATE GetState();
  70. DWORD GetTickCount() {return m_dwTick;}
  71. VOID DisplayPopup(void);
  72. VOID SetSelectedConference() {m_fSelectedConference = TRUE;}
  73. static VOID CALLBACK PopupMsgRingingCallback(LPVOID pContext, DWORD dwFlags);
  74. };
  75. // Fake connection points
  76. HRESULT OnUICallCreated(INmCall *pNmCall);
  77. // Global utility Functions
  78. int CleanupE164StringEx(LPTSTR szPhoneNumber);
  79. CCall * CallFromNmCall(INmCall * pNmCall);
  80. DWORD GetCallStatus(LPTSTR pszStatus, int cchMax, UINT * puID);
  81. BOOL FIsCallInProgress(void);
  82. VOID FreeCallList(void);
  83. CCall * CreateIncomingCall(INmCall * pNmCall);
  84. // Commands
  85. VOID CancelAllOutgoingCalls(void);
  86. VOID CancelAllCalls(void);
  87. BOOL FIpAddress(LPCTSTR pcsz);
  88. VOID DisplayCallError(HRESULT hr, LPCTSTR pcszName);
  89. // Gateway utility routines
  90. BOOL FH323GatewayEnabled(void);
  91. int GetDefaultGateway(LPTSTR psz, UINT cchMax);
  92. HRESULT CreateGatewayAddress(LPTSTR pszResult, UINT cchMax, LPCTSTR pszAddr);
  93. // Gatekeeper logon state
  94. extern NM_GK_STATE g_GkLogonState;
  95. BOOL FGkEnabled(void);
  96. void GkLogon(void);
  97. void GkLogoff(void);
  98. void SetGkLogonState(NM_GK_STATE state);
  99. bool IsGatekeeperLoggedOn(void);
  100. bool IsGatekeeperLoggingOn(void);
  101. class CCallResolver
  102. {
  103. private:
  104. LPTSTR m_pszAddr; // Address (original)
  105. LPTSTR m_pszAddrIP; // Address (IP)
  106. NM_ADDR_TYPE m_addrType; // Address type (of m_pszAddr)
  107. HRESULT ResolveIpName(LPCTSTR pcszAddr);
  108. HRESULT ResolveMachineName(LPCTSTR pcszAddr);
  109. HRESULT ResolveUlsName(LPCTSTR pcszAddr);
  110. HRESULT ResolveGateway(LPCTSTR pcszAddr);
  111. HRESULT CheckHostEnt(HOSTENT * pHostInfo);
  112. public:
  113. CCallResolver(LPCTSTR pszAddr, NM_ADDR_TYPE addrType);
  114. ~CCallResolver();
  115. LPCTSTR GetPszAddr() { return m_pszAddr; }
  116. NM_ADDR_TYPE GetAddrType() { return m_addrType; }
  117. LPCTSTR GetPszAddrIP() { return m_pszAddrIP; }
  118. HRESULT Resolve();
  119. };
  120. #endif // _CALL_H_