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.

230 lines
9.5 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 CheckVersion( PT120PRODUCTVERSION pRemoteVersion);
  51. STDMETHODIMP QueryRemote( LPVOID pCallerContext,
  52. LPCSTR pcszAddress,
  53. BOOL fSecure,
  54. BOOL fIsConferenceActive);
  55. STDMETHOD(CancelQueryRemote)( LPVOID pCallerContext);
  56. STDMETHODIMP CreateConference( LPCWSTR pcwszConferenceName,
  57. LPCWSTR pcwszPassword,
  58. PBYTE pbHashedPassword,
  59. DWORD cbHashedPassword,
  60. BOOL fSecure,
  61. PCONF_HANDLE phConference);
  62. STDMETHODIMP JoinConference( LPCWSTR pcwszConferenceName,
  63. LPCWSTR pcwszPassword,
  64. LPCSTR pcszAddress,
  65. BOOL fSecure,
  66. PUSERDATAINFO pUserDataInfoEntries,
  67. UINT cUserDataEntries,
  68. PCONF_HANDLE phConference);
  69. STDMETHODIMP GetUserData( ROSTER_DATA_HANDLE hUserData,
  70. const GUID* pcGUID,
  71. PUINT pcbData,
  72. LPVOID* ppvData);
  73. STDMETHODIMP_(UINT) GetPluggableConnID (LPCSTR pcszNodeAddress);
  74. public:
  75. DCRNCConferenceManager(INodeControllerEvents *pCallback, HRESULT * pStatus);
  76. virtual ~DCRNCConferenceManager(void);
  77. void WndMsgHandler(UINT uMsg, LPARAM lParam);
  78. void PostWndMsg(UINT uMsg, LPARAM lParam)
  79. {
  80. ::PostMessage(g_pControlSap->GetHwnd(), uMsg, (WPARAM) this, lParam);
  81. }
  82. void NotifyConferenceComplete(PCONFERENCE pConference,
  83. BOOL bIncoming,
  84. HRESULT result);
  85. PCONFERENCE GetConferenceFromName(LPCWSTR pcwszConfName);
  86. PCONFERENCE GetConferenceFromNumber(GCCNumericString NumericName);
  87. CLogicalConnection * GetConEntryFromConnectionHandle(ConnectionHandle hInviteIndConn);
  88. static void CALLBACK GCCCallBackHandler (GCCMessage * gcc_message);
  89. void AddInviteIndWorkItem(CInviteIndWork * pWorkItem) { m_InviteIndWorkList.AddWorkItem(pWorkItem); }
  90. void RemoveInviteIndWorkItem(CInviteIndWork * pWorkItem) { m_InviteIndWorkList.RemoveWorkItem(pWorkItem); }
  91. void RemoveJoinIndWorkItem(CJoinIndWork * pWorkItem) { m_JoinIndWorkList.RemoveWorkItem(pWorkItem); }
  92. CJoinIndWork *PeekFirstJoinIndWorkItem(void) { return m_JoinIndWorkList.PeekHead(); }
  93. BOOL FindSocketNumber(GCCNodeID nid, SOCKET * socket_number);
  94. /************************************************************************/
  95. /* RemoveConference() - remove the conference from the conference list. */
  96. /************************************************************************/
  97. void RemoveConference(PCONFERENCE pConf, BOOL fDontCheckList = FALSE, BOOL fReleaseNow = FALSE);
  98. ULONG GetNodeName(GCCConfID, GCCNodeID, LPSTR, ULONG);
  99. ULONG GetUserGUIDData(GCCConfID, GCCNodeID, GUID*, LPBYTE, ULONG);
  100. protected:
  101. void GCCCreateResponse(
  102. HRESULT rc,
  103. GCCConferenceID conference_id,
  104. GCCConferenceName * pGCCName);
  105. HRESULT CreateNewConference(PCWSTR wszconferenceName,
  106. GCCConferenceID conferenceID,
  107. PCONFERENCE * ppConference,
  108. BOOL fFindExistingConf,
  109. BOOL fSecure);
  110. PCONFERENCE GetConferenceFromID(GCCConferenceID conferenceID);
  111. void HandleGCCCallback(GCCMessage * pGCCMessage);
  112. void BroadcastGCCCallback(GCCMessage FAR * pGCCMessage);
  113. void HandleJoinConfirm(JoinConfirmMessage * pJoinConfirm);
  114. #ifdef ENABLE_START_REMOTE
  115. void HandleCreateIndication(CreateIndicationMessage * pCreateMessage);
  116. #else
  117. void HandleCreateIndication(CreateIndicationMessage *pMsg)
  118. {
  119. GCCCreateResponse(UI_RC_USER_REJECTED, pMsg->conference_id, &pMsg->conference_name);
  120. }
  121. #endif // ENABLE_START_REMOTE
  122. void HandleInviteIndication(InviteIndicationMessage * pInviteMessage);
  123. void HandleJoinInd(JoinIndicationMessage * pJoinInd);
  124. /************************************************************************/
  125. /* MapConftoCMRC - map a CONFERENCE return code to a CM return code. */
  126. /************************************************************************/
  127. HRESULT MapConftoCMRC(HRESULT confrc);
  128. void UpdateNodeIdNameListAndUserData(GCCMessage * pGCCMessage);
  129. private:
  130. /************************************************************************/
  131. /* State of the conference manager. */
  132. /************************************************************************/
  133. NC_CONF_MGR_STATE m_eState;
  134. /************************************************************************/
  135. /* Sequential lists of work to give to UI/receive answers from */
  136. /************************************************************************/
  137. CInviteIndWorkList m_InviteIndWorkList;
  138. CJoinIndWorkList m_JoinIndWorkList;
  139. /************************************************************************/
  140. /* The list of active conferences. */
  141. /************************************************************************/
  142. CNCConfList m_ConfList;
  143. };
  144. extern DCRNCConferenceManager *g_pNCConfMgr;
  145. /****************************************************************************/
  146. /* */
  147. /* CONSTANTS */
  148. /* */
  149. /****************************************************************************/
  150. /****************************************************************************/
  151. /* Return codes */
  152. /****************************************************************************/
  153. #define CM_RC_UNKNOWN_CONFERENCE 1
  154. #define CM_RC_INTERNAL_ERROR 2
  155. #define CM_RC_NOT_SUPPORTED_IN_BACKLEVEL 3
  156. /****************************************************************************/
  157. /* Constants for SetAutoAcceptMode(). */
  158. /****************************************************************************/
  159. #define CM_AUTO_JOIN 0
  160. #define CM_DONT_AUTO_JOIN 1
  161. // Get a name in Unicode from either an ANSII numeric name or
  162. // a Unicode text name, and allocate memory for result.
  163. HRESULT GetUnicodeFromGCC(PCSTR szGCCNumeric,
  164. PCWSTR wszGCCUnicode,
  165. PWSTR * pwszText);
  166. // Do the reverse of GetUnicodeFromGCC, and reuse the Unicode text name,
  167. // (i.e. do not allocate), and only allocate a ANSI numeric name if needed.
  168. HRESULT GetGCCFromUnicode(PCWSTR wszText,
  169. GCCNumericString * pGCCNumeric,
  170. LPWSTR * pGCCUnicode);
  171. HRESULT GCCJoinResponseWrapper(GCCResponseTag join_response_tag,
  172. GCCChallengeRequestResponse * password_challenge,
  173. GCCResult result,
  174. GCCConferenceID conferenceID,
  175. UINT nUserData = 0,
  176. GCCUserData ** ppUserData = NULL);
  177. GCCConferenceID GetConfIDFromMessage(GCCMessage *pGCCMessage);
  178. #endif /* __ERNCCM_HPP_ */