Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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