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.

243 lines
8.2 KiB

  1. /***************************************************************************/
  2. /** Microsoft Windows **/
  3. /** Copyright(c) Microsoft Corp., 1995-1996 **/
  4. /***************************************************************************/
  5. //
  6. // File: iconf.h
  7. // Created: ChrisPi 12/6/95
  8. // Modified:
  9. //
  10. // The CConfObject class is defined
  11. //
  12. #ifndef _ICONF_H_
  13. #define _ICONF_H_
  14. #include <inodecnt.h>
  15. #include "h323.h"
  16. #include "connpnts.h"
  17. #include "medialst.h"
  18. #include <atlbase.h>
  19. #include <lst.h>
  20. enum CONFSTATE
  21. {
  22. CS_UNINITIALIZED,
  23. CS_CREATING,
  24. CS_COMING_UP,
  25. CS_RUNNING,
  26. CS_GOING_DOWN,
  27. CS_TERMINATED
  28. };
  29. enum AC_TYPE
  30. {
  31. CLT_T120,
  32. CLT_H323
  33. };
  34. class CNmMember;
  35. class CNmChannelAudio;
  36. class CNmChannelVideo;
  37. class CNmChannelData;
  38. class CConfObject : public INmConference2, public CConnectionPointContainer,
  39. public IStreamEventNotify
  40. {
  41. protected:
  42. COBLIST m_MemberList;
  43. COBLIST m_DataChannelGUIDS;
  44. CNmChannelAudio * m_pChannelAudioLocal;
  45. CNmChannelVideo * m_pChannelVideoLocal;
  46. CNmChannelAudio * m_pChannelAudioRemote;
  47. CNmChannelVideo * m_pChannelVideoRemote;
  48. IH323ConfAdvise * m_pIH323ConfAdvise;
  49. // Attributes:
  50. CONFSTATE m_csState;
  51. CONF_HANDLE m_hConf;
  52. BOOL m_fConferenceCreated;
  53. BOOL m_fServerMode;
  54. BSTR m_bstrConfName;
  55. BSTR m_bstrConfPassword;
  56. PBYTE m_pbConfHashedPassword;
  57. DWORD m_cbConfHashedPassword;
  58. NM30_MTG_PERMISSIONS m_attendeePermissions;
  59. UINT m_maxParticipants;
  60. CNmMember * m_pMemberLocal;
  61. UINT m_uDataMembers;
  62. UINT m_uH323Endpoints;
  63. UINT m_uMembers;
  64. UINT m_ourNodeID;
  65. UINT m_uGCCConferenceID;
  66. ULONG m_cRef;
  67. BOOL m_fSecure;
  68. VOID AddMember(CNmMember * pMember, IH323Endpoint * pConnection);
  69. VOID RemoveMember(POSITION pos);
  70. VOID RemoveMember(CNmMember * pMember)
  71. {
  72. POSITION pos = m_MemberList.GetPosition(pMember);
  73. if (NULL != pos)
  74. {
  75. RemoveMember(pos);
  76. }
  77. }
  78. VOID ResetDataMember(CNmMember * pMember,
  79. ROSTER_DATA_HANDLE hData);
  80. VOID RemoveOldDataMembers(int nExpected);
  81. CNmMember * MatchDataToH323Member(REFGUID pguidNodeId,
  82. UINT uNodeId,
  83. PVOID pvUserInfo);
  84. VOID AddDataToH323Member(CNmMember * pMember,
  85. PVOID pvUserInfo,
  86. UINT cbUserInfo,
  87. UINT uCaps,
  88. NC_ROSTER_NODE_ENTRY* pRosterNode);
  89. CNmMember * CreateDataMember(BOOL fLocal,
  90. REFGUID pguidNodeId,
  91. PVOID pvUserInfo,
  92. UINT cbUserInfo,
  93. UINT uCaps,
  94. NC_ROSTER_NODE_ENTRY* pRosterNode);
  95. CNmMember * MatchH323ToDataMembers(REFGUID pguidNodeId,
  96. IH323Endpoint * pConnection);
  97. VOID CreateMember(IH323Endpoint * pConnection, REFGUID rguidNode, UINT uNodeID);
  98. VOID AddH323ToDataMember(CNmMember * pMember, IH323Endpoint * pConnection);
  99. VOID RemoveH323FromDataMember(CNmMember * pMember, IH323Endpoint * pConnection);
  100. VOID SetT120State(CONFSTATE state);
  101. VOID OnH323ChannelChange(DWORD dwFlags, BOOL fIncoming, BOOL fOpen, ICommChannel *pIChannel);
  102. VOID AddMemberToAVChannels(CNmMember *pMember);
  103. VOID RemoveMemberFromAVChannels(CNmMember *pMember);
  104. VOID CreateAVChannels(IH323Endpoint * pConnection, CMediaList* pMediaList);
  105. VOID OpenAVChannels(IH323Endpoint * pConnection, CMediaList* pMediaList);
  106. VOID DestroyAVChannels();
  107. ICommChannel * CreateT120Channel(IH323Endpoint * pConnection, CMediaList* pMediaList);
  108. VOID OpenT120Channel(IH323Endpoint * pConnection, CMediaList* pMediaList, ICommChannel *pChannelT120);
  109. VOID CheckState(NM_CONFERENCE_STATE pState);
  110. HRESULT __stdcall EventNotification(UINT uDirection, UINT uMediaType, UINT uEventCode, UINT uSubCode);
  111. public:
  112. // Methods:
  113. CConfObject();
  114. ~CConfObject();
  115. VOID Init(IH323ConfAdvise * pci) {m_pIH323ConfAdvise = pci; };
  116. VOID OnConferenceCreated() {m_fConferenceCreated = TRUE; }
  117. VOID OnMemberUpdated(INmMember *pMember);
  118. VOID OnChannelUpdated(INmChannel *pChannel);
  119. HRESULT CreateConference(void);
  120. HRESULT JoinConference(LPCWSTR pcwszConferenceName,
  121. LPCWSTR pcwszPassword,
  122. LPCSTR pcszAddress,
  123. BSTR bstrUserString,
  124. BOOL fRetry = FALSE);
  125. HRESULT InviteConference(LPCSTR pszAddr,
  126. BSTR bstrUserString,
  127. REQUEST_HANDLE *phRequest);
  128. HRESULT LeaveConference(BOOL fForceLeave=TRUE);
  129. HRESULT CancelInvite(REQUEST_HANDLE hRequest)
  130. {
  131. if (NULL == m_hConf)
  132. {
  133. return E_FAIL;
  134. }
  135. return m_hConf->CancelInvite(hRequest);
  136. }
  137. HRESULT LeaveH323(BOOL fKeepAV);
  138. // Properties:
  139. BSTR GetConfName() { return m_bstrConfName; };
  140. UINT GetOurNodeID() { return m_ourNodeID; };
  141. UINT GetGCCConferenceID() { return m_uGCCConferenceID; };
  142. UINT GetNumMembers() { return m_uMembers; };
  143. BOOL InCall() { return (m_uMembers > 0); };
  144. COBLIST* GetMemberList() { return &m_MemberList; };
  145. CONF_HANDLE GetConfHandle() { return m_hConf; };
  146. CONFSTATE GetT120State() { return m_csState; };
  147. BOOL IsConferenceActive() { return m_hConf!= NULL; };
  148. BOOL IsConferenceCreated() { return m_fConferenceCreated; };
  149. BOOL IsConfObjSecure() { return m_fSecure; };
  150. CNmMember * GetLocalMember() { return m_pMemberLocal; };
  151. NM30_MTG_PERMISSIONS GetConfAttendeePermissions() { return m_attendeePermissions; }
  152. UINT GetConfMaxParticipants() { return m_maxParticipants; }
  153. DWORD GetDwUserIdLocal(void);
  154. HRESULT GetMediaChannel (GUID *pmediaID,BOOL bSendDirection, IMediaChannel **ppI);
  155. VOID SetConfName(BSTR bstr);
  156. VOID SetConfPassword(BSTR bstr);
  157. VOID SetConfHashedPassword(BSTR bstr);
  158. VOID SetConfSecurity(BOOL fSecure);
  159. VOID SetConfAttendeePermissions(NM30_MTG_PERMISSIONS attendeePermissions);
  160. VOID SetConfMaxParticipants(UINT maxParticipants);
  161. CNmMember * PMemberFromNodeGuid(REFGUID pguidNode);
  162. CNmMember * PMemberFromGCCID(UINT uNodeID);
  163. CNmMember * PMemberFromH323Endpoint(IH323Endpoint * pConnection);
  164. CNmMember * PDataMemberFromName(PCWSTR pwszName);
  165. // Event Handlers:
  166. VOID OnT120Connected(IH323Endpoint * pConnection, UINT uNodeID);
  167. // Data Conferencing (R1.1, T.120) events from NCUI:
  168. BOOL OnRosterChanged(PNC_ROSTER pRoster);
  169. BOOL OnT120Invite(CONF_HANDLE hConference, BOOL fSecure);
  170. BOOL OnConferenceEnded();
  171. BOOL OnConferenceStarted(CONF_HANDLE hNewConf,
  172. HRESULT Result);
  173. // H323 Connection events from opncui.cpp:
  174. VOID OnH323Connected(IH323Endpoint * pConnection, DWORD dwFlags, BOOL fAddMember, REFGUID rguidNode);
  175. VOID OnH323Disconnected(IH323Endpoint * pConnection, BOOL fHasAV);
  176. VOID OnAudioChannelStatus(ICommChannel *pIChannel, IH323Endpoint * lpConnection, DWORD dwStatus);
  177. VOID OnVideoChannelStatus(ICommChannel *pIChannel, IH323Endpoint * lpConnection, DWORD dwStatus);
  178. // INmConference
  179. STDMETHODIMP_(ULONG) AddRef(void);
  180. STDMETHODIMP_(ULONG) Release(void);
  181. STDMETHODIMP QueryInterface(REFIID riid, PVOID *ppvObj);
  182. STDMETHODIMP GetName(BSTR *pbstrName);
  183. STDMETHODIMP GetID(ULONG *puID);
  184. STDMETHODIMP GetState(NM_CONFERENCE_STATE *pState);
  185. STDMETHODIMP GetNmchCaps(ULONG *puchCaps);
  186. STDMETHODIMP GetTopProvider(INmMember **ppMember);
  187. STDMETHODIMP EnumMember(IEnumNmMember **ppEnum);
  188. STDMETHODIMP GetMemberCount(ULONG *puCount);
  189. STDMETHODIMP EnumChannel(IEnumNmChannel **ppEnum);
  190. STDMETHODIMP GetChannelCount(ULONG *puCount);
  191. STDMETHODIMP CreateDataChannel(INmChannelData **ppChannel, REFGUID rguid);
  192. STDMETHODIMP IsHosting(void);
  193. STDMETHODIMP Host(void);
  194. STDMETHODIMP Leave(void);
  195. STDMETHODIMP LaunchRemote(REFGUID rguid, INmMember *pMember);
  196. // INmConference3
  197. STDMETHODIMP DisconnectAV(INmMember *pMember);
  198. STDMETHODIMP ConnectAV(INmMember *pMember);
  199. STDMETHODIMP GetConferenceHandle(DWORD_PTR *pdwHandle);
  200. STDMETHODIMP CreateDataChannelEx(INmChannelData **ppChannel, REFGUID rguid, BYTE* pER);
  201. void _EraseDataChannelGUIDS(void);
  202. void RemoveDataChannelGUID(REFGUID rguid);
  203. };
  204. CConfObject * GetConfObject(void);
  205. HRESULT GetConference(INmConference **ppConference);
  206. COBLIST * GetMemberList(void);
  207. #endif /* _ICONF_H_ */