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.

3727 lines
110 KiB

  1. #include "precomp.h"
  2. DEBUG_FILEZONE(ZONE_T120_GCCNC);
  3. /*
  4. * gcontrol.cpp
  5. *
  6. * Copyright (c) 1995 by DataBeam Corporation, Lexington, KY
  7. *
  8. * Abstract:
  9. * This module manages the creation and deletion of various objects
  10. * within GCC. This includes the Control SAP, the Application SAPs, the
  11. * Conference objectis indexed by the Conference ID. Primitives are
  12. * routed to the as and the MCS interface. Conferences are maintained
  13. * in a list that ppropriate conference object based on the Conference ID.
  14. * The controller module is also responsible for routing Connect Provider
  15. * indications to the appropriate destination.
  16. *
  17. * SEE THE INTERFACE FILE FOR A MORE DETAILED EXPLANATION OF THIS CLASS
  18. *
  19. * Portable:
  20. * Not Completely
  21. *
  22. * Protected Instance Variables:
  23. * None.
  24. *
  25. * Private Instance Variables:
  26. * g_pMCSIntf - Pointer to the MCS Interface object.
  27. * All request to MCS and all callbacks
  28. * received from MCS travel through this
  29. * interface.
  30. * m_ConfList2 - This list maintains the active
  31. * conference objects.
  32. * m_ConfPollList - The conference poll list is used when
  33. * polling the conference objects. A
  34. * seperate poll list is needed from the
  35. * conference list to avoid any changes
  36. * to the rogue wave list while it is
  37. * being iterated on.
  38. * m_AppSapList - This list maintains all the registered
  39. * application SAP objects.
  40. * m_PendingCreateConfList2 - This list is used to maintain
  41. * conference information for pending
  42. * conference objects that have not
  43. * yet been created (i.e. CreateRequest
  44. * has been received but not the Create
  45. * Response).
  46. * m_PendingJoinConfList2 - This list is used to maintain the
  47. * join information for pending
  48. * conference joins that have not
  49. * yet been accepted (i.e. JoinRequest
  50. * has been received but not the Join
  51. * Response).
  52. * m_ConfDeleteList - This list contains any conference
  53. * objects that have been marked for
  54. * deletion. Once a conference object is
  55. * put into this list on the next call to
  56. * PollCommDevices it will be deleted.
  57. * m_fConfListChangePending This flag is used to inform when the
  58. * m_ConfList2 changes. This includes
  59. * when items are added as well as deleted.
  60. * m_ConfIDCounter - This instance variable is used to
  61. * generate Conference IDs.
  62. * m_QueryIDCounter - This instance variable is used to
  63. * generate the DomainSelector used in the
  64. * query request.
  65. * m_PendingQueryConfList2 - This list contains the query id (used
  66. * for the domain selector in the query
  67. * request). This query id needs to be
  68. * kept around so that the domain selector
  69. * can be deleted when the query response
  70. * comes back in (or if the controller is
  71. * deleted before the confirm comes back).
  72. *
  73. *
  74. * WIN32 related instance variables:
  75. *
  76. * g_hevGCCOutgoingPDU - This is a Windows handle to an event
  77. * object that signals a GCC PDU being
  78. * queued and ready to send on to MCS.
  79. *
  80. * WIN16 related instance variables:
  81. *
  82. * Timer_Procedure - This is the Process Instance of the
  83. * timer procedure used in the Win16
  84. * environment to get an internal
  85. * heartbeat.
  86. * Timer_ID - This is the timer id of the timer that
  87. * may be allocated in the Win16
  88. * constructor.
  89. *
  90. * Caveats:
  91. * None.
  92. *
  93. * Author:
  94. * blp
  95. */
  96. #include <stdio.h>
  97. #include "gcontrol.h"
  98. #include "ogcccode.h"
  99. #include "translat.h"
  100. #include "appldr.h"
  101. /*
  102. ** These ID ranges are used for conferences and queries. Note that
  103. ** conference ID's and query ID's can never conflict. These ID's are
  104. ** used to create the MCS domains.
  105. */
  106. #define MINIMUM_CONFERENCE_ID_VALUE 0x00000001L
  107. #define MAXIMUM_CONFERENCE_ID_VALUE 0x10000000L
  108. #define MINIMUM_QUERY_ID_VALUE 0x10000001L
  109. #define MAXIMUM_QUERY_ID_VALUE 0xffffffffL
  110. /* ------ local data strctures ------ */
  111. /*
  112. ** The join information structure is used to temporarily store
  113. ** information needed to join a conference after the join response is
  114. ** issued.
  115. */
  116. PENDING_JOIN_CONF::PENDING_JOIN_CONF(void)
  117. :
  118. convener_password(NULL),
  119. password_challenge(NULL),
  120. pwszCallerID(NULL)
  121. {
  122. }
  123. PENDING_JOIN_CONF::~PENDING_JOIN_CONF(void)
  124. {
  125. if (NULL != convener_password)
  126. {
  127. convener_password->Release();
  128. }
  129. if (NULL != password_challenge)
  130. {
  131. password_challenge->Release();
  132. }
  133. delete pwszCallerID;
  134. }
  135. /*
  136. ** The conference information structure is used to temporarily store
  137. ** information needed to create a conference while waiting for a
  138. ** conference create response.
  139. */
  140. PENDING_CREATE_CONF::PENDING_CREATE_CONF(void)
  141. :
  142. pszConfNumericName(NULL),
  143. pwszConfTextName(NULL),
  144. conduct_privilege_list(NULL),
  145. conduct_mode_privilege_list(NULL),
  146. non_conduct_privilege_list(NULL),
  147. pwszConfDescription(NULL)
  148. {
  149. }
  150. PENDING_CREATE_CONF::~PENDING_CREATE_CONF(void)
  151. {
  152. delete pszConfNumericName;
  153. delete pwszConfTextName;
  154. delete conduct_privilege_list;
  155. delete conduct_mode_privilege_list;
  156. delete non_conduct_privilege_list;
  157. delete pwszConfDescription;
  158. }
  159. // The DLL's HINSTANCE.
  160. extern HINSTANCE g_hDllInst;
  161. MCSDLLInterface *g_pMCSIntf;
  162. CRITICAL_SECTION g_csGCCProvider;
  163. DWORD g_dwNCThreadID;
  164. HANDLE g_hevGCCOutgoingPDU;
  165. /*
  166. * This is a global variable that has a pointer to the one GCC coder that
  167. * is instantiated by the GCC Controller. Most objects know in advance
  168. * whether they need to use the MCS or the GCC coder, so, they do not need
  169. * this pointer in their constructors.
  170. */
  171. extern CGCCCoder *g_GCCCoder;
  172. /*
  173. * GCCController::GCCController ()
  174. *
  175. * Public Function Description
  176. * This is the Win32 controller constructor. It is responsible for
  177. * creating the application interface and the mcs interface.
  178. * It also creates up the memory manager, the packet coder etc.
  179. */
  180. GCCController::GCCController(PGCCError pRetCode)
  181. :
  182. CRefCount(MAKE_STAMP_ID('C','t','r','l')),
  183. m_ConfIDCounter(MAXIMUM_CONFERENCE_ID_VALUE),
  184. m_QueryIDCounter(MAXIMUM_QUERY_ID_VALUE),
  185. m_fConfListChangePending(FALSE),
  186. m_PendingQueryConfList2(CLIST_DEFAULT_MAX_ITEMS),
  187. m_PendingCreateConfList2(CLIST_DEFAULT_MAX_ITEMS),
  188. m_PendingJoinConfList2(CLIST_DEFAULT_MAX_ITEMS),
  189. m_AppSapList(DESIRED_MAX_APP_SAP_ITEMS),
  190. m_ConfList2(DESIRED_MAX_CONFS),
  191. m_ConfPollList(DESIRED_MAX_CONFS)
  192. {
  193. GCCError rc = GCC_ALLOCATION_FAILURE;
  194. MCSError mcs_rc;
  195. //WNDCLASS wc;
  196. DebugEntry(GCCController::GCCController);
  197. g_dwNCThreadID = ::GetCurrentThreadId();
  198. g_pMCSIntf = NULL;
  199. g_GCCCoder = NULL;
  200. g_hevGCCOutgoingPDU = NULL;
  201. /*
  202. * The allocation of the critical section succeeded, but we must
  203. * initialize it before we can use it.
  204. */
  205. ::InitializeCriticalSection(&g_csGCCProvider);
  206. DBG_SAVE_FILE_LINE
  207. g_GCCCoder = new CGCCCoder ();
  208. if (g_GCCCoder == NULL)
  209. {
  210. /*
  211. * If the packet coder could not be created then report the error.
  212. * This IS a fatal error, so the faulty controller should be
  213. * destroyed and never used.
  214. */
  215. ERROR_OUT(("GCCController::GCCController: failure creating packet coder"));
  216. // rc = GCC_ALLOCATION_FAILURE;
  217. goto MyExit;
  218. }
  219. /*
  220. * We must allocate an event object that will used to notify the
  221. * controller when messages are ready to be processed within the shared
  222. * memory application interface.
  223. */
  224. g_hevGCCOutgoingPDU = ::CreateEvent(NULL, FALSE, FALSE, NULL);
  225. if (g_hevGCCOutgoingPDU == NULL)
  226. {
  227. /*
  228. * Were unable to allocate an event object for this task, so we
  229. * must fail the creation of this controller.
  230. */
  231. ERROR_OUT(("GCCController::GCCController: failure allocating mcs pdu event object"));
  232. // rc = GCC_ALLOCATION_FAILURE;
  233. goto MyExit;
  234. }
  235. DBG_SAVE_FILE_LINE
  236. g_pMCSIntf = new MCSDLLInterface(&mcs_rc);
  237. if ((NULL == g_pMCSIntf) || (mcs_rc != MCS_NO_ERROR))
  238. {
  239. if (NULL != g_pMCSIntf)
  240. {
  241. ERROR_OUT(("GCCController: Error creating MCS Interface, mcs_rc=%u", (UINT) mcs_rc));
  242. rc = g_pMCSIntf->TranslateMCSIFErrorToGCCError(mcs_rc);
  243. }
  244. else
  245. {
  246. ERROR_OUT(("GCCController: can't create MCSDLLInterface"));
  247. // rc = GCC_ALLOCATION_FAILURE;
  248. }
  249. goto MyExit;
  250. }
  251. rc = GCC_NO_ERROR;
  252. MyExit:
  253. *pRetCode = rc;
  254. DebugExitVOID(GCCController::GCCController);
  255. }
  256. /*
  257. * GCCController::~GCCController ()
  258. *
  259. * Public Function Description
  260. * This is the controller destructor. It takes care of freeing up
  261. * many of the objects this class creates.
  262. */
  263. GCCController::~GCCController(void)
  264. {
  265. GCCConfID query_id;
  266. PENDING_JOIN_CONF *lpJoinInfo;
  267. //PConference lpConf;
  268. //CAppSap *lpAppSap;
  269. PENDING_CREATE_CONF *lpConfInfo;
  270. ConnectionHandle hConn;
  271. DebugEntry(GCCController::~GCCController);
  272. /*
  273. * We need to enter the critical section before attempting to clean out
  274. * all of this stuff (if there is a critical section).
  275. */
  276. ::EnterCriticalSection(&g_csGCCProvider);
  277. //
  278. // No one should use this global pointer any more.
  279. //
  280. ASSERT(this == g_pGCCController);
  281. g_pGCCController = NULL;
  282. // Free up any outstanding join info
  283. while (NULL != (lpJoinInfo = m_PendingJoinConfList2.Get(&hConn)))
  284. {
  285. FailConfJoinIndResponse(lpJoinInfo->nConfID, hConn);
  286. delete lpJoinInfo;
  287. }
  288. // Clean up any outstanding query request
  289. while (GCC_INVALID_CID != (query_id = m_PendingQueryConfList2.Get()))
  290. {
  291. g_pMCSIntf->DeleteDomain(&query_id);
  292. }
  293. // Delete any conferences that are left around
  294. m_ConfList2.DeleteList();
  295. // Delete any application SAPs the are left around
  296. m_AppSapList.DeleteList();
  297. // Delete any outstanding conference information
  298. while (NULL != (lpConfInfo = m_PendingCreateConfList2.Get()))
  299. {
  300. delete lpConfInfo;
  301. }
  302. /*
  303. ** If a conference list change is pending we must delete any outstanding
  304. ** conference.
  305. */
  306. if (m_fConfListChangePending)
  307. {
  308. // Delete any outstanding conference objects
  309. m_ConfDeleteList.DeleteList();
  310. m_fConfListChangePending = FALSE;
  311. }
  312. /*
  313. * We can now leave the critical section.
  314. */
  315. ::LeaveCriticalSection(&g_csGCCProvider);
  316. delete g_pMCSIntf;
  317. g_pMCSIntf = NULL;
  318. ::DeleteCriticalSection(&g_csGCCProvider);
  319. ::My_CloseHandle(g_hevGCCOutgoingPDU);
  320. delete g_GCCCoder;
  321. g_GCCCoder = NULL; // do we really need to set it to NULL?
  322. }
  323. void GCCController::RegisterAppSap(CAppSap *pAppSap)
  324. {
  325. CConf *pConf;
  326. DebugEntry(GCCController::RegisterAppSap);
  327. // Update the application SAP list with the new SAP.
  328. pAppSap->AddRef();
  329. m_AppSapList.Append(pAppSap);
  330. /*
  331. ** Here we are registering the SAP with the conference. A permit
  332. ** to enroll indication is also sent here for all the available
  333. ** conferences.
  334. */
  335. m_ConfList2.Reset();
  336. while (NULL != (pConf = m_ConfList2.Iterate()))
  337. {
  338. /*
  339. ** Only register and send the permit for conferences that are
  340. ** established.
  341. */
  342. if (pConf->IsConfEstablished())
  343. {
  344. // Register the application SAP with the conference.
  345. pConf->RegisterAppSap(pAppSap);
  346. }
  347. }
  348. DebugExitVOID(GCCController::RegisterAppSap);
  349. }
  350. void GCCController::UnRegisterAppSap(CAppSap *pAppSap)
  351. {
  352. DebugEntry(GCCController::UnRegisterAppSap);
  353. if (m_AppSapList.Find(pAppSap))
  354. {
  355. CConf *pConf;
  356. m_ConfPollList.Reset();
  357. while (NULL != (pConf = m_ConfPollList.Iterate()))
  358. {
  359. // This routine takes care of all the necessary unenrollments.
  360. pConf->UnRegisterAppSap(pAppSap);
  361. }
  362. /*
  363. ** Here we remove the application SAP object from the list of valid
  364. ** application SAPs and insert it into the list of Application SAPs
  365. ** to be deleted. On the next call to PollCommDevices this
  366. ** SAP object will be deleted.
  367. */
  368. m_AppSapList.Remove(pAppSap);
  369. pAppSap->Release();
  370. }
  371. else
  372. {
  373. ERROR_OUT(("GCCController::UnRegisterAppSap: bad app sap"));
  374. }
  375. DebugExitVOID(GCCController::UnRegisterAppSap);
  376. }
  377. // Calls received from the Control SAP
  378. /*
  379. * GCCController::ConfCreateRequest()
  380. *
  381. * Private Function Description
  382. * This routine is called when the node controller request that
  383. * a conference is created. The conference object is instantiated in
  384. * this routine.
  385. *
  386. * Formal Parameters:
  387. * conf_create_request_info - (i) Information structure that holds
  388. * all the info necessary to create
  389. * a conference.
  390. *
  391. * Return Value
  392. * GCC_NO_ERROR - No error occured.
  393. * GCC_ALLOCATION_FAILURE - A resource error occured.
  394. * GCC_INVALID_CONFERENCE_NAME - Invalid conference name passed in.
  395. * GCC_FAILURE_CREATING_DOMAIN - Failure creating domain.
  396. * GCC_BAD_NETWORK_ADDRESS - Bad network address passed in.
  397. * GCC_BAD_NETWORK_ADDRESS_TYPE - Bad network address type passed in.
  398. * GCC_CONFERENCE_ALREADY_EXISTS - Conference specified already exists.
  399. * GCC_INVALID_TRANSPORT - Cannot find specified transport.
  400. * GCC_INVALID_ADDRESS_PREFIX - Bad transport address passed in.
  401. * GCC_INVALID_TRANSPORT_ADDRESS - Bad transport address
  402. * GCC_INVALID_PASSWORD - Invalid password passed in.
  403. * GCC_FAILURE_ATTACHING_TO_MCS - Failure creating MCS user attachment
  404. * GCC_BAD_USER_DATA - Invalid user data passed in.
  405. *
  406. * Side Effects
  407. * None
  408. *
  409. * Caveats
  410. * In the Win32 world we pass in a shared memory manager to the
  411. * conference object to use for the message memory manager. This is
  412. * not necessary in the Win16 world since shared memory is not used.
  413. */
  414. GCCError GCCController::
  415. ConfCreateRequest
  416. (
  417. CONF_CREATE_REQUEST *pCCR,
  418. GCCConfID *pnConfID
  419. )
  420. {
  421. GCCError rc;
  422. PConference new_conference;
  423. GCCConfID conference_id;
  424. CONF_SPEC_PARAMS csp;
  425. DebugEntry(GCCController: ConfCreateRequest);
  426. /*
  427. ** We must first check all the existing conferences to make sure that this
  428. ** conference name is not already in use. We will use an empty conference
  429. ** modifier here for our comparision. Note that this returns immediatly
  430. ** if a conference by the same name alreay exists. Conference names
  431. ** must be unique at a node.
  432. */
  433. conference_id = GetConferenceIDFromName(
  434. pCCR->Core.conference_name,
  435. pCCR->Core.conference_modifier);
  436. if (conference_id != 0)
  437. {
  438. ERROR_OUT(("GCCController:ConfCreateRequest: Conference exists."));
  439. return (GCC_CONFERENCE_ALREADY_EXISTS);
  440. }
  441. /*
  442. ** Here we are allocating a conference ID. In most cases this ID
  443. ** will be the same as the conference name. Only if a conference
  444. ** name is passed in that already exists will the name and ID
  445. ** be different. In this case, a modifier will be appended to the
  446. ** conference name to create the conference ID.
  447. */
  448. conference_id = AllocateConferenceID();
  449. // set up conference specification parameters
  450. csp.fClearPassword = pCCR->Core.use_password_in_the_clear;
  451. csp.fConfLocked = pCCR->Core.conference_is_locked;
  452. csp.fConfListed = pCCR->Core.conference_is_listed;
  453. csp.fConfConductable = pCCR->Core.conference_is_conductible;
  454. csp.eTerminationMethod = pCCR->Core.termination_method;
  455. csp.pConductPrivilege = pCCR->Core.conduct_privilege_list;
  456. csp.pConductModePrivilege = pCCR->Core.conduct_mode_privilege_list;
  457. csp.pNonConductPrivilege = pCCR->Core.non_conduct_privilege_list;
  458. csp.pwszConfDescriptor = pCCR->Core.pwszConfDescriptor;
  459. DBG_SAVE_FILE_LINE
  460. new_conference= new CConf(pCCR->Core.conference_name,
  461. pCCR->Core.conference_modifier,
  462. conference_id,
  463. &csp,
  464. pCCR->Core.number_of_network_addresses,
  465. pCCR->Core.network_address_list,
  466. &rc);
  467. if ((new_conference != NULL) && (rc == GCC_NO_ERROR))
  468. {
  469. rc = new_conference->ConfCreateRequest
  470. (
  471. pCCR->Core.calling_address,
  472. pCCR->Core.called_address,
  473. pCCR->fSecure,
  474. pCCR->convener_password,
  475. pCCR->password,
  476. pCCR->Core.pwszCallerID,
  477. pCCR->Core.domain_parameters,
  478. pCCR->user_data_list,
  479. pCCR->Core.connection_handle
  480. );
  481. if (rc == GCC_NO_ERROR)
  482. {
  483. m_fConfListChangePending = TRUE;
  484. if (NULL != pnConfID)
  485. {
  486. *pnConfID = conference_id;
  487. }
  488. m_ConfList2.Append(conference_id, new_conference);
  489. PostMsgToRebuildConfPollList();
  490. }
  491. else
  492. {
  493. new_conference->Release();
  494. }
  495. }
  496. else
  497. {
  498. ERROR_OUT(("GCCController:ConfCreateRequest: Error occured creating conference"));
  499. if (new_conference != NULL)
  500. {
  501. new_conference->Release();
  502. }
  503. else
  504. {
  505. rc = GCC_ALLOCATION_FAILURE;
  506. }
  507. }
  508. DebugExitINT(GCCController: ConfCreateRequest, rc);
  509. return rc;
  510. }
  511. /*
  512. * GCCController::ConfCreateResponse ()
  513. *
  514. * Private Function Description
  515. * This routine is called when the node controller responds to
  516. * a conference create indication. It is responsible for
  517. * creating the conference object.
  518. *
  519. * Formal Parameters:
  520. * conf_create_response_info - (i) Information structure that holds
  521. * all the info necessary to respond to
  522. * a conference create request.
  523. *
  524. * Return Value
  525. * GCC_NO_ERROR - No error occured.
  526. * GCC_ALLOCATION_FAILURE - A resource error occured.
  527. * GCC_INVALID_CONFERENCE - An invalid conference was passed in.
  528. * GCC_INVALID_CONFERENCE_NAME - Invalid conference name passed in.
  529. * GCC_FAILURE_CREATING_DOMAIN - Failure creating domain.
  530. * GCC_CONFERENCE_ALREADY_EXISTS - Conference specified already exists.
  531. * GCC_BAD_USER_DATA - Invalid user data passed in.
  532. * GCC_FAILURE_ATTACHING_TO_MCS - Failure creating MCS user attachment
  533. *
  534. *
  535. * Side Effects
  536. * None
  537. *
  538. * Caveats
  539. * In the Win32 world we pass in a shared memory manager to the
  540. * conference object to use for the message memory manager. This is
  541. * not necessary in the Win16 world since shared memory is not used.
  542. */
  543. GCCError GCCController::
  544. ConfCreateResponse ( PConfCreateResponseInfo conf_create_response_info )
  545. {
  546. GCCConferenceName conference_name;
  547. PENDING_CREATE_CONF *conference_info;
  548. PConference new_conference;
  549. GCCError rc = GCC_NO_ERROR;
  550. GCCConfID conference_id;
  551. ConnectGCCPDU connect_pdu;
  552. LPBYTE encoded_pdu;
  553. UINT encoded_pdu_length;
  554. MCSError mcsif_error;
  555. LPWSTR pwszConfDescription = NULL;
  556. PGCCConferencePrivileges conduct_privilege_list_ptr = NULL;
  557. PGCCConferencePrivileges conduct_mode_privilege_list_ptr = NULL;
  558. PGCCConferencePrivileges non_conduct_privilege_list_ptr = NULL;
  559. CONF_SPEC_PARAMS csp;
  560. DebugEntry(GCCController::ConfCreateResponse);
  561. // Is the conference create info structure in the rogue wave list
  562. if (NULL != (conference_info = m_PendingCreateConfList2.Find(conf_create_response_info->conference_id)))
  563. {
  564. if (conf_create_response_info->result == GCC_RESULT_SUCCESSFUL)
  565. {
  566. // First set up the conference name.
  567. conference_name.numeric_string = (GCCNumericString) conference_info->pszConfNumericName;
  568. conference_name.text_string = conference_info->pwszConfTextName;
  569. /*
  570. ** If the conference name is valid check all the existing
  571. ** conferences to make sure that this conference name is not
  572. * already in use.
  573. */
  574. conference_id = GetConferenceIDFromName(
  575. &conference_name,
  576. conf_create_response_info->conference_modifier);
  577. if (conference_id != 0)
  578. {
  579. WARNING_OUT(("GCCController:ConfCreateResponse: Conference exists"));
  580. rc = GCC_CONFERENCE_ALREADY_EXISTS;
  581. }
  582. else
  583. {
  584. /*
  585. ** Now set up the real conference ID from the conference id
  586. ** that was generated when the create request came in.
  587. */
  588. conference_id = conf_create_response_info->conference_id;
  589. }
  590. /*
  591. ** If everything is OK up to here go ahead and process the
  592. ** create request.
  593. */
  594. if (rc == GCC_NO_ERROR)
  595. {
  596. // Set up the privilege list pointers for the list that exists
  597. if (conference_info->conduct_privilege_list != NULL)
  598. {
  599. conference_info->conduct_privilege_list->
  600. GetPrivilegeListData(&conduct_privilege_list_ptr);
  601. }
  602. if (conference_info->conduct_mode_privilege_list != NULL)
  603. {
  604. conference_info->conduct_mode_privilege_list->
  605. GetPrivilegeListData(&conduct_mode_privilege_list_ptr);
  606. }
  607. if (conference_info->non_conduct_privilege_list != NULL)
  608. {
  609. conference_info->non_conduct_privilege_list->
  610. GetPrivilegeListData(&non_conduct_privilege_list_ptr);
  611. }
  612. // Set up the conference description pointer if one exists
  613. pwszConfDescription = conference_info->pwszConfDescription;
  614. // set up conference specification parameters
  615. csp.fClearPassword = conf_create_response_info->use_password_in_the_clear,
  616. csp.fConfLocked = conference_info->conference_is_locked,
  617. csp.fConfListed = conference_info->conference_is_listed,
  618. csp.fConfConductable = conference_info->conference_is_conductible,
  619. csp.eTerminationMethod = conference_info->termination_method,
  620. csp.pConductPrivilege = conduct_privilege_list_ptr,
  621. csp.pConductModePrivilege = conduct_mode_privilege_list_ptr,
  622. csp.pNonConductPrivilege = non_conduct_privilege_list_ptr,
  623. csp.pwszConfDescriptor = pwszConfDescription,
  624. // Here we instantiate the conference object
  625. DBG_SAVE_FILE_LINE
  626. new_conference = new CConf(&conference_name,
  627. conf_create_response_info->conference_modifier,
  628. conference_id,
  629. &csp,
  630. conf_create_response_info->number_of_network_addresses,
  631. conf_create_response_info->network_address_list,
  632. &rc);
  633. if ((new_conference != NULL) &&
  634. (rc == GCC_NO_ERROR))
  635. {
  636. // Here we actually issue the create response.
  637. rc = new_conference->ConfCreateResponse(
  638. conference_info->connection_handle,
  639. conf_create_response_info->domain_parameters,
  640. conf_create_response_info->user_data_list);
  641. if (rc == GCC_NO_ERROR)
  642. {
  643. // Add the new conference to the Conference List
  644. m_fConfListChangePending = TRUE;
  645. m_ConfList2.Append(conference_id, new_conference);
  646. PostMsgToRebuildConfPollList();
  647. }
  648. else
  649. {
  650. new_conference->Release();
  651. }
  652. }
  653. else
  654. {
  655. if (new_conference != NULL)
  656. {
  657. new_conference->Release();
  658. }
  659. else
  660. {
  661. rc = GCC_ALLOCATION_FAILURE;
  662. }
  663. }
  664. }
  665. }
  666. else
  667. {
  668. /*
  669. ** This section of the code is sending back the failed result.
  670. ** Note that no conference object is instantiated when the
  671. ** result is something other than success.
  672. */
  673. connect_pdu.choice = CONFERENCE_CREATE_RESPONSE_CHOSEN;
  674. connect_pdu.u.conference_create_response.bit_mask = 0;
  675. // This must be set to satisfy ASN.1 restriction
  676. connect_pdu.u.conference_create_response.node_id = 1001;
  677. connect_pdu.u.conference_create_response.tag = 0;
  678. if (conf_create_response_info->user_data_list != NULL)
  679. {
  680. connect_pdu.u.conference_create_response.bit_mask =
  681. CCRS_USER_DATA_PRESENT;
  682. conf_create_response_info->user_data_list->GetUserDataPDU(
  683. &connect_pdu.u.conference_create_response.ccrs_user_data);
  684. }
  685. // We always send a user rejected result here.
  686. connect_pdu.u.conference_create_response.result =
  687. ::TranslateGCCResultToCreateResult(
  688. GCC_RESULT_USER_REJECTED);
  689. if (g_GCCCoder->Encode((LPVOID) &connect_pdu,
  690. CONNECT_GCC_PDU,
  691. PACKED_ENCODING_RULES,
  692. &encoded_pdu,
  693. &encoded_pdu_length))
  694. {
  695. mcsif_error = g_pMCSIntf->ConnectProviderResponse(
  696. conference_info->connection_handle,
  697. NULL,
  698. NULL,
  699. RESULT_USER_REJECTED,
  700. encoded_pdu,
  701. encoded_pdu_length);
  702. rc = g_pMCSIntf->TranslateMCSIFErrorToGCCError(mcsif_error);
  703. g_GCCCoder->FreeEncoded(encoded_pdu);
  704. }
  705. else
  706. {
  707. rc = GCC_ALLOCATION_FAILURE;
  708. }
  709. }
  710. if (rc == GCC_NO_ERROR)
  711. {
  712. /*
  713. ** Remove the conference information structure from the rogue
  714. ** wave list.
  715. */
  716. delete conference_info;
  717. m_PendingCreateConfList2.Remove(conf_create_response_info->conference_id);
  718. }
  719. }
  720. else
  721. rc = GCC_INVALID_CONFERENCE;
  722. DebugExitINT(GCCController::ConfCreateResponse, rc);
  723. return rc;
  724. }
  725. /*
  726. * GCCController::ConfQueryRequest ()
  727. *
  728. * Private Function Description
  729. * This routine is called when the node controller makes a
  730. * conference query request. This routine is responsible for
  731. * creating the MCS domain used to send the request and is also
  732. * responsible for issuing the ConnectProvider request.
  733. *
  734. * Formal Parameters:
  735. * conf_query_request_info - (i) Information structure that holds
  736. * all the info necessary to issue
  737. * a conference query request.
  738. *
  739. * Return Value
  740. * GCC_NO_ERROR - No error occured.
  741. * GCC_ALLOCATION_FAILURE - A resource error occured.
  742. * GCC_INVALID_ADDRESS_PREFIX - Bad transport address passed in.
  743. * GCC_INVALID_TRANSPORT - Bad transport address passed in.
  744. * GCC_BAD_USER_DATA - Invalid user data passed in.
  745. * GCC_INVALID_TRANSPORT_ADDRESS - Bad transport address
  746. *
  747. * Side Effects
  748. * None
  749. *
  750. * Caveats
  751. * None
  752. */
  753. GCCError GCCController::
  754. ConfQueryRequest ( PConfQueryRequestInfo conf_query_request_info )
  755. {
  756. MCSError mcs_error;
  757. GCCError rc = GCC_NO_ERROR;
  758. ConnectGCCPDU connect_pdu;
  759. LPBYTE encoded_pdu;
  760. UINT encoded_pdu_length;
  761. GCCConfID query_id;
  762. DebugEntry(GCCController::ConfQueryRequest);
  763. // Get the query id used to create the query domain
  764. query_id = AllocateQueryID ();
  765. /*
  766. ** Create the MCS domain used by the query. Return an error if the
  767. ** domain already exists.
  768. */
  769. mcs_error = g_pMCSIntf->CreateDomain(&query_id);
  770. if (mcs_error != MCS_NO_ERROR)
  771. {
  772. if (mcs_error == MCS_DOMAIN_ALREADY_EXISTS)
  773. return (GCC_QUERY_REQUEST_OUTSTANDING);
  774. else
  775. return (GCC_ALLOCATION_FAILURE);
  776. }
  777. // Encode the Query Request PDU
  778. connect_pdu.choice = CONFERENCE_QUERY_REQUEST_CHOSEN;
  779. connect_pdu.u.conference_query_request.bit_mask = 0;
  780. // Translate the node type
  781. connect_pdu.u.conference_query_request.node_type =
  782. (NodeType)conf_query_request_info->node_type;
  783. // Set up asymetry indicator if it exists
  784. if (conf_query_request_info->asymmetry_indicator != NULL)
  785. {
  786. connect_pdu.u.conference_query_request.bit_mask |=
  787. CQRQ_ASYMMETRY_INDICATOR_PRESENT;
  788. connect_pdu.u.conference_query_request.cqrq_asymmetry_indicator.choice =
  789. (USHORT)conf_query_request_info->
  790. asymmetry_indicator->asymmetry_type;
  791. connect_pdu.u.conference_query_request.
  792. cqrq_asymmetry_indicator.u.unknown =
  793. conf_query_request_info->asymmetry_indicator->random_number;
  794. }
  795. // Set up the user data if it exists
  796. if (conf_query_request_info->user_data_list != NULL)
  797. {
  798. rc = conf_query_request_info->user_data_list->
  799. GetUserDataPDU (
  800. &connect_pdu.u.conference_query_request.
  801. cqrq_user_data);
  802. if (rc == GCC_NO_ERROR)
  803. {
  804. connect_pdu.u.conference_query_request.bit_mask |=
  805. CQRQ_USER_DATA_PRESENT;
  806. }
  807. }
  808. if (g_GCCCoder->Encode((LPVOID) &connect_pdu,
  809. CONNECT_GCC_PDU,
  810. PACKED_ENCODING_RULES,
  811. &encoded_pdu,
  812. &encoded_pdu_length))
  813. {
  814. // Here we create the logical connection used for the query.
  815. mcs_error = g_pMCSIntf->ConnectProviderRequest (
  816. &query_id, // calling domain selector
  817. &query_id, // called domain selector
  818. conf_query_request_info->calling_address,
  819. conf_query_request_info->called_address,
  820. conf_query_request_info->fSecure,
  821. TRUE, // Upward connection
  822. encoded_pdu,
  823. encoded_pdu_length,
  824. conf_query_request_info->connection_handle,
  825. NULL, // Domain Parameters
  826. NULL);
  827. g_GCCCoder->FreeEncoded(encoded_pdu);
  828. if (mcs_error == MCS_NO_ERROR)
  829. {
  830. /*
  831. ** Add the connection and domain name to the outstanding
  832. ** query request list.
  833. */
  834. m_PendingQueryConfList2.Append(*conf_query_request_info->connection_handle, query_id);
  835. rc = GCC_NO_ERROR;
  836. }
  837. else
  838. {
  839. g_pMCSIntf->DeleteDomain(&query_id);
  840. /*
  841. ** DataBeam's current implementation of MCS returns
  842. ** MCS_INVALID_PARAMETER when something other than
  843. ** the transport prefix is wrong with the specified
  844. ** transport address.
  845. */
  846. if (mcs_error == MCS_INVALID_PARAMETER)
  847. rc = GCC_INVALID_TRANSPORT_ADDRESS;
  848. else
  849. {
  850. rc = g_pMCSIntf->TranslateMCSIFErrorToGCCError(mcs_error);
  851. }
  852. }
  853. }
  854. else
  855. {
  856. rc = GCC_ALLOCATION_FAILURE;
  857. }
  858. DebugExitINT(GCCController::ConfQueryRequest, rc);
  859. return rc;
  860. }
  861. /*
  862. * GCCController::ConfQueryResponse ()
  863. *
  864. * Private Function Description
  865. * This routine is called when the node controller makes a
  866. * conference query response. This routine uses a conference
  867. * descriptor list object to build the PDU associated with the
  868. * query response.
  869. *
  870. * Formal Parameters:
  871. * conf_query_response_info - (i) Information structure that holds
  872. * all the info necessary to issue
  873. * a conference query response.
  874. *
  875. * Return Value
  876. * GCC_NO_ERROR - No error occured.
  877. * GCC_ALLOCATION_FAILURE - A resource error occured.
  878. * GCC_BAD_NETWORK_ADDRESS - Bad network address passed in.
  879. * GCC_BAD_NETWORK_ADDRESS_TYPE - Bad network address type passed in.
  880. * GCC_BAD_USER_DATA - Invalid user data passed in.
  881. *
  882. * Side Effects
  883. * None
  884. *
  885. * Caveats
  886. * None
  887. */
  888. GCCError GCCController::
  889. ConfQueryResponse ( PConfQueryResponseInfo conf_query_response_info )
  890. {
  891. GCCError rc = GCC_NO_ERROR;
  892. ConnectGCCPDU connect_pdu;
  893. LPBYTE encoded_pdu;
  894. UINT encoded_pdu_length;
  895. ConnectionHandle connection_handle;
  896. MCSError mcs_error;
  897. CConfDescriptorListContainer *conference_list = NULL;
  898. DebugEntry(GCCController::ConfQueryResponse);
  899. connection_handle = (ConnectionHandle)conf_query_response_info->
  900. query_response_tag;
  901. // Encode the Query Response PDU
  902. connect_pdu.choice = CONFERENCE_QUERY_RESPONSE_CHOSEN;
  903. connect_pdu.u.conference_query_response.bit_mask = 0;
  904. connect_pdu.u.conference_query_response.node_type =
  905. (NodeType)conf_query_response_info->node_type;
  906. // Set up asymmetry indicator if it exists
  907. if (conf_query_response_info->asymmetry_indicator != NULL)
  908. {
  909. connect_pdu.u.conference_query_response.bit_mask |=
  910. CQRS_ASYMMETRY_INDICATOR_PRESENT;
  911. connect_pdu.u.conference_query_response.
  912. cqrs_asymmetry_indicator.choice =
  913. conf_query_response_info->asymmetry_indicator->asymmetry_type;
  914. connect_pdu.u.conference_query_response.
  915. cqrs_asymmetry_indicator.u.unknown =
  916. conf_query_response_info->asymmetry_indicator->random_number;
  917. }
  918. // Set up the user data if it exists
  919. if (conf_query_response_info->user_data_list != NULL)
  920. {
  921. rc = conf_query_response_info->user_data_list->
  922. GetUserDataPDU (
  923. &connect_pdu.u.conference_query_response.
  924. cqrs_user_data);
  925. if (rc == GCC_NO_ERROR)
  926. {
  927. connect_pdu.u.conference_query_response.bit_mask |=
  928. CQRS_USER_DATA_PRESENT;
  929. }
  930. }
  931. // Translate the result
  932. connect_pdu.u.conference_query_response.result =
  933. ::TranslateGCCResultToQueryResult(
  934. conf_query_response_info->result);
  935. /*
  936. ** We only create a conference descriptor list if the returned result
  937. ** is success.
  938. */
  939. if (conf_query_response_info->result == GCC_RESULT_SUCCESSFUL)
  940. {
  941. // Create a new conference descriptor list and check it for validity.
  942. DBG_SAVE_FILE_LINE
  943. conference_list = new CConfDescriptorListContainer();
  944. if (conference_list != NULL)
  945. {
  946. PConference lpConf;
  947. // Here we build the set of conference descriptor list
  948. m_ConfList2.Reset();
  949. while (NULL != (lpConf = m_ConfList2.Iterate()))
  950. {
  951. // Only show established conferences
  952. if (lpConf->IsConfEstablished())
  953. {
  954. if (lpConf->IsConfListed())
  955. {
  956. conference_list->AddConferenceDescriptorToList (
  957. lpConf->GetNumericConfName(),
  958. lpConf->GetTextConfName(),
  959. lpConf->GetConfModifier(),
  960. lpConf->IsConfLocked(),
  961. lpConf->IsConfPasswordInTheClear(),
  962. lpConf->GetConfDescription(),
  963. lpConf->GetNetworkAddressList());
  964. }
  965. }
  966. }
  967. // Get the pointer to the set of conference descriptors
  968. conference_list->GetConferenceDescriptorListPDU (
  969. &(connect_pdu.u.conference_query_response.conference_list));
  970. }
  971. else
  972. {
  973. rc = GCC_ALLOCATION_FAILURE;
  974. }
  975. }
  976. else
  977. {
  978. // No conference list is sent in this case
  979. connect_pdu.u.conference_query_response.conference_list = NULL;
  980. }
  981. if (rc == GCC_NO_ERROR)
  982. {
  983. if (g_GCCCoder->Encode((LPVOID) &connect_pdu,
  984. CONNECT_GCC_PDU,
  985. PACKED_ENCODING_RULES,
  986. &encoded_pdu,
  987. &encoded_pdu_length))
  988. {
  989. mcs_error = g_pMCSIntf->ConnectProviderResponse(
  990. connection_handle,
  991. NULL,
  992. NULL,
  993. RESULT_USER_REJECTED,
  994. encoded_pdu,
  995. encoded_pdu_length);
  996. g_GCCCoder->FreeEncoded(encoded_pdu);
  997. if (mcs_error == MCS_NO_ERROR)
  998. rc = GCC_NO_ERROR;
  999. else if (mcs_error == MCS_NO_SUCH_CONNECTION)
  1000. rc = GCC_INVALID_QUERY_TAG;
  1001. else
  1002. {
  1003. rc = g_pMCSIntf->TranslateMCSIFErrorToGCCError(mcs_error);
  1004. }
  1005. }
  1006. else
  1007. {
  1008. rc = GCC_ALLOCATION_FAILURE;
  1009. }
  1010. }
  1011. // Free up the conference list allocated above to create the PDU.
  1012. if (NULL != conference_list)
  1013. {
  1014. conference_list->Release();
  1015. }
  1016. DebugExitINT(GCCController::ConfQueryResponse, rc);
  1017. return rc;
  1018. }
  1019. /*
  1020. * GCCController::ConfJoinRequest ()
  1021. *
  1022. * Private Function Description
  1023. * This routine is called when the node controller makes a request
  1024. * to join an existing conference. It is responsible for
  1025. * creating the conference object.
  1026. *
  1027. * Formal Parameters:
  1028. * conf_join_request_info - (i) Information structure that holds
  1029. * all the info necessary to issue
  1030. * a conference join request.
  1031. *
  1032. * Return Value
  1033. * GCC_NO_ERROR - No error occured.
  1034. * GCC_ALLOCATION_FAILURE - A resource error occured.
  1035. * GCC_INVALID_CONFERENCE_NAME - Invalid conference name passed in.
  1036. * GCC_FAILURE_CREATING_DOMAIN - Failure creating domain.
  1037. * GCC_BAD_NETWORK_ADDRESS - Bad network address passed in.
  1038. * GCC_BAD_NETWORK_ADDRESS_TYPE - Bad network address type passed in.
  1039. * GCC_CONFERENCE_ALREADY_EXISTS - Conference specified already exists.
  1040. * GCC_INVALID_ADDRESS_PREFIX - Bad transport address passed in.
  1041. * GCC_INVALID_TRANSPORT - Bad transport address passed in.
  1042. * GCC_INVALID_PASSWORD - Invalid password passed in.
  1043. * GCC_BAD_USER_DATA - Invalid user data passed in.
  1044. * GCC_FAILURE_ATTACHING_TO_MCS - Failure creating MCS user attachment
  1045. *
  1046. * Side Effects
  1047. * None
  1048. *
  1049. * Caveats
  1050. * In the Win32 world we pass in a shared memory manager to the
  1051. * conference object to use for the message memory manager. This is
  1052. * not necessary in the Win16 world since shared memory is not used.
  1053. */
  1054. GCCError GCCController::
  1055. ConfJoinRequest
  1056. (
  1057. PConfJoinRequestInfo conf_join_request_info,
  1058. GCCConfID *pnConfID
  1059. )
  1060. {
  1061. PConference new_conference;
  1062. GCCError rc;
  1063. GCCConfID conference_id;
  1064. DebugEntry(GCCController::ConfJoinRequest);
  1065. /*
  1066. ** We must first check all the existing conferences to make sure that this
  1067. ** conference name is not already in use. Note that this returns immediatly
  1068. ** if a conference by the same name alreay exists. Conference names
  1069. ** must be unique at a node.
  1070. */
  1071. conference_id = GetConferenceIDFromName(
  1072. conf_join_request_info->conference_name,
  1073. conf_join_request_info->calling_node_modifier);
  1074. if (conference_id != 0)
  1075. {
  1076. WARNING_OUT(("GCCController:ConfJoinRequest: Conference exists."));
  1077. return (GCC_CONFERENCE_ALREADY_EXISTS);
  1078. }
  1079. /*
  1080. ** Here we are allocating a conference ID. In most cases this ID
  1081. ** will be the same as the conference name. Only if a conference
  1082. ** name is passed in that already exists will the name and ID
  1083. ** be different. In this case, a modifier will be appended to the
  1084. ** conference name to create the conference ID.
  1085. */
  1086. conference_id = AllocateConferenceID ();
  1087. DBG_SAVE_FILE_LINE
  1088. new_conference = new CConf(conf_join_request_info->conference_name,
  1089. conf_join_request_info->calling_node_modifier,
  1090. conference_id,
  1091. NULL,
  1092. conf_join_request_info->number_of_network_addresses,
  1093. conf_join_request_info->local_network_address_list,
  1094. &rc);
  1095. if ((new_conference != NULL) && (rc == GCC_NO_ERROR))
  1096. {
  1097. rc = new_conference->ConfJoinRequest(
  1098. conf_join_request_info->called_node_modifier,
  1099. conf_join_request_info->convener_password,
  1100. conf_join_request_info->password_challenge,
  1101. conf_join_request_info->pwszCallerID,
  1102. conf_join_request_info->calling_address,
  1103. conf_join_request_info->called_address,
  1104. conf_join_request_info->fSecure,
  1105. conf_join_request_info->domain_parameters,
  1106. conf_join_request_info->user_data_list,
  1107. conf_join_request_info->connection_handle);
  1108. if (rc == GCC_NO_ERROR)
  1109. {
  1110. m_fConfListChangePending = TRUE;
  1111. if (NULL != pnConfID)
  1112. {
  1113. *pnConfID = conference_id;
  1114. }
  1115. m_ConfList2.Append(conference_id, new_conference);
  1116. PostMsgToRebuildConfPollList();
  1117. }
  1118. else
  1119. {
  1120. new_conference->Release();
  1121. }
  1122. }
  1123. else
  1124. {
  1125. if (new_conference != NULL)
  1126. {
  1127. new_conference->Release();
  1128. }
  1129. else
  1130. {
  1131. rc = GCC_ALLOCATION_FAILURE;
  1132. }
  1133. }
  1134. DebugExitINT(GCCController::ConfJoinRequest, rc);
  1135. return rc;
  1136. }
  1137. /*
  1138. * GCCController::ConfJoinIndResponse ()
  1139. *
  1140. * Private Function Description
  1141. * This routine is called when the node controller responds
  1142. * to a join indication. If the result is success, we check to make sure
  1143. * that the conference exist before proceeding. If it is not success, we
  1144. * send back the rejected request.
  1145. *
  1146. * Formal Parameters:
  1147. * conf_join_response_info - (i) Information structure that holds
  1148. * all the info necessary to issue
  1149. * a conference join response.
  1150. *
  1151. * Return Value
  1152. * GCC_NO_ERROR - No error occured.
  1153. * GCC_ALLOCATION_FAILURE - A resource error occured.
  1154. * GCC_INVALID_JOIN_RESPONSE_TAG - No match found for join response tag
  1155. * GCC_INVALID_CONFERENCE_NAME - Invalid conference name passed in.
  1156. * GCC_FAILURE_CREATING_DOMAIN - Failure creating domain.
  1157. * GCC_CONFERENCE_ALREADY_EXISTS - Conference specified already exists.
  1158. * GCC_INVALID_PASSWORD - Invalid password passed in.
  1159. * GCC_BAD_USER_DATA - Invalid user data passed in.
  1160. * GCC_INVALID_CONFERENCE - Invalid conference ID passed in.
  1161. *
  1162. * Side Effects
  1163. * None
  1164. *
  1165. * Caveats
  1166. * If this node is not the Top Provider and the result is success, we
  1167. * go ahead and forward the request on up to the top provider.
  1168. */
  1169. GCCError GCCController::
  1170. ConfJoinIndResponse ( PConfJoinResponseInfo conf_join_response_info )
  1171. {
  1172. PConference joined_conference;
  1173. PENDING_JOIN_CONF *join_info_ptr;
  1174. BOOL convener_is_joining;
  1175. GCCError rc = GCC_NO_ERROR;
  1176. GCCResult gcc_result = GCC_RESULT_SUCCESSFUL;
  1177. BOOL fForwardJoinReq = FALSE;
  1178. DebugEntry(GCCController::ConfJoinIndResponse);
  1179. if (NULL != (join_info_ptr = m_PendingJoinConfList2.Find(conf_join_response_info->connection_handle)))
  1180. {
  1181. /*
  1182. ** If the result is success, we must first check all the existing
  1183. ** conferences to make sure that this conference exist.
  1184. */
  1185. if (conf_join_response_info->result == GCC_RESULT_SUCCESSFUL)
  1186. {
  1187. if (NULL != (joined_conference = m_ConfList2.Find(conf_join_response_info->conference_id)))
  1188. {
  1189. /*
  1190. ** If the node for this conference is not the top provider we
  1191. ** must forward the join request on up to the Top Provider.
  1192. */
  1193. if (! joined_conference->IsConfTopProvider())
  1194. {
  1195. rc = joined_conference->ForwardConfJoinRequest(
  1196. join_info_ptr->convener_password,
  1197. join_info_ptr->password_challenge,
  1198. join_info_ptr->pwszCallerID,
  1199. conf_join_response_info->user_data_list,
  1200. join_info_ptr->numeric_name_present,
  1201. conf_join_response_info->connection_handle);
  1202. if (GCC_NO_ERROR == rc)
  1203. {
  1204. fForwardJoinReq = TRUE;
  1205. }
  1206. }
  1207. else
  1208. {
  1209. /*
  1210. ** If a convener password exists we must inform the conference
  1211. ** object that this is a convener that is trying to rejoin
  1212. ** the conference.
  1213. */
  1214. if (join_info_ptr->convener_password != NULL)
  1215. convener_is_joining = TRUE;
  1216. else
  1217. convener_is_joining = FALSE;
  1218. rc = joined_conference->ConfJoinIndResponse(
  1219. conf_join_response_info->connection_handle,
  1220. conf_join_response_info->password_challenge,
  1221. conf_join_response_info->user_data_list,
  1222. join_info_ptr->numeric_name_present,
  1223. convener_is_joining,
  1224. conf_join_response_info->result);
  1225. }
  1226. if (GCC_NO_ERROR != rc)
  1227. {
  1228. gcc_result = GCC_RESULT_UNSPECIFIED_FAILURE;
  1229. }
  1230. }
  1231. else
  1232. {
  1233. rc = GCC_INVALID_CONFERENCE;
  1234. gcc_result = GCC_RESULT_INVALID_CONFERENCE;
  1235. }
  1236. }
  1237. else
  1238. {
  1239. gcc_result = conf_join_response_info->result;
  1240. }
  1241. }
  1242. else
  1243. {
  1244. rc = GCC_INVALID_JOIN_RESPONSE_TAG;
  1245. gcc_result = GCC_RESULT_INVALID_CONFERENCE;
  1246. }
  1247. if (GCC_RESULT_SUCCESSFUL != gcc_result)
  1248. {
  1249. conf_join_response_info->result = gcc_result;
  1250. FailConfJoinIndResponse(conf_join_response_info);
  1251. }
  1252. /*
  1253. ** Cleanup the join info list if the join was succesful or if the
  1254. ** Domain Parameters were unacceptable. The connection is automatically
  1255. ** rejected by MCS if the domain parameters are found to be unacceptable.
  1256. */
  1257. // if ((rc == GCC_NO_ERROR) ||
  1258. // (rc == GCC_DOMAIN_PARAMETERS_UNACCEPTABLE))
  1259. if (NULL != join_info_ptr && (! fForwardJoinReq))
  1260. {
  1261. RemoveConfJoinInfo(conf_join_response_info->connection_handle);
  1262. }
  1263. DebugExitINT(GCCController::ConfJoinIndResponse, rc);
  1264. return rc;
  1265. }
  1266. GCCError GCCController::
  1267. FailConfJoinIndResponse
  1268. (
  1269. GCCConfID nConfID,
  1270. ConnectionHandle hConn
  1271. )
  1272. {
  1273. ConfJoinResponseInfo cjri;
  1274. cjri.result = GCC_RESULT_RESOURCES_UNAVAILABLE;
  1275. cjri.conference_id = nConfID;
  1276. cjri.password_challenge = NULL;
  1277. cjri.user_data_list = NULL;
  1278. cjri.connection_handle = hConn;
  1279. return FailConfJoinIndResponse(&cjri);
  1280. }
  1281. GCCError GCCController::
  1282. FailConfJoinIndResponse ( PConfJoinResponseInfo conf_join_response_info )
  1283. {
  1284. GCCError rc = GCC_NO_ERROR;
  1285. ConnectGCCPDU connect_pdu;
  1286. LPBYTE encoded_pdu;
  1287. UINT encoded_pdu_length;
  1288. // Send back the failed response with the specified result
  1289. DebugEntry(GCCController::FailConfJoinIndResponse);
  1290. // Encode the Join Response PDU
  1291. connect_pdu.choice = CONNECT_JOIN_RESPONSE_CHOSEN;
  1292. connect_pdu.u.connect_join_response.bit_mask = 0;
  1293. // Get the password challenge if one exists
  1294. if (conf_join_response_info->password_challenge != NULL)
  1295. {
  1296. connect_pdu.u.connect_join_response.bit_mask |= CJRS_PASSWORD_PRESENT;
  1297. rc = conf_join_response_info->password_challenge->GetPasswordChallengeResponsePDU(
  1298. &connect_pdu.u.connect_join_response.cjrs_password);
  1299. }
  1300. // Get the user data
  1301. if ((conf_join_response_info->user_data_list != NULL) && (rc == GCC_NO_ERROR))
  1302. {
  1303. connect_pdu.u.connect_join_response.bit_mask |= CJRS_USER_DATA_PRESENT;
  1304. rc = conf_join_response_info->user_data_list->GetUserDataPDU(
  1305. &connect_pdu.u.connect_join_response.cjrs_user_data);
  1306. }
  1307. if (rc == GCC_NO_ERROR)
  1308. {
  1309. connect_pdu.u.connect_join_response.top_node_id = 1001;
  1310. connect_pdu.u.connect_join_response.tag = 0;
  1311. connect_pdu.u.connect_join_response.conference_is_locked = 0;
  1312. connect_pdu.u.connect_join_response.conference_is_listed = 0;
  1313. connect_pdu.u.connect_join_response.conference_is_conductible = 0;
  1314. connect_pdu.u.connect_join_response.termination_method = AUTOMATIC;
  1315. connect_pdu.u.connect_join_response.clear_password_required = FALSE;
  1316. connect_pdu.u.connect_join_response.result =
  1317. ::TranslateGCCResultToJoinResult(conf_join_response_info->result);
  1318. if (g_GCCCoder->Encode((LPVOID) &connect_pdu,
  1319. CONNECT_GCC_PDU,
  1320. PACKED_ENCODING_RULES,
  1321. &encoded_pdu,
  1322. &encoded_pdu_length))
  1323. {
  1324. g_pMCSIntf->ConnectProviderResponse(
  1325. conf_join_response_info->connection_handle,
  1326. NULL,
  1327. NULL,
  1328. RESULT_USER_REJECTED,
  1329. encoded_pdu,
  1330. encoded_pdu_length);
  1331. g_GCCCoder->FreeEncoded(encoded_pdu);
  1332. }
  1333. else
  1334. {
  1335. ERROR_OUT(("GCCController:FailConfJoinIndResponse: can't encode"));
  1336. rc = GCC_ALLOCATION_FAILURE;
  1337. }
  1338. }
  1339. DebugExitINT(GCCController::FailConfJoinIndResponse, rc);
  1340. return rc;
  1341. }
  1342. /*
  1343. * GCCController::ConfInviteResponse ()
  1344. *
  1345. * Private Function Description
  1346. * This routine is called when the node controller responds to
  1347. * a conference invite indication. It is responsible for
  1348. * creating the conference object.
  1349. *
  1350. * Formal Parameters:
  1351. * conf_invite_response_info - (i) Information structure that holds
  1352. * all the info necessary to issue
  1353. * a conference invite response.
  1354. *
  1355. * Return Value
  1356. * GCC_NO_ERROR - No error occured.
  1357. * GCC_ALLOCATION_FAILURE - A resource error occured.
  1358. * GCC_INVALID_CONFERENCE_NAME - Invalid conference name passed in.
  1359. * GCC_FAILURE_CREATING_DOMAIN - Failure creating domain.
  1360. * GCC_CONFERENCE_ALREADY_EXISTS - Conference specified already exists.
  1361. * GCC_BAD_USER_DATA - Invalid user data passed in.
  1362. * GCC_INVALID_CONFERENCE - Invalid conference ID passed in.
  1363. * GCC_FAILURE_ATTACHING_TO_MCS - Failure creating MCS user attachment
  1364. *
  1365. * Side Effects
  1366. * None
  1367. *
  1368. * Caveats
  1369. * In the Win32 world we pass in a shared memory manager to the
  1370. * conference object to use for the message memory manager. This is
  1371. * not necessary in the Win16 world since shared memory is not used.
  1372. */
  1373. GCCError GCCController::
  1374. ConfInviteResponse ( PConfInviteResponseInfo conf_invite_response_info )
  1375. {
  1376. GCCError rc = GCC_NO_ERROR;
  1377. PENDING_CREATE_CONF *conference_info;
  1378. PConference new_conference;
  1379. GCCConferenceName conference_name;
  1380. LPWSTR pwszConfDescription = NULL;
  1381. PGCCConferencePrivileges conduct_privilege_list_ptr = NULL;
  1382. PGCCConferencePrivileges conduct_mode_privilege_list_ptr = NULL;
  1383. PGCCConferencePrivileges non_conduct_privilege_list_ptr = NULL;
  1384. GCCConfID conference_id;
  1385. ConnectGCCPDU connect_pdu;
  1386. LPBYTE encoded_pdu;
  1387. UINT encoded_pdu_length;
  1388. MCSError mcsif_error;
  1389. CONF_SPEC_PARAMS csp;
  1390. GCCResult gcc_result = GCC_RESULT_SUCCESSFUL;
  1391. DebugEntry(GCCController::ConfInviteResponse);
  1392. if (NULL != (conference_info = m_PendingCreateConfList2.Find(conf_invite_response_info->conference_id)))
  1393. {
  1394. // Is the conference create handle in the rogue wave list
  1395. if (conf_invite_response_info->result == GCC_RESULT_SUCCESSFUL)
  1396. {
  1397. /*
  1398. ** We must first check all the existing conferences to make sure
  1399. ** that this conference name is not already in use. Note that this
  1400. ** returns immediatly if a conference by the same name alreay
  1401. ** exists. Conference names must be unique at a node.
  1402. */
  1403. // Set up the conference name
  1404. conference_name.numeric_string = (GCCNumericString) conference_info->pszConfNumericName;
  1405. conference_name.text_string = conference_info->pwszConfTextName;
  1406. conference_id = GetConferenceIDFromName(
  1407. &conference_name,
  1408. conf_invite_response_info->conference_modifier);
  1409. if (conference_id == 0)
  1410. {
  1411. // Set up the privilege list pointers for the list that exists
  1412. if (conference_info->conduct_privilege_list != NULL)
  1413. {
  1414. conference_info->conduct_privilege_list->
  1415. GetPrivilegeListData(&conduct_privilege_list_ptr);
  1416. }
  1417. if (conference_info->conduct_mode_privilege_list != NULL)
  1418. {
  1419. conference_info->conduct_mode_privilege_list->
  1420. GetPrivilegeListData(&conduct_mode_privilege_list_ptr);
  1421. }
  1422. if (conference_info->non_conduct_privilege_list != NULL)
  1423. {
  1424. conference_info->non_conduct_privilege_list->
  1425. GetPrivilegeListData(&non_conduct_privilege_list_ptr);
  1426. }
  1427. // Set up the conference description pointer if one exists
  1428. pwszConfDescription = conference_info->pwszConfDescription;
  1429. // Now set up the real conference ID
  1430. conference_id = conf_invite_response_info->conference_id;
  1431. // set up conference specification parameters
  1432. csp.fClearPassword = conference_info->password_in_the_clear,
  1433. csp.fConfLocked = conference_info->conference_is_locked,
  1434. csp.fConfListed = conference_info->conference_is_listed,
  1435. csp.fConfConductable = conference_info->conference_is_conductible,
  1436. csp.eTerminationMethod = conference_info->termination_method,
  1437. csp.pConductPrivilege = conduct_privilege_list_ptr,
  1438. csp.pConductModePrivilege = conduct_mode_privilege_list_ptr,
  1439. csp.pNonConductPrivilege = non_conduct_privilege_list_ptr,
  1440. csp.pwszConfDescriptor = pwszConfDescription,
  1441. DBG_SAVE_FILE_LINE
  1442. new_conference = new CConf(&conference_name,
  1443. conf_invite_response_info->conference_modifier,
  1444. conference_id,
  1445. &csp,
  1446. conf_invite_response_info->number_of_network_addresses,
  1447. conf_invite_response_info->local_network_address_list,
  1448. &rc);
  1449. if ((new_conference != NULL) &&
  1450. (rc == GCC_NO_ERROR))
  1451. {
  1452. rc = new_conference->ConfInviteResponse(
  1453. conference_info->parent_node_id,
  1454. conference_info->top_node_id,
  1455. conference_info->tag_number,
  1456. conference_info->connection_handle,
  1457. conf_invite_response_info->fSecure,
  1458. conf_invite_response_info->domain_parameters,
  1459. conf_invite_response_info->user_data_list);
  1460. if (rc == GCC_NO_ERROR)
  1461. {
  1462. // Add the new conference to the Conference List
  1463. m_fConfListChangePending = TRUE;
  1464. m_ConfList2.Append(conference_id, new_conference);
  1465. PostMsgToRebuildConfPollList();
  1466. }
  1467. else
  1468. {
  1469. new_conference->Release();
  1470. gcc_result = GCC_RESULT_UNSPECIFIED_FAILURE;
  1471. }
  1472. }
  1473. else
  1474. {
  1475. if (new_conference != NULL)
  1476. {
  1477. new_conference->Release();
  1478. }
  1479. else
  1480. {
  1481. rc = GCC_ALLOCATION_FAILURE;
  1482. }
  1483. gcc_result = GCC_RESULT_RESOURCES_UNAVAILABLE;
  1484. }
  1485. }
  1486. else
  1487. {
  1488. WARNING_OUT(("GCCController::ConfInviteResponse: Conference exists."));
  1489. rc = GCC_CONFERENCE_ALREADY_EXISTS;
  1490. gcc_result = GCC_RESULT_ENTRY_ALREADY_EXISTS;
  1491. }
  1492. }
  1493. else
  1494. {
  1495. WARNING_OUT(("GCCController: ConfInviteResponse: User Rejected"));
  1496. gcc_result = conf_invite_response_info->result;
  1497. }
  1498. // Let's send a user reject response if any error or reject
  1499. if (GCC_RESULT_SUCCESSFUL != gcc_result)
  1500. {
  1501. GCCError rc2;
  1502. // Encode the Invite Response PDU
  1503. connect_pdu.choice = CONFERENCE_INVITE_RESPONSE_CHOSEN;
  1504. connect_pdu.u.conference_invite_response.bit_mask = 0;
  1505. if (conf_invite_response_info->user_data_list != NULL)
  1506. {
  1507. rc2 = conf_invite_response_info->
  1508. user_data_list->GetUserDataPDU(
  1509. &connect_pdu.u.
  1510. conference_invite_response.cirs_user_data);
  1511. if (rc2 == GCC_NO_ERROR)
  1512. {
  1513. connect_pdu.u.conference_invite_response.bit_mask |=
  1514. CIRS_USER_DATA_PRESENT;
  1515. }
  1516. else
  1517. {
  1518. ERROR_OUT(("GCCController::ConfInviteResponse: GetUserDataPDU failed"));
  1519. }
  1520. }
  1521. // connect_pdu.u.conference_invite_response.result = ::TranslateGCCResultToInviteResult(gcc_result);
  1522. connect_pdu.u.conference_invite_response.result = CIRS_USER_REJECTED;
  1523. if (g_GCCCoder->Encode((LPVOID) &connect_pdu,
  1524. CONNECT_GCC_PDU,
  1525. PACKED_ENCODING_RULES,
  1526. &encoded_pdu,
  1527. &encoded_pdu_length))
  1528. {
  1529. mcsif_error = g_pMCSIntf->ConnectProviderResponse(
  1530. conference_info->connection_handle,
  1531. NULL,
  1532. NULL,
  1533. RESULT_USER_REJECTED,
  1534. encoded_pdu,
  1535. encoded_pdu_length);
  1536. rc2 = g_pMCSIntf->TranslateMCSIFErrorToGCCError(mcsif_error);
  1537. g_GCCCoder->FreeEncoded(encoded_pdu);
  1538. }
  1539. else
  1540. {
  1541. // nothing we can do right now.
  1542. ERROR_OUT(("GCCController::ConfInviteResponse: encode failed"));
  1543. rc2 = GCC_ALLOCATION_FAILURE;
  1544. }
  1545. // Update the error code. If rc is no error, which means the result
  1546. // was passed in by the caller, then we should use the rc2 for
  1547. // the return value.
  1548. if (GCC_NO_ERROR == rc)
  1549. {
  1550. rc = rc2;
  1551. }
  1552. }
  1553. /*
  1554. ** Remove the conference information structure from the rogue
  1555. ** wave list. Also cleanup all the containers needed to store
  1556. ** the conference information.
  1557. */
  1558. delete conference_info;
  1559. m_PendingCreateConfList2.Remove(conf_invite_response_info->conference_id);
  1560. }
  1561. else
  1562. {
  1563. rc = GCC_INVALID_CONFERENCE;
  1564. }
  1565. DebugExitINT(GCCController::ConfInviteResponse, rc);
  1566. return rc;
  1567. }
  1568. // Calls received through the owner callback from a conference.
  1569. /*
  1570. * GCCController::ProcessConfEstablished ()
  1571. *
  1572. * Private Function Description
  1573. * This owner callback is called when the conference has stabalized
  1574. * after creation. This routine takes care of registering all the
  1575. * available application saps with the conference which then kicks off the
  1576. * sending of permission to enrolls to all the applications that have
  1577. * registered a service access point.
  1578. *
  1579. * Formal Parameters:
  1580. * conference_id - (i) The conference ID of the conference
  1581. * object that is now established.
  1582. *
  1583. * Return Value
  1584. * GCC_NO_ERROR - No error occured.
  1585. *
  1586. * Side Effects
  1587. * None
  1588. *
  1589. * Caveats
  1590. * None
  1591. */
  1592. GCCError GCCController::
  1593. ProcessConfEstablished ( GCCConfID nConfID )
  1594. {
  1595. CConf *pConf;
  1596. DebugEntry(GCCController:ProcessConfEstablished);
  1597. /*
  1598. ** Here we make a copy of the SAP list to use in case some kind of
  1599. ** resource error occurs when calling RegisterAppSap that
  1600. ** would cause a SAP to be deleted from the list.
  1601. */
  1602. CAppSapList AppSapList(m_AppSapList);
  1603. /*
  1604. ** Here we register all the available SAPs with the newly available
  1605. ** conference and then we send a permit to enroll indication on to all the
  1606. ** application SAPs.
  1607. */
  1608. if (NULL != (pConf = m_ConfList2.Find(nConfID)))
  1609. {
  1610. CAppSap *pAppSap;
  1611. AppSapList.Reset();
  1612. while (NULL != (pAppSap = AppSapList.Iterate()))
  1613. {
  1614. // Register the Application SAP with the conference
  1615. pConf->RegisterAppSap(pAppSap);
  1616. }
  1617. }
  1618. #if 0 // use it when merging CApplet and CAppSap
  1619. // notify permit-to-enroll callbacks
  1620. CApplet *pApplet;
  1621. m_AppletList.Reset();
  1622. while (NULL != (pApplet = m_AppletList.Iterate()))
  1623. {
  1624. ASSERT(0 != nConfID);
  1625. T120AppletMsg Msg;
  1626. Msg.eMsgType = GCC_PERMIT_TO_ENROLL_INDICATION;
  1627. Msg.PermitToEnrollInd.nConfID = nConfID;
  1628. Msg.PermitToEnrollInd.fPermissionGranted = TRUE;
  1629. pApplet->SendCallbackMessage(&Msg);
  1630. }
  1631. #endif // 0
  1632. DebugExitINT(GCCController:ProcessConfEstablished, GCC_NO_ERROR);
  1633. return (GCC_NO_ERROR);
  1634. }
  1635. void GCCController::RegisterApplet
  1636. (
  1637. CApplet *pApplet
  1638. )
  1639. {
  1640. pApplet->AddRef();
  1641. m_AppletList.Append(pApplet);
  1642. #if 0 // use it when merging CApplet and CAppSap
  1643. // notify of existing conferences
  1644. CConf *pConf;
  1645. GCCConfID nConfID;
  1646. m_ConfList2.Reset();
  1647. while (NULL != (pConf = m_ConfList2.Iterate(&nConfID)))
  1648. {
  1649. ASSERT(0 != nConfID);
  1650. T120AppletMsg Msg;
  1651. Msg.eMsgType = GCC_PERMIT_TO_ENROLL_INDICATION;
  1652. Msg.PermitToEnrollInd.nConfID = nConfID;
  1653. Msg.PermitToEnrollInd.fPermissionGranted = TRUE;
  1654. pApplet->SendCallbackMessage(&Msg);
  1655. }
  1656. #endif // 0
  1657. }
  1658. void GCCController::UnregisterApplet
  1659. (
  1660. CApplet *pApplet
  1661. )
  1662. {
  1663. m_AppletList.Remove(pApplet);
  1664. pApplet->Release();
  1665. }
  1666. /*
  1667. * GCCController::ProcessConfTerminated ()
  1668. *
  1669. * Private Function Description
  1670. * This owner callback is called when the conference has terminated
  1671. * itself. Termination can occur due because of an error or it can
  1672. * terminate for normal reasons.
  1673. *
  1674. * Formal Parameters:
  1675. * conference_id - (i) The conference ID of the conference
  1676. * object that wants to terminate.
  1677. * gcc_reason - (i) Reason the conference was terminated.
  1678. *
  1679. * Return Value
  1680. * GCC_NO_ERROR - No error occured.
  1681. *
  1682. * Side Effects
  1683. * None
  1684. *
  1685. * Caveats
  1686. * None
  1687. */
  1688. GCCError GCCController::
  1689. ProcessConfTerminated
  1690. (
  1691. GCCConfID conference_id,
  1692. GCCReason gcc_reason
  1693. )
  1694. {
  1695. CConf *pConf;
  1696. PENDING_JOIN_CONF *pJoinInfo;
  1697. ConnectionHandle hConn;
  1698. BOOL fMoreToFlush;
  1699. DebugEntry(GCCController::ProcessConfTerminated);
  1700. if (NULL != (pConf = m_ConfList2.Find(conference_id)))
  1701. {
  1702. /*
  1703. ** The conference object will be deleted the next time a
  1704. ** heartbeat occurs.
  1705. */
  1706. m_fConfListChangePending = TRUE;
  1707. m_ConfDeleteList.Append(pConf);
  1708. m_ConfList2.Remove(conference_id);
  1709. PostMsgToRebuildConfPollList();
  1710. // flush any pending join requests from remote
  1711. do
  1712. {
  1713. fMoreToFlush = FALSE;
  1714. m_PendingJoinConfList2.Reset();
  1715. while (NULL != (pJoinInfo = m_PendingJoinConfList2.Iterate(&hConn)))
  1716. {
  1717. if (pJoinInfo->nConfID == conference_id)
  1718. {
  1719. FailConfJoinIndResponse(pJoinInfo->nConfID, hConn);
  1720. m_PendingJoinConfList2.Remove(hConn);
  1721. delete pJoinInfo;
  1722. fMoreToFlush = TRUE;
  1723. break;
  1724. }
  1725. }
  1726. }
  1727. while (fMoreToFlush);
  1728. #ifdef TSTATUS_INDICATION
  1729. /*
  1730. ** Here we inform the node controller of any resource errors that
  1731. ** occured by sending a status message.
  1732. */
  1733. if ((gcc_reason == GCC_REASON_ERROR_LOW_RESOURCES) ||
  1734. (gcc_reason == GCC_REASON_MCS_RESOURCE_FAILURE))
  1735. {
  1736. g_pControlSap->StatusIndication(
  1737. GCC_STATUS_CONF_RESOURCE_ERROR,
  1738. (UINT)conference_id);
  1739. }
  1740. #endif // TSTATUS_INDICATION
  1741. }
  1742. DebugExitINT(GCCController::ProcessConfTerminated, GCC_NO_ERROR);
  1743. return (GCC_NO_ERROR);
  1744. }
  1745. // Calls received from the MCS interface
  1746. void GCCController::RemoveConfJoinInfo(ConnectionHandle hConn)
  1747. {
  1748. PENDING_JOIN_CONF *pJoinInfo = m_PendingJoinConfList2.Remove(hConn);
  1749. delete pJoinInfo;
  1750. }
  1751. /*
  1752. * GCCController::ProcessConnectProviderIndication ()
  1753. *
  1754. * Private Function Description
  1755. * This routine is called when the controller receives a Connect
  1756. * Provider Indication. All connect provider indications are
  1757. * initially directed to the controller. They may then be routed
  1758. * to the Control SAP (for a create, query, join or an invite).
  1759. *
  1760. * Formal Parameters:
  1761. * connect_provider_indication - (i) This is the connect provider
  1762. * indication structure received
  1763. * from MCS.
  1764. *
  1765. * Return Value
  1766. * MCS_NO_ERROR - No error occured.
  1767. *
  1768. * Side Effects
  1769. * None
  1770. *
  1771. * Caveats
  1772. * Note that MCS_NO_ERROR is always returned from this routine.
  1773. * This ensures that the MCS will not resend this message.
  1774. */
  1775. GCCError GCCController::
  1776. ProcessConnectProviderIndication
  1777. (
  1778. PConnectProviderIndication connect_provider_indication
  1779. )
  1780. {
  1781. GCCError error_value = GCC_NO_ERROR;
  1782. PPacket packet;
  1783. PConnectGCCPDU connect_pdu;
  1784. PacketError packet_error;
  1785. Result mcs_result = RESULT_UNSPECIFIED_FAILURE;
  1786. DebugEntry(GCCController::ProcessConnectProviderIndication);
  1787. // Decode the PDU type and switch appropriatly
  1788. DBG_SAVE_FILE_LINE
  1789. packet = new Packet((PPacketCoder) g_GCCCoder,
  1790. PACKED_ENCODING_RULES,
  1791. connect_provider_indication->user_data,
  1792. connect_provider_indication->user_data_length,
  1793. CONNECT_GCC_PDU,
  1794. TRUE,
  1795. &packet_error);
  1796. if ((packet != NULL) && (packet_error == PACKET_NO_ERROR))
  1797. {
  1798. // Only connect PDUs should be processed here
  1799. connect_pdu = (PConnectGCCPDU)packet->GetDecodedData();
  1800. /*
  1801. ** Here we determine what type of GCC connect packet this is and
  1802. ** the request is passed on to the appropriate routine to process
  1803. ** the request.
  1804. */
  1805. switch (connect_pdu->choice)
  1806. {
  1807. case CONFERENCE_CREATE_REQUEST_CHOSEN:
  1808. error_value = ProcessConferenceCreateRequest(
  1809. &(connect_pdu->u.conference_create_request),
  1810. connect_provider_indication);
  1811. break;
  1812. case CONFERENCE_QUERY_REQUEST_CHOSEN:
  1813. error_value = ProcessConferenceQueryRequest(
  1814. &(connect_pdu->u.conference_query_request),
  1815. connect_provider_indication);
  1816. break;
  1817. case CONNECT_JOIN_REQUEST_CHOSEN:
  1818. error_value = ProcessConferenceJoinRequest(
  1819. &(connect_pdu->u.connect_join_request),
  1820. connect_provider_indication);
  1821. break;
  1822. case CONFERENCE_INVITE_REQUEST_CHOSEN:
  1823. error_value = ProcessConferenceInviteRequest(
  1824. &(connect_pdu->u.conference_invite_request),
  1825. connect_provider_indication);
  1826. break;
  1827. default:
  1828. WARNING_OUT(("GCCController::ProcessConnectProviderIndication: connect pdu not supported"));
  1829. error_value = GCC_COMMAND_NOT_SUPPORTED;
  1830. break;
  1831. }
  1832. packet->Unlock();
  1833. }
  1834. else
  1835. {
  1836. if (packet != NULL)
  1837. {
  1838. /*
  1839. ** Here we send a status indication to inform the node controller
  1840. ** that someone attempted to call us with an incompatible protocol.
  1841. */
  1842. if (packet_error == PACKET_INCOMPATIBLE_PROTOCOL)
  1843. {
  1844. #ifdef TSTATUS_INDICATION
  1845. g_pControlSap->StatusIndication(GCC_STATUS_INCOMPATIBLE_PROTOCOL, 0);
  1846. #endif // TSTATUS_INDICATION
  1847. mcs_result = RESULT_PARAMETERS_UNACCEPTABLE;
  1848. }
  1849. packet->Unlock();
  1850. }
  1851. error_value = GCC_ALLOCATION_FAILURE;
  1852. }
  1853. /*
  1854. ** Here, if an error occured, we send back the connect provider response
  1855. ** showing that a failure occured. We use the
  1856. ** RESULT_PARAMETERS_UNACCEPTABLE to indicate that an
  1857. ** incompatible protocol occured. Otherwise, we return a result of
  1858. ** RESULT_UNSPECIFIED_FAILURE.
  1859. */
  1860. if (error_value != GCC_NO_ERROR)
  1861. {
  1862. WARNING_OUT(("GCCController:ProcessConnectProviderIndication: "
  1863. "Error occured processing connect provider: error = %d", error_value));
  1864. g_pMCSIntf->ConnectProviderResponse(
  1865. connect_provider_indication->connection_handle,
  1866. NULL,
  1867. &(connect_provider_indication->domain_parameters),
  1868. mcs_result,
  1869. NULL, 0);
  1870. }
  1871. DebugExitINT(GCCController::ProcessConnectProviderIndication, error_value);
  1872. return error_value;
  1873. }
  1874. /*
  1875. * GCCController::ProcessConferenceCreateRequest ()
  1876. *
  1877. * Private Function Description
  1878. * This routine processes a GCC conference create request "connect"
  1879. * PDU structure. Note that the PDU has already been decoded by
  1880. * the time it reaches this routine.
  1881. *
  1882. * Formal Parameters:
  1883. * create_request - (i) This is a pointer to a structure
  1884. * that holds a GCC conference create
  1885. * request connect PDU.
  1886. * connect_provider_indication - (i) This is the connect provider
  1887. * indication structure received
  1888. * from MCS.
  1889. *
  1890. * Return Value
  1891. * GCC_NO_ERROR - No error occured.
  1892. * GCC_ALLOCATION_FAILURE - A resource error occured.
  1893. * GCC_INVALID_PASSWORD - Invalid password in the PDU.
  1894. * GCC_BAD_USER_DATA - Invalid user data in the PDU.
  1895. *
  1896. * Side Effects
  1897. * None
  1898. *
  1899. * Caveats
  1900. * None
  1901. */
  1902. GCCError GCCController::ProcessConferenceCreateRequest(
  1903. PConferenceCreateRequest create_request,
  1904. PConnectProviderIndication connect_provider_indication)
  1905. {
  1906. GCCError rc = GCC_NO_ERROR;
  1907. PENDING_CREATE_CONF *conference_info;
  1908. GCCConferenceName conference_name;
  1909. GCCConfID conference_id;
  1910. CPassword *convener_password_ptr = NULL;
  1911. CPassword *password_ptr = NULL;
  1912. LPWSTR pwszConfDescription = NULL;
  1913. LPWSTR pwszCallerID = NULL;
  1914. CUserDataListContainer *user_data_list = NULL;
  1915. DebugEntry(GCCController::ProcessConferenceCreateRequest);
  1916. DBG_SAVE_FILE_LINE
  1917. conference_info = new PENDING_CREATE_CONF;
  1918. if (conference_info != NULL)
  1919. {
  1920. /*
  1921. ** This section of the code deals with the conference name
  1922. */
  1923. conference_name.numeric_string = (GCCNumericString)create_request->
  1924. conference_name.numeric;
  1925. // Set up the numeric name portion of the conference info structure.
  1926. conference_info->pszConfNumericName = ::My_strdupA(create_request->conference_name.numeric);
  1927. // Next get the text conference name if one exists
  1928. if (create_request->conference_name.bit_mask &
  1929. CONFERENCE_NAME_TEXT_PRESENT)
  1930. {
  1931. // Save the unicode string object in the conference info structure.
  1932. if (NULL != (conference_info->pwszConfTextName = ::My_strdupW2(
  1933. create_request->conference_name.conference_name_text.length,
  1934. create_request->conference_name.conference_name_text.value)))
  1935. {
  1936. conference_name.text_string = conference_info->pwszConfTextName;
  1937. }
  1938. else
  1939. {
  1940. rc = GCC_ALLOCATION_FAILURE;
  1941. }
  1942. }
  1943. else
  1944. {
  1945. conference_name.text_string = NULL;
  1946. ASSERT(NULL == conference_info->pwszConfTextName);
  1947. }
  1948. // Unpack the convener password
  1949. if ((create_request->bit_mask & CCRQ_CONVENER_PASSWORD_PRESENT) &&
  1950. (rc == GCC_NO_ERROR))
  1951. {
  1952. DBG_SAVE_FILE_LINE
  1953. convener_password_ptr = new CPassword(
  1954. &create_request->ccrq_convener_password,
  1955. &rc);
  1956. if (convener_password_ptr == NULL)
  1957. rc = GCC_ALLOCATION_FAILURE;
  1958. }
  1959. // Unpack the password
  1960. if ((create_request->bit_mask & CCRQ_PASSWORD_PRESENT) &&
  1961. (rc == GCC_NO_ERROR))
  1962. {
  1963. DBG_SAVE_FILE_LINE
  1964. password_ptr = new CPassword(&create_request->ccrq_password, &rc);
  1965. if (password_ptr == NULL)
  1966. rc = GCC_ALLOCATION_FAILURE;
  1967. }
  1968. // Unpack the privilege list that exists
  1969. conference_info->conduct_privilege_list = NULL;
  1970. conference_info->conduct_mode_privilege_list = NULL;
  1971. conference_info->non_conduct_privilege_list = NULL;
  1972. if ((create_request->bit_mask & CCRQ_CONDUCTOR_PRIVS_PRESENT) &&
  1973. (rc == GCC_NO_ERROR))
  1974. {
  1975. DBG_SAVE_FILE_LINE
  1976. conference_info->conduct_privilege_list = new PrivilegeListData (
  1977. create_request->ccrq_conductor_privs);
  1978. if (conference_info->conduct_privilege_list == NULL)
  1979. rc = GCC_ALLOCATION_FAILURE;
  1980. }
  1981. if ((create_request->bit_mask & CCRQ_CONDUCTED_PRIVS_PRESENT) &&
  1982. (rc == GCC_NO_ERROR))
  1983. {
  1984. DBG_SAVE_FILE_LINE
  1985. conference_info->conduct_mode_privilege_list =
  1986. new PrivilegeListData (create_request->ccrq_conducted_privs);
  1987. if (conference_info->conduct_mode_privilege_list == NULL)
  1988. rc = GCC_ALLOCATION_FAILURE;
  1989. }
  1990. if ((create_request->bit_mask & CCRQ_NON_CONDUCTED_PRIVS_PRESENT) &&
  1991. (rc == GCC_NO_ERROR))
  1992. {
  1993. DBG_SAVE_FILE_LINE
  1994. conference_info->non_conduct_privilege_list =
  1995. new PrivilegeListData(create_request->ccrq_non_conducted_privs);
  1996. if (conference_info->non_conduct_privilege_list == NULL)
  1997. rc = GCC_ALLOCATION_FAILURE;
  1998. }
  1999. // Unpack the conference description if one exists
  2000. if ((create_request->bit_mask & CCRQ_DESCRIPTION_PRESENT) &&
  2001. (rc == GCC_NO_ERROR))
  2002. {
  2003. pwszConfDescription = create_request->ccrq_description.value;
  2004. /* Save conference description data in info for later use. This
  2005. ** constructor will automatically append a NULL terminator to the
  2006. ** end of the string.
  2007. */
  2008. if (NULL == (conference_info->pwszConfDescription = ::My_strdupW2(
  2009. create_request->ccrq_description.length,
  2010. create_request->ccrq_description.value)))
  2011. {
  2012. rc = GCC_ALLOCATION_FAILURE;
  2013. }
  2014. }
  2015. else
  2016. {
  2017. ASSERT(NULL == conference_info->pwszConfDescription);
  2018. }
  2019. // Unpack the caller identifier if one exists
  2020. if ((create_request->bit_mask & CCRQ_CALLER_ID_PRESENT) &&
  2021. (rc == GCC_NO_ERROR))
  2022. {
  2023. /*
  2024. * Use a temporary UnicodeString object in order to append a NULL
  2025. * terminator to the end of the string.
  2026. */
  2027. if (NULL == (pwszCallerID = ::My_strdupW2(
  2028. create_request->ccrq_caller_id.length,
  2029. create_request->ccrq_caller_id.value)))
  2030. {
  2031. rc = GCC_ALLOCATION_FAILURE;
  2032. }
  2033. }
  2034. // Unpack the user data list if it exists
  2035. if ((create_request->bit_mask & CCRQ_USER_DATA_PRESENT) &&
  2036. (rc == GCC_NO_ERROR))
  2037. {
  2038. DBG_SAVE_FILE_LINE
  2039. user_data_list = new CUserDataListContainer(create_request->ccrq_user_data, &rc);
  2040. if (user_data_list == NULL)
  2041. {
  2042. rc = GCC_ALLOCATION_FAILURE;
  2043. }
  2044. }
  2045. if (rc == GCC_NO_ERROR)
  2046. {
  2047. // Build the conference information structure
  2048. conference_info->connection_handle =
  2049. connect_provider_indication->connection_handle;
  2050. conference_info->conference_is_locked =
  2051. create_request->conference_is_locked;
  2052. conference_info->conference_is_listed =
  2053. create_request->conference_is_listed;
  2054. conference_info->conference_is_conductible =
  2055. create_request->conference_is_conductible;
  2056. conference_info->termination_method =
  2057. (GCCTerminationMethod)
  2058. create_request->termination_method;
  2059. /*
  2060. ** Add the conference information to the conference
  2061. ** info list. This will be accessed again on a
  2062. ** conference create response.
  2063. */
  2064. conference_id = AllocateConferenceID();
  2065. m_PendingCreateConfList2.Append(conference_id, conference_info);
  2066. g_pControlSap->ConfCreateIndication
  2067. (
  2068. &conference_name,
  2069. conference_id,
  2070. convener_password_ptr,
  2071. password_ptr,
  2072. conference_info->conference_is_locked,
  2073. conference_info->conference_is_listed,
  2074. conference_info->conference_is_conductible,
  2075. conference_info->termination_method,
  2076. conference_info->conduct_privilege_list,
  2077. conference_info->conduct_mode_privilege_list,
  2078. conference_info->non_conduct_privilege_list,
  2079. pwszConfDescription,
  2080. pwszCallerID,
  2081. NULL, // FIX: When supported by MCS
  2082. NULL, // FIX: When supported by MCS
  2083. &(connect_provider_indication->domain_parameters),
  2084. user_data_list,
  2085. connect_provider_indication->connection_handle);
  2086. //
  2087. // LONCHANC: Who is going to delete conference_info?
  2088. //
  2089. }
  2090. if( NULL != convener_password_ptr )
  2091. delete convener_password_ptr;
  2092. if( NULL != password_ptr )
  2093. delete password_ptr;
  2094. if( NULL != conference_info )
  2095. delete conference_info;
  2096. // Free up the user data list
  2097. if (user_data_list != NULL)
  2098. {
  2099. user_data_list->Release();
  2100. }
  2101. }
  2102. else
  2103. {
  2104. rc = GCC_ALLOCATION_FAILURE;
  2105. }
  2106. DebugExitINT(GCCController::ProcessConferenceCreateRequest, rc);
  2107. return (rc);
  2108. }
  2109. /*
  2110. * GCCController::ProcessConferenceQueryRequest ()
  2111. *
  2112. * Private Function Description
  2113. * This routine processes a GCC conference query request "connect"
  2114. * PDU structure. Note that the PDU has already been decoded by
  2115. * the time it reaches this routine.
  2116. *
  2117. * Formal Parameters:
  2118. * query_request - (i) This is a pointer to a structure
  2119. * that holds a GCC conference query
  2120. * request connect PDU.
  2121. * connect_provider_indication - (i) This is the connect provider
  2122. * indication structure received
  2123. * from MCS.
  2124. *
  2125. * Return Value
  2126. * GCC_NO_ERROR - No error occured.
  2127. * GCC_ALLOCATION_FAILURE - A resource error occured.
  2128. * GCC_BAD_USER_DATA - Invalid user data in the PDU.
  2129. *
  2130. * Side Effects
  2131. * None
  2132. *
  2133. * Caveats
  2134. * None
  2135. */
  2136. GCCError GCCController::ProcessConferenceQueryRequest (
  2137. PConferenceQueryRequest query_request,
  2138. PConnectProviderIndication connect_provider_indication)
  2139. {
  2140. GCCError rc = GCC_NO_ERROR;
  2141. GCCNodeType node_type;
  2142. GCCAsymmetryIndicator asymmetry_indicator;
  2143. PGCCAsymmetryIndicator asymmetry_indicator_ptr = NULL;
  2144. CUserDataListContainer *user_data_list = NULL;
  2145. DebugEntry(GCCController::ProcessConferenceQueryRequest);
  2146. node_type = (GCCNodeType)query_request->node_type;
  2147. // First get the asymmetry indicator if it exists
  2148. if (query_request->bit_mask & CQRQ_ASYMMETRY_INDICATOR_PRESENT)
  2149. {
  2150. asymmetry_indicator.asymmetry_type =
  2151. (GCCAsymmetryType)query_request->cqrq_asymmetry_indicator.choice;
  2152. asymmetry_indicator.random_number =
  2153. query_request->cqrq_asymmetry_indicator.u.unknown;
  2154. asymmetry_indicator_ptr = &asymmetry_indicator;
  2155. }
  2156. // Next get the user data if it exists
  2157. if (query_request->bit_mask & CQRQ_USER_DATA_PRESENT)
  2158. {
  2159. DBG_SAVE_FILE_LINE
  2160. user_data_list = new CUserDataListContainer(query_request->cqrq_user_data, &rc);
  2161. if (user_data_list == NULL)
  2162. {
  2163. rc = GCC_ALLOCATION_FAILURE;
  2164. }
  2165. }
  2166. if (rc == GCC_NO_ERROR)
  2167. {
  2168. g_pControlSap->ConfQueryIndication(
  2169. (GCCResponseTag)connect_provider_indication->
  2170. connection_handle,
  2171. node_type,
  2172. asymmetry_indicator_ptr,
  2173. NULL, // FIX: When transport address supported by MCS
  2174. NULL, // FIX: When transport address supported by MCS
  2175. user_data_list,
  2176. connect_provider_indication->connection_handle);
  2177. }
  2178. // Free the user data list container
  2179. if (user_data_list != NULL)
  2180. {
  2181. user_data_list->Release();
  2182. }
  2183. DebugExitINT(GCCController::ProcessConferenceQueryRequest, rc);
  2184. return (rc);
  2185. }
  2186. /*
  2187. * GCCController::ProcessConferenceJoinRequest ()
  2188. *
  2189. * Private Function Description
  2190. * This routine processes a GCC conference join request "connect"
  2191. * PDU structure. Note that the PDU has already been decoded by
  2192. * the time it reaches this routine.
  2193. *
  2194. * If the conference conference exist and this node is the Top
  2195. * Provider for the conference we allow the join request to propogate
  2196. * up to the node controller so that the decision about how to proceed is
  2197. * made there.
  2198. *
  2199. * If the conference exist and this is not the Top Provider we
  2200. * still send the join indication to the intermediate node controller
  2201. * so that this node has a chance to reject it before the join request is
  2202. * passed on up to the top provider.
  2203. *
  2204. * If the conference does not currently exist at this node
  2205. * we immediately reject the request and send a status indication to
  2206. * the local node controller to inform it of the failed join attempt.
  2207. *
  2208. * Formal Parameters:
  2209. * join_request - (i) This is a pointer to a structure
  2210. * that holds a GCC conference join
  2211. * request connect PDU.
  2212. * connect_provider_indication - (i) This is the connect provider
  2213. * indication structure received
  2214. * from MCS.
  2215. *
  2216. * Return Value
  2217. * GCC_NO_ERROR - No error occured.
  2218. * GCC_ALLOCATION_FAILURE - A resource error occured.
  2219. * GCC_BAD_USER_DATA - Invalid user data in the PDU.
  2220. * GCC_INVALID_PASSWORD - Invalid password in the PDU.
  2221. * GCC_INVALID_CONFERENCE_NAME - Invalid conference name in PDU.
  2222. *
  2223. * Side Effects
  2224. * None
  2225. *
  2226. * Caveats
  2227. * None
  2228. */
  2229. GCCError GCCController::ProcessConferenceJoinRequest(
  2230. PConferenceJoinRequest join_request,
  2231. PConnectProviderIndication connect_provider_indication)
  2232. {
  2233. GCCError rc = GCC_NO_ERROR;
  2234. GCCConfID conference_id = 0;
  2235. GCCConferenceName conference_name;
  2236. GCCNumericString conference_modifier = NULL;
  2237. PConference conference_ptr = NULL;
  2238. CUserDataListContainer *user_data_list;
  2239. BOOL intermediate_node = FALSE;
  2240. PENDING_JOIN_CONF *join_info_ptr;
  2241. BOOL convener_exists = FALSE;
  2242. BOOL conference_is_locked = FALSE;
  2243. GCCStatusMessageType status_message_type;
  2244. CPassword *convener_password = NULL;
  2245. CPassword *password_challenge = NULL;
  2246. PConference lpConf;
  2247. GCCResult gcc_result = GCC_RESULT_SUCCESSFUL;
  2248. DebugEntry(GCCController::ProcessConferenceJoinRequest);
  2249. DBG_SAVE_FILE_LINE
  2250. join_info_ptr = new PENDING_JOIN_CONF;
  2251. if (join_info_ptr != NULL)
  2252. {
  2253. // Get the conference name
  2254. if (join_request->bit_mask & CONFERENCE_NAME_PRESENT)
  2255. {
  2256. if (join_request->conference_name.choice == NAME_SELECTOR_NUMERIC_CHOSEN)
  2257. {
  2258. conference_name.numeric_string =
  2259. (GCCNumericString)join_request->conference_name.u.name_selector_numeric;
  2260. conference_name.text_string = NULL;
  2261. join_info_ptr->numeric_name_present = TRUE;
  2262. }
  2263. else
  2264. {
  2265. conference_name.numeric_string = NULL;
  2266. /*
  2267. * Use a temporary UnicodeString object in order to append a
  2268. * NULL terminator to the end of the string.
  2269. */
  2270. if (NULL == (conference_name.text_string = ::My_strdupW2(
  2271. join_request->conference_name.u.name_selector_text.length,
  2272. join_request->conference_name.u.name_selector_text.value)))
  2273. {
  2274. rc = GCC_ALLOCATION_FAILURE;
  2275. }
  2276. join_info_ptr->numeric_name_present = FALSE;
  2277. }
  2278. }
  2279. else
  2280. rc = GCC_INVALID_CONFERENCE_NAME;
  2281. // Get the conference modifier
  2282. if (join_request->bit_mask & CJRQ_CONFERENCE_MODIFIER_PRESENT)
  2283. conference_modifier = (GCCNumericString)join_request->cjrq_conference_modifier;
  2284. // Get the convener password if one exist
  2285. if ((join_request->bit_mask & CJRQ_CONVENER_PASSWORD_PRESENT) &&
  2286. (rc == GCC_NO_ERROR))
  2287. {
  2288. // First allocate the convener password for the join info structure
  2289. DBG_SAVE_FILE_LINE
  2290. join_info_ptr->convener_password = new CPassword(
  2291. &join_request->cjrq_convener_password,
  2292. &rc);
  2293. if (join_info_ptr->convener_password == NULL)
  2294. rc = GCC_ALLOCATION_FAILURE;
  2295. else if (rc == GCC_NO_ERROR)
  2296. {
  2297. // Now allocate the convener password to send in the indication
  2298. DBG_SAVE_FILE_LINE
  2299. convener_password = new CPassword(
  2300. &join_request->cjrq_convener_password,
  2301. &rc);
  2302. if (convener_password == NULL)
  2303. rc = GCC_ALLOCATION_FAILURE;
  2304. }
  2305. }
  2306. else
  2307. {
  2308. ASSERT(NULL == join_info_ptr->convener_password);
  2309. }
  2310. // Get the password challange if one exist
  2311. if ((join_request->bit_mask & CJRQ_PASSWORD_PRESENT) &&
  2312. (rc == GCC_NO_ERROR))
  2313. {
  2314. // First allocate the password for the join info structure
  2315. DBG_SAVE_FILE_LINE
  2316. join_info_ptr->password_challenge = new CPassword(
  2317. &join_request->cjrq_password,
  2318. &rc);
  2319. if (join_info_ptr->password_challenge == NULL)
  2320. rc = GCC_ALLOCATION_FAILURE;
  2321. else if (rc == GCC_NO_ERROR)
  2322. {
  2323. // Now allocate the password to send in the indication
  2324. DBG_SAVE_FILE_LINE
  2325. password_challenge = new CPassword(
  2326. &join_request->cjrq_password,
  2327. &rc);
  2328. if (password_challenge == NULL)
  2329. rc = GCC_ALLOCATION_FAILURE;
  2330. }
  2331. }
  2332. else
  2333. {
  2334. ASSERT(NULL == join_info_ptr->password_challenge);
  2335. }
  2336. // Get the caller identifier
  2337. if ((join_request->bit_mask & CJRQ_CALLER_ID_PRESENT) &&
  2338. (rc == GCC_NO_ERROR))
  2339. {
  2340. /*
  2341. * Use a temporary UnicodeString object in order to append a
  2342. * NULL terminator to the end of the string.
  2343. */
  2344. if (NULL == (join_info_ptr->pwszCallerID = ::My_strdupW2(
  2345. join_request->cjrq_caller_id.length,
  2346. join_request->cjrq_caller_id.value)))
  2347. {
  2348. rc = GCC_ALLOCATION_FAILURE;
  2349. }
  2350. }
  2351. // Get the user data if it exists
  2352. if ((join_request->bit_mask & CJRQ_USER_DATA_PRESENT) &&
  2353. (rc == GCC_NO_ERROR))
  2354. {
  2355. DBG_SAVE_FILE_LINE
  2356. user_data_list = new CUserDataListContainer(join_request->cjrq_user_data, &rc);
  2357. if (user_data_list == NULL)
  2358. {
  2359. rc = GCC_ALLOCATION_FAILURE;
  2360. }
  2361. }
  2362. else
  2363. {
  2364. user_data_list = NULL;
  2365. }
  2366. if (rc == GCC_NO_ERROR)
  2367. {
  2368. /*
  2369. ** We must query each conference to determine if the name
  2370. ** matches the name recevied from the joining node.
  2371. */
  2372. conference_id = GetConferenceIDFromName(&conference_name,
  2373. conference_modifier);
  2374. // Determine if this is an intermediate node
  2375. if (conference_id == 0)
  2376. {
  2377. /*
  2378. ** If the conference_id equals zero then the conference
  2379. ** specified in the join request does not exists and the
  2380. ** request is automatically rejected. We send a GCC status
  2381. ** indication to the control sap to indicate that someone
  2382. ** tried to join with a bad conference name.
  2383. */
  2384. gcc_result = GCC_RESULT_INVALID_CONFERENCE;
  2385. // Set up the status message
  2386. status_message_type = GCC_STATUS_JOIN_FAILED_BAD_CONF_NAME;
  2387. }
  2388. else if (NULL != (lpConf = m_ConfList2.Find(conference_id)) &&
  2389. lpConf->IsConfEstablished() == FALSE)
  2390. {
  2391. /*
  2392. ** If the conference is not established then the conference
  2393. ** specified in the join request does not exists and the
  2394. ** request is automatically rejected. We send a GCC status
  2395. ** indication to the control sap to indicate that someone
  2396. ** tried to join with a bad conference name.
  2397. */
  2398. gcc_result = GCC_RESULT_INVALID_CONFERENCE;
  2399. // Set up the status message
  2400. status_message_type = GCC_STATUS_JOIN_FAILED_BAD_CONF_NAME;
  2401. }
  2402. else if (NULL != (lpConf = m_ConfList2.Find(conference_id)) &&
  2403. lpConf->IsConfSecure() != connect_provider_indication->fSecure )
  2404. {
  2405. /*
  2406. ** If the conference security does not match the security
  2407. ** setting of the connection underlying the join then the
  2408. ** join is rejected
  2409. */
  2410. WARNING_OUT(("JOIN REJECTED: %d joins %d",
  2411. connect_provider_indication->fSecure,
  2412. lpConf->IsConfSecure() ));
  2413. //
  2414. // Make sure that we really compared 2 booleans
  2415. //
  2416. ASSERT(FALSE == lpConf->IsConfSecure() ||
  2417. TRUE == lpConf->IsConfSecure() );
  2418. ASSERT(FALSE == connect_provider_indication->fSecure ||
  2419. TRUE == connect_provider_indication->fSecure );
  2420. // BUGBUG - these don't map to good UI errors
  2421. gcc_result = lpConf->IsConfSecure() ?
  2422. GCC_RESULT_CONNECT_PROVIDER_REMOTE_REQUIRE_SECURITY :
  2423. GCC_RESULT_CONNECT_PROVIDER_REMOTE_NO_SECURITY ;
  2424. // Set up the status message
  2425. status_message_type = GCC_STATUS_INCOMPATIBLE_PROTOCOL;
  2426. }
  2427. else
  2428. {
  2429. conference_ptr = m_ConfList2.Find(conference_id);
  2430. if (! conference_ptr->IsConfTopProvider())
  2431. intermediate_node = TRUE;
  2432. convener_exists = conference_ptr->DoesConvenerExists();
  2433. conference_is_locked = conference_ptr->IsConfLocked();
  2434. /*
  2435. ** This logic takes care of the convener password. If the
  2436. ** convener password exists we must make sure that the
  2437. ** conference does not already have a convener, that this is
  2438. ** not an intermediate node within the conference.
  2439. */
  2440. if (((join_info_ptr->convener_password == NULL) &&
  2441. (conference_is_locked == FALSE)) ||
  2442. ((join_info_ptr->convener_password != NULL) &&
  2443. (convener_exists == FALSE) &&
  2444. (intermediate_node == FALSE)))
  2445. {
  2446. gcc_result = GCC_RESULT_SUCCESSFUL;
  2447. }
  2448. else
  2449. {
  2450. if (join_info_ptr->convener_password != NULL)
  2451. {
  2452. /*
  2453. ** We must send a rejection here informing the
  2454. ** requester that this was an illegal join attempt due
  2455. ** to the presence of a convener password.
  2456. */
  2457. gcc_result = GCC_RESULT_INVALID_CONVENER_PASSWORD;
  2458. // Set up the status message
  2459. status_message_type = GCC_STATUS_JOIN_FAILED_BAD_CONVENER;
  2460. }
  2461. else
  2462. {
  2463. /*
  2464. ** We must send a rejection here informing the
  2465. ** requester that the conference was locked.
  2466. */
  2467. gcc_result = GCC_RESULT_INVALID_CONFERENCE;
  2468. // Set up the status message
  2469. status_message_type = GCC_STATUS_JOIN_FAILED_LOCKED;
  2470. }
  2471. }
  2472. }
  2473. /*
  2474. ** Here we either send the conference join indication to the
  2475. ** control sap or send back a response specifying a failed
  2476. ** join attempt with the result code. If the response is sent
  2477. ** here we send a status indication to the control sap informing
  2478. ** of the failed join attempt.
  2479. */
  2480. if (gcc_result == GCC_RESULT_SUCCESSFUL)
  2481. {
  2482. /*
  2483. ** Add the join info structure to the list of outstanding
  2484. ** join request.
  2485. */
  2486. join_info_ptr->nConfID = conference_id;
  2487. m_PendingJoinConfList2.Append(connect_provider_indication->connection_handle, join_info_ptr);
  2488. // All join request are passed to the Node Controller.
  2489. g_pControlSap->ConfJoinIndication(
  2490. conference_id,
  2491. convener_password,
  2492. password_challenge,
  2493. join_info_ptr->pwszCallerID,
  2494. NULL, // FIX: Support when added to MCS
  2495. NULL, // FIX: Support when added to MCS
  2496. user_data_list,
  2497. intermediate_node,
  2498. connect_provider_indication->connection_handle);
  2499. }
  2500. else
  2501. {
  2502. ConfJoinResponseInfo cjri;
  2503. #ifdef TSTATUS_INDICATION
  2504. /*
  2505. ** This status message is used to inform the node controller
  2506. ** of the failed join.
  2507. */
  2508. g_pControlSap->StatusIndication(
  2509. status_message_type, conference_id);
  2510. #endif // TSTATUS_INDICATION
  2511. // Send back the failed response with the result
  2512. cjri.result = gcc_result;
  2513. cjri.conference_id = conference_id;
  2514. cjri.password_challenge = NULL;
  2515. cjri.user_data_list = NULL;
  2516. cjri.connection_handle = connect_provider_indication->connection_handle;
  2517. /*
  2518. ** The join response takes care of freeing up the join
  2519. ** info structure.
  2520. */
  2521. ConfJoinIndResponse(&cjri);
  2522. delete join_info_ptr;
  2523. }
  2524. }
  2525. else
  2526. {
  2527. // Clean up the join info data when an error occurs.
  2528. delete join_info_ptr;
  2529. }
  2530. // Free up any containers that are no longer needed
  2531. if (user_data_list != NULL)
  2532. {
  2533. user_data_list->Release();
  2534. }
  2535. if (convener_password != NULL)
  2536. {
  2537. convener_password->Release();
  2538. }
  2539. if (password_challenge != NULL)
  2540. {
  2541. password_challenge->Release();
  2542. }
  2543. delete conference_name.text_string;
  2544. }
  2545. else
  2546. {
  2547. rc = GCC_ALLOCATION_FAILURE;
  2548. }
  2549. // in case of error, we have to flush response PDU in order to unblock the remote node
  2550. if (GCC_NO_ERROR != rc)
  2551. {
  2552. FailConfJoinIndResponse(conference_id, connect_provider_indication->connection_handle);
  2553. }
  2554. DebugExitINT(GCCController::ProcessConferenceJoinRequest, rc);
  2555. return (rc);
  2556. }
  2557. /*
  2558. * GCCController::ProcessConferenceInviteRequest ()
  2559. *
  2560. * Private Function Description
  2561. * This routine processes a GCC conference invite request "connect"
  2562. * PDU structure. Note that the PDU has already been decoded by
  2563. * the time it reaches this routine.
  2564. *
  2565. * Formal Parameters:
  2566. * invite_request - (i) This is a pointer to a structure
  2567. * that holds a GCC conference invite
  2568. * request connect PDU.
  2569. * connect_provider_indication - (i) This is the connect provider
  2570. * indication structure received
  2571. * from MCS.
  2572. *
  2573. * Return Value
  2574. * GCC_NO_ERROR - No error occured.
  2575. * GCC_ALLOCATION_FAILURE - A resource error occured.
  2576. * GCC_BAD_USER_DATA - Invalid user data in the PDU.
  2577. *
  2578. * Side Effects
  2579. * None
  2580. *
  2581. * Caveats
  2582. * None
  2583. */
  2584. GCCError GCCController::ProcessConferenceInviteRequest(
  2585. PConferenceInviteRequest invite_request,
  2586. PConnectProviderIndication connect_provider_indication)
  2587. {
  2588. GCCError rc = GCC_NO_ERROR;
  2589. PENDING_CREATE_CONF *conference_info;
  2590. GCCConfID conference_id;
  2591. LPWSTR pwszCallerID = NULL;
  2592. CUserDataListContainer *user_data_list = NULL;
  2593. GCCConferenceName conference_name;
  2594. LPWSTR pwszConfDescription = NULL;
  2595. DBG_SAVE_FILE_LINE
  2596. conference_info = new PENDING_CREATE_CONF;
  2597. if (conference_info != NULL)
  2598. {
  2599. // First make copies of the conference name
  2600. conference_info->pszConfNumericName = ::My_strdupA(invite_request->conference_name.numeric);
  2601. if (invite_request->conference_name.bit_mask & CONFERENCE_NAME_TEXT_PRESENT)
  2602. {
  2603. if (NULL == (conference_info->pwszConfTextName = ::My_strdupW2(
  2604. invite_request->conference_name.conference_name_text.length,
  2605. invite_request->conference_name.conference_name_text.value)))
  2606. {
  2607. rc = GCC_ALLOCATION_FAILURE;
  2608. }
  2609. }
  2610. else
  2611. {
  2612. ASSERT(NULL == conference_info->pwszConfTextName);
  2613. }
  2614. // Fill in the GCC Conference Name
  2615. conference_name.numeric_string = (GCCNumericString) conference_info->pszConfNumericName;
  2616. conference_name.text_string = conference_info->pwszConfTextName;
  2617. // Now get the privilege lists
  2618. if (invite_request->bit_mask & CIRQ_CONDUCTOR_PRIVS_PRESENT)
  2619. {
  2620. DBG_SAVE_FILE_LINE
  2621. conference_info->conduct_privilege_list = new PrivilegeListData (
  2622. invite_request->cirq_conductor_privs);
  2623. if (conference_info->conduct_privilege_list == NULL)
  2624. rc = GCC_ALLOCATION_FAILURE;
  2625. }
  2626. else
  2627. {
  2628. ASSERT(NULL == conference_info->conduct_privilege_list);
  2629. }
  2630. if (invite_request->bit_mask & CIRQ_CONDUCTED_PRIVS_PRESENT)
  2631. {
  2632. DBG_SAVE_FILE_LINE
  2633. conference_info->conduct_mode_privilege_list =
  2634. new PrivilegeListData(invite_request->cirq_conducted_privs);
  2635. if (conference_info->conduct_mode_privilege_list == NULL)
  2636. rc = GCC_ALLOCATION_FAILURE;
  2637. }
  2638. else
  2639. {
  2640. ASSERT(NULL == conference_info->conduct_mode_privilege_list);
  2641. }
  2642. if (invite_request->bit_mask & CIRQ_NON_CONDUCTED_PRIVS_PRESENT)
  2643. {
  2644. DBG_SAVE_FILE_LINE
  2645. conference_info->non_conduct_privilege_list =
  2646. new PrivilegeListData(invite_request->cirq_non_conducted_privs);
  2647. if (conference_info->non_conduct_privilege_list == NULL)
  2648. rc = GCC_ALLOCATION_FAILURE;
  2649. }
  2650. else
  2651. {
  2652. ASSERT(NULL == conference_info->non_conduct_privilege_list);
  2653. }
  2654. // Get the conference description of one exists
  2655. if (invite_request->bit_mask & CIRQ_DESCRIPTION_PRESENT)
  2656. {
  2657. if (NULL == (conference_info->pwszConfDescription = ::My_strdupW2(
  2658. invite_request->cirq_description.length,
  2659. invite_request->cirq_description.value)))
  2660. {
  2661. rc = GCC_ALLOCATION_FAILURE;
  2662. }
  2663. else
  2664. {
  2665. pwszConfDescription = conference_info->pwszConfDescription;
  2666. }
  2667. }
  2668. else
  2669. {
  2670. ASSERT(NULL == conference_info->pwszConfDescription);
  2671. }
  2672. // Get the caller identifier
  2673. if (invite_request->bit_mask & CIRQ_CALLER_ID_PRESENT)
  2674. {
  2675. /*
  2676. * Use a temporary UnicodeString object in order to append a
  2677. * NULL terminator to the end of the string.
  2678. */
  2679. if (NULL == (pwszCallerID = ::My_strdupW2(
  2680. invite_request->cirq_caller_id.length,
  2681. invite_request->cirq_caller_id.value)))
  2682. {
  2683. rc = GCC_ALLOCATION_FAILURE;
  2684. }
  2685. }
  2686. // Get the user data if any exists
  2687. if ((invite_request->bit_mask & CIRQ_USER_DATA_PRESENT) &&
  2688. (rc == GCC_NO_ERROR))
  2689. {
  2690. DBG_SAVE_FILE_LINE
  2691. user_data_list = new CUserDataListContainer(invite_request->cirq_user_data, &rc);
  2692. if (user_data_list == NULL)
  2693. {
  2694. rc = GCC_ALLOCATION_FAILURE;
  2695. }
  2696. }
  2697. if (rc == GCC_NO_ERROR)
  2698. {
  2699. // Build the conference information structure
  2700. conference_info->connection_handle =
  2701. connect_provider_indication->connection_handle;
  2702. conference_info->password_in_the_clear =
  2703. invite_request->clear_password_required;
  2704. conference_info->conference_is_listed =
  2705. invite_request->conference_is_listed;
  2706. conference_info->conference_is_locked =
  2707. invite_request->conference_is_locked;
  2708. conference_info->conference_is_conductible =
  2709. invite_request->conference_is_conductible;
  2710. conference_info->termination_method =
  2711. (GCCTerminationMethod)invite_request->termination_method;
  2712. conference_info->top_node_id = (UserID)invite_request->top_node_id;
  2713. conference_info->parent_node_id = (UserID)invite_request->node_id;
  2714. conference_info->tag_number = invite_request->tag;
  2715. /*
  2716. ** Add the conference information to the conference
  2717. ** info list. This will be accessed again on a
  2718. ** conference create response.
  2719. */
  2720. conference_id = AllocateConferenceID();
  2721. m_PendingCreateConfList2.Append(conference_id, conference_info);
  2722. g_pControlSap->ConfInviteIndication(
  2723. conference_id,
  2724. &conference_name,
  2725. pwszCallerID,
  2726. NULL, // FIX : When supported by MCS
  2727. NULL, // FIX : When supported by MCS
  2728. connect_provider_indication->fSecure,
  2729. &(connect_provider_indication->domain_parameters),
  2730. conference_info->password_in_the_clear,
  2731. conference_info->conference_is_locked,
  2732. conference_info->conference_is_listed,
  2733. conference_info->conference_is_conductible,
  2734. conference_info->termination_method,
  2735. conference_info->conduct_privilege_list,
  2736. conference_info->conduct_mode_privilege_list,
  2737. conference_info->non_conduct_privilege_list,
  2738. pwszConfDescription,
  2739. user_data_list,
  2740. connect_provider_indication->connection_handle);
  2741. //
  2742. // LONCHANC: Who will free conference_info?
  2743. //
  2744. }
  2745. else
  2746. {
  2747. delete conference_info;
  2748. }
  2749. // Free up the user data list
  2750. if (user_data_list != NULL)
  2751. {
  2752. user_data_list->Release();
  2753. }
  2754. delete pwszCallerID;
  2755. }
  2756. else
  2757. {
  2758. rc = GCC_ALLOCATION_FAILURE;
  2759. }
  2760. return (rc);
  2761. }
  2762. /*
  2763. * GCCController::ProcessConnectProviderConfirm ()
  2764. *
  2765. * Private Function Description
  2766. * This routine is called when the controller receives a Connect Provider
  2767. * confirm from the MCS interface. This will occur after a conference
  2768. * query request is issued. All other connect provider confirms should
  2769. * be directly handled by the conference object.
  2770. *
  2771. * Formal Parameters:
  2772. * connect_provider_confirm - (i) This is the connect provider
  2773. * confirm structure received
  2774. * from MCS.
  2775. *
  2776. * Return Value
  2777. * GCC_NO_ERROR - No error occured.
  2778. * GCC_ALLOCATION_FAILURE - A resource error occured.
  2779. *
  2780. * Side Effects
  2781. * None
  2782. *
  2783. * Caveats
  2784. * None
  2785. */
  2786. GCCError GCCController::
  2787. ProcessConnectProviderConfirm
  2788. (
  2789. PConnectProviderConfirm connect_provider_confirm
  2790. )
  2791. {
  2792. GCCError error_value = GCC_NO_ERROR;
  2793. PPacket packet;
  2794. PConnectGCCPDU connect_pdu;
  2795. PacketError packet_error;
  2796. /*
  2797. ** If the user data length is zero then the GCC request to MCS to
  2798. ** connect provider failed (probably do to a bad address). If this
  2799. ** happens we will check the connection handle to determine what
  2800. ** request to match the failed confirm with.
  2801. */
  2802. if (connect_provider_confirm->user_data_length != 0)
  2803. {
  2804. // Decode the PDU type and switch appropriatly
  2805. DBG_SAVE_FILE_LINE
  2806. packet = new Packet((PPacketCoder) g_GCCCoder,
  2807. PACKED_ENCODING_RULES,
  2808. connect_provider_confirm->user_data,
  2809. connect_provider_confirm->user_data_length,
  2810. CONNECT_GCC_PDU,
  2811. TRUE,
  2812. &packet_error);
  2813. if ((packet != NULL) && (packet_error == PACKET_NO_ERROR))
  2814. {
  2815. // Only connect PDUs should be processed here
  2816. connect_pdu = (PConnectGCCPDU)packet->GetDecodedData();
  2817. switch (connect_pdu->choice)
  2818. {
  2819. case CONFERENCE_QUERY_RESPONSE_CHOSEN:
  2820. ProcessConferenceQueryResponse(
  2821. &(connect_pdu->u.conference_query_response),
  2822. connect_provider_confirm);
  2823. break;
  2824. default:
  2825. error_value = GCC_COMMAND_NOT_SUPPORTED;
  2826. break;
  2827. }
  2828. packet->Unlock();
  2829. }
  2830. else
  2831. {
  2832. if (packet != NULL)
  2833. packet->Unlock();
  2834. error_value = GCC_ALLOCATION_FAILURE;
  2835. }
  2836. }
  2837. else
  2838. error_value = GCC_ALLOCATION_FAILURE;
  2839. if (error_value != GCC_NO_ERROR)
  2840. {
  2841. /*
  2842. ** Since we are only processing conference query responses here
  2843. ** we know that any failure must be associated with one of these
  2844. ** request.
  2845. */
  2846. ProcessConferenceQueryResponse( NULL,
  2847. connect_provider_confirm);
  2848. }
  2849. return error_value;
  2850. }
  2851. /*
  2852. * GCCController::ProcessConferenceQueryResponse ()
  2853. *
  2854. * Private Function Description
  2855. * This routine processes a GCC conference query response "connect"
  2856. * PDU structure. Note that the PDU has already been decoded by
  2857. * the time it reaches this routine.
  2858. *
  2859. * Formal Parameters:
  2860. * query_response - (i) This is a pointer to a structure
  2861. * that holds a GCC conference query
  2862. * response connect PDU.
  2863. * connect_provider_confirm - (i) This is the connect provider
  2864. * confirm structure received
  2865. * from MCS.
  2866. *
  2867. * Return Value
  2868. * None
  2869. *
  2870. * Side Effects
  2871. * None
  2872. *
  2873. * Caveats
  2874. * None
  2875. */
  2876. GCCError GCCController::
  2877. ProcessConferenceQueryResponse
  2878. (
  2879. PConferenceQueryResponse query_response,
  2880. PConnectProviderConfirm connect_provider_confirm
  2881. )
  2882. {
  2883. CConfDescriptorListContainer *conference_list;
  2884. GCCError error_value = GCC_NO_ERROR;
  2885. GCCResult result;
  2886. GCCConfID query_id;
  2887. GCCNodeType node_type;
  2888. GCCAsymmetryIndicator asymmetry_indicator;
  2889. PGCCAsymmetryIndicator asymmetry_indicator_ptr = NULL;
  2890. CUserDataListContainer *user_data_list = NULL;
  2891. if (GCC_INVALID_CID != (query_id = m_PendingQueryConfList2.Remove(connect_provider_confirm->connection_handle)))
  2892. {
  2893. // Clean up the query connection and domain used to perform query
  2894. g_pMCSIntf->DeleteDomain(&query_id);
  2895. if (query_response != NULL)
  2896. {
  2897. // Create a new conference list
  2898. DBG_SAVE_FILE_LINE
  2899. conference_list = new CConfDescriptorListContainer(query_response->conference_list, &error_value);
  2900. if ((conference_list != NULL) && (error_value == GCC_NO_ERROR))
  2901. {
  2902. node_type = (GCCNodeType)query_response->node_type;
  2903. // First get the asymmetry indicator if it exists
  2904. if (query_response->bit_mask & CQRS_ASYMMETRY_INDICATOR_PRESENT)
  2905. {
  2906. asymmetry_indicator.asymmetry_type =
  2907. (GCCAsymmetryType)query_response->
  2908. cqrs_asymmetry_indicator.choice;
  2909. asymmetry_indicator.random_number =
  2910. query_response->cqrs_asymmetry_indicator.u.unknown;
  2911. asymmetry_indicator_ptr = &asymmetry_indicator;
  2912. }
  2913. // Next get the user data if it exists
  2914. if (query_response->bit_mask & CQRS_USER_DATA_PRESENT)
  2915. {
  2916. DBG_SAVE_FILE_LINE
  2917. user_data_list = new CUserDataListContainer(query_response->cqrs_user_data, &error_value);
  2918. if (user_data_list == NULL)
  2919. {
  2920. error_value = GCC_ALLOCATION_FAILURE;
  2921. }
  2922. }
  2923. result = ::TranslateQueryResultToGCCResult(query_response->result);
  2924. if (error_value == GCC_NO_ERROR)
  2925. {
  2926. g_pControlSap->ConfQueryConfirm(
  2927. node_type,
  2928. asymmetry_indicator_ptr,
  2929. conference_list,
  2930. user_data_list,
  2931. result,
  2932. connect_provider_confirm->connection_handle);
  2933. }
  2934. /*
  2935. ** Here we call free so that the conference list container
  2936. ** object will be freed up when its lock count goes to zero.
  2937. */
  2938. conference_list->Release();
  2939. }
  2940. else
  2941. {
  2942. if (NULL != conference_list)
  2943. {
  2944. conference_list->Release();
  2945. }
  2946. else
  2947. {
  2948. error_value = GCC_ALLOCATION_FAILURE;
  2949. }
  2950. }
  2951. }
  2952. else
  2953. {
  2954. switch (connect_provider_confirm->result)
  2955. {
  2956. case RESULT_PARAMETERS_UNACCEPTABLE :
  2957. result = GCC_RESULT_INCOMPATIBLE_PROTOCOL;
  2958. break;
  2959. case RESULT_REMOTE_NO_SECURITY :
  2960. result = GCC_RESULT_CONNECT_PROVIDER_REMOTE_NO_SECURITY;
  2961. break;
  2962. case RESULT_REMOTE_DOWNLEVEL_SECURITY :
  2963. result = GCC_RESULT_CONNECT_PROVIDER_REMOTE_DOWNLEVEL_SECURITY;
  2964. break;
  2965. case RESULT_REMOTE_REQUIRE_SECURITY :
  2966. result = GCC_RESULT_CONNECT_PROVIDER_REMOTE_REQUIRE_SECURITY;
  2967. break;
  2968. case RESULT_AUTHENTICATION_FAILED :
  2969. result = GCC_RESULT_CONNECT_PROVIDER_AUTHENTICATION_FAILED;
  2970. break;
  2971. default:
  2972. result = GCC_RESULT_CONNECT_PROVIDER_FAILED;
  2973. break;
  2974. }
  2975. // Send back a failed result
  2976. g_pControlSap->ConfQueryConfirm(
  2977. GCC_TERMINAL,
  2978. NULL,
  2979. NULL,
  2980. NULL,
  2981. result,
  2982. connect_provider_confirm->connection_handle);
  2983. }
  2984. }
  2985. else
  2986. {
  2987. WARNING_OUT(("GCCController:ProcessConferenceQueryResponse: invalid conference"));
  2988. }
  2989. if (NULL != user_data_list)
  2990. {
  2991. user_data_list->Release();
  2992. }
  2993. return error_value;
  2994. }
  2995. void GCCController::
  2996. CancelConfQueryRequest ( ConnectionHandle hQueryReqConn )
  2997. {
  2998. GCCConfID nQueryID;
  2999. if (GCC_INVALID_CID != (nQueryID = m_PendingQueryConfList2.Remove(hQueryReqConn)))
  3000. {
  3001. // Clean up the query connection and domain used to perform query
  3002. g_pMCSIntf->DeleteDomain(&nQueryID);
  3003. // Send back a failed result
  3004. g_pControlSap->ConfQueryConfirm(GCC_TERMINAL, NULL, NULL, NULL,
  3005. GCC_RESULT_CANCELED,
  3006. hQueryReqConn);
  3007. }
  3008. }
  3009. /*
  3010. * GCCController::ProcessDisconnectProviderIndication ()
  3011. *
  3012. * Private Function Description
  3013. * This routine is called when the controller receives a Disconnect
  3014. * Provider Indication. All disconnect provider indications are
  3015. * initially directed to the controller. They may then be routed
  3016. * to a conference.
  3017. *
  3018. * Formal Parameters:
  3019. * connection_handle - (i) Logical connection that has been
  3020. * disconnected.
  3021. *
  3022. * Return Value
  3023. * MCS_NO_ERROR - Always return MCS no error so that the
  3024. * message wont be delivered again.
  3025. *
  3026. * Side Effects
  3027. * None
  3028. *
  3029. * Caveats
  3030. * None
  3031. */
  3032. GCCError GCCController::
  3033. ProcessDisconnectProviderIndication
  3034. (
  3035. ConnectionHandle connection_handle
  3036. )
  3037. {
  3038. GCCError error_value = GCC_NO_ERROR;
  3039. PConference lpConf;
  3040. m_ConfPollList.Reset();
  3041. while (NULL != (lpConf = m_ConfPollList.Iterate()))
  3042. {
  3043. error_value = lpConf->DisconnectProviderIndication (connection_handle);
  3044. /*
  3045. ** Once a conference deletes a connection handle there is no
  3046. ** need to continue in the iterator. Connection Handles
  3047. ** are specific to only one conference. We decided not to
  3048. ** keep a connection handle list in both the controller and
  3049. ** conference for resource reasons.
  3050. */
  3051. if (error_value == GCC_NO_ERROR)
  3052. break;
  3053. }
  3054. TRACE_OUT(("Controller::ProcessDisconnectProviderIndication: "
  3055. "Sending ConnectionBrokenIndication"));
  3056. g_pControlSap->ConnectionBrokenIndication(connection_handle);
  3057. return error_value;
  3058. }
  3059. // Utility functions used by the controller class
  3060. /*
  3061. * GCCController::AllocateConferenceID()
  3062. *
  3063. * Private Function Description
  3064. * This routine is used to generate a unique Conference ID.
  3065. *
  3066. * Formal Parameters:
  3067. * None
  3068. *
  3069. * Return Value
  3070. * The generated unique conference ID.
  3071. *
  3072. * Side Effects
  3073. * None
  3074. *
  3075. * Caveats
  3076. * None
  3077. */
  3078. GCCConfID GCCController::AllocateConferenceID(void)
  3079. {
  3080. /*
  3081. * This loop simply increments a rolling number, looking for the next
  3082. * one that is not already in use.
  3083. */
  3084. do
  3085. {
  3086. m_ConfIDCounter = ((m_ConfIDCounter + 1) % MAXIMUM_CONFERENCE_ID_VALUE) + MINIMUM_CONFERENCE_ID_VALUE;
  3087. }
  3088. while (NULL != m_ConfList2.Find(m_ConfIDCounter));
  3089. return m_ConfIDCounter;
  3090. }
  3091. /*
  3092. * GCCController::AllocateQueryID()
  3093. *
  3094. * Private Function Description
  3095. * This routine is used to generate a unique Query ID
  3096. *
  3097. * Formal Parameters:
  3098. * None
  3099. *
  3100. * Return Value
  3101. * The generated unique query ID.
  3102. *
  3103. * Side Effects
  3104. * None
  3105. *
  3106. * Caveats
  3107. * None
  3108. */
  3109. GCCConfID GCCController::AllocateQueryID()
  3110. {
  3111. GCCConfID test_query_id, nConfID;
  3112. /*
  3113. * This loop simply increments a rolling number, looking for the next
  3114. * one that is not already in use.
  3115. */
  3116. while (1)
  3117. {
  3118. m_QueryIDCounter = ((m_QueryIDCounter + 1) % MAXIMUM_QUERY_ID_VALUE) + MINIMUM_QUERY_ID_VALUE;
  3119. // If this handle is not in use, break from the loop and use it.
  3120. m_PendingQueryConfList2.Reset();
  3121. /*
  3122. ** Check the outstanding query request list to make sure that no
  3123. ** queries are using this ID.
  3124. */
  3125. test_query_id = 0;
  3126. while (GCC_INVALID_CID != (nConfID = m_PendingQueryConfList2.Iterate()))
  3127. {
  3128. if (nConfID == m_QueryIDCounter)
  3129. {
  3130. test_query_id = nConfID;
  3131. break;
  3132. }
  3133. }
  3134. // Break if the ID is not in use.
  3135. if (test_query_id == 0)
  3136. break;
  3137. }
  3138. return m_QueryIDCounter;
  3139. }
  3140. /*
  3141. * GCCController::GetConferenceIDFromName()
  3142. *
  3143. * Private Function Description
  3144. * This call returns the conference Id associated with a conference
  3145. * name and modifier.
  3146. *
  3147. * Formal Parameters:
  3148. * conference_name - (i) Pointer to conference name structure to
  3149. * search on.
  3150. * conference_modifier - (i) The conference name modifier to search on.
  3151. *
  3152. * Return Value
  3153. * The conference ID associated with the specified name.
  3154. * 0 if the name does not exists.
  3155. *
  3156. * Side Effects
  3157. * None
  3158. *
  3159. * Caveats
  3160. * We must iterate on the m_ConfList2 instead of the
  3161. * m_ConfPollList here to insure that the list is accurate. It
  3162. * is possible for the m_ConfList2 to change while the
  3163. * m_ConfPollList is being iterated on followed by something like
  3164. * a join request. If you don't use the m_ConfList2 here the name
  3165. * would still show up even after it had been terminated.
  3166. */
  3167. GCCConfID GCCController::GetConferenceIDFromName(
  3168. PGCCConferenceName conference_name,
  3169. GCCNumericString conference_modifier)
  3170. {
  3171. GCCConfID conference_id = 0;
  3172. LPSTR pszNumericName;
  3173. LPWSTR text_name_ptr;
  3174. LPSTR pszConfModifier;
  3175. PConference lpConf;
  3176. m_ConfList2.Reset();
  3177. while (NULL != (lpConf = m_ConfList2.Iterate()))
  3178. {
  3179. pszNumericName = lpConf->GetNumericConfName();
  3180. text_name_ptr = lpConf->GetTextConfName();
  3181. pszConfModifier = lpConf->GetConfModifier();
  3182. /*
  3183. ** First check the conference name. If both names are used we must
  3184. ** determine if there is a match on either name. If so the
  3185. ** conference is a match. We do this because having either correct
  3186. ** name will be interpreted as a match in a join request.
  3187. **
  3188. */
  3189. if ((conference_name->numeric_string != NULL) &&
  3190. (conference_name->text_string != NULL))
  3191. {
  3192. if (text_name_ptr != NULL)
  3193. {
  3194. if ((0 != lstrcmpA(pszNumericName, conference_name->numeric_string)) &&
  3195. (0 != My_strcmpW(text_name_ptr, conference_name->text_string)))
  3196. continue;
  3197. }
  3198. else
  3199. continue;
  3200. }
  3201. else if (conference_name->numeric_string != NULL)
  3202. {
  3203. if (0 != lstrcmpA(pszNumericName, conference_name->numeric_string))
  3204. continue;
  3205. }
  3206. else
  3207. {
  3208. if (text_name_ptr != NULL)
  3209. {
  3210. if (0 != My_strcmpW(text_name_ptr, conference_name->text_string))
  3211. continue;
  3212. }
  3213. else
  3214. {
  3215. TRACE_OUT(("GCCController: GetConferenceIDFromName: Text Conference Name is NULL: No Match"));
  3216. continue;
  3217. }
  3218. }
  3219. // Next check the conference modifier
  3220. TRACE_OUT(("GCCController: GetConferenceIDFromName: Before Modifier Check"));
  3221. if (conference_modifier != NULL)
  3222. {
  3223. if (pszConfModifier != NULL)
  3224. {
  3225. if (0 != lstrcmpA(pszConfModifier, conference_modifier))
  3226. {
  3227. TRACE_OUT(("GCCController: GetConferenceIDFromName: After Modifier Check"));
  3228. continue;
  3229. }
  3230. else
  3231. {
  3232. TRACE_OUT(("GCCController: GetConferenceIDFromName: Name match was found"));
  3233. }
  3234. }
  3235. else
  3236. {
  3237. TRACE_OUT(("GCCController: GetConferenceIDFromName: Conference Modifier is NULL: No Match"));
  3238. continue;
  3239. }
  3240. }
  3241. else if (pszConfModifier != NULL)
  3242. continue;
  3243. /*
  3244. ** If we get this far then we have found the correct conference.
  3245. ** Go ahead and get the conference id and then break out of the
  3246. ** search loop.
  3247. */
  3248. conference_id = lpConf->GetConfID();
  3249. break;
  3250. }
  3251. return (conference_id);
  3252. }
  3253. //
  3254. // Called from the SAP window procedure.
  3255. //
  3256. void GCCController::
  3257. WndMsgHandler ( UINT uMsg )
  3258. {
  3259. if (GCTRL_REBUILD_CONF_POLL_LIST == uMsg)
  3260. {
  3261. if (m_fConfListChangePending)
  3262. {
  3263. CConf *pConf;
  3264. m_fConfListChangePending = FALSE;
  3265. m_ConfPollList.Clear();
  3266. // Delete any outstanding conference objects
  3267. m_ConfDeleteList.DeleteList();
  3268. // Create a new conference poll list
  3269. m_ConfList2.Reset();
  3270. while (NULL != (pConf = m_ConfList2.Iterate()))
  3271. {
  3272. m_ConfPollList.Append(pConf);
  3273. }
  3274. }
  3275. //
  3276. // Flush any pending PDU.
  3277. //
  3278. FlushOutgoingPDU();
  3279. }
  3280. else
  3281. {
  3282. ERROR_OUT(("GCCController::WndMsgHandler: invalid msg=%u", uMsg));
  3283. }
  3284. }
  3285. //
  3286. // Rebuild the conf poll list in the next tick.
  3287. //
  3288. void GCCController::
  3289. PostMsgToRebuildConfPollList ( void )
  3290. {
  3291. if (NULL != g_pControlSap)
  3292. {
  3293. ::PostMessage(g_pControlSap->GetHwnd(), GCTRL_REBUILD_CONF_POLL_LIST, 0, (LPARAM) this);
  3294. }
  3295. else
  3296. {
  3297. ERROR_OUT(("GCCController::PostMsgToRebuildConfPollList: invalid control sap"));
  3298. }
  3299. }
  3300. //
  3301. // Enumerate all conferences and flush their pending outgoing PDUs to MCS.
  3302. //
  3303. BOOL GCCController::
  3304. FlushOutgoingPDU ( void )
  3305. {
  3306. BOOL fFlushMoreData = FALSE;
  3307. CConf *pConf;
  3308. m_ConfPollList.Reset();
  3309. while (NULL != (pConf = m_ConfPollList.Iterate()))
  3310. {
  3311. fFlushMoreData |= pConf->FlushOutgoingPDU();
  3312. }
  3313. return fFlushMoreData;
  3314. }
  3315. //
  3316. // Called from MCS work thread.
  3317. //
  3318. BOOL GCCRetryFlushOutgoingPDU ( void )
  3319. {
  3320. BOOL fFlushMoreData = FALSE;
  3321. //
  3322. // Normally, we should get to here because it is very rarely
  3323. // that there is a backlog in MCS SendData. We are using local memory.
  3324. // It will be interesting to note that we are having a backlog here.
  3325. //
  3326. TRACE_OUT(("GCCRetryFlushOutgoingPDU: ============"));
  3327. //
  3328. // We have to enter GCC critical section because
  3329. // we are called from MCS work thread.
  3330. //
  3331. ::EnterCriticalSection(&g_csGCCProvider);
  3332. if (NULL != g_pGCCController)
  3333. {
  3334. fFlushMoreData = g_pGCCController->FlushOutgoingPDU();
  3335. }
  3336. ::LeaveCriticalSection(&g_csGCCProvider);
  3337. return fFlushMoreData;
  3338. }