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.

248 lines
8.4 KiB

  1. #ifndef __NmManager_h__
  2. #define __NmManager_h__
  3. #include "resource.h" // main symbols
  4. #include "SDKInternal.h"
  5. #include "ias.h"
  6. #include "iplgxprt.h"
  7. #include "it120xprt.h"
  8. extern bool g_bSDKPostNotifications;
  9. /////////////////////////////////////////////////////////////////////////////
  10. // CNmManagerObj
  11. class ATL_NO_VTABLE CNmManagerObj :
  12. public CComObjectRootEx<CComSingleThreadModel>,
  13. public CComCoClass<CNmManagerObj, &CLSID_NmManager>,
  14. public IConnectionPointContainerImpl<CNmManagerObj>,
  15. public IConnectionPointImpl<CNmManagerObj, &IID_INmManagerNotify, CComDynamicUnkArray>,
  16. public INmManager,
  17. public INmObject,
  18. public INmManagerNotify,
  19. public IInternalConfExe,
  20. public IPluggableTransport
  21. {
  22. friend class CNmConferenceObj;
  23. // Datatypes and constants
  24. CONSTANT(MSECS_PER_SEC_CPU_USAGE = 900);
  25. // Static Data
  26. static CSimpleArray<CNmManagerObj*>* ms_pManagerObjList;
  27. static DWORD ms_dwID;
  28. // Member Data
  29. bool m_bNmActive;
  30. bool m_bInitialized;
  31. ULONG m_uOptions;
  32. ULONG m_chCaps;
  33. CSimpleArray<INmConference*> m_SDKConferenceObjs;
  34. CSimpleArray<INmCall*> m_SDKCallObjs;
  35. CComPtr<INmManager2> m_spInternalNmManager;
  36. DWORD m_dwInternalNmManagerAdvise;
  37. bool m_bSentConferenceCreated;
  38. DWORD m_dwID;
  39. DWORD m_dwSysInfoID;
  40. CComBSTR m_bstrConfName;
  41. static IT120PluggableTransport *ms_pT120Transport;
  42. public:
  43. #ifdef ENABLE_UPDATE_CONNECTION
  44. static IPluggableTransportNotify *ms_pPluggableTransportNotify;
  45. #endif
  46. static HRESULT InitSDK();
  47. static void CleanupSDK();
  48. // Because this is in a local server, we are not going to be able to be aggregated...
  49. DECLARE_NOT_AGGREGATABLE(CNmManagerObj)
  50. // This is the resource ID for the .rgs file
  51. DECLARE_REGISTRY_RESOURCEID(IDR_NMMANAGER)
  52. BEGIN_COM_MAP(CNmManagerObj)
  53. COM_INTERFACE_ENTRY(INmManager)
  54. COM_INTERFACE_ENTRY(IConnectionPointContainer)
  55. COM_INTERFACE_ENTRY(INmObject)
  56. COM_INTERFACE_ENTRY(INmManagerNotify)
  57. COM_INTERFACE_ENTRY(IInternalConfExe)
  58. COM_INTERFACE_ENTRY(IPluggableTransport)
  59. END_COM_MAP()
  60. BEGIN_CONNECTION_POINT_MAP(CNmManagerObj)
  61. CONNECTION_POINT_ENTRY(IID_INmManagerNotify)
  62. END_CONNECTION_POINT_MAP()
  63. ///////////////////////////////////////////////
  64. // Construction and destruction
  65. CNmManagerObj();
  66. ~CNmManagerObj();
  67. HRESULT FinalConstruct();
  68. void FinalRelease();
  69. ULONG InternalRelease();
  70. ///////////////////////////////////////////////
  71. // INmManager
  72. STDMETHOD(Initialize)( ULONG * puOptions, ULONG * puchCaps);
  73. STDMETHOD(GetSysInfo)(INmSysInfo **ppSysInfo);
  74. STDMETHOD(CreateConference)(INmConference **ppConference, BSTR bstrName, BSTR bstrPassword, ULONG uchCaps);
  75. STDMETHOD(EnumConference)(IEnumNmConference **ppEnum);
  76. STDMETHOD(CreateCall)(INmCall **ppCall, NM_CALL_TYPE callType,NM_ADDR_TYPE addrType, BSTR bstrAddr, INmConference *pConference);
  77. STDMETHOD(CallConference)(INmCall **ppCall, NM_CALL_TYPE callType,NM_ADDR_TYPE uType, BSTR bstrAddr, BSTR bstrConferenceName, BSTR bstrPassword);
  78. STDMETHOD(EnumCall)(IEnumNmCall **ppEnum);
  79. // INmObject
  80. STDMETHOD(CallDialog)(long hwnd, int cdOptions);
  81. STDMETHOD(ShowLocal)(NM_APPID id);
  82. STDMETHOD(VerifyUserInfo)(UINT_PTR hwnd, NM_VUI options);
  83. // IInternalConfExe
  84. STDMETHOD(LoggedIn)();
  85. STDMETHOD(IsRunning)();
  86. STDMETHOD(InConference)();
  87. STDMETHOD(LDAPLogon)(BOOL bLogon);
  88. STDMETHOD(GetLocalCaps)(DWORD* pdwLocalCaps);
  89. STDMETHOD(IsNetMeetingRunning)();
  90. STDMETHOD(GetActiveConference)(INmConference** ppConf);
  91. STDMETHOD(ShellCalltoProtocolHandler)(BSTR url, BOOL bStrict);
  92. STDMETHOD(Launch)();
  93. STDMETHOD(LaunchApplet)(NM_APPID appid, BSTR strCmdLine);
  94. STDMETHOD(GetUserData)(REFGUID rguid, BYTE **ppb, ULONG *pcb);
  95. STDMETHOD(SetUserData)(REFGUID rguid, BYTE *pb, ULONG cb);
  96. STDMETHOD(SetSysInfoID)(DWORD dwID) { m_dwSysInfoID = dwID; return S_OK; }
  97. STDMETHOD(DisableH323)(BOOL bDisableH323);
  98. STDMETHOD(SetCallerIsRTC)(BOOL bCallerIsRTC);
  99. STDMETHOD(DisableInitialILSLogon)(BOOL bDisableH323);
  100. //
  101. // INmManagerNotify methods:
  102. //
  103. STDMETHOD(NmUI)(CONFN uNotify);
  104. STDMETHOD(ConferenceCreated)(INmConference *pInternalConference);
  105. STDMETHOD(CallCreated)(INmCall *pInternalCall);
  106. //
  107. // IPluggableTransport
  108. //
  109. STDMETHOD(CreateConnection)(
  110. BSTR *pbstrConnectionID, // For placing a call and closing connection
  111. PLUGXPRT_CALL_TYPE eCaller, // Caller or Callee
  112. DWORD dwProcessID, // Used for DuplicateHandle
  113. HCOMMDEV hCommLink, // Handle to communications file handle
  114. HEVENT hevtDataAvailable, // Ready To Read event ( data avail )
  115. HEVENT hevtWriteReady, // Ready To Write event
  116. HEVENT hevtConnectionClosed, // Connection closed ( unexpectedly???)
  117. PLUGXPRT_FRAMING eFraming, // framing of bits sent on link
  118. PLUGXPRT_PARAMETERS *pParams // OPTIONAL framing specific parameters
  119. );
  120. #ifdef ENABLE_UPDATE_CONNECTION
  121. STDMETHOD(UpdateConnection)(
  122. BSTR bstrConnectionID,
  123. DWORD dwProcessID, // Used for DuplicateHandle
  124. HCOMMDEV hCommLink // Handle to communications file handle
  125. );
  126. #endif
  127. STDMETHOD(CloseConnection)(BSTR bstrConnectionID);
  128. STDMETHOD(EnableWinsock)(void);
  129. STDMETHOD(DisableWinsock)(void);
  130. #ifdef ENABLE_UPDATE_CONNECTION
  131. STDMETHOD(AdvisePluggableTransport)(IPluggableTransportNotify *, DWORD *pdwCookie);
  132. STDMETHOD(UnAdvisePluggableTransport)(DWORD dwCookie);
  133. #endif
  134. //
  135. // Notifications
  136. //
  137. HRESULT Fire_NmUI(CONFN uNotify);
  138. HRESULT Fire_ConferenceCreated(INmConference *pConference);
  139. HRESULT Fire_CallCreated(INmCall* pCall);
  140. INmConference* GetSDKConferenceFromInternalConference(INmConference* pInternalConference);
  141. INmCall* GetSDKCallFromInternalCall(INmCall* pInternalCall);
  142. HRESULT RemoveCall(INmCall* pSDKCallObj);
  143. HRESULT RemoveConference(INmConference* pSDKConferenceObj);
  144. bool AudioNotifications();
  145. bool VideoNotifications();
  146. bool DataNotifications();
  147. bool FileTransferNotifications();
  148. bool AppSharingNotifications();
  149. bool OfficeMode() const { return m_bInitialized && (NM_INIT_OBJECT == m_uOptions); }
  150. static void NetMeetingLaunched();
  151. static void AppSharingChannelChanged();
  152. void _AppSharingChannelChanged();
  153. static void AppSharingChannelActiveStateChanged(bool bActive);
  154. void _AppSharingChannelActiveStateChanged(bool bActive);
  155. static void SharableAppStateChanged(HWND hWnd, NM_SHAPP_STATE state);
  156. void _SharableAppStateChanged(HWND hWnd, NM_SHAPP_STATE state);
  157. static void ASLocalMemberChanged();
  158. void _ASLocalMemberChanged();
  159. static void ASMemberChanged(UINT gccID);
  160. void _ASMemberChanged(UINT gccID);
  161. static void NM211_CONF_NM_STARTED(bool bConfStarted);
  162. static void AudioChannelActiveState(BOOL bActive, BOOL bIsIncoming);
  163. void _AudioChannelActiveState(BOOL bActive, BOOL bIsIncoming);
  164. static void VideoChannelActiveState(BOOL bActive, BOOL bIsIncoming);
  165. void _VideoChannelActiveState(BOOL bActive, BOOL bIsIncoming);
  166. static void OnShowUI(BOOL fShow);
  167. static UINT GetManagerCount() { return ms_pManagerObjList->GetSize(); };
  168. static UINT GetManagerCount(ULONG uOption);
  169. static void VideoPropChanged(DWORD dwProp, BOOL bIsIncoming);
  170. void _VideoPropChanged(DWORD dwProp, BOOL bIsIncoming);
  171. static void VideoChannelStateChanged(NM_VIDEO_STATE uState, BOOL bIsIncoming);
  172. void _VideoChannelStateChanged(NM_VIDEO_STATE uState, BOOL bIsIncoming);
  173. private:
  174. ///////////////////////////////////////////////
  175. // Helper Fns
  176. INmConference* _GetActiveConference();
  177. void EnsureTransportInterface(void);
  178. static BOOL InitPluggableTransportSDK(void);
  179. static void CleanupPluggableTransportSDK(void);
  180. DWORD MapNmCallTypeToCallFlags(NM_CALL_TYPE callType,
  181. NM_ADDR_TYPE addrType, UINT uCaps);
  182. HRESULT SdkPlaceCall(NM_CALL_TYPE callType,
  183. NM_ADDR_TYPE addrType,
  184. BSTR bstrAddr,
  185. BSTR bstrConf,
  186. BSTR bstrPw,
  187. INmCall **ppInternalCall);
  188. };
  189. #endif //__NmManager_h__