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.

229 lines
9.1 KiB

  1. /****************************************************************************/
  2. /* */
  3. /* ERNCCM.HPP */
  4. /* */
  5. /* Conference Manager class for the Reference System Node Controller. */
  6. /* */
  7. /* Copyright Data Connection Ltd. 1995 */
  8. /* */
  9. /****************************************************************************/
  10. /* Changes: */
  11. /* */
  12. /* 16Jun95 NFC Created. */
  13. /* */
  14. /****************************************************************************/
  15. #ifndef __ERNCCM_HPP_
  16. #define __ERNCCM_HPP_
  17. #include "events.hpp"
  18. #include "erncconf.hpp"
  19. #include "inodecnt.h"
  20. #include "csap.h"
  21. class DCRNCConference;
  22. class CLogicalConnection;
  23. extern INodeControllerEvents *g_pCallbackInterface;
  24. extern BOOL g_bRDS;
  25. /****************************************************************************/
  26. /* Values for CM state. */
  27. /****************************************************************************/
  28. typedef enum
  29. {
  30. CM_ST_UNINITIALIZED,
  31. CM_ST_CPI_INITIALIZED,
  32. CM_ST_GCC_INITIALIZED,
  33. CM_ST_STARTING_CMP,
  34. CM_ST_CMP_STARTED,
  35. }
  36. NC_CONF_MGR_STATE;
  37. class CNCConfList : public CList
  38. {
  39. DEFINE_CLIST(CNCConfList, DCRNCConference*)
  40. };
  41. class DCRNCConferenceManager : public INodeController, public CRefCount
  42. {
  43. friend class DCRNCConference;
  44. friend class CInviteIndWork;
  45. public:
  46. //
  47. // INodeController Methods:
  48. //
  49. STDMETHODIMP_(void) ReleaseInterface(void);
  50. STDMETHODIMP QueryRemote( LPVOID pCallerContext,
  51. LPCSTR pcszAddress,
  52. BOOL fSecure,
  53. BOOL fIsConferenceActive);
  54. STDMETHOD(CancelQueryRemote)( LPVOID pCallerContext);
  55. STDMETHODIMP CreateConference( LPCWSTR pcwszConferenceName,
  56. LPCWSTR pcwszPassword,
  57. PBYTE pbHashedPassword,
  58. DWORD cbHashedPassword,
  59. BOOL fSecure,
  60. PCONF_HANDLE phConference);
  61. STDMETHODIMP JoinConference( LPCWSTR pcwszConferenceName,
  62. LPCWSTR pcwszPassword,
  63. LPCSTR pcszAddress,
  64. BOOL fSecure,
  65. PCONF_HANDLE phConference);
  66. STDMETHODIMP_(UINT) GetPluggableConnID (LPCSTR pcszNodeAddress);
  67. public:
  68. DCRNCConferenceManager(INodeControllerEvents *pCallback, BSTR szName, HRESULT * pStatus);
  69. virtual ~DCRNCConferenceManager(void);
  70. void WndMsgHandler(UINT uMsg, LPARAM lParam);
  71. void PostWndMsg(UINT uMsg, LPARAM lParam)
  72. {
  73. ::PostMessage(g_pControlSap->GetHwnd(), uMsg, (WPARAM) this, lParam);
  74. }
  75. void NotifyConferenceComplete(PCONFERENCE pConference,
  76. BOOL bIncoming,
  77. HRESULT result);
  78. PCONFERENCE GetConferenceFromName(LPCWSTR pcwszConfName);
  79. PCONFERENCE GetConferenceFromNumber(GCCNumericString NumericName);
  80. CLogicalConnection * GetConEntryFromConnectionHandle(ConnectionHandle hInviteIndConn);
  81. static void CALLBACK GCCCallBackHandler (GCCMessage * gcc_message);
  82. void AddInviteIndWorkItem(CInviteIndWork * pWorkItem) { m_InviteIndWorkList.AddWorkItem(pWorkItem); }
  83. void RemoveInviteIndWorkItem(CInviteIndWork * pWorkItem) { m_InviteIndWorkList.RemoveWorkItem(pWorkItem); }
  84. void RemoveJoinIndWorkItem(CJoinIndWork * pWorkItem) { m_JoinIndWorkList.RemoveWorkItem(pWorkItem); }
  85. CJoinIndWork *PeekFirstJoinIndWorkItem(void) { return m_JoinIndWorkList.PeekHead(); }
  86. BOOL FindSocketNumber(GCCNodeID nid, SOCKET * socket_number);
  87. /************************************************************************/
  88. /* RemoveConference() - remove the conference from the conference list. */
  89. /************************************************************************/
  90. void RemoveConference(PCONFERENCE pConf, BOOL fDontCheckList = FALSE, BOOL fReleaseNow = FALSE);
  91. BSTR GetNodeName(void);
  92. ULONG GetNodeName(GCCConfID, GCCNodeID, LPSTR, ULONG);
  93. ULONG GetUserGUIDData(GCCConfID, GCCNodeID, GUID*, LPBYTE, ULONG);
  94. protected:
  95. void GCCCreateResponse(
  96. HRESULT rc,
  97. GCCConferenceID conference_id,
  98. GCCConferenceName * pGCCName);
  99. HRESULT CreateNewConference(PCWSTR wszconferenceName,
  100. GCCConferenceID conferenceID,
  101. PCONFERENCE * ppConference,
  102. BOOL fFindExistingConf,
  103. BOOL fSecure);
  104. PCONFERENCE GetConferenceFromID(GCCConferenceID conferenceID);
  105. void HandleGCCCallback(GCCMessage * pGCCMessage);
  106. void BroadcastGCCCallback(GCCMessage FAR * pGCCMessage);
  107. void HandleJoinConfirm(JoinConfirmMessage * pJoinConfirm);
  108. #ifdef ENABLE_START_REMOTE
  109. void HandleCreateIndication(CreateIndicationMessage * pCreateMessage);
  110. #else
  111. void HandleCreateIndication(CreateIndicationMessage *pMsg)
  112. {
  113. GCCCreateResponse(UI_RC_USER_REJECTED, pMsg->conference_id, &pMsg->conference_name);
  114. }
  115. #endif // ENABLE_START_REMOTE
  116. void HandleInviteIndication(InviteIndicationMessage * pInviteMessage);
  117. void HandleJoinInd(JoinIndicationMessage * pJoinInd);
  118. /************************************************************************/
  119. /* MapConftoCMRC - map a CONFERENCE return code to a CM return code. */
  120. /************************************************************************/
  121. HRESULT MapConftoCMRC(HRESULT confrc);
  122. void UpdateNodeIdNameListAndUserData(GCCMessage * pGCCMessage);
  123. private:
  124. /************************************************************************/
  125. /* State of the conference manager. */
  126. /************************************************************************/
  127. NC_CONF_MGR_STATE m_eState;
  128. /************************************************************************/
  129. /* Sequential lists of work to give to UI/receive answers from */
  130. /************************************************************************/
  131. CInviteIndWorkList m_InviteIndWorkList;
  132. CJoinIndWorkList m_JoinIndWorkList;
  133. /************************************************************************/
  134. /* The list of active conferences. */
  135. /************************************************************************/
  136. CNCConfList m_ConfList;
  137. // The user name
  138. BSTR m_bstrUserName;
  139. };
  140. extern DCRNCConferenceManager *g_pNCConfMgr;
  141. /****************************************************************************/
  142. /* */
  143. /* CONSTANTS */
  144. /* */
  145. /****************************************************************************/
  146. /****************************************************************************/
  147. /* Return codes */
  148. /****************************************************************************/
  149. #define CM_RC_UNKNOWN_CONFERENCE 1
  150. #define CM_RC_INTERNAL_ERROR 2
  151. #define CM_RC_NOT_SUPPORTED_IN_BACKLEVEL 3
  152. /****************************************************************************/
  153. /* Constants for SetAutoAcceptMode(). */
  154. /****************************************************************************/
  155. #define CM_AUTO_JOIN 0
  156. #define CM_DONT_AUTO_JOIN 1
  157. // Get a name in Unicode from either an ANSII numeric name or
  158. // a Unicode text name, and allocate memory for result.
  159. HRESULT GetUnicodeFromGCC(PCSTR szGCCNumeric,
  160. PCWSTR wszGCCUnicode,
  161. PWSTR * pwszText);
  162. // Do the reverse of GetUnicodeFromGCC, and reuse the Unicode text name,
  163. // (i.e. do not allocate), and only allocate a ANSI numeric name if needed.
  164. HRESULT GetGCCFromUnicode(PCWSTR wszText,
  165. GCCNumericString * pGCCNumeric,
  166. LPWSTR * pGCCUnicode);
  167. HRESULT GCCJoinResponseWrapper(GCCResponseTag join_response_tag,
  168. GCCChallengeRequestResponse * password_challenge,
  169. GCCResult result,
  170. GCCConferenceID conferenceID,
  171. UINT nUserData = 0,
  172. GCCUserData ** ppUserData = NULL);
  173. GCCConferenceID GetConfIDFromMessage(GCCMessage *pGCCMessage);
  174. BSTR GetNodeName(void);
  175. #endif /* __ERNCCM_HPP_ */