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.

9683 lines
262 KiB

  1. #include "precomp.h"
  2. DEBUG_FILEZONE(ZONE_T120_SAP);
  3. /*
  4. * csap.cpp
  5. *
  6. * Copyright (c) 1995 by DataBeam Corporation, Lexington, KY
  7. *
  8. * Abstract:
  9. * This implementation file for the CControlSAP class contains Service
  10. * Access entry and exit points specific to the Node Controller. This
  11. * module inherits the common entry and exit points from the CBaseSap object.
  12. * On request and responses, parameter checking is performed to ensure that
  13. * they can be properly processed. Queuing and flushing of out bound
  14. * messages is taken care of in the base class.
  15. *
  16. * Protected Instance Variables:
  17. * See file SAP.CPP for definitions of instance variables.
  18. *
  19. * Private Instance Variables:
  20. * m_nJoinResponseTag:
  21. * This tag is used to match join request with join responses from the
  22. * node controller.
  23. *
  24. * m_JoinResponseTagList2:
  25. * This list keeps up with all the outstanding join response tags.
  26. * Tags are added to this list on a join indication and removed
  27. * from this list on a Join response.
  28. *
  29. * Private Member Functions:
  30. * IsNumericNameValid
  31. * This routine is used to validate a numeric string by checking to
  32. * make sure that none of the constraints imposed by the ASN.1
  33. * specification are violated.
  34. * IsTextNameValid
  35. * This routine is used to validate a text string by checking to make
  36. * sure that none of the constraints imposed by the ASN.1 specification
  37. * are violated.
  38. * QueueJoinIndication
  39. * This routine is used to place join indications into the queue of
  40. * messages to be delivered to the node controller.
  41. * HandleResourceFailure
  42. * This routine is used to clean up after any resource allocation
  43. * failures which may have occurred by sending a status indication
  44. * reporting the error.
  45. * FreeCallbackMessage
  46. * This routine is used to free up any data which was allocated in
  47. * order to send a callback message to the node controller.
  48. * RetrieveUserDataList
  49. * This routine is used to fill in a user data list using a
  50. * CUserDataListContainer container. The memory needed to hold the user data
  51. * will be allocated by this routine.
  52. *
  53. * Caveats:
  54. * None.
  55. *
  56. * Author:
  57. * blp
  58. */
  59. #include "ms_util.h"
  60. #include "csap.h"
  61. #include "conf.h"
  62. #include "gcontrol.h"
  63. // Defintions to support Join Response Tag hash list
  64. #define MAXIMUM_CONFERENCE_NAME_LENGTH 255
  65. // This is how much time the apps have to cleanup with MCS and GCC
  66. // after GCCCleanup is called. They may be terminated if they do not
  67. // cleanup in this amount of time.
  68. #define PROCESS_TERMINATE_TIME 5000
  69. /*
  70. * Static variables used within the C to C++ converter.
  71. *
  72. * Static_Controller
  73. * This is a pointer to the one-and-only controller created within the
  74. * GCC system. This object is created during
  75. * GCCStartup by the process
  76. * that is taking on the responsibilities of the node controller.
  77. */
  78. GCCController *g_pGCCController = NULL;
  79. CControlSAP *g_pControlSap = NULL;
  80. char g_szGCCWndClassName[24];
  81. // The MCS main thread handle
  82. extern HANDLE g_hMCSThread;
  83. /*
  84. * GCCError GCCStartup()
  85. *
  86. * Public
  87. *
  88. * Functional Description:
  89. * This API entry point is used to initialize the GCC DLL for action. It
  90. * creates an instance of the Controller, which controls all activity
  91. * during a GCC session. Note that there is only one instance of the
  92. * Controller, no matter how many applications are utilizing GCC
  93. * services.
  94. */
  95. GCCError WINAPI T120_CreateControlSAP
  96. (
  97. IT120ControlSAP **ppIControlSap,
  98. LPVOID pUserDefined,
  99. LPFN_T120_CONTROL_SAP_CB pfnControlSapCallback
  100. )
  101. {
  102. GCCError rc;
  103. if (NULL != ppIControlSap && NULL != pfnControlSapCallback)
  104. {
  105. if (NULL == g_pGCCController && NULL == g_pControlSap)
  106. {
  107. //
  108. // Create the window class for all the SAPs, including both
  109. // control SAP and applet SAP.
  110. //
  111. WNDCLASS wc;
  112. ::wsprintfA(g_szGCCWndClassName, "GCC%0lx_%0lx", (UINT) ::GetCurrentProcessId(), (UINT) ::GetTickCount());
  113. ASSERT(::lstrlenA(g_szGCCWndClassName) < sizeof(g_szGCCWndClassName));
  114. ::ZeroMemory(&wc, sizeof(wc));
  115. // wc.style = 0;
  116. wc.lpfnWndProc = SapNotifyWndProc;
  117. // wc.cbClsExtra = 0;
  118. // wc.cbWndExtra = 0;
  119. wc.hInstance = g_hDllInst;
  120. // wc.hIcon = NULL;
  121. // wc.hbrBackground = NULL;
  122. // wc.hCursor = NULL;
  123. // wc.lpszMenuName = NULL;
  124. wc.lpszClassName = g_szGCCWndClassName;
  125. if (::RegisterClass(&wc))
  126. {
  127. /*
  128. * This process is to become the node controller. Create a
  129. * controller object to carry out these duties.
  130. */
  131. DBG_SAVE_FILE_LINE
  132. g_pGCCController = new GCCController(&rc);
  133. if (NULL != g_pGCCController && GCC_NO_ERROR == rc)
  134. {
  135. /*
  136. ** Create the control SAP. Note that the Node Controller
  137. ** interface must be in place before this is called so
  138. ** that the control SAP can register itself.
  139. */
  140. DBG_SAVE_FILE_LINE
  141. g_pControlSap = new CControlSAP();
  142. if (NULL != g_pControlSap)
  143. {
  144. /*
  145. * Tell the application interface object what it
  146. * needs to know send callbacks to the node
  147. * controller.
  148. */
  149. TRACE_OUT(("T120_CreateControlSAP: controller successfully created"));
  150. *ppIControlSap = g_pControlSap;
  151. g_pControlSap->RegisterNodeController(pfnControlSapCallback, pUserDefined);
  152. }
  153. else
  154. {
  155. ERROR_OUT(("T120_CreateControlSAP: can't create CControlSAP"));
  156. rc = GCC_ALLOCATION_FAILURE;
  157. }
  158. }
  159. else
  160. {
  161. ERROR_OUT(("T120_CreateControlSAP: deleting faulty controller"));
  162. if (NULL != g_pGCCController)
  163. {
  164. g_pGCCController->Release();
  165. g_pGCCController = NULL;
  166. }
  167. rc = GCC_ALLOCATION_FAILURE;
  168. }
  169. }
  170. else
  171. {
  172. ERROR_OUT(("T120_CreateControlSAP: can't register window class, err=%u", (UINT) GetLastError()));
  173. rc = GCC_ALLOCATION_FAILURE;
  174. }
  175. }
  176. else
  177. {
  178. ERROR_OUT(("T120_CreateControlSAP: GCC has already been initialized, g_pControlSap=0x%x, g_pGCCCotnroller=0x%x", g_pControlSap, g_pGCCController));
  179. rc = GCC_ALREADY_INITIALIZED;
  180. }
  181. }
  182. else
  183. {
  184. ERROR_OUT(("T120_CreateControlSAP: null pointers, ppIControlSap=0x%x, pfnControlSapCallback=0x%x", ppIControlSap, pfnControlSapCallback));
  185. rc = GCC_INVALID_PARAMETER;
  186. }
  187. return rc;
  188. }
  189. /*
  190. * GCCError GCCCleanup()
  191. *
  192. * Public
  193. *
  194. * Functional Description:
  195. * This function deletes the controller (if one exists). It is VERY
  196. * important that only the routine that successfully called
  197. * GCCInitialize call this routine. Once this routine has been called,
  198. * all other GCC calls will fail.
  199. */
  200. void CControlSAP::ReleaseInterface ( void )
  201. {
  202. UnregisterNodeController();
  203. /*
  204. * Destroy the controller, which will clean up all
  205. * resources in use at this time. Then reset the flag
  206. * indicating that GCC is initialized (since it no
  207. * longer is).
  208. */
  209. TRACE_OUT(("GCCControlSap::ReleaseInterface: deleting controller"));
  210. g_pGCCController->Release();
  211. // This is how much time the apps have to cleanup with MCS and GCC
  212. // after GCCCleanup is called. They may be terminated if they do not
  213. // cleanup in this amount of time.
  214. if (WAIT_TIMEOUT == ::WaitForSingleObject(g_hMCSThread, PROCESS_TERMINATE_TIME))
  215. {
  216. WARNING_OUT(("GCCControlSap::ReleaseInterface: Timed out waiting for MCS thread to exit. Apps did not cleanup in time."));
  217. }
  218. ::CloseHandle(g_hMCSThread);
  219. g_hMCSThread = NULL;
  220. //
  221. // LONCHANC: We should free control sap after exiting the GCC work thread
  222. // because the work thread may still use the control sap to flush messages.
  223. //
  224. Release();
  225. ::UnregisterClass(g_szGCCWndClassName, g_hDllInst);
  226. }
  227. /*
  228. * CControlSAP()
  229. *
  230. * Public Function Description
  231. * This is the control sap constructor. It is responsible for
  232. * registering control sap with the application interface via
  233. * an owner callback.
  234. */
  235. CControlSAP::CControlSAP ( void )
  236. :
  237. CBaseSap(MAKE_STAMP_ID('C','S','a','p')),
  238. m_pfnNCCallback(NULL),
  239. m_pNCData(NULL),
  240. m_nJoinResponseTag(0),
  241. m_JoinResponseTagList2()
  242. {
  243. }
  244. /*
  245. * ~CControlSap()
  246. *
  247. * Public Function Description
  248. * This is the controller destructor. It is responsible for
  249. * flushing any pending upward bound messages and freeing all
  250. * the resources tied up with pending messages. Also it clears
  251. * the message queue and queue of command targets that are registered
  252. * with it. Actually all command targets at this point should
  253. * already have been unregistered but this is just a double check.
  254. */
  255. CControlSAP::~CControlSAP ( void )
  256. {
  257. //
  258. // No one should use this global pointer any more.
  259. //
  260. ASSERT(this == g_pControlSap);
  261. g_pControlSap = NULL;
  262. }
  263. void CControlSAP::PostCtrlSapMsg ( GCCCtrlSapMsgEx *pCtrlSapMsgEx )
  264. {
  265. //
  266. // LONCHANC: GCC WorkThread may also get to here.
  267. // For instance, the following stack trace happen during exiting a conference.
  268. // CControlSAP::AddToMessageQueue()
  269. // CControlSAP::ConfDisconnectConfirm()
  270. // CConf::DisconnectProviderIndication()
  271. // CConf::Owner-Callback()
  272. // MCSUser::FlushOutgoingPDU()
  273. // CConf::FlushOutgoingPDU()
  274. // GCCController::EventLoop()
  275. // GCCControllerThread(void * 0x004f1bf0)
  276. //
  277. ASSERT(NULL != m_hwndNotify);
  278. ::PostMessage(m_hwndNotify,
  279. CSAPMSG_BASE + (UINT) pCtrlSapMsgEx->Msg.message_type,
  280. (WPARAM) pCtrlSapMsgEx,
  281. (LPARAM) this);
  282. }
  283. #if defined(GCCNC_DIRECT_INDICATION) || defined(GCCNC_DIRECT_CONFIRM)
  284. void CControlSAP::SendCtrlSapMsg ( GCCCtrlSapMsg *pCtrlSapMsg )
  285. {
  286. extern DWORD g_dwNCThreadID;
  287. ASSERT(g_dwNCThreadID == ::GetCurrentThreadId());
  288. if (NULL != m_pfnNCCallback)
  289. {
  290. pCtrlSapMsg->user_defined = m_pNCData;
  291. (*m_pfnNCCallback)(pCtrlSapMsg);
  292. }
  293. }
  294. #endif // GCCNC_DIRECT_INDICATION || GCCNC_DIRECT_CONFIRM
  295. /*
  296. * void RegisterNodeController()
  297. *
  298. * Public Functional Description:
  299. * This routine sets up the node controller callback structure which
  300. * holds all the information needed by GCC to perform a node controller
  301. * callback. It also sets up the task switching window required to
  302. * perform the context switch.
  303. */
  304. /*
  305. * void UnregisterNodeController()
  306. *
  307. * Public Functional Description:
  308. */
  309. /*
  310. * ConfCreateRequest()
  311. *
  312. * Public Function Description
  313. * This function is called by the interface when it gets a conference
  314. * create request from the node controller. This function just passes this
  315. * request to the controller via an owner callback.
  316. */
  317. GCCError CControlSAP::ConfCreateRequest
  318. (
  319. GCCConfCreateRequest *pReq,
  320. GCCConfID *pnConfID
  321. )
  322. {
  323. GCCError rc;
  324. CONF_CREATE_REQUEST ccr;
  325. DebugEntry(CControlSAP::ConferenceCreateRequest);
  326. // initialize for cleanup
  327. ccr.convener_password = NULL;
  328. ccr.password = NULL;
  329. ccr.user_data_list = NULL;
  330. // copy security setting
  331. ccr.fSecure = pReq->fSecure;
  332. /*
  333. ** This section of the code performs all the necessary parameter
  334. ** checking.
  335. */
  336. // Check for invalid conference name
  337. if (pReq->Core.conference_name != NULL)
  338. {
  339. /*
  340. ** Do not allow non-numeric or zero length strings to get
  341. ** past this point.
  342. */
  343. if (pReq->Core.conference_name->numeric_string != NULL)
  344. {
  345. if (! IsNumericNameValid(pReq->Core.conference_name->numeric_string))
  346. {
  347. ERROR_OUT(("CControlSAP::ConfCreateRequest: invalid numeric name=%s", pReq->Core.conference_name->numeric_string));
  348. rc = GCC_INVALID_CONFERENCE_NAME;
  349. goto MyExit;
  350. }
  351. }
  352. else
  353. {
  354. ERROR_OUT(("CControlSAP::ConfCreateRequest: null numeric string"));
  355. rc = GCC_INVALID_CONFERENCE_NAME;
  356. goto MyExit;
  357. }
  358. if (pReq->Core.conference_name->text_string != NULL)
  359. {
  360. if (! IsTextNameValid(pReq->Core.conference_name->text_string))
  361. {
  362. ERROR_OUT(("CControlSAP::ConfCreateRequest: invalid text name=%s", pReq->Core.conference_name->text_string));
  363. rc = GCC_INVALID_CONFERENCE_NAME;
  364. goto MyExit;
  365. }
  366. }
  367. }
  368. else
  369. {
  370. ERROR_OUT(("CControlSAP::ConfCreateRequest: null conf name"));
  371. rc = GCC_INVALID_CONFERENCE_NAME;
  372. goto MyExit;
  373. }
  374. // Check for valid conference modifier
  375. if (pReq->Core.conference_modifier != NULL)
  376. {
  377. if (! IsNumericNameValid(pReq->Core.conference_modifier))
  378. {
  379. ERROR_OUT(("CControlSAP::ConfCreateRequest: invalid conf modifier=%s", pReq->Core.conference_modifier));
  380. rc = GCC_INVALID_CONFERENCE_MODIFIER;
  381. goto MyExit;
  382. }
  383. }
  384. // Check for valid convener password
  385. if (pReq->convener_password != NULL)
  386. {
  387. if (pReq->convener_password->numeric_string != NULL)
  388. {
  389. if (! IsNumericNameValid(pReq->convener_password->numeric_string))
  390. {
  391. ERROR_OUT(("CControlSAP::ConfCreateRequest: invalid convener password=%s", pReq->convener_password->numeric_string));
  392. rc = GCC_INVALID_PASSWORD;
  393. goto MyExit;
  394. }
  395. }
  396. else
  397. {
  398. ERROR_OUT(("CControlSAP::ConfCreateRequest: null convener password numeric string"));
  399. rc = GCC_INVALID_PASSWORD;
  400. goto MyExit;
  401. }
  402. // Construct the convener password container
  403. DBG_SAVE_FILE_LINE
  404. ccr.convener_password = new CPassword(pReq->convener_password, &rc);
  405. if (ccr.convener_password == NULL || GCC_NO_ERROR != rc)
  406. {
  407. ERROR_OUT(("CControlSAP::ConfCreateRequest: can't create convener password"));
  408. rc = GCC_ALLOCATION_FAILURE;
  409. goto MyExit;
  410. }
  411. }
  412. // Check for valid password
  413. if (pReq->password != NULL)
  414. {
  415. if (pReq->password->numeric_string != NULL)
  416. {
  417. if (! IsNumericNameValid(pReq->password->numeric_string))
  418. {
  419. ERROR_OUT(("CControlSAP::ConfCreateRequest: invalid password=%s", pReq->password->numeric_string));
  420. rc = GCC_INVALID_PASSWORD;
  421. goto MyExit;
  422. }
  423. }
  424. else
  425. {
  426. ERROR_OUT(("CControlSAP::ConfCreateRequest: null password numeric string"));
  427. rc = GCC_INVALID_PASSWORD;
  428. goto MyExit;
  429. }
  430. // Construct the password container
  431. DBG_SAVE_FILE_LINE
  432. ccr.password = new CPassword(pReq->password, &rc);
  433. if (ccr.password == NULL || GCC_NO_ERROR != rc)
  434. {
  435. ERROR_OUT(("CControlSAP::ConfCreateRequest: can't create password"));
  436. rc = GCC_ALLOCATION_FAILURE;
  437. goto MyExit;
  438. }
  439. }
  440. if (pReq->Core.connection_handle == NULL)
  441. {
  442. ERROR_OUT(("CControlSAP::ConfCreateRequest: bad connection handle"));
  443. rc = GCC_BAD_CONNECTION_HANDLE_POINTER;
  444. goto MyExit;
  445. }
  446. /*
  447. ** If no errors occurred start building the general purpose containers
  448. ** to be passed on.
  449. */
  450. // copy the core component which has the same representation in both API and internal
  451. ccr.Core = pReq->Core;
  452. // Construct the user data list container
  453. if (pReq->number_of_user_data_members != 0)
  454. {
  455. DBG_SAVE_FILE_LINE
  456. ccr.user_data_list = new CUserDataListContainer(pReq->number_of_user_data_members, pReq->user_data_list, &rc);
  457. if (ccr.user_data_list == NULL || GCC_NO_ERROR != rc)
  458. {
  459. ERROR_OUT(("CControlSAP::ConfCreateRequest: can't create user data list container"));
  460. rc = GCC_ALLOCATION_FAILURE;
  461. goto MyExit;
  462. }
  463. }
  464. // Perform the owner callback
  465. ::EnterCriticalSection(&g_csGCCProvider);
  466. rc = g_pGCCController->ConfCreateRequest(&ccr, pnConfID);
  467. ::LeaveCriticalSection(&g_csGCCProvider);
  468. MyExit:
  469. // Free up all the containers
  470. // Free up the convener password container
  471. if (ccr.convener_password != NULL)
  472. {
  473. ccr.convener_password->Release();
  474. }
  475. // Free up the password container
  476. if (ccr.password != NULL)
  477. {
  478. ccr.password->Release();
  479. }
  480. // Free up any memory used in callback
  481. if (ccr.user_data_list != NULL)
  482. {
  483. ccr.user_data_list->Release();
  484. }
  485. DebugExitINT(CControlSAP::ConferenceCreateRequest, rc);
  486. return rc;
  487. }
  488. /*
  489. * ConfCreateResponse ()
  490. *
  491. * Public Function Description
  492. * This function is called by the interface when it gets a conference
  493. * create response from the node controller, to be sent to the provider
  494. * that issued the conference create request. This function just passes
  495. * this request to the controller via an owner callback.
  496. */
  497. GCCError CControlSAP::ConfCreateResponse
  498. (
  499. GCCNumericString conference_modifier,
  500. GCCConfID conference_id,
  501. BOOL use_password_in_the_clear,
  502. PDomainParameters domain_parameters,
  503. UINT number_of_network_addresses,
  504. PGCCNetworkAddress * local_network_address_list,
  505. UINT number_of_user_data_members,
  506. PGCCUserData * user_data_list,
  507. GCCResult result
  508. )
  509. {
  510. GCCError rc = GCC_NO_ERROR;
  511. ConfCreateResponseInfo create_response_info;
  512. DebugEntry(CControlSAP::ConfCreateResponse);
  513. /*
  514. ** This section of the code performs all the necessary parameter
  515. ** checking.
  516. */
  517. // Check for valid conference modifier
  518. if (conference_modifier != NULL)
  519. {
  520. if (IsNumericNameValid(conference_modifier) == FALSE)
  521. {
  522. ERROR_OUT(("CControlSAP::ConfCreateResponse: invalid conf modifier"));
  523. rc = GCC_INVALID_CONFERENCE_MODIFIER;
  524. }
  525. }
  526. /*
  527. ** If no errors occurred fill in the info structure and pass it on to the
  528. ** owner object.
  529. */
  530. if (rc == GCC_NO_ERROR)
  531. {
  532. // Construct the user data list
  533. if (number_of_user_data_members != 0)
  534. {
  535. DBG_SAVE_FILE_LINE
  536. create_response_info.user_data_list = new CUserDataListContainer(
  537. number_of_user_data_members,
  538. user_data_list,
  539. &rc);
  540. if (create_response_info.user_data_list == NULL)
  541. {
  542. ERROR_OUT(("CControlSAP::ConfCreateResponse: can't create CUserDataListContainer"));
  543. rc = GCC_ALLOCATION_FAILURE;
  544. }
  545. }
  546. else
  547. {
  548. create_response_info.user_data_list = NULL;
  549. }
  550. if (rc == GCC_NO_ERROR)
  551. {
  552. // Fill in the conference create info structure and send it on
  553. create_response_info.conference_modifier = conference_modifier;
  554. create_response_info.conference_id = conference_id;
  555. create_response_info.use_password_in_the_clear =
  556. use_password_in_the_clear;
  557. create_response_info.domain_parameters = domain_parameters;
  558. create_response_info.number_of_network_addresses =
  559. number_of_network_addresses;
  560. create_response_info.network_address_list =
  561. local_network_address_list;
  562. create_response_info.result = result;
  563. // Perform the owner callback
  564. ::EnterCriticalSection(&g_csGCCProvider);
  565. rc = g_pGCCController->ConfCreateResponse(&create_response_info);
  566. ::LeaveCriticalSection(&g_csGCCProvider);
  567. }
  568. if (create_response_info.user_data_list != NULL)
  569. {
  570. create_response_info.user_data_list->Release();
  571. }
  572. }
  573. DebugExitINT(CControlSAP::ConfCreateResponse, rc);
  574. return rc;
  575. }
  576. /*
  577. * ConfQueryRequest ()
  578. *
  579. * Public Function Description
  580. * This function is called by the interface when it gets a conference
  581. * query request from the node controller. This function just passes
  582. * this request to the controller via an owner callback.
  583. */
  584. GCCError CControlSAP::ConfQueryRequest
  585. (
  586. GCCNodeType node_type,
  587. PGCCAsymmetryIndicator asymmetry_indicator,
  588. TransportAddress calling_address,
  589. TransportAddress called_address,
  590. BOOL fSecure,
  591. UINT number_of_user_data_members,
  592. PGCCUserData * user_data_list,
  593. PConnectionHandle connection_handle
  594. )
  595. {
  596. GCCError rc = GCC_NO_ERROR;
  597. ConfQueryRequestInfo conf_query_request_info;
  598. DebugEntry(CControlSAP::ConfQueryRequest);
  599. // Check for an invalid called address.
  600. if (called_address == NULL)
  601. {
  602. ERROR_OUT(("CControlSAP::ConfQueryRequest: invalid transport"));
  603. rc = GCC_INVALID_TRANSPORT;
  604. }
  605. // Check for an invalid connection handle.
  606. if (connection_handle == NULL)
  607. {
  608. ERROR_OUT(("CControlSAP::ConfQueryRequest: null connection handle"));
  609. rc = GCC_BAD_CONNECTION_HANDLE_POINTER;
  610. }
  611. // Check for a valid node type.
  612. if ((node_type != GCC_TERMINAL) &&
  613. (node_type != GCC_MULTIPORT_TERMINAL) &&
  614. (node_type != GCC_MCU))
  615. {
  616. ERROR_OUT(("CControlSAP::ConfQueryRequest: invalid node type=%u", (UINT) node_type));
  617. rc = GCC_INVALID_NODE_TYPE;
  618. }
  619. // Check for an invalid asymmetry indicator.
  620. if (asymmetry_indicator != NULL)
  621. {
  622. if ((asymmetry_indicator->asymmetry_type != GCC_ASYMMETRY_CALLER) &&
  623. (asymmetry_indicator->asymmetry_type != GCC_ASYMMETRY_CALLED) &&
  624. (asymmetry_indicator->asymmetry_type != GCC_ASYMMETRY_UNKNOWN))
  625. {
  626. ERROR_OUT(("CControlSAP::ConfQueryRequest: invalid asymmetry indicator=%u", (UINT) asymmetry_indicator->asymmetry_type));
  627. rc = GCC_INVALID_ASYMMETRY_INDICATOR;
  628. }
  629. }
  630. // Create user data container if necessary.
  631. if ((number_of_user_data_members != 0) &&
  632. (rc == GCC_NO_ERROR))
  633. {
  634. DBG_SAVE_FILE_LINE
  635. conf_query_request_info.user_data_list = new CUserDataListContainer (
  636. number_of_user_data_members,
  637. user_data_list,
  638. &rc);
  639. if (conf_query_request_info.user_data_list == NULL)
  640. {
  641. ERROR_OUT(("CControlSAP::ConfQueryRequest: can't create CUserDataListContainer"));
  642. rc = GCC_ALLOCATION_FAILURE;
  643. }
  644. }
  645. else
  646. {
  647. conf_query_request_info.user_data_list = NULL;
  648. }
  649. // Call back the controller to send the response.
  650. if (rc == GCC_NO_ERROR)
  651. {
  652. conf_query_request_info.node_type = node_type;
  653. conf_query_request_info.asymmetry_indicator = asymmetry_indicator;
  654. conf_query_request_info.calling_address = calling_address;
  655. conf_query_request_info.called_address = called_address;
  656. conf_query_request_info.connection_handle = connection_handle;
  657. conf_query_request_info.fSecure = fSecure;
  658. ::EnterCriticalSection(&g_csGCCProvider);
  659. rc = g_pGCCController->ConfQueryRequest(&conf_query_request_info);
  660. ::LeaveCriticalSection(&g_csGCCProvider);
  661. }
  662. if (conf_query_request_info.user_data_list != NULL)
  663. {
  664. conf_query_request_info.user_data_list->Release();
  665. }
  666. DebugExitINT(CControlSAP::ConfQueryRequest, rc);
  667. return rc;
  668. }
  669. void CControlSAP::CancelConfQueryRequest ( ConnectionHandle hQueryReqConn )
  670. {
  671. DebugEntry(CControlSAP::CancelConfQueryRequest);
  672. ::EnterCriticalSection(&g_csGCCProvider);
  673. g_pGCCController->CancelConfQueryRequest(hQueryReqConn);
  674. ::LeaveCriticalSection(&g_csGCCProvider);
  675. DebugExitVOID(CControlSAP::CancelConfQueryRequest);
  676. }
  677. /*
  678. * ConfQueryResponse ()
  679. *
  680. * Public Function Description
  681. * This function is called by the DLL interface when it gets a conference
  682. * query response from the node controller. This function just passes
  683. * this response to the controller via an owner callback.
  684. */
  685. GCCError CControlSAP::ConfQueryResponse
  686. (
  687. GCCResponseTag query_response_tag,
  688. GCCNodeType node_type,
  689. PGCCAsymmetryIndicator asymmetry_indicator,
  690. UINT number_of_user_data_members,
  691. PGCCUserData * user_data_list,
  692. GCCResult result
  693. )
  694. {
  695. GCCError rc = GCC_NO_ERROR;
  696. ConfQueryResponseInfo conf_query_response_info;
  697. DebugEntry(CControlSAP::ConfQueryResponse);
  698. // Check for a valid node type.
  699. if ((node_type != GCC_TERMINAL) &&
  700. (node_type != GCC_MULTIPORT_TERMINAL) &&
  701. (node_type != GCC_MCU))
  702. {
  703. ERROR_OUT(("CControlSAP::ConfQueryResponse: invalid node type=%u", (UINT) node_type));
  704. rc = GCC_INVALID_NODE_TYPE;
  705. }
  706. // Check for an invalid asymmetry indicator.
  707. if (asymmetry_indicator != NULL)
  708. {
  709. if ((asymmetry_indicator->asymmetry_type != GCC_ASYMMETRY_CALLER) &&
  710. (asymmetry_indicator->asymmetry_type != GCC_ASYMMETRY_CALLED) &&
  711. (asymmetry_indicator->asymmetry_type != GCC_ASYMMETRY_UNKNOWN))
  712. {
  713. ERROR_OUT(("CControlSAP::ConfQueryResponse: invalid asymmetry indicator=%u", (UINT) asymmetry_indicator->asymmetry_type));
  714. rc = GCC_INVALID_ASYMMETRY_INDICATOR;
  715. }
  716. }
  717. // Create user data container if necessary.
  718. if ((number_of_user_data_members != 0) &&
  719. (rc == GCC_NO_ERROR))
  720. {
  721. DBG_SAVE_FILE_LINE
  722. conf_query_response_info.user_data_list = new CUserDataListContainer(
  723. number_of_user_data_members,
  724. user_data_list,
  725. &rc);
  726. if (conf_query_response_info.user_data_list == NULL)
  727. {
  728. ERROR_OUT(("CControlSAP::ConfQueryResponse: can't create CUserDataListContainer"));
  729. rc = GCC_ALLOCATION_FAILURE;
  730. }
  731. }
  732. else
  733. {
  734. conf_query_response_info.user_data_list = NULL;
  735. }
  736. // Call back the controller to send the response.
  737. if (rc == GCC_NO_ERROR)
  738. {
  739. conf_query_response_info.query_response_tag = query_response_tag;
  740. conf_query_response_info.node_type = node_type;
  741. conf_query_response_info.asymmetry_indicator = asymmetry_indicator;
  742. conf_query_response_info.result = result;
  743. ::EnterCriticalSection(&g_csGCCProvider);
  744. rc = g_pGCCController->ConfQueryResponse(&conf_query_response_info);
  745. ::LeaveCriticalSection(&g_csGCCProvider);
  746. }
  747. // Free the data associated with the user data container.
  748. if (conf_query_response_info.user_data_list != NULL)
  749. {
  750. conf_query_response_info.user_data_list->Release();
  751. }
  752. DebugExitINT(CControlSAP::ConfQueryResponse, rc);
  753. return rc;
  754. }
  755. /*
  756. * AnnouncePresenceRequest()
  757. *
  758. * Public Function Description
  759. * This function is called by the interface when it gets an announce
  760. * presence request from the node controller. This function passes this
  761. * request on to the appropriate conference object as obtained from
  762. * the list of command targets that control sap maintains. The ConferenceID
  763. * passed in is used to index the list of command targets to get the
  764. * correct conference.
  765. */
  766. GCCError CControlSAP::AnnouncePresenceRequest
  767. (
  768. GCCConfID conference_id,
  769. GCCNodeType node_type,
  770. GCCNodeProperties node_properties,
  771. LPWSTR pwszNodeName,
  772. UINT number_of_participants,
  773. LPWSTR * participant_name_list,
  774. LPWSTR pwszSiteInfo,
  775. UINT number_of_network_addresses,
  776. PGCCNetworkAddress * network_address_list,
  777. LPOSTR alternative_node_id,
  778. UINT number_of_user_data_members,
  779. PGCCUserData * user_data_list
  780. )
  781. {
  782. GCCError rc = GCC_NO_ERROR;
  783. GCCNodeRecord node_record;
  784. DebugEntry(CControlSAP::AnnouncePresenceRequest);
  785. // Check for a valid node type
  786. if ((node_type != GCC_TERMINAL) &&
  787. (node_type != GCC_MULTIPORT_TERMINAL) &&
  788. (node_type != GCC_MCU))
  789. {
  790. ERROR_OUT(("CControlSAP::AnnouncePresenceRequest: invalid node type=%u", node_type));
  791. rc = GCC_INVALID_NODE_TYPE;
  792. }
  793. // Check for valid node properties.
  794. if ((node_properties != GCC_PERIPHERAL_DEVICE) &&
  795. (node_properties != GCC_MANAGEMENT_DEVICE) &&
  796. (node_properties != GCC_PERIPHERAL_AND_MANAGEMENT_DEVICE) &&
  797. (node_properties != GCC_NEITHER_PERIPHERAL_NOR_MANAGEMENT))
  798. {
  799. ERROR_OUT(("CControlSAP::AnnouncePresenceRequest: invalid node properties=%u", node_properties));
  800. rc = GCC_INVALID_NODE_PROPERTIES;
  801. }
  802. // Check to make sure the conference exists.
  803. if (rc == GCC_NO_ERROR)
  804. {
  805. CConf *pConf;
  806. ::EnterCriticalSection(&g_csGCCProvider);
  807. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  808. {
  809. // Fill in the node record and pass it on.
  810. node_record.node_type = node_type;
  811. node_record.node_properties = node_properties;
  812. node_record.node_name = pwszNodeName;
  813. node_record.number_of_participants = (USHORT)number_of_participants;
  814. node_record.participant_name_list = participant_name_list;
  815. node_record.site_information = pwszSiteInfo;
  816. node_record.number_of_network_addresses = number_of_network_addresses;
  817. node_record.network_address_list = network_address_list;
  818. node_record.alternative_node_id = alternative_node_id;
  819. node_record.number_of_user_data_members = (USHORT)number_of_user_data_members;
  820. node_record.user_data_list = user_data_list;
  821. // Pass the record on to the conference object.
  822. rc = pConf->ConfAnnouncePresenceRequest(&node_record);
  823. }
  824. else
  825. {
  826. TRACE_OUT(("CControlSAP::AnnouncePresenceRequest: invalid conference ID=%u", (UINT) conference_id));
  827. rc = GCC_INVALID_CONFERENCE;
  828. }
  829. ::LeaveCriticalSection(&g_csGCCProvider);
  830. }
  831. DebugExitINT(CControlSAP::AnnouncePresenceRequest, rc);
  832. return rc;
  833. }
  834. /*
  835. * ConfDisconnectRequest()
  836. *
  837. * Public Function Description
  838. * This function is called by the interface when it gets a conference
  839. * disconnect request from the node controller. This function passes the
  840. * request on to the appropriate conference object as obtained from
  841. * the list of command targets that the control sap maintains.
  842. */
  843. GCCError CControlSAP::ConfDisconnectRequest ( GCCConfID conference_id )
  844. {
  845. GCCError rc;
  846. CConf *pConf;
  847. DebugEntry(CControlSAP::ConfDisconnectRequest);
  848. ::EnterCriticalSection(&g_csGCCProvider);
  849. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  850. {
  851. // Pass the disconnect on to the conference object.
  852. rc = pConf->ConfDisconnectRequest();
  853. }
  854. else
  855. {
  856. WARNING_OUT(("CControlSAP::ConfDisconnectRequest: invalid conference ID=%u", (UINT) conference_id));
  857. rc = GCC_INVALID_CONFERENCE;
  858. }
  859. ::LeaveCriticalSection(&g_csGCCProvider);
  860. DebugExitINT(CControlSAP::ConfDisconnectRequest, rc);
  861. return rc;
  862. }
  863. /*
  864. * ConfTerminateRequest()
  865. *
  866. * Public Function Description
  867. * This function is called by the interface when it gets a conference
  868. * terminate request from the node controller. This function passes the
  869. * request on to the appropriate conference object as obtained from
  870. * the list of command targets that the control sap maintains.
  871. */
  872. #ifdef JASPER
  873. GCCError CControlSAP::ConfTerminateRequest
  874. (
  875. GCCConfID conference_id,
  876. GCCReason reason
  877. )
  878. {
  879. GCCError rc;
  880. CConf *pConf;
  881. DebugEntry(CControlSAP::ConfTerminateRequest);
  882. ::EnterCriticalSection(&g_csGCCProvider);
  883. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  884. {
  885. // Pass the disconnect on to the conference object
  886. rc = pConf->ConfTerminateRequest(reason);
  887. }
  888. else
  889. {
  890. WARNING_OUT(("CControlSAP::ConfTerminateRequest: invalid conference ID=%u", (UINT) conference_id));
  891. rc = GCC_INVALID_CONFERENCE;
  892. }
  893. ::LeaveCriticalSection(&g_csGCCProvider);
  894. DebugExitINT(CControlSAP::ConfTerminateRequest, rc);
  895. return rc;
  896. }
  897. #endif // JASPER
  898. /*
  899. * ConfEjectUserRequest()
  900. *
  901. * Public Function Description
  902. * This function is called by the interface when it gets a conference
  903. * eject user request from the node controller. This function passes the
  904. * request on to the appropriate conference object as obtained from
  905. * the list of command targets that the control sap maintains.
  906. */
  907. GCCError CControlSAP::ConfEjectUserRequest
  908. (
  909. GCCConfID conference_id,
  910. UserID ejected_node_id,
  911. GCCReason reason
  912. )
  913. {
  914. GCCError rc;
  915. CConf *pConf;
  916. DebugEntry(CControlSAP::ConfEjectUserRequest);
  917. ::EnterCriticalSection(&g_csGCCProvider);
  918. if (ejected_node_id < MINIMUM_USER_ID_VALUE)
  919. {
  920. ERROR_OUT(("CControlSAP::ConfEjectUserRequest: invalid mcs user ID=%u", (UINT) ejected_node_id));
  921. rc = GCC_INVALID_MCS_USER_ID;
  922. }
  923. else
  924. // Check to make sure the conference exists.
  925. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  926. {
  927. // Pass the command on to the conference object
  928. rc = pConf->ConfEjectUserRequest(ejected_node_id, reason);
  929. }
  930. else
  931. {
  932. WARNING_OUT(("CControlSAP::ConfEjectUserRequest: invalid conference ID=%u", (UINT) conference_id));
  933. rc = GCC_INVALID_CONFERENCE;
  934. }
  935. ::LeaveCriticalSection(&g_csGCCProvider);
  936. DebugExitINT(CControlSAP::ConfEjectUserRequest, rc);
  937. return rc;
  938. }
  939. /*
  940. * ConfJoinRequest ()
  941. *
  942. * Public Function Description
  943. * This function is called by the interface when it gets a conference
  944. * join request from the node controller, to be sent to the top provider
  945. * either directly or through a directly connected intermediate provider.
  946. * This function just passes this request to the controller via an owner
  947. * callback.
  948. */
  949. GCCError CControlSAP::ConfJoinRequest
  950. (
  951. PGCCConferenceName conference_name,
  952. GCCNumericString called_node_modifier,
  953. GCCNumericString calling_node_modifier,
  954. PGCCPassword convener_password,
  955. PGCCChallengeRequestResponse password_challenge,
  956. LPWSTR pwszCallerID,
  957. TransportAddress calling_address,
  958. TransportAddress called_address,
  959. BOOL fSecure,
  960. PDomainParameters domain_parameters,
  961. UINT number_of_network_addresses,
  962. PGCCNetworkAddress * local_network_address_list,
  963. UINT number_of_user_data_members,
  964. PGCCUserData * user_data_list,
  965. PConnectionHandle connection_handle,
  966. GCCConfID * pnConfID
  967. )
  968. {
  969. GCCError rc = GCC_NO_ERROR;
  970. ConfJoinRequestInfo join_request_info;
  971. DebugEntry(CControlSAP::ConfJoinRequest);
  972. // Check for invalid conference name
  973. if (conference_name != NULL)
  974. {
  975. /*
  976. ** Check to make sure a valid conference name exists.
  977. */
  978. if ((conference_name->numeric_string == NULL) &&
  979. (conference_name->text_string == NULL))
  980. {
  981. ERROR_OUT(("CControlSAP::ConfJoinRequest: invalid conference name (1)"));
  982. rc = GCC_INVALID_CONFERENCE_NAME;
  983. }
  984. /*
  985. ** If both numeric and text versions of the conference name exist,
  986. ** make sure they are both valid.
  987. */
  988. else if ((conference_name->numeric_string != NULL) &&
  989. (conference_name->text_string != NULL))
  990. {
  991. if ((IsNumericNameValid(conference_name->numeric_string) == FALSE)
  992. || (IsTextNameValid(conference_name->text_string) == FALSE))
  993. {
  994. ERROR_OUT(("CControlSAP::ConfJoinRequest: invalid conference name (2)"));
  995. rc = GCC_INVALID_CONFERENCE_NAME;
  996. }
  997. }
  998. /*
  999. ** If only a numeric version of the conference name is provided, check
  1000. ** to make sure it is valid.
  1001. */
  1002. else if (conference_name->numeric_string != NULL)
  1003. {
  1004. if (IsNumericNameValid(conference_name->numeric_string) == FALSE)
  1005. {
  1006. ERROR_OUT(("CControlSAP::ConfJoinRequest: invalid conference name (3)"));
  1007. rc = GCC_INVALID_CONFERENCE_NAME;
  1008. }
  1009. }
  1010. /*
  1011. ** If only a text version of the conference name is provided, check to
  1012. ** make sure it is valid.
  1013. */
  1014. else
  1015. {
  1016. if (IsTextNameValid(conference_name->text_string) == FALSE)
  1017. {
  1018. ERROR_OUT(("CControlSAP::ConfJoinRequest: invalid conference name (4)"));
  1019. rc = GCC_INVALID_CONFERENCE_NAME;
  1020. }
  1021. }
  1022. }
  1023. else
  1024. {
  1025. ERROR_OUT(("CControlSAP::ConfJoinRequest: invalid conference name (5)"));
  1026. rc = GCC_INVALID_CONFERENCE_NAME;
  1027. }
  1028. // Check for valid called_node_modifier.
  1029. if (called_node_modifier != NULL)
  1030. {
  1031. if (IsNumericNameValid(called_node_modifier) == FALSE)
  1032. {
  1033. ERROR_OUT(("CControlSAP::ConfJoinRequest: invalid called node modifier"));
  1034. rc = GCC_INVALID_CONFERENCE_MODIFIER;
  1035. }
  1036. }
  1037. // Check for valid calling_node_modifier
  1038. if (calling_node_modifier != NULL)
  1039. {
  1040. if (IsNumericNameValid(calling_node_modifier) == FALSE)
  1041. {
  1042. ERROR_OUT(("CControlSAP::ConfJoinRequest: invalid calling node modifier"));
  1043. rc = GCC_INVALID_CONFERENCE_MODIFIER;
  1044. }
  1045. }
  1046. // Check for valid convener password
  1047. if (convener_password != NULL)
  1048. {
  1049. if (convener_password->numeric_string != NULL)
  1050. {
  1051. if (IsNumericNameValid(convener_password->numeric_string) == FALSE)
  1052. {
  1053. ERROR_OUT(("CControlSAP::ConfJoinRequest: invalid convener password"));
  1054. rc = GCC_INVALID_PASSWORD;
  1055. }
  1056. }
  1057. else
  1058. {
  1059. ERROR_OUT(("CControlSAP::ConfJoinRequest: null convener password"));
  1060. rc = GCC_INVALID_PASSWORD;
  1061. }
  1062. }
  1063. if (connection_handle == NULL)
  1064. {
  1065. ERROR_OUT(("CControlSAP::ConfJoinRequest: null connection handle"));
  1066. rc = GCC_BAD_CONNECTION_HANDLE_POINTER;
  1067. }
  1068. if (called_address == NULL)
  1069. {
  1070. ERROR_OUT(("CControlSAP::ConfJoinRequest: null transport address"));
  1071. rc = GCC_INVALID_TRANSPORT_ADDRESS;
  1072. }
  1073. /*
  1074. ** If no errors occurred start building the general purpose containers
  1075. ** to be passed on.
  1076. */
  1077. if (rc == GCC_NO_ERROR)
  1078. {
  1079. // Construct a convener password container
  1080. if (convener_password != NULL)
  1081. {
  1082. DBG_SAVE_FILE_LINE
  1083. join_request_info.convener_password = new CPassword(convener_password, &rc);
  1084. if (join_request_info.convener_password == NULL)
  1085. {
  1086. ERROR_OUT(("CControlSAP::ConfJoinRequest: can't create CPassword (1)"));
  1087. rc = GCC_ALLOCATION_FAILURE;
  1088. }
  1089. }
  1090. else
  1091. {
  1092. join_request_info.convener_password = NULL;
  1093. }
  1094. // Construct a password challenge container
  1095. if ((password_challenge != NULL) && (rc == GCC_NO_ERROR))
  1096. {
  1097. DBG_SAVE_FILE_LINE
  1098. join_request_info.password_challenge = new CPassword(password_challenge, &rc);
  1099. if (join_request_info.password_challenge == NULL)
  1100. {
  1101. ERROR_OUT(("CControlSAP::ConfJoinRequest: can't create CPassword (2)"));
  1102. rc = GCC_ALLOCATION_FAILURE;
  1103. }
  1104. }
  1105. else
  1106. {
  1107. join_request_info.password_challenge = NULL;
  1108. }
  1109. // Construct the user data list
  1110. if ((number_of_user_data_members != 0) &&
  1111. (rc == GCC_NO_ERROR))
  1112. {
  1113. DBG_SAVE_FILE_LINE
  1114. join_request_info.user_data_list = new CUserDataListContainer(
  1115. number_of_user_data_members,
  1116. user_data_list,
  1117. &rc);
  1118. if (join_request_info.user_data_list == NULL)
  1119. {
  1120. ERROR_OUT(("CControlSAP::ConfJoinRequest: can't create CUserDataListContainer"));
  1121. rc = GCC_ALLOCATION_FAILURE;
  1122. }
  1123. }
  1124. else
  1125. {
  1126. join_request_info.user_data_list = NULL;
  1127. }
  1128. /*
  1129. ** If all the containers were successfully created go ahead and
  1130. ** fill in the rest of the create request info structure and pass
  1131. ** it on to the owner object.
  1132. */
  1133. if (rc == GCC_NO_ERROR)
  1134. {
  1135. join_request_info.conference_name = conference_name;
  1136. join_request_info.called_node_modifier = called_node_modifier;
  1137. join_request_info.calling_node_modifier =calling_node_modifier;
  1138. join_request_info.pwszCallerID = pwszCallerID;
  1139. join_request_info.calling_address = calling_address;
  1140. join_request_info.called_address = called_address;
  1141. join_request_info.fSecure = fSecure;
  1142. join_request_info.domain_parameters = domain_parameters;
  1143. join_request_info.number_of_network_addresses = number_of_network_addresses;
  1144. join_request_info.local_network_address_list = local_network_address_list;
  1145. join_request_info.connection_handle = connection_handle;
  1146. ::EnterCriticalSection(&g_csGCCProvider);
  1147. rc = g_pGCCController->ConfJoinRequest(&join_request_info, pnConfID);
  1148. ::LeaveCriticalSection(&g_csGCCProvider);
  1149. }
  1150. // Free up all the containers
  1151. // Free up the convener password container
  1152. if (join_request_info.convener_password != NULL)
  1153. {
  1154. join_request_info.convener_password->Release();
  1155. }
  1156. // Free up the password container
  1157. if (join_request_info.password_challenge != NULL)
  1158. {
  1159. join_request_info.password_challenge->Release();
  1160. }
  1161. // Free up any memory used in callback
  1162. if (join_request_info.user_data_list != NULL)
  1163. {
  1164. join_request_info.user_data_list->Release();
  1165. }
  1166. }
  1167. DebugExitINT(CControlSAP::ConfJoinRequest, rc);
  1168. return rc;
  1169. }
  1170. /*
  1171. * ConfJoinResponse ()
  1172. *
  1173. * Public Function Description
  1174. * This function is called by the interface when it gets a conference
  1175. * join response from the node controller. This routine is responsible
  1176. * for routing the response to either the conference that made the
  1177. * request or the controller. Responses which are routed to a conference
  1178. * are associated with requests that originate at a subnode that is a
  1179. * node removed from the Top Provider.
  1180. */
  1181. GCCError CControlSAP::ConfJoinResponse
  1182. (
  1183. GCCResponseTag join_response_tag,
  1184. PGCCChallengeRequestResponse password_challenge,
  1185. UINT number_of_user_data_members,
  1186. PGCCUserData * user_data_list,
  1187. GCCResult result
  1188. )
  1189. {
  1190. GCCError rc = GCC_NO_ERROR;
  1191. PJoinResponseStructure join_info;
  1192. CPassword *password_challenge_container = NULL;
  1193. CUserDataListContainer *user_data_container = NULL;
  1194. DebugEntry(CControlSAP::ConfJoinResponse);
  1195. ::EnterCriticalSection(&g_csGCCProvider);
  1196. if (NULL != (join_info = m_JoinResponseTagList2.Find(join_response_tag)))
  1197. {
  1198. /*
  1199. ** First create the data containers used in the join response.
  1200. */
  1201. // Set up the password challenge container
  1202. if (password_challenge != NULL)
  1203. {
  1204. DBG_SAVE_FILE_LINE
  1205. password_challenge_container = new CPassword(password_challenge, &rc);
  1206. if (password_challenge_container == NULL)
  1207. {
  1208. ERROR_OUT(("CControlSAP::ConfJoinResponse: can't create CPassword"));
  1209. rc = GCC_ALLOCATION_FAILURE;
  1210. }
  1211. }
  1212. // Set up the user data list container
  1213. if ((number_of_user_data_members != 0) && (rc == GCC_NO_ERROR))
  1214. {
  1215. DBG_SAVE_FILE_LINE
  1216. user_data_container = new CUserDataListContainer(number_of_user_data_members, user_data_list, &rc);
  1217. if (user_data_container == NULL)
  1218. {
  1219. ERROR_OUT(("CControlSAP::ConfJoinResponse: can't create CUserDataListContainer"));
  1220. rc = GCC_ALLOCATION_FAILURE;
  1221. }
  1222. }
  1223. if (rc == GCC_NO_ERROR)
  1224. {
  1225. if (join_info->command_target_call == FALSE)
  1226. {
  1227. ConfJoinResponseInfo join_response_info;
  1228. /*
  1229. ** Since the request originated from the Owner Object the
  1230. ** response gets routed to the Owner Object.
  1231. */
  1232. join_response_info.password_challenge =
  1233. password_challenge_container;
  1234. join_response_info.conference_id = join_info->conference_id;
  1235. join_response_info.connection_handle =
  1236. join_info->connection_handle;
  1237. join_response_info.user_data_list = user_data_container;
  1238. join_response_info.result = result;
  1239. rc = g_pGCCController->ConfJoinIndResponse(&join_response_info);
  1240. }
  1241. else
  1242. {
  1243. CConf *pConf;
  1244. /*
  1245. ** If the conference is terminated before the conference join
  1246. ** is responded to, a GCC_INVALID_CONFERENCE errror will occur.
  1247. */
  1248. if (NULL != (pConf = g_pGCCController->GetConfObject(join_info->conference_id)))
  1249. {
  1250. rc = pConf->ConfJoinReqResponse(
  1251. join_info->user_id,
  1252. password_challenge_container,
  1253. user_data_container,
  1254. result);
  1255. }
  1256. else
  1257. {
  1258. WARNING_OUT(("CControlSAP::ConfJoinResponse: invalid conference ID=%u", (UINT) join_info->conference_id));
  1259. rc = GCC_INVALID_CONFERENCE;
  1260. // If this error occurs go ahead and cleanup up
  1261. m_JoinResponseTagList2.Remove(join_response_tag);
  1262. delete join_info;
  1263. }
  1264. }
  1265. }
  1266. /*
  1267. ** Remove the join information structure from the join response list
  1268. ** if no error is returned.
  1269. */
  1270. if (rc == GCC_NO_ERROR)
  1271. {
  1272. m_JoinResponseTagList2.Remove(join_response_tag);
  1273. delete join_info;
  1274. }
  1275. // Free up all the containers
  1276. // Free up the password challenge container
  1277. if (password_challenge_container != NULL)
  1278. {
  1279. password_challenge_container->Release();
  1280. }
  1281. // Free up any memory used in callback
  1282. if (user_data_container != NULL)
  1283. {
  1284. user_data_container->Release();
  1285. }
  1286. }
  1287. else
  1288. {
  1289. rc = GCC_INVALID_JOIN_RESPONSE_TAG;
  1290. }
  1291. ::LeaveCriticalSection(&g_csGCCProvider);
  1292. DebugExitINT(CControlSAP::ConfJoinResponse, rc);
  1293. return rc;
  1294. }
  1295. /*
  1296. * ConfInviteRequest ()
  1297. *
  1298. * Public Function Description
  1299. * This function is called by the interface when it gets a conference
  1300. * invite request from the node controller. This function passes the
  1301. * request on to the appropriate conference object as obtained from
  1302. * the list of command targets that the control sap maintains.
  1303. */
  1304. GCCError CControlSAP::ConfInviteRequest
  1305. (
  1306. GCCConfID conference_id,
  1307. LPWSTR pwszCallerID,
  1308. TransportAddress calling_address,
  1309. TransportAddress called_address,
  1310. BOOL fSecure,
  1311. UINT number_of_user_data_members,
  1312. PGCCUserData * user_data_list,
  1313. PConnectionHandle connection_handle
  1314. )
  1315. {
  1316. GCCError rc = GCC_NO_ERROR;
  1317. CUserDataListContainer *user_data_list_ptr = NULL;
  1318. DebugEntry(CControlSAP::ConfInviteRequest);
  1319. if (called_address == NULL)
  1320. {
  1321. ERROR_OUT(("CControlSAP::ConfInviteRequest: null called address"));
  1322. rc = GCC_INVALID_TRANSPORT_ADDRESS;
  1323. }
  1324. if (connection_handle == NULL)
  1325. {
  1326. ERROR_OUT(("CControlSAP::ConfInviteRequest: null connection handle"));
  1327. rc = GCC_BAD_CONNECTION_HANDLE_POINTER;
  1328. }
  1329. if (rc == GCC_NO_ERROR)
  1330. {
  1331. CConf *pConf;
  1332. ::EnterCriticalSection(&g_csGCCProvider);
  1333. // Check to make sure the conference exists.
  1334. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  1335. {
  1336. // Construct the user data list container
  1337. if (number_of_user_data_members != 0)
  1338. {
  1339. DBG_SAVE_FILE_LINE
  1340. user_data_list_ptr = new CUserDataListContainer(number_of_user_data_members, user_data_list, &rc);
  1341. if (user_data_list_ptr == NULL)
  1342. {
  1343. ERROR_OUT(("CControlSAP::ConfInviteRequest: can't create CUserDataListContainer"));
  1344. rc = GCC_ALLOCATION_FAILURE;
  1345. }
  1346. }
  1347. // Send the request on to the conference object.
  1348. if (rc == GCC_NO_ERROR)
  1349. {
  1350. rc = pConf->ConfInviteRequest(pwszCallerID,
  1351. calling_address,
  1352. called_address,
  1353. fSecure,
  1354. user_data_list_ptr,
  1355. connection_handle);
  1356. }
  1357. // Free up any memory used in callback
  1358. if (user_data_list_ptr != NULL)
  1359. {
  1360. user_data_list_ptr->Release();
  1361. }
  1362. }
  1363. else
  1364. {
  1365. rc = GCC_INVALID_CONFERENCE;
  1366. }
  1367. ::LeaveCriticalSection(&g_csGCCProvider);
  1368. }
  1369. DebugExitINT(CControlSAP::ConfInviteRequest, rc);
  1370. return rc;
  1371. }
  1372. void CControlSAP::CancelInviteRequest
  1373. (
  1374. GCCConfID nConfID,
  1375. ConnectionHandle hInviteReqConn
  1376. )
  1377. {
  1378. CConf *pConf;
  1379. DebugEntry(CControlSAP::CancelInviteRequest);
  1380. ::EnterCriticalSection(&g_csGCCProvider);
  1381. // Check to make sure the conference exists.
  1382. if (NULL != (pConf = g_pGCCController->GetConfObject(nConfID)))
  1383. {
  1384. pConf->CancelInviteRequest(hInviteReqConn);
  1385. }
  1386. ::LeaveCriticalSection(&g_csGCCProvider);
  1387. DebugExitVOID(CControlSAP::CancelInviteRequest);
  1388. }
  1389. GCCError CControlSAP::GetParentNodeID
  1390. (
  1391. GCCConfID nConfID,
  1392. GCCNodeID *pnidParent
  1393. )
  1394. {
  1395. GCCError rc = T120_INVALID_PARAMETER;
  1396. CConf *pConf;
  1397. DebugEntry(CControlSAP::GetParentNodeID);
  1398. if (NULL != pnidParent)
  1399. {
  1400. ::EnterCriticalSection(&g_csGCCProvider);
  1401. // Check to make sure the conference exists.
  1402. if (NULL != (pConf = g_pGCCController->GetConfObject(nConfID)))
  1403. {
  1404. *pnidParent = pConf->GetParentNodeID();
  1405. rc = GCC_NO_ERROR;
  1406. }
  1407. ::LeaveCriticalSection(&g_csGCCProvider);
  1408. }
  1409. DebugExitINT(CControlSAP::GetParentNodeID, rc);
  1410. return rc;
  1411. }
  1412. /*
  1413. * ConfInviteResponse ()
  1414. *
  1415. * Public Function Description
  1416. * This function is called by the interface when it gets a conference
  1417. * invite response from the node controller. This function passes the
  1418. * response on to the appropriate conference object as obtained from
  1419. * the list of command targets that the control sap maintains.
  1420. */
  1421. GCCError CControlSAP::ConfInviteResponse
  1422. (
  1423. GCCConfID conference_id,
  1424. GCCNumericString conference_modifier,
  1425. BOOL fSecure,
  1426. PDomainParameters domain_parameters,
  1427. UINT number_of_network_addresses,
  1428. PGCCNetworkAddress * local_network_address_list,
  1429. UINT number_of_user_data_members,
  1430. PGCCUserData * user_data_list,
  1431. GCCResult result
  1432. )
  1433. {
  1434. GCCError rc = GCC_NO_ERROR;
  1435. ConfInviteResponseInfo invite_response_info;
  1436. DebugEntry(CControlSAP::ConfInviteResponse);
  1437. // Check for invalid conference name
  1438. if (conference_modifier != NULL)
  1439. {
  1440. if (IsNumericNameValid(conference_modifier) == FALSE)
  1441. {
  1442. ERROR_OUT(("CControlSAP::ConfInviteResponse: invalid conference modifier"));
  1443. rc = GCC_INVALID_CONFERENCE_MODIFIER;
  1444. }
  1445. }
  1446. /*
  1447. ** If no errors occurred fill in the info structure and pass it on to the
  1448. ** owner object.
  1449. */
  1450. if (rc == GCC_NO_ERROR)
  1451. {
  1452. // Construct the user data list
  1453. if (number_of_user_data_members != 0)
  1454. {
  1455. DBG_SAVE_FILE_LINE
  1456. invite_response_info.user_data_list = new CUserDataListContainer(number_of_user_data_members, user_data_list, &rc);
  1457. if (invite_response_info.user_data_list == NULL)
  1458. {
  1459. ERROR_OUT(("CControlSAP::ConfInviteResponse: can't create CUserDataListContainer"));
  1460. rc = GCC_ALLOCATION_FAILURE;
  1461. }
  1462. }
  1463. else
  1464. {
  1465. invite_response_info.user_data_list = NULL;
  1466. }
  1467. if (rc == GCC_NO_ERROR)
  1468. {
  1469. invite_response_info.conference_id = conference_id;
  1470. invite_response_info.conference_modifier = conference_modifier;
  1471. invite_response_info.fSecure = fSecure;
  1472. invite_response_info.domain_parameters = domain_parameters;
  1473. invite_response_info.number_of_network_addresses =
  1474. number_of_network_addresses;
  1475. invite_response_info.local_network_address_list =
  1476. local_network_address_list;
  1477. invite_response_info.result = result;
  1478. // Call back the controller to issue invite response.
  1479. ::EnterCriticalSection(&g_csGCCProvider);
  1480. rc = g_pGCCController->ConfInviteResponse(&invite_response_info);
  1481. ::LeaveCriticalSection(&g_csGCCProvider);
  1482. }
  1483. // Free up the data associated with the user data container.
  1484. if (invite_response_info.user_data_list != NULL)
  1485. {
  1486. invite_response_info.user_data_list->Release();
  1487. }
  1488. }
  1489. DebugExitINT(CControlSAP::ConfInviteResponse, rc);
  1490. return rc;
  1491. }
  1492. /*
  1493. * ConfLockRequest ()
  1494. *
  1495. * Public Function Description:
  1496. * This function is called by the interface when it gets a conference
  1497. * lock request from the node controller. This function passes the
  1498. * request on to the appropriate conference object as obtained from
  1499. * the list of command targets that the control sap maintains.
  1500. */
  1501. #ifdef JASPER
  1502. GCCError CControlSAP::ConfLockRequest ( GCCConfID conference_id )
  1503. {
  1504. GCCError rc;
  1505. CConf *pConf;
  1506. DebugEntry(CControlSAP::ConfLockRequest);
  1507. ::EnterCriticalSection(&g_csGCCProvider);
  1508. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  1509. {
  1510. rc = pConf->ConfLockRequest();
  1511. }
  1512. else
  1513. {
  1514. WARNING_OUT(("CControlSAP::ConfInviteResponse: invalid conference ID=%u", (UINT) conference_id));
  1515. rc = GCC_INVALID_CONFERENCE;
  1516. }
  1517. ::LeaveCriticalSection(&g_csGCCProvider);
  1518. DebugExitINT(CControlSAP::ConfLockRequest, rc);
  1519. return rc;
  1520. }
  1521. #endif // JASPER
  1522. /*
  1523. * ConfLockResponse ()
  1524. *
  1525. * Public Function Description:
  1526. * This function is called by the interface when it gets a conference
  1527. * lock response from the node controller. This function passes the
  1528. * response on to the appropriate conference object as obtained from
  1529. * the list of command targets that the control sap maintains.
  1530. */
  1531. GCCError CControlSAP::ConfLockResponse
  1532. (
  1533. GCCConfID conference_id,
  1534. UserID requesting_node,
  1535. GCCResult result
  1536. )
  1537. {
  1538. GCCError rc;
  1539. CConf *pConf;
  1540. DebugEntry(CControlSAP::ConfLockResponse);
  1541. ::EnterCriticalSection(&g_csGCCProvider);
  1542. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  1543. {
  1544. rc = pConf->ConfLockResponse(requesting_node, result);
  1545. }
  1546. else
  1547. {
  1548. WARNING_OUT(("CControlSAP::ConfLockResponse: invalid conference ID=%u", (UINT) conference_id));
  1549. rc = GCC_INVALID_CONFERENCE;
  1550. }
  1551. ::LeaveCriticalSection(&g_csGCCProvider);
  1552. DebugExitINT(CControlSAP::ConfLockResponse, rc);
  1553. return rc;
  1554. }
  1555. /*
  1556. * ConfUnlockRequest ()
  1557. *
  1558. * Public Function Description:
  1559. * This function is called by the interface when it gets a conference
  1560. * unlock request from the node controller. This function passes the
  1561. * request on to the appropriate conference object as obtained from
  1562. * the list of command targets that the control sap maintains.
  1563. */
  1564. #ifdef JASPER
  1565. GCCError CControlSAP::ConfUnlockRequest ( GCCConfID conference_id )
  1566. {
  1567. GCCError rc;
  1568. CConf *pConf;
  1569. DebugEntry(CControlSAP::ConfUnlockRequest);
  1570. ::EnterCriticalSection(&g_csGCCProvider);
  1571. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  1572. {
  1573. rc = pConf->ConfUnlockRequest();
  1574. }
  1575. else
  1576. {
  1577. WARNING_OUT(("CControlSAP::ConfUnlockRequest: invalid conference ID=%u", (UINT) conference_id));
  1578. rc = GCC_INVALID_CONFERENCE;
  1579. }
  1580. ::LeaveCriticalSection(&g_csGCCProvider);
  1581. DebugExitINT(CControlSAP::ConfUnlockRequest, rc);
  1582. return rc;
  1583. }
  1584. #endif // JASPER
  1585. /*
  1586. * ConfUnlockResponse ()
  1587. *
  1588. * Public Function Description:
  1589. * This function is called by the interface when it gets a conference
  1590. * unlock response from the node controller. This function passes the
  1591. * response on to the appropriate conference object as obtained from
  1592. * the list of command targets that the control sap maintains.
  1593. */
  1594. #ifdef JASPER
  1595. GCCError CControlSAP::ConfUnlockResponse
  1596. (
  1597. GCCConfID conference_id,
  1598. UserID requesting_node,
  1599. GCCResult result
  1600. )
  1601. {
  1602. GCCError rc;
  1603. CConf *pConf;
  1604. DebugEntry(CControlSAP::ConfUnlockResponse);
  1605. ::EnterCriticalSection(&g_csGCCProvider);
  1606. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  1607. {
  1608. rc = pConf->ConfUnlockResponse(requesting_node, result);
  1609. }
  1610. else
  1611. {
  1612. WARNING_OUT(("CControlSAP::ConfUnlockResponse: invalid conference ID=%u", (UINT) conference_id));
  1613. rc = GCC_INVALID_CONFERENCE;
  1614. }
  1615. ::LeaveCriticalSection(&g_csGCCProvider);
  1616. DebugExitINT(CControlSAP::ConfUnlockResponse, rc);
  1617. return rc;
  1618. }
  1619. #endif // JASPER
  1620. /*
  1621. * ConductorAssignRequest ()
  1622. *
  1623. * Public Function Description
  1624. * This function is called by the interface when it gets a conductor
  1625. * assign request from the node controller. This function passes the
  1626. * request on to the appropriate conference object as obtained from
  1627. * the list of command targets that the control sap maintains.
  1628. */
  1629. #ifdef JASPER
  1630. GCCError CControlSAP::ConductorAssignRequest ( GCCConfID conference_id )
  1631. {
  1632. GCCError rc;
  1633. CConf *pConf;
  1634. DebugEntry(CControlSAP::ConductorAssignRequest);
  1635. ::EnterCriticalSection(&g_csGCCProvider);
  1636. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  1637. {
  1638. rc = pConf->ConductorAssignRequest();
  1639. }
  1640. else
  1641. {
  1642. WARNING_OUT(("CControlSAP::ConductorAssignRequest: invalid conference ID=%u", (UINT) conference_id));
  1643. rc = GCC_INVALID_CONFERENCE;
  1644. }
  1645. ::LeaveCriticalSection(&g_csGCCProvider);
  1646. DebugExitINT(CControlSAP::ConductorAssignRequest, rc);
  1647. return rc;
  1648. }
  1649. #endif // JASPER
  1650. /*
  1651. * ConductorReleaseRequest ()
  1652. *
  1653. * Public Function Description
  1654. * This function is called by the interface when it gets a conductor
  1655. * release request from the node controller. This function passes the
  1656. * request on to the appropriate conference object as obtained from
  1657. * the list of command targets that the control sap maintains.
  1658. */
  1659. #ifdef JASPER
  1660. GCCError CControlSAP::ConductorReleaseRequest ( GCCConfID conference_id )
  1661. {
  1662. GCCError rc;
  1663. CConf *pConf;
  1664. DebugEntry(CControlSAP::ConductorReleaseRequest);
  1665. ::EnterCriticalSection(&g_csGCCProvider);
  1666. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  1667. {
  1668. rc = pConf->ConductorReleaseRequest();
  1669. }
  1670. else
  1671. {
  1672. WARNING_OUT(("CControlSAP::ConductorReleaseRequest: invalid conference ID=%u", (UINT) conference_id));
  1673. rc = GCC_INVALID_CONFERENCE;
  1674. }
  1675. ::LeaveCriticalSection(&g_csGCCProvider);
  1676. DebugExitINT(CControlSAP::ConductorReleaseRequest, rc);
  1677. return rc;
  1678. }
  1679. #endif // JASPER
  1680. /*
  1681. * ConductorPleaseRequest ()
  1682. *
  1683. * Public Function Description
  1684. * This function is called by the interface when it gets a conductor
  1685. * please request from the node controller. This function passes the
  1686. * request on to the appropriate conference object as obtained from
  1687. * the list of command targets that the control sap maintains.
  1688. */
  1689. #ifdef JASPER
  1690. GCCError CControlSAP::ConductorPleaseRequest ( GCCConfID conference_id )
  1691. {
  1692. GCCError rc;
  1693. CConf *pConf;
  1694. DebugEntry(CControlSAP::ConductorPleaseRequest);
  1695. ::EnterCriticalSection(&g_csGCCProvider);
  1696. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  1697. {
  1698. rc = pConf->ConductorPleaseRequest();
  1699. }
  1700. else
  1701. {
  1702. WARNING_OUT(("CControlSAP::ConductorPleaseRequest: invalid conference ID=%u", (UINT) conference_id));
  1703. rc = GCC_INVALID_CONFERENCE;
  1704. }
  1705. ::LeaveCriticalSection(&g_csGCCProvider);
  1706. DebugExitINT(CControlSAP::ConductorPleaseRequest, rc);
  1707. return rc;
  1708. }
  1709. #endif // JASPER
  1710. /*
  1711. * ConductorGiveRequest ()
  1712. *
  1713. * Public Function Description
  1714. * This function is called by the interface when it gets a conductor
  1715. * give request from the node controller. This function passes the
  1716. * request on to the appropriate conference object as obtained from
  1717. * the list of command targets that the control sap maintains.
  1718. */
  1719. #ifdef JASPER
  1720. GCCError CControlSAP::ConductorGiveRequest
  1721. (
  1722. GCCConfID conference_id,
  1723. UserID recipient_user_id
  1724. )
  1725. {
  1726. GCCError rc;
  1727. CConf *pConf;
  1728. DebugEntry(CControlSAP::ConductorGiveRequest);
  1729. // Make sure the ID of the conductorship recipient is valid.
  1730. if (recipient_user_id < MINIMUM_USER_ID_VALUE)
  1731. return (GCC_INVALID_MCS_USER_ID);
  1732. ::EnterCriticalSection(&g_csGCCProvider);
  1733. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  1734. {
  1735. rc = pConf->ConductorGiveRequest (recipient_user_id);
  1736. }
  1737. else
  1738. {
  1739. WARNING_OUT(("CControlSAP::ConductorGiveRequest: invalid conference ID=%u", (UINT) conference_id));
  1740. rc = GCC_INVALID_CONFERENCE;
  1741. }
  1742. ::LeaveCriticalSection(&g_csGCCProvider);
  1743. DebugExitINT(CControlSAP::ConductorGiveRequest, rc);
  1744. return rc;
  1745. }
  1746. #endif // JASPER
  1747. /*
  1748. * ConductorGiveResponse ()
  1749. *
  1750. * Public Function Description
  1751. * This function is called by the interface when it gets a conductor
  1752. * give response from the node controller. This function passes the
  1753. * response on to the appropriate conference object as obtained from
  1754. * the list of command targets that the control sap maintains.
  1755. */
  1756. GCCError CControlSAP::ConductorGiveResponse
  1757. (
  1758. GCCConfID conference_id,
  1759. GCCResult result
  1760. )
  1761. {
  1762. GCCError rc;
  1763. CConf *pConf;
  1764. DebugEntry(CControlSAP::ConductorGiveResponse);
  1765. ::EnterCriticalSection(&g_csGCCProvider);
  1766. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  1767. {
  1768. rc = pConf->ConductorGiveResponse (result);
  1769. }
  1770. else
  1771. {
  1772. WARNING_OUT(("CControlSAP::ConductorGiveResponse: invalid conference ID=%u", (UINT) conference_id));
  1773. rc = GCC_INVALID_CONFERENCE;
  1774. }
  1775. ::LeaveCriticalSection(&g_csGCCProvider);
  1776. DebugExitINT(CControlSAP::ConductorGiveResponse, rc);
  1777. return rc;
  1778. }
  1779. /*
  1780. * ConductorPermitGrantRequest ()
  1781. *
  1782. * Public Function Description
  1783. * This function is called by the interface when it gets a conductor
  1784. * permit grant request from the node controller. This function passes the
  1785. * request on to the appropriate conference object as obtained from
  1786. * the list of command targets that the control sap maintains.
  1787. */
  1788. #ifdef JASPER
  1789. GCCError CControlSAP::ConductorPermitGrantRequest
  1790. (
  1791. GCCConfID conference_id,
  1792. UINT number_granted,
  1793. PUserID granted_node_list,
  1794. UINT number_waiting,
  1795. PUserID waiting_node_list
  1796. )
  1797. {
  1798. GCCError rc;
  1799. CConf *pConf;
  1800. UINT i;
  1801. DebugEntry(CControlSAP::ConductorPermitGrantRequest);
  1802. ::EnterCriticalSection(&g_csGCCProvider);
  1803. // Check to make sure the conference exists.
  1804. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  1805. {
  1806. /*
  1807. ** Run through both lists to make sure that valid MCS User IDs
  1808. ** are used.
  1809. */
  1810. for (i = 0; i < number_granted; i++)
  1811. {
  1812. if (granted_node_list[i] < MINIMUM_USER_ID_VALUE)
  1813. {
  1814. ERROR_OUT(("CControlSAP::ConductorPermitGrantRequest: invalid granted user ID"));
  1815. rc = GCC_INVALID_MCS_USER_ID;
  1816. goto MyExit;
  1817. }
  1818. }
  1819. for (i = 0; i < number_waiting; i++)
  1820. {
  1821. if (waiting_node_list[i] < MINIMUM_USER_ID_VALUE)
  1822. {
  1823. ERROR_OUT(("CControlSAP::ConductorPermitGrantRequest: invalid waiting user ID"));
  1824. rc = GCC_INVALID_MCS_USER_ID;
  1825. goto MyExit;
  1826. }
  1827. }
  1828. rc = pConf->ConductorPermitGrantRequest(number_granted,
  1829. granted_node_list,
  1830. number_waiting,
  1831. waiting_node_list);
  1832. }
  1833. else
  1834. {
  1835. rc = GCC_INVALID_CONFERENCE;
  1836. }
  1837. MyExit:
  1838. ::LeaveCriticalSection(&g_csGCCProvider);
  1839. DebugExitINT(CControlSAP::ConductorPermitGrantRequest, rc);
  1840. return rc;
  1841. }
  1842. #endif // JASPER
  1843. /*
  1844. * ConductorPermitAskRequest()
  1845. *
  1846. * Public Function Description
  1847. * This routine is called in order to ask for certain permissions to be
  1848. * granted (or not granted) by the conductor.
  1849. */
  1850. #ifdef JASPER
  1851. GCCError CControlSAP::ConductorPermitAskRequest
  1852. (
  1853. GCCConfID nConfID,
  1854. BOOL fGrantPermission
  1855. )
  1856. {
  1857. GCCError rc;
  1858. CConf *pConf;
  1859. DebugEntry(CControlSAP::ConductorPermitAskRequest);
  1860. ::EnterCriticalSection(&g_csGCCProvider);
  1861. if (NULL != (pConf = g_pGCCController->GetConfObject(nConfID)))
  1862. {
  1863. rc = pConf->ConductorPermitAskRequest(fGrantPermission);
  1864. }
  1865. else
  1866. {
  1867. WARNING_OUT(("CControlSAP::ConductorPermitAskRequest: invalid conference ID=%u", (UINT) nConfID));
  1868. rc = GCC_INVALID_CONFERENCE;
  1869. }
  1870. ::LeaveCriticalSection(&g_csGCCProvider);
  1871. DebugExitINT(CControlSAP::ConductorPermitAskRequest, rc);
  1872. return rc;
  1873. }
  1874. #endif // JASPER
  1875. /*
  1876. * ConfTimeRemainingRequest ()
  1877. *
  1878. * Public Function Description
  1879. * This function is called by the interface when it gets a conference time
  1880. * remaining request from the node controller. This function passes the
  1881. * request on to the appropriate conference object as obtained from
  1882. * the list of command targets that the control sap maintains.
  1883. */
  1884. GCCError CControlSAP::ConfTimeRemainingRequest
  1885. (
  1886. GCCConfID conference_id,
  1887. UINT time_remaining,
  1888. UserID node_id
  1889. )
  1890. {
  1891. GCCError rc;
  1892. CConf *pConf;
  1893. DebugEntry(CControlSAP::ConfTimeRemainingRequest);
  1894. ::EnterCriticalSection(&g_csGCCProvider);
  1895. // Check to make sure the node ID is valid and the conference exists.
  1896. if ((node_id < MINIMUM_USER_ID_VALUE) && (node_id != 0))
  1897. {
  1898. ERROR_OUT(("CControlSAP::ConfTimeRemainingRequest: invalid node ID"));
  1899. rc = GCC_INVALID_MCS_USER_ID;
  1900. }
  1901. else
  1902. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  1903. {
  1904. rc = pConf->ConferenceTimeRemainingRequest(time_remaining, node_id);
  1905. }
  1906. else
  1907. {
  1908. WARNING_OUT(("CControlSAP::ConfTimeRemainingRequest: invalid conference ID=%u", (UINT) conference_id));
  1909. rc = GCC_INVALID_CONFERENCE;
  1910. }
  1911. ::LeaveCriticalSection(&g_csGCCProvider);
  1912. DebugExitINT(CControlSAP::ConfTimeRemainingRequest, rc);
  1913. return rc;
  1914. }
  1915. /*
  1916. * ConfTimeInquireRequest ()
  1917. *
  1918. * Public Function Description
  1919. * This function is called by the interface when it gets a conference time
  1920. * inquire request from the node controller. This function passes the
  1921. * request on to the appropriate conference object as obtained from
  1922. * the list of command targets that the control sap maintains.
  1923. */
  1924. #ifdef JASPER
  1925. GCCError CControlSAP::ConfTimeInquireRequest
  1926. (
  1927. GCCConfID conference_id,
  1928. BOOL time_is_conference_wide
  1929. )
  1930. {
  1931. GCCError rc;
  1932. CConf *pConf;
  1933. DebugEntry(CControlSAP::ConfTimeInquireRequest);
  1934. ::EnterCriticalSection(&g_csGCCProvider);
  1935. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  1936. {
  1937. rc = pConf->ConfTimeInquireRequest(time_is_conference_wide);
  1938. }
  1939. else
  1940. {
  1941. WARNING_OUT(("CControlSAP::ConfTimeInquireRequest: invalid conference ID=%u", (UINT) conference_id));
  1942. rc = GCC_INVALID_CONFERENCE;
  1943. }
  1944. ::LeaveCriticalSection(&g_csGCCProvider);
  1945. DebugExitINT(CControlSAP::ConfTimeInquireRequest, rc);
  1946. return rc;
  1947. }
  1948. #endif // JASPER
  1949. /*
  1950. * ConfExtendRequest ()
  1951. *
  1952. * Public Function Description
  1953. * This function is called by the interface when it gets a conference
  1954. * extend request from the node controller. This function passes the
  1955. * request on to the appropriate conference object as obtained from
  1956. * the list of command targets that the control sap maintains.
  1957. */
  1958. #ifdef JASPER
  1959. GCCError CControlSAP::ConfExtendRequest
  1960. (
  1961. GCCConfID conference_id,
  1962. UINT extension_time,
  1963. BOOL time_is_conference_wide
  1964. )
  1965. {
  1966. GCCError rc;
  1967. CConf *pConf;
  1968. DebugEntry(CControlSAP::ConfExtendRequest);
  1969. ::EnterCriticalSection(&g_csGCCProvider);
  1970. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  1971. {
  1972. rc = pConf->ConfExtendRequest(extension_time, time_is_conference_wide);
  1973. }
  1974. else
  1975. {
  1976. WARNING_OUT(("CControlSAP::ConfExtendRequest: invalid conference ID=%u", (UINT) conference_id));
  1977. rc = GCC_INVALID_CONFERENCE;
  1978. }
  1979. ::LeaveCriticalSection(&g_csGCCProvider);
  1980. DebugExitINT(CControlSAP::ConfExtendRequest, rc);
  1981. return rc;
  1982. }
  1983. #endif // JASPER
  1984. /*
  1985. * ConfAssistanceRequest ()
  1986. *
  1987. * Public Function Description
  1988. * This function is called by the interface when it gets a conference
  1989. * assistance request from the node controller. This function passes the
  1990. * request on to the appropriate conference object as obtained from
  1991. * the list of command targets that the control sap maintains.
  1992. */
  1993. #ifdef JASPER
  1994. GCCError CControlSAP::ConfAssistanceRequest
  1995. (
  1996. GCCConfID conference_id,
  1997. UINT number_of_user_data_members,
  1998. PGCCUserData * user_data_list
  1999. )
  2000. {
  2001. GCCError rc;
  2002. CConf *pConf;
  2003. DebugEntry(CControlSAP::ConfAssistanceRequest);
  2004. ::EnterCriticalSection(&g_csGCCProvider);
  2005. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  2006. {
  2007. rc = pConf->ConfAssistanceRequest(number_of_user_data_members, user_data_list);
  2008. }
  2009. else
  2010. {
  2011. WARNING_OUT(("CControlSAP::ConfAssistanceRequest: invalid conference ID=%u", (UINT) conference_id));
  2012. rc = GCC_INVALID_CONFERENCE;
  2013. }
  2014. ::LeaveCriticalSection(&g_csGCCProvider);
  2015. DebugExitINT(CControlSAP::ConfAssistanceRequest, rc);
  2016. return rc;
  2017. }
  2018. #endif // JASPER
  2019. /*
  2020. * TextMessageRequest ()
  2021. *
  2022. * Public Function Description
  2023. * This function is called by the interface when it gets a text message
  2024. * request from the node controller. This function passes the
  2025. * request on to the appropriate conference object as obtained from
  2026. * the list of command targets that the control sap maintains.
  2027. */
  2028. #ifdef JASPER
  2029. GCCError CControlSAP::TextMessageRequest
  2030. (
  2031. GCCConfID conference_id,
  2032. LPWSTR pwszTextMsg,
  2033. UserID destination_node
  2034. )
  2035. {
  2036. GCCError rc;
  2037. CConf *pConf;
  2038. DebugEntry(CControlSAP::TextMessageRequest);
  2039. ::EnterCriticalSection(&g_csGCCProvider);
  2040. // Check to make sure the node ID is valid and the conference exists.
  2041. if ((destination_node < MINIMUM_USER_ID_VALUE) &&
  2042. (destination_node != 0))
  2043. {
  2044. ERROR_OUT(("CControlSAP::TextMessageRequest: invalid user ID"));
  2045. rc = GCC_INVALID_MCS_USER_ID;
  2046. }
  2047. else
  2048. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  2049. {
  2050. rc = pConf->TextMessageRequest(pwszTextMsg, destination_node);
  2051. }
  2052. else
  2053. {
  2054. WARNING_OUT(("CControlSAP::TextMessageRequest: invalid conference ID=%u", (UINT) conference_id));
  2055. rc = GCC_INVALID_CONFERENCE;
  2056. }
  2057. ::LeaveCriticalSection(&g_csGCCProvider);
  2058. DebugExitINT(CControlSAP::TextMessageRequest, rc);
  2059. return rc;
  2060. }
  2061. #endif // JASPER
  2062. /*
  2063. * ConfTransferRequest ()
  2064. *
  2065. * Public Function Description
  2066. * This function is called by the interface when it gets a conference
  2067. * transfer request from the node controller. This function passes the
  2068. * request on to the appropriate conference object as obtained from
  2069. * the list of command targets that the control sap maintains.
  2070. */
  2071. #ifdef JASPER
  2072. GCCError CControlSAP::ConfTransferRequest
  2073. (
  2074. GCCConfID conference_id,
  2075. PGCCConferenceName destination_conference_name,
  2076. GCCNumericString destination_conference_modifier,
  2077. UINT number_of_destination_addresses,
  2078. PGCCNetworkAddress *destination_address_list,
  2079. UINT number_of_destination_nodes,
  2080. PUserID destination_node_list,
  2081. PGCCPassword password
  2082. )
  2083. {
  2084. GCCError rc = GCC_NO_ERROR;
  2085. CPassword *password_data = NULL;
  2086. CNetAddrListContainer *network_address_list = NULL;
  2087. UINT i = 0;
  2088. DebugEntry(CControlSAP::ConfTransferRequest);
  2089. // Check for invalid conference name
  2090. if (destination_conference_name != NULL)
  2091. {
  2092. /*
  2093. ** Do not allow non-numeric or zero length strings to get
  2094. ** past this point.
  2095. */
  2096. if (destination_conference_name->numeric_string != NULL)
  2097. {
  2098. if (IsNumericNameValid (
  2099. destination_conference_name->numeric_string) == FALSE)
  2100. {
  2101. ERROR_OUT(("CControlSAP::ConfTransferRequest: invalid numeric conference name"));
  2102. rc = GCC_INVALID_CONFERENCE_NAME;
  2103. }
  2104. }
  2105. else if (destination_conference_name->text_string != NULL)
  2106. {
  2107. if (IsTextNameValid (
  2108. destination_conference_name->text_string) == FALSE)
  2109. {
  2110. ERROR_OUT(("CControlSAP::ConfTransferRequest: invalid text conference name"));
  2111. rc = GCC_INVALID_CONFERENCE_NAME;
  2112. }
  2113. }
  2114. else
  2115. {
  2116. ERROR_OUT(("CControlSAP::ConfTransferRequest: null numeric/text conference name"));
  2117. rc = GCC_INVALID_CONFERENCE_NAME;
  2118. }
  2119. if ((rc == GCC_NO_ERROR) &&
  2120. (destination_conference_name->text_string != NULL))
  2121. {
  2122. if (IsTextNameValid (
  2123. destination_conference_name->text_string) == FALSE)
  2124. {
  2125. ERROR_OUT(("CControlSAP::ConfTransferRequest: invalid text conference name"));
  2126. rc = GCC_INVALID_CONFERENCE_NAME;
  2127. }
  2128. }
  2129. }
  2130. else
  2131. {
  2132. ERROR_OUT(("CControlSAP::ConfTransferRequest: null conference name"));
  2133. rc = GCC_INVALID_CONFERENCE_NAME;
  2134. }
  2135. // Check for valid conference modifier
  2136. if ((destination_conference_modifier != NULL) &&
  2137. (rc == GCC_NO_ERROR))
  2138. {
  2139. if (IsNumericNameValid(destination_conference_modifier) == FALSE)
  2140. {
  2141. ERROR_OUT(("CControlSAP::ConfTransferRequest: invalid conference modifier"));
  2142. rc = GCC_INVALID_CONFERENCE_MODIFIER;
  2143. }
  2144. }
  2145. // Check for valid password
  2146. if ((password != NULL) &&
  2147. (rc == GCC_NO_ERROR))
  2148. {
  2149. if (password->numeric_string != NULL)
  2150. {
  2151. if (IsNumericNameValid(password->numeric_string) == FALSE)
  2152. {
  2153. ERROR_OUT(("CControlSAP::ConfTransferRequest: invalid password"));
  2154. rc = GCC_INVALID_PASSWORD;
  2155. }
  2156. }
  2157. else
  2158. {
  2159. ERROR_OUT(("CControlSAP::ConfTransferRequest: null password"));
  2160. rc = GCC_INVALID_PASSWORD;
  2161. }
  2162. }
  2163. // Check for invalid user IDs
  2164. if (rc == GCC_NO_ERROR)
  2165. {
  2166. while (i != number_of_destination_nodes)
  2167. {
  2168. if (destination_node_list[i] < MINIMUM_USER_ID_VALUE)
  2169. {
  2170. rc = GCC_INVALID_MCS_USER_ID;
  2171. break;
  2172. }
  2173. i++;
  2174. }
  2175. }
  2176. if (rc == GCC_NO_ERROR)
  2177. {
  2178. CConf *pConf;
  2179. ::EnterCriticalSection(&g_csGCCProvider);
  2180. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  2181. {
  2182. // Construct the password container
  2183. if (password != NULL)
  2184. {
  2185. DBG_SAVE_FILE_LINE
  2186. password_data = new CPassword(password, &rc);
  2187. if (password_data == NULL)
  2188. {
  2189. ERROR_OUT(("CControlSAP::ConfTransferRequest: can't create CPassword"));
  2190. rc = GCC_ALLOCATION_FAILURE;
  2191. }
  2192. }
  2193. // Construct the network address(es) container
  2194. if ((number_of_destination_addresses != 0) &&
  2195. (rc == GCC_NO_ERROR))
  2196. {
  2197. DBG_SAVE_FILE_LINE
  2198. network_address_list = new CNetAddrListContainer(
  2199. number_of_destination_addresses,
  2200. destination_address_list,
  2201. &rc);
  2202. if (network_address_list == NULL)
  2203. {
  2204. ERROR_OUT(("CControlSAP::CNetAddrListContainer: can't create CPassword"));
  2205. rc = GCC_ALLOCATION_FAILURE;
  2206. }
  2207. }
  2208. if (rc == GCC_NO_ERROR)
  2209. {
  2210. rc = pConf->ConfTransferRequest(destination_conference_name,
  2211. destination_conference_modifier,
  2212. network_address_list,
  2213. number_of_destination_nodes,
  2214. destination_node_list,
  2215. password_data);
  2216. }
  2217. // Free the data associated with the containers.
  2218. if (password_data != NULL)
  2219. {
  2220. password_data->Release();
  2221. }
  2222. if (network_address_list != NULL)
  2223. {
  2224. network_address_list->Release();
  2225. }
  2226. }
  2227. else
  2228. {
  2229. rc = GCC_INVALID_CONFERENCE;
  2230. }
  2231. ::LeaveCriticalSection(&g_csGCCProvider);
  2232. }
  2233. DebugExitINT(CControlSAP::ConfTransferRequest, rc);
  2234. return rc;
  2235. }
  2236. #endif // JASPER
  2237. /*
  2238. * ConfAddRequest ()
  2239. *
  2240. * Public Function Description
  2241. * This function is called by the interface when it gets a conference
  2242. * add request from the node controller. This function passes the
  2243. * request on to the appropriate conference object as obtained from
  2244. * the list of command targets that the control sap maintains.
  2245. */
  2246. #ifdef JASPER
  2247. GCCError CControlSAP::ConfAddRequest
  2248. (
  2249. GCCConfID conference_id,
  2250. UINT number_of_network_addresses,
  2251. PGCCNetworkAddress * network_address_list,
  2252. UserID adding_node,
  2253. UINT number_of_user_data_members,
  2254. PGCCUserData * user_data_list
  2255. )
  2256. {
  2257. GCCError rc = GCC_NO_ERROR;
  2258. CNetAddrListContainer *network_address_container = NULL;
  2259. CUserDataListContainer *user_data_container = NULL;
  2260. CConf *pConf;
  2261. DebugEntry(CControlSAP::ConfAddRequest);
  2262. if ((adding_node < MINIMUM_USER_ID_VALUE) &&
  2263. (adding_node != 0))
  2264. {
  2265. ERROR_OUT(("CControlSAP::ConfAddRequest: invalid adding node ID"));
  2266. return GCC_INVALID_MCS_USER_ID;
  2267. }
  2268. if (number_of_network_addresses == 0)
  2269. {
  2270. ERROR_OUT(("CControlSAP::ConfAddRequest: no network address"));
  2271. return GCC_BAD_NETWORK_ADDRESS;
  2272. }
  2273. ::EnterCriticalSection(&g_csGCCProvider);
  2274. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  2275. {
  2276. // Construct the network address(es) container
  2277. if (number_of_network_addresses != 0)
  2278. {
  2279. DBG_SAVE_FILE_LINE
  2280. network_address_container = new CNetAddrListContainer(
  2281. number_of_network_addresses,
  2282. network_address_list,
  2283. &rc);
  2284. if (network_address_container == NULL)
  2285. {
  2286. ERROR_OUT(("CControlSAP::ConfAddRequest: can't create CNetAddrListContainer"));
  2287. rc = GCC_ALLOCATION_FAILURE;
  2288. }
  2289. }
  2290. // Construct the user data list container
  2291. if ((number_of_user_data_members != 0) &&
  2292. (rc == GCC_NO_ERROR))
  2293. {
  2294. DBG_SAVE_FILE_LINE
  2295. user_data_container = new CUserDataListContainer(number_of_user_data_members, user_data_list, &rc);
  2296. if (user_data_container == NULL)
  2297. {
  2298. ERROR_OUT(("CControlSAP::ConfAddRequest: can't create CUserDataListContainer"));
  2299. rc = GCC_ALLOCATION_FAILURE;
  2300. }
  2301. }
  2302. else
  2303. {
  2304. user_data_container = NULL;
  2305. }
  2306. if (rc == GCC_NO_ERROR)
  2307. {
  2308. rc = pConf->ConfAddRequest(network_address_container,
  2309. adding_node,
  2310. user_data_container);
  2311. }
  2312. // Free the data associated with the containers.
  2313. if (network_address_container != NULL)
  2314. {
  2315. network_address_container->Release();
  2316. }
  2317. if (user_data_container != NULL)
  2318. {
  2319. user_data_container->Release();
  2320. }
  2321. }
  2322. else
  2323. {
  2324. rc = GCC_INVALID_CONFERENCE;
  2325. }
  2326. ::LeaveCriticalSection(&g_csGCCProvider);
  2327. DebugExitINT(CControlSAP::ConfAddRequest, rc);
  2328. return rc;
  2329. }
  2330. #endif // JASPER
  2331. /*
  2332. * ConfAddResponse ()
  2333. *
  2334. * Public Function Description
  2335. * This function is called by the interface when it gets a conference
  2336. * add response from the node controller. This function passes the
  2337. * response on to the appropriate conference object as obtained from
  2338. * the list of command targets that the control sap maintains.
  2339. */
  2340. GCCError CControlSAP::ConfAddResponse
  2341. (
  2342. GCCResponseTag add_response_tag,
  2343. GCCConfID conference_id,
  2344. UserID requesting_node,
  2345. UINT number_of_user_data_members,
  2346. PGCCUserData * user_data_list,
  2347. GCCResult result
  2348. )
  2349. {
  2350. GCCError rc = GCC_NO_ERROR;
  2351. CUserDataListContainer *user_data_container = NULL;
  2352. CConf *pConf;
  2353. DebugEntry(CControlSAP::ConfAddResponse);
  2354. if (requesting_node < MINIMUM_USER_ID_VALUE)
  2355. {
  2356. ERROR_OUT(("CControlSAP::ConfAddResponse: invalid user ID"));
  2357. return GCC_INVALID_MCS_USER_ID;
  2358. }
  2359. ::EnterCriticalSection(&g_csGCCProvider);
  2360. // Check to make sure the conference exists.
  2361. if (NULL != (pConf = g_pGCCController->GetConfObject(conference_id)))
  2362. {
  2363. // Construct the user data list container
  2364. if ((number_of_user_data_members != 0) &&
  2365. (rc == GCC_NO_ERROR))
  2366. {
  2367. DBG_SAVE_FILE_LINE
  2368. user_data_container = new CUserDataListContainer(number_of_user_data_members, user_data_list, &rc);
  2369. if (user_data_container == NULL)
  2370. {
  2371. ERROR_OUT(("CControlSAP::ConfAddResponse: can't create CUserDataListContainer"));
  2372. rc = GCC_ALLOCATION_FAILURE;
  2373. }
  2374. }
  2375. else
  2376. {
  2377. user_data_container = NULL;
  2378. }
  2379. if (rc == GCC_NO_ERROR)
  2380. {
  2381. rc = pConf->ConfAddResponse(add_response_tag,
  2382. requesting_node,
  2383. user_data_container,
  2384. result);
  2385. }
  2386. // Free the data associated with the user data container.
  2387. if (user_data_container != NULL)
  2388. {
  2389. user_data_container->Release();
  2390. }
  2391. }
  2392. else
  2393. {
  2394. WARNING_OUT(("CControlSAP::ConfAddResponse: invalid conference ID=%u", (UINT) conference_id));
  2395. rc = GCC_INVALID_CONFERENCE;
  2396. }
  2397. ::LeaveCriticalSection(&g_csGCCProvider);
  2398. DebugExitINT(CControlSAP::ConfAddResponse, rc);
  2399. return rc;
  2400. }
  2401. #ifdef NM_RESET_DEVICE
  2402. /*
  2403. * ResetDevice ()
  2404. *
  2405. * Public Function Description
  2406. * This routine is called in order to explicitly reset a particular
  2407. * transport stack. The call is routed to the controller in order to take
  2408. * the appropriate action.
  2409. */
  2410. GCCError CControlSAP::ResetDevice ( LPSTR device_identifier )
  2411. {
  2412. GCCError rc;
  2413. MCSError mcs_error;
  2414. DebugEntry(CControlSAP::ResetDevice);
  2415. ::EnterCriticalSection(&g_csGCCProvider);
  2416. // Call back the controller to reset the device.
  2417. mcs_error = g_pMCSIntf->ResetDevice(device_identifier);
  2418. rc = g_pMCSIntf->TranslateMCSIFErrorToGCCError(mcs_error);
  2419. //
  2420. // If the the node controller was in a query, this will tell the node controller
  2421. // to remove the query.
  2422. //
  2423. ConfQueryConfirm(GCC_TERMINAL, NULL, NULL, NULL,
  2424. GCC_RESULT_CONNECT_PROVIDER_FAILED, NULL);
  2425. ::LeaveCriticalSection(&g_csGCCProvider);
  2426. DebugExitINT(CControlSAP::ResetDevice, rc);
  2427. return rc;
  2428. }
  2429. #endif // NM_RESET_DEVICE
  2430. /*
  2431. * ConfCreateIndication ()
  2432. *
  2433. * Public Function Description
  2434. * This function is called by the GCC Controller when it gets a connect
  2435. * provider indication from MCS, carrying a conference create request PDU.
  2436. * This function fills in all the parameters in the CreateIndicationInfo
  2437. * structure. It then adds it to a queue of messages supposed to be sent to
  2438. * the node controller in the next heartbeat.
  2439. */
  2440. GCCError CControlSAP::ConfCreateIndication
  2441. (
  2442. PGCCConferenceName conference_name,
  2443. GCCConfID conference_id,
  2444. CPassword *convener_password,
  2445. CPassword *password,
  2446. BOOL conference_is_locked,
  2447. BOOL conference_is_listed,
  2448. BOOL conference_is_conductible,
  2449. GCCTerminationMethod termination_method,
  2450. PPrivilegeListData conductor_privilege_list,
  2451. PPrivilegeListData conducted_mode_privilege_list,
  2452. PPrivilegeListData non_conducted_privilege_list,
  2453. LPWSTR pwszConfDescriptor,
  2454. LPWSTR pwszCallerID,
  2455. TransportAddress calling_address,
  2456. TransportAddress called_address,
  2457. PDomainParameters domain_parameters,
  2458. CUserDataListContainer *user_data_list,
  2459. ConnectionHandle connection_handle
  2460. )
  2461. {
  2462. GCCError rc;
  2463. DebugEntry(CControlSAP::ConfCreateIndication);
  2464. #ifdef GCCNC_DIRECT_INDICATION
  2465. GCCCtrlSapMsg Msg;
  2466. Msg.message_type = GCC_CREATE_INDICATION;
  2467. /*
  2468. ** Copy the information that needs to be sent to the node
  2469. ** controller into local memory that can be deleted once the
  2470. ** information to be sent to the application is flushed. Note that
  2471. ** if an error occurs in one call to "CopyDataToGCCMessage" then no
  2472. ** action is taken on subsequent calls to that routine.
  2473. */
  2474. // start with success
  2475. rc = GCC_NO_ERROR;
  2476. // Copy the conference name
  2477. ::CSAP_CopyDataToGCCMessage_ConfName(
  2478. conference_name,
  2479. &(Msg.u.create_indication.conference_name));
  2480. // Copy the Convener Password
  2481. ::CSAP_CopyDataToGCCMessage_Password(
  2482. convener_password,
  2483. &(Msg.u.create_indication.convener_password));
  2484. // Copy the Password
  2485. ::CSAP_CopyDataToGCCMessage_Password(
  2486. password,
  2487. &(Msg.u.create_indication.password));
  2488. // Copy the Conductor Privilege List
  2489. GCCConfPrivileges _ConductorPrivileges;
  2490. ::CSAP_CopyDataToGCCMessage_PrivilegeList(
  2491. conductor_privilege_list,
  2492. &(Msg.u.create_indication.conductor_privilege_list),
  2493. &_ConductorPrivileges);
  2494. // Copy the Conducted-mode Conference Privilege List
  2495. GCCConfPrivileges _ConductedModePrivileges;
  2496. ::CSAP_CopyDataToGCCMessage_PrivilegeList(
  2497. conducted_mode_privilege_list,
  2498. &(Msg.u.create_indication.conducted_mode_privilege_list),
  2499. &_ConductedModePrivileges);
  2500. // Copy the Non-Conducted-mode Conference Privilege List
  2501. GCCConfPrivileges _NonConductedPrivileges;
  2502. ::CSAP_CopyDataToGCCMessage_PrivilegeList(
  2503. non_conducted_privilege_list,
  2504. &(Msg.u.create_indication.non_conducted_privilege_list),
  2505. &_NonConductedPrivileges);
  2506. // Copy the Conference Descriptor
  2507. ::CSAP_CopyDataToGCCMessage_IDvsDesc(
  2508. pwszConfDescriptor,
  2509. &(Msg.u.create_indication.conference_descriptor));
  2510. // Copy the Caller Identifier
  2511. ::CSAP_CopyDataToGCCMessage_IDvsDesc(
  2512. pwszCallerID,
  2513. &(Msg.u.create_indication.caller_identifier));
  2514. // Copy the Calling Address
  2515. ::CSAP_CopyDataToGCCMessage_Call(
  2516. calling_address,
  2517. &(Msg.u.create_indication.calling_address));
  2518. // Copy the Called Address
  2519. ::CSAP_CopyDataToGCCMessage_Call(
  2520. called_address,
  2521. &(Msg.u.create_indication.called_address));
  2522. // Copy the Domain Parameters
  2523. DomainParameters _DomainParams;
  2524. ::CSAP_CopyDataToGCCMessage_DomainParams(
  2525. domain_parameters,
  2526. &(Msg.u.create_indication.domain_parameters),
  2527. &_DomainParams);
  2528. // Copy the User Data
  2529. LPBYTE pUserDataMemory = NULL;
  2530. if (user_data_list != NULL)
  2531. {
  2532. rc = RetrieveUserDataList(
  2533. user_data_list,
  2534. &(Msg.u.create_indication.number_of_user_data_members),
  2535. &(Msg.u.create_indication.user_data_list),
  2536. &pUserDataMemory);
  2537. }
  2538. else
  2539. {
  2540. Msg.u.create_indication.number_of_user_data_members = 0;
  2541. Msg.u.create_indication.user_data_list = NULL;
  2542. }
  2543. if (GCC_NO_ERROR == rc)
  2544. {
  2545. // Queue up the message for delivery to the Node Controller.
  2546. Msg.nConfID = conference_id;
  2547. Msg.u.create_indication.conference_id = conference_id;
  2548. Msg.u.create_indication.conference_is_locked = conference_is_locked;
  2549. Msg.u.create_indication.conference_is_listed = conference_is_listed;
  2550. Msg.u.create_indication.conference_is_conductible = conference_is_conductible;
  2551. Msg.u.create_indication.termination_method = termination_method;
  2552. Msg.u.create_indication.connection_handle = connection_handle;
  2553. SendCtrlSapMsg(&Msg);
  2554. delete pUserDataMemory;
  2555. }
  2556. #else
  2557. GCCCtrlSapMsgEx *pMsgEx;
  2558. //
  2559. // Allocate control sap message.
  2560. //
  2561. DBG_SAVE_FILE_LINE
  2562. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_CREATE_INDICATION, TRUE)))
  2563. {
  2564. ::ZeroMemory(&(pMsgEx->Msg.u.create_indication), sizeof(pMsgEx->Msg.u.create_indication));
  2565. }
  2566. else
  2567. {
  2568. ERROR_OUT(("CControlSAP::ConfCreateIndication: can't create GCCCtrlSapMsgEx"));
  2569. rc = GCC_ALLOCATION_FAILURE;
  2570. goto MyExit;
  2571. }
  2572. /*
  2573. ** Copy the information that needs to be sent to the node
  2574. ** controller into local memory that can be deleted once the
  2575. ** information to be sent to the application is flushed. Note that
  2576. ** if an error occurs in one call to "CopyDataToGCCMessage" then no
  2577. ** action is taken on subsequent calls to that routine.
  2578. */
  2579. // start with success
  2580. rc = GCC_NO_ERROR;
  2581. // Copy the conference name
  2582. ::CSAP_CopyDataToGCCMessage_ConfName(
  2583. pMsgEx->pToDelete,
  2584. conference_name,
  2585. &(pMsgEx->Msg.u.create_indication.conference_name),
  2586. &rc);
  2587. // Copy the Convener Password
  2588. ::CSAP_CopyDataToGCCMessage_Password(
  2589. TRUE, // convener password
  2590. pMsgEx->pToDelete,
  2591. convener_password,
  2592. &(pMsgEx->Msg.u.create_indication.convener_password),
  2593. &rc);
  2594. // Copy the Password
  2595. ::CSAP_CopyDataToGCCMessage_Password(
  2596. FALSE, // non-convener password
  2597. pMsgEx->pToDelete,
  2598. password,
  2599. &(pMsgEx->Msg.u.create_indication.password),
  2600. &rc);
  2601. // Copy the Conductor Privilege List
  2602. ::CSAP_CopyDataToGCCMessage_PrivilegeList(
  2603. conductor_privilege_list,
  2604. &(pMsgEx->Msg.u.create_indication.conductor_privilege_list),
  2605. &rc);
  2606. pMsgEx->pToDelete->conductor_privilege_list = pMsgEx->Msg.u.create_indication.conductor_privilege_list;
  2607. // Copy the Conducted-mode Conference Privilege List
  2608. ::CSAP_CopyDataToGCCMessage_PrivilegeList(
  2609. conducted_mode_privilege_list,
  2610. &(pMsgEx->Msg.u.create_indication.conducted_mode_privilege_list),
  2611. &rc);
  2612. pMsgEx->pToDelete->conducted_mode_privilege_list = pMsgEx->Msg.u.create_indication.conducted_mode_privilege_list;
  2613. // Copy the Non-Conducted-mode Conference Privilege List
  2614. ::CSAP_CopyDataToGCCMessage_PrivilegeList(
  2615. non_conducted_privilege_list,
  2616. &(pMsgEx->Msg.u.create_indication.non_conducted_privilege_list),
  2617. &rc);
  2618. pMsgEx->pToDelete->non_conducted_privilege_list = pMsgEx->Msg.u.create_indication.non_conducted_privilege_list;
  2619. // Copy the Conference Descriptor
  2620. ::CSAP_CopyDataToGCCMessage_IDvsDesc(
  2621. FALSE, // conference descriptor
  2622. pMsgEx->pToDelete,
  2623. pwszConfDescriptor,
  2624. &(pMsgEx->Msg.u.create_indication.conference_descriptor),
  2625. &rc);
  2626. // Copy the Caller Identifier
  2627. ::CSAP_CopyDataToGCCMessage_IDvsDesc(
  2628. TRUE, // caller id
  2629. pMsgEx->pToDelete,
  2630. pwszCallerID,
  2631. &(pMsgEx->Msg.u.create_indication.caller_identifier),
  2632. &rc);
  2633. // Copy the Calling Address
  2634. ::CSAP_CopyDataToGCCMessage_Call(
  2635. TRUE, // calling address
  2636. pMsgEx->pToDelete,
  2637. calling_address,
  2638. &(pMsgEx->Msg.u.create_indication.calling_address),
  2639. &rc);
  2640. // Copy the Called Address
  2641. ::CSAP_CopyDataToGCCMessage_Call(
  2642. FALSE, // called address
  2643. pMsgEx->pToDelete,
  2644. called_address,
  2645. &(pMsgEx->Msg.u.create_indication.called_address),
  2646. &rc);
  2647. // Copy the Domain Parameters
  2648. ::CSAP_CopyDataToGCCMessage_DomainParams(
  2649. pMsgEx->pToDelete,
  2650. domain_parameters,
  2651. &(pMsgEx->Msg.u.create_indication.domain_parameters),
  2652. &rc);
  2653. if (GCC_NO_ERROR != rc)
  2654. {
  2655. ERROR_OUT(("CControlSAP::ConfCreateIndication: can't copy data to gcc message"));
  2656. goto MyExit;
  2657. }
  2658. // Copy the User Data
  2659. if (user_data_list != NULL)
  2660. {
  2661. rc = RetrieveUserDataList(
  2662. user_data_list,
  2663. &(pMsgEx->Msg.u.create_indication.number_of_user_data_members),
  2664. &(pMsgEx->Msg.u.create_indication.user_data_list),
  2665. &(pMsgEx->pToDelete->user_data_list_memory));
  2666. if (GCC_NO_ERROR != rc)
  2667. {
  2668. goto MyExit;
  2669. }
  2670. }
  2671. else
  2672. {
  2673. // pMsgEx->Msg.u.create_indication.number_of_user_data_members = 0;
  2674. // pMsgEx->Msg.u.create_indication.user_data_list = NULL;
  2675. }
  2676. // Queue up the message for delivery to the Node Controller.
  2677. pMsgEx->Msg.nConfID = conference_id;
  2678. pMsgEx->Msg.u.create_indication.conference_id = conference_id;
  2679. pMsgEx->Msg.u.create_indication.conference_is_locked = conference_is_locked;
  2680. pMsgEx->Msg.u.create_indication.conference_is_listed = conference_is_listed;
  2681. pMsgEx->Msg.u.create_indication.conference_is_conductible = conference_is_conductible;
  2682. pMsgEx->Msg.u.create_indication.termination_method = termination_method;
  2683. pMsgEx->Msg.u.create_indication.connection_handle = connection_handle;
  2684. PostIndCtrlSapMsg(pMsgEx);
  2685. MyExit:
  2686. if (GCC_NO_ERROR != rc)
  2687. {
  2688. FreeCtrlSapMsgEx(pMsgEx);
  2689. HandleResourceFailure(rc);
  2690. }
  2691. #endif // GCCNC_DIRECT_INDICATION
  2692. DebugExitINT(CControlSAP::ConfCreateIndication, rc);
  2693. return rc;
  2694. }
  2695. /*
  2696. * ConfQueryIndication ()
  2697. *
  2698. * Public Function Description
  2699. * This function is called by the GCC Controller when it need to send a
  2700. * conference query indication to the node controller. It adds the message
  2701. * to a queue of messages to be sent to the node controller in the next
  2702. * heartbeat.
  2703. */
  2704. GCCError CControlSAP::ConfQueryIndication
  2705. (
  2706. GCCResponseTag query_response_tag,
  2707. GCCNodeType node_type,
  2708. PGCCAsymmetryIndicator asymmetry_indicator,
  2709. TransportAddress calling_address,
  2710. TransportAddress called_address,
  2711. CUserDataListContainer *user_data_list,
  2712. ConnectionHandle connection_handle
  2713. )
  2714. {
  2715. GCCError rc;
  2716. DebugEntry(CControlSAP::ConfQueryIndication);
  2717. #ifdef GCCNC_DIRECT_INDICATION
  2718. GCCCtrlSapMsg Msg;
  2719. Msg.message_type = GCC_QUERY_INDICATION;
  2720. /*
  2721. ** Copy the information that needs to be sent to the node
  2722. ** controller into local memory that can be deleted once the
  2723. ** information to be sent to the application is flushed. Note that
  2724. ** if an error occurs in one call to "CopyDataToGCCMessage" then no
  2725. ** action is taken on subsequent calls to that routine.
  2726. */
  2727. // start with success
  2728. rc = GCC_NO_ERROR;
  2729. // Copy the Calling Address
  2730. ::CSAP_CopyDataToGCCMessage_Call(
  2731. calling_address,
  2732. &(Msg.u.query_indication.calling_address));
  2733. // Copy the Calling Address
  2734. ::CSAP_CopyDataToGCCMessage_Call(
  2735. called_address,
  2736. &(Msg.u.query_indication.called_address));
  2737. // Copy the asymmetry indicator if it exists
  2738. GCCAsymmetryIndicator AsymIndicator;
  2739. if (asymmetry_indicator != NULL)
  2740. {
  2741. Msg.u.query_indication.asymmetry_indicator = &AsymIndicator;
  2742. AsymIndicator = *asymmetry_indicator;
  2743. }
  2744. else
  2745. {
  2746. Msg.u.query_indication.asymmetry_indicator = NULL;
  2747. }
  2748. // Lock and Copy the user data if it exists
  2749. LPBYTE pUserDataMemory = NULL;
  2750. if (user_data_list != NULL)
  2751. {
  2752. rc = RetrieveUserDataList(
  2753. user_data_list,
  2754. &(Msg.u.query_indication.number_of_user_data_members),
  2755. &(Msg.u.query_indication.user_data_list),
  2756. &pUserDataMemory);
  2757. }
  2758. else
  2759. {
  2760. Msg.u.query_indication.number_of_user_data_members = 0;
  2761. Msg.u.query_indication.user_data_list = NULL;
  2762. }
  2763. if (GCC_NO_ERROR == rc)
  2764. {
  2765. // If everything is OK add the message to the message queue
  2766. Msg.u.query_indication.query_response_tag = query_response_tag;
  2767. Msg.u.query_indication.node_type = node_type;
  2768. Msg.u.query_indication.connection_handle = connection_handle;
  2769. SendCtrlSapMsg(&Msg);
  2770. delete pUserDataMemory;
  2771. }
  2772. #else
  2773. GCCCtrlSapMsgEx *pMsgEx;
  2774. //
  2775. // Allocate control sap message.
  2776. //
  2777. DBG_SAVE_FILE_LINE
  2778. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_QUERY_INDICATION, TRUE)))
  2779. {
  2780. ::ZeroMemory(&(pMsgEx->Msg.u.query_indication), sizeof(pMsgEx->Msg.u.query_indication));
  2781. }
  2782. else
  2783. {
  2784. ERROR_OUT(("CControlSAP::ConfCreateIndication: can't create GCCCtrlSapMsgEx"));
  2785. rc = GCC_ALLOCATION_FAILURE;
  2786. goto MyExit;
  2787. }
  2788. /*
  2789. ** Copy the information that needs to be sent to the node
  2790. ** controller into local memory that can be deleted once the
  2791. ** information to be sent to the application is flushed. Note that
  2792. ** if an error occurs in one call to "CopyDataToGCCMessage" then no
  2793. ** action is taken on subsequent calls to that routine.
  2794. */
  2795. // start with success
  2796. rc = GCC_NO_ERROR;
  2797. // Copy the Calling Address
  2798. ::CSAP_CopyDataToGCCMessage_Call(
  2799. TRUE, // calling address
  2800. pMsgEx->pToDelete,
  2801. calling_address,
  2802. &(pMsgEx->Msg.u.query_indication.calling_address),
  2803. &rc);
  2804. // Copy the Calling Address
  2805. ::CSAP_CopyDataToGCCMessage_Call(
  2806. FALSE, // called address
  2807. pMsgEx->pToDelete,
  2808. called_address,
  2809. &(pMsgEx->Msg.u.query_indication.called_address),
  2810. &rc);
  2811. if (GCC_NO_ERROR != rc)
  2812. {
  2813. ERROR_OUT(("CControlSAP::ConfQueryIndication: can't copy data to gcc message"));
  2814. goto MyExit;
  2815. }
  2816. // Copy the asymmetry indicator if it exists
  2817. if (asymmetry_indicator != NULL)
  2818. {
  2819. DBG_SAVE_FILE_LINE
  2820. pMsgEx->Msg.u.query_indication.asymmetry_indicator = new GCCAsymmetryIndicator;
  2821. if (pMsgEx->Msg.u.query_indication.asymmetry_indicator != NULL)
  2822. {
  2823. *(pMsgEx->Msg.u.query_indication.asymmetry_indicator) = *asymmetry_indicator;
  2824. }
  2825. else
  2826. {
  2827. rc = GCC_ALLOCATION_FAILURE;
  2828. goto MyExit;
  2829. }
  2830. }
  2831. else
  2832. {
  2833. // pMsgEx->Msg.u.query_indication.asymmetry_indicator = NULL;
  2834. }
  2835. // Lock and Copy the user data if it exists
  2836. if (user_data_list != NULL)
  2837. {
  2838. rc = RetrieveUserDataList(
  2839. user_data_list,
  2840. &(pMsgEx->Msg.u.query_indication.number_of_user_data_members),
  2841. &(pMsgEx->Msg.u.query_indication.user_data_list),
  2842. &(pMsgEx->pToDelete->user_data_list_memory));
  2843. if (GCC_NO_ERROR != rc)
  2844. {
  2845. goto MyExit;
  2846. }
  2847. }
  2848. else
  2849. {
  2850. // pMsgEx->Msg.u.query_indication.number_of_user_data_members = 0;
  2851. // pMsgEx->Msg.u.query_indication.user_data_list = NULL;
  2852. }
  2853. // If everything is OK add the message to the message queue
  2854. pMsgEx->Msg.u.query_indication.query_response_tag = query_response_tag;
  2855. pMsgEx->Msg.u.query_indication.node_type = node_type;
  2856. pMsgEx->Msg.u.query_indication.connection_handle = connection_handle;
  2857. PostIndCtrlSapMsg(pMsgEx);
  2858. MyExit:
  2859. if (GCC_NO_ERROR != rc)
  2860. {
  2861. FreeCtrlSapMsgEx(pMsgEx);
  2862. HandleResourceFailure(rc);
  2863. }
  2864. #endif // GCCNC_DIRECT_INDICATION
  2865. DebugExitINT(CControlSAP::ConfQueryIndication, rc);
  2866. return rc;
  2867. }
  2868. /*
  2869. * ConfQueryConfirm ()
  2870. *
  2871. * Public Function Description
  2872. * This function is called by the GCC Controller when it need to send a
  2873. * conference query confirm to the node controller. It adds the message
  2874. * to a queue of messages to be sent to the node controller in the next
  2875. * heartbeat.
  2876. */
  2877. GCCError CControlSAP::ConfQueryConfirm
  2878. (
  2879. GCCNodeType node_type,
  2880. PGCCAsymmetryIndicator asymmetry_indicator,
  2881. CConfDescriptorListContainer *conference_list,
  2882. CUserDataListContainer *user_data_list,
  2883. GCCResult result,
  2884. ConnectionHandle connection_handle
  2885. )
  2886. {
  2887. GCCError rc = GCC_NO_ERROR;
  2888. DebugEntry(CControlSAP::ConfQueryConfirm);
  2889. #ifdef GCCNC_DIRECT_CONFIRM
  2890. GCCCtrlSapMsg Msg;
  2891. Msg.message_type = GCC_QUERY_CONFIRM;
  2892. GCCAsymmetryIndicator _AsymIndicator;
  2893. if (asymmetry_indicator != NULL)
  2894. {
  2895. Msg.u.query_confirm.asymmetry_indicator = &_AsymIndicator;
  2896. _AsymIndicator = *asymmetry_indicator;
  2897. }
  2898. else
  2899. {
  2900. Msg.u.query_confirm.asymmetry_indicator = NULL;
  2901. }
  2902. // Get the conference descriptor list if one exists
  2903. if (conference_list != NULL)
  2904. {
  2905. rc = conference_list->LockConferenceDescriptorList();
  2906. if (rc == GCC_NO_ERROR)
  2907. {
  2908. conference_list->GetConferenceDescriptorList(
  2909. &(Msg.u.query_confirm.conference_descriptor_list),
  2910. &(Msg.u.query_confirm.number_of_descriptors));
  2911. }
  2912. }
  2913. else
  2914. {
  2915. Msg.u.query_confirm.conference_descriptor_list = NULL;
  2916. Msg.u.query_confirm.number_of_descriptors = 0;
  2917. }
  2918. // Lock and Copy the user data if it exists
  2919. LPBYTE pUserDataMemory = NULL;
  2920. if (user_data_list != NULL)
  2921. {
  2922. rc = RetrieveUserDataList(
  2923. user_data_list,
  2924. &(Msg.u.query_confirm.number_of_user_data_members),
  2925. &(Msg.u.query_confirm.user_data_list),
  2926. &pUserDataMemory);
  2927. }
  2928. else
  2929. {
  2930. Msg.u.query_confirm.number_of_user_data_members = 0;
  2931. Msg.u.query_confirm.user_data_list = NULL;
  2932. }
  2933. if (rc == GCC_NO_ERROR)
  2934. {
  2935. Msg.u.query_confirm.node_type = node_type;
  2936. Msg.u.query_confirm.result = result;
  2937. Msg.u.query_confirm.connection_handle = connection_handle;
  2938. // Queue up the message for delivery to the Node Controller.
  2939. SendCtrlSapMsg(&Msg);
  2940. // clean up
  2941. delete pUserDataMemory;
  2942. }
  2943. else
  2944. {
  2945. HandleResourceFailure(rc);
  2946. }
  2947. // clean up
  2948. if (NULL != conference_list)
  2949. {
  2950. conference_list->UnLockConferenceDescriptorList();
  2951. }
  2952. #else
  2953. GCCCtrlSapMsgEx *pMsgEx;
  2954. //
  2955. // Allocate control sap message.
  2956. //
  2957. DBG_SAVE_FILE_LINE
  2958. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_QUERY_CONFIRM, TRUE)))
  2959. {
  2960. ::ZeroMemory(&(pMsgEx->Msg.u.query_confirm), sizeof(pMsgEx->Msg.u.query_confirm));
  2961. if (asymmetry_indicator != NULL)
  2962. {
  2963. DBG_SAVE_FILE_LINE
  2964. pMsgEx->Msg.u.query_confirm.asymmetry_indicator = new GCCAsymmetryIndicator;
  2965. if (pMsgEx->Msg.u.query_confirm.asymmetry_indicator != NULL)
  2966. {
  2967. *(pMsgEx->Msg.u.query_confirm.asymmetry_indicator) = *asymmetry_indicator;
  2968. }
  2969. else
  2970. {
  2971. rc = GCC_ALLOCATION_FAILURE;
  2972. ERROR_OUT(("CControlSAP::ConfQueryConfirm: can't create GCCAsymmetryIndicator"));
  2973. }
  2974. }
  2975. else
  2976. {
  2977. // pMsgEx->Msg.u.query_confirm.asymmetry_indicator = NULL;
  2978. }
  2979. // Get the conference descriptor list if one exists
  2980. if (conference_list != NULL)
  2981. {
  2982. pMsgEx->pToDelete->conference_list = conference_list;
  2983. rc = conference_list->LockConferenceDescriptorList();
  2984. if (rc == GCC_NO_ERROR)
  2985. {
  2986. conference_list->GetConferenceDescriptorList (
  2987. &(pMsgEx->Msg.u.query_confirm.conference_descriptor_list),
  2988. &(pMsgEx->Msg.u.query_confirm.number_of_descriptors));
  2989. }
  2990. }
  2991. else
  2992. {
  2993. // pMsgEx->Msg.u.query_confirm.conference_descriptor_list = NULL;
  2994. // pMsgEx->Msg.u.query_confirm.number_of_descriptors = 0;
  2995. }
  2996. // Lock and Copy the user data if it exists
  2997. if (user_data_list != NULL)
  2998. {
  2999. rc = RetrieveUserDataList (
  3000. user_data_list,
  3001. &(pMsgEx->Msg.u.query_confirm.number_of_user_data_members),
  3002. &(pMsgEx->Msg.u.query_confirm.user_data_list),
  3003. &(pMsgEx->pToDelete->user_data_list_memory));
  3004. }
  3005. else
  3006. {
  3007. // pMsgEx->Msg.u.query_confirm.number_of_user_data_members = 0;
  3008. // pMsgEx->Msg.u.query_confirm.user_data_list = NULL;
  3009. }
  3010. if (rc == GCC_NO_ERROR)
  3011. {
  3012. pMsgEx->Msg.u.query_confirm.node_type = node_type;
  3013. pMsgEx->Msg.u.query_confirm.result = result;
  3014. pMsgEx->Msg.u.query_confirm.connection_handle = connection_handle;
  3015. // Queue up the message for delivery to the Node Controller.
  3016. PostConfirmCtrlSapMsg(pMsgEx);
  3017. }
  3018. }
  3019. else
  3020. {
  3021. rc = GCC_ALLOCATION_FAILURE;
  3022. ERROR_OUT(("CControlSAP::ConfQueryConfirm: can't create GCCCtrlSapMsgEx"));
  3023. }
  3024. if (GCC_NO_ERROR != rc)
  3025. {
  3026. FreeCtrlSapMsgEx(pMsgEx);
  3027. HandleResourceFailure(rc);
  3028. }
  3029. #endif // GCCNC_DIRECT_CONFIRM
  3030. DebugExitINT(CControlSAP::ConfQueryConfirm, rc);
  3031. return rc;
  3032. }
  3033. /*
  3034. * ConfJoinIndication ()
  3035. *
  3036. * Public Function Description
  3037. * This join indication is recevied from the owner object. This join
  3038. * indication is designed to make the join response very flexible at the
  3039. * node controller. The node controller can respond to this indication
  3040. * by either creating a new conference and moving the joiner into it,
  3041. * putting the joiner in the conference requested or putting the joiner
  3042. * into a different conference that already exist.
  3043. */
  3044. // LONCHANC: from GCCController, normal code path.
  3045. GCCError CControlSAP::ConfJoinIndication
  3046. (
  3047. GCCConfID conference_id,
  3048. CPassword *convener_password,
  3049. CPassword *password_challenge,
  3050. LPWSTR pwszCallerID,
  3051. TransportAddress calling_address,
  3052. TransportAddress called_address,
  3053. CUserDataListContainer *user_data_list,
  3054. BOOL intermediate_node,
  3055. ConnectionHandle connection_handle
  3056. )
  3057. {
  3058. PJoinResponseStructure join_info;
  3059. GCCError rc;
  3060. DebugEntry(CControlSAP::ConfJoinIndication);
  3061. // First generate a Join Response Handle and add info to response list
  3062. while (1)
  3063. {
  3064. m_nJoinResponseTag++;
  3065. if (NULL == m_JoinResponseTagList2.Find(m_nJoinResponseTag))
  3066. break;
  3067. }
  3068. DBG_SAVE_FILE_LINE
  3069. join_info = new JoinResponseStructure;
  3070. if (join_info != NULL)
  3071. {
  3072. join_info->connection_handle = connection_handle;
  3073. join_info->conference_id = conference_id;
  3074. join_info->user_id = NULL;
  3075. join_info->command_target_call = FALSE;
  3076. m_JoinResponseTagList2.Append(m_nJoinResponseTag, join_info);
  3077. // Queue up the message for delivery to the Node Controller.
  3078. rc = QueueJoinIndication( m_nJoinResponseTag,
  3079. conference_id,
  3080. convener_password,
  3081. password_challenge,
  3082. pwszCallerID,
  3083. calling_address,
  3084. called_address,
  3085. user_data_list,
  3086. intermediate_node,
  3087. connection_handle);
  3088. }
  3089. else
  3090. {
  3091. rc = GCC_ALLOCATION_FAILURE;
  3092. ERROR_OUT(("CControlSAP::ConfJoinIndication: can't create JoinResponseStructure"));
  3093. }
  3094. DebugExitINT(CControlSAP::ConfJoinIndication, rc);
  3095. return rc;
  3096. }
  3097. /*
  3098. * ConfInviteIndication ()
  3099. *
  3100. * Public Function Description
  3101. * This function is called by the GCC Controller when it need to send a
  3102. * conference invite indication to the node controller. It adds the message
  3103. * to a queue of messages to be sent to the node controller in the next
  3104. * heartbeat.
  3105. */
  3106. GCCError CControlSAP::ConfInviteIndication
  3107. (
  3108. GCCConfID conference_id,
  3109. PGCCConferenceName conference_name,
  3110. LPWSTR pwszCallerID,
  3111. TransportAddress calling_address,
  3112. TransportAddress called_address,
  3113. BOOL fSecure,
  3114. PDomainParameters domain_parameters,
  3115. BOOL clear_password_required,
  3116. BOOL conference_is_locked,
  3117. BOOL conference_is_listed,
  3118. BOOL conference_is_conductible,
  3119. GCCTerminationMethod termination_method,
  3120. PPrivilegeListData conductor_privilege_list,
  3121. PPrivilegeListData conducted_mode_privilege_list,
  3122. PPrivilegeListData non_conducted_privilege_list,
  3123. LPWSTR pwszConfDescriptor,
  3124. CUserDataListContainer *user_data_list,
  3125. ConnectionHandle connection_handle
  3126. )
  3127. {
  3128. GCCError rc;
  3129. DebugEntry(CControlSAP::ConfInviteIndication);
  3130. #ifdef GCCNC_DIRECT_INDICATION
  3131. GCCCtrlSapMsg Msg;
  3132. Msg.message_type = GCC_INVITE_INDICATION;
  3133. //
  3134. // Copy the information that needs to be sent to the node
  3135. // controller into local memory that can be deleted once the
  3136. // information to be sent to the application is flushed. Note that
  3137. // if an error occurs in one call to "CopyDataToGCCMessage" then no
  3138. // action is taken on subsequent calls to that routine.
  3139. //
  3140. // start with success
  3141. rc = GCC_NO_ERROR;
  3142. // Copy the conference name
  3143. ::CSAP_CopyDataToGCCMessage_ConfName(
  3144. conference_name,
  3145. &(Msg.u.invite_indication.conference_name));
  3146. // Copy the Conductor Privilege List
  3147. GCCConfPrivileges _ConductorPrivileges;
  3148. ::CSAP_CopyDataToGCCMessage_PrivilegeList(
  3149. conductor_privilege_list,
  3150. &(Msg.u.invite_indication.conductor_privilege_list),
  3151. &_ConductorPrivileges);
  3152. // Copy the Conducted-mode Conference Privilege List
  3153. GCCConfPrivileges _ConductedModePrivileges;
  3154. ::CSAP_CopyDataToGCCMessage_PrivilegeList(
  3155. conducted_mode_privilege_list,
  3156. &(Msg.u.invite_indication.conducted_mode_privilege_list),
  3157. &_ConductedModePrivileges);
  3158. // Copy the Non-Conducted-mode Conference Privilege List
  3159. GCCConfPrivileges _NonConductedPrivileges;
  3160. ::CSAP_CopyDataToGCCMessage_PrivilegeList(
  3161. non_conducted_privilege_list,
  3162. &(Msg.u.invite_indication.non_conducted_privilege_list),
  3163. &_NonConductedPrivileges);
  3164. // Copy the Conference Descriptor
  3165. ::CSAP_CopyDataToGCCMessage_IDvsDesc(
  3166. pwszConfDescriptor,
  3167. &(Msg.u.invite_indication.conference_descriptor));
  3168. // Copy the Caller Identifier
  3169. ::CSAP_CopyDataToGCCMessage_IDvsDesc(
  3170. pwszCallerID,
  3171. &(Msg.u.invite_indication.caller_identifier));
  3172. // Copy the Calling Address
  3173. ::CSAP_CopyDataToGCCMessage_Call(
  3174. calling_address,
  3175. &(Msg.u.invite_indication.calling_address));
  3176. // Copy the Called Address
  3177. ::CSAP_CopyDataToGCCMessage_Call(
  3178. called_address,
  3179. &(Msg.u.invite_indication.called_address));
  3180. // Copy the Domain Parameters
  3181. DomainParameters _DomainParams;
  3182. ::CSAP_CopyDataToGCCMessage_DomainParams(
  3183. domain_parameters,
  3184. &(Msg.u.invite_indication.domain_parameters),
  3185. &_DomainParams);
  3186. // Copy the User Data
  3187. LPBYTE pUserDataMemory = NULL;
  3188. if (user_data_list != NULL)
  3189. {
  3190. rc = RetrieveUserDataList(
  3191. user_data_list,
  3192. &(Msg.u.invite_indication.number_of_user_data_members),
  3193. &(Msg.u.invite_indication.user_data_list),
  3194. &pUserDataMemory);
  3195. ASSERT(GCC_NO_ERROR == rc);
  3196. }
  3197. else
  3198. {
  3199. Msg.u.invite_indication.number_of_user_data_members = 0;
  3200. Msg.u.invite_indication.user_data_list = NULL;
  3201. }
  3202. if (GCC_NO_ERROR == rc)
  3203. {
  3204. Msg.u.invite_indication.conference_id = conference_id;
  3205. Msg.u.invite_indication.clear_password_required = clear_password_required;
  3206. Msg.u.invite_indication.conference_is_locked = conference_is_locked;
  3207. Msg.u.invite_indication.conference_is_listed = conference_is_listed;
  3208. Msg.u.invite_indication.conference_is_conductible = conference_is_conductible;
  3209. Msg.u.invite_indication.termination_method = termination_method;
  3210. Msg.u.invite_indication.connection_handle = connection_handle;
  3211. Msg.u.invite_indication.fSecure = fSecure;
  3212. SendCtrlSapMsg(&Msg);
  3213. delete pUserDataMemory;
  3214. }
  3215. #else
  3216. GCCCtrlSapMsgEx *pMsgEx;
  3217. //
  3218. // Allocate control sap message.
  3219. //
  3220. DBG_SAVE_FILE_LINE
  3221. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_INVITE_INDICATION, TRUE)))
  3222. {
  3223. ::ZeroMemory(&(pMsgEx->Msg.u.invite_indication), sizeof(pMsgEx->Msg.u.invite_indication));
  3224. }
  3225. else
  3226. {
  3227. ERROR_OUT(("CControlSAP::ConfInviteIndication: can't create GCCCtrlSapMsgEx"));
  3228. rc = GCC_ALLOCATION_FAILURE;
  3229. goto MyExit;
  3230. }
  3231. /*
  3232. ** Copy the information that needs to be sent to the node
  3233. ** controller into local memory that can be deleted once the
  3234. ** information to be sent to the application is flushed. Note that
  3235. ** if an error occurs in one call to "CopyDataToGCCMessage" then no
  3236. ** action is taken on subsequent calls to that routine.
  3237. */
  3238. // start with success
  3239. rc = GCC_NO_ERROR;
  3240. // Copy the conference name
  3241. ::CSAP_CopyDataToGCCMessage_ConfName(
  3242. pMsgEx->pToDelete,
  3243. conference_name,
  3244. &(pMsgEx->Msg.u.invite_indication.conference_name),
  3245. &rc);
  3246. // Copy the Conductor Privilege List
  3247. ::CSAP_CopyDataToGCCMessage_PrivilegeList(
  3248. conductor_privilege_list,
  3249. &(pMsgEx->Msg.u.invite_indication.conductor_privilege_list),
  3250. &rc);
  3251. pMsgEx->pToDelete->conductor_privilege_list = pMsgEx->Msg.u.invite_indication.conductor_privilege_list;
  3252. // Copy the Conducted-mode Conference Privilege List
  3253. ::CSAP_CopyDataToGCCMessage_PrivilegeList(
  3254. conducted_mode_privilege_list,
  3255. &(pMsgEx->Msg.u.invite_indication.conducted_mode_privilege_list),
  3256. &rc);
  3257. pMsgEx->pToDelete->conducted_mode_privilege_list = pMsgEx->Msg.u.invite_indication.conducted_mode_privilege_list;
  3258. // Copy the Non-Conducted-mode Conference Privilege List
  3259. ::CSAP_CopyDataToGCCMessage_PrivilegeList(
  3260. non_conducted_privilege_list,
  3261. &(pMsgEx->Msg.u.invite_indication.non_conducted_privilege_list),
  3262. &rc);
  3263. pMsgEx->pToDelete->non_conducted_privilege_list = pMsgEx->Msg.u.invite_indication.non_conducted_privilege_list;
  3264. // Copy the Conference Descriptor
  3265. ::CSAP_CopyDataToGCCMessage_IDvsDesc(
  3266. FALSE, // conference descriptor
  3267. pMsgEx->pToDelete,
  3268. pwszConfDescriptor,
  3269. &(pMsgEx->Msg.u.invite_indication.conference_descriptor),
  3270. &rc);
  3271. // Copy the Caller Identifier
  3272. ::CSAP_CopyDataToGCCMessage_IDvsDesc(
  3273. TRUE, // caller id
  3274. pMsgEx->pToDelete,
  3275. pwszCallerID,
  3276. &(pMsgEx->Msg.u.invite_indication.caller_identifier),
  3277. &rc);
  3278. // Copy the Calling Address
  3279. ::CSAP_CopyDataToGCCMessage_Call(
  3280. TRUE, /// calling address
  3281. pMsgEx->pToDelete,
  3282. calling_address,
  3283. &(pMsgEx->Msg.u.invite_indication.calling_address),
  3284. &rc);
  3285. // Copy the Called Address
  3286. ::CSAP_CopyDataToGCCMessage_Call(
  3287. FALSE, // called address
  3288. pMsgEx->pToDelete,
  3289. called_address,
  3290. &(pMsgEx->Msg.u.invite_indication.called_address),
  3291. &rc);
  3292. // Copy the Domain Parameters
  3293. ::CSAP_CopyDataToGCCMessage_DomainParams(
  3294. pMsgEx->pToDelete,
  3295. domain_parameters,
  3296. &(pMsgEx->Msg.u.invite_indication.domain_parameters),
  3297. &rc);
  3298. if (GCC_NO_ERROR != rc)
  3299. {
  3300. ERROR_OUT(("CControlSAP::ConfInviteIndication: can't copy data to gcc message"));
  3301. goto MyExit;
  3302. }
  3303. // Copy the User Data
  3304. if (user_data_list != NULL)
  3305. {
  3306. rc = RetrieveUserDataList(
  3307. user_data_list,
  3308. &(pMsgEx->Msg.u.invite_indication.number_of_user_data_members),
  3309. &(pMsgEx->Msg.u.invite_indication.user_data_list),
  3310. &(pMsgEx->pToDelete->user_data_list_memory));
  3311. if (GCC_NO_ERROR != rc)
  3312. {
  3313. goto MyExit;
  3314. }
  3315. }
  3316. else
  3317. {
  3318. // pMsgEx->Msg.u.invite_indication.number_of_user_data_members = 0;
  3319. // pMsgEx->Msg.u.invite_indication.user_data_list = NULL;
  3320. }
  3321. pMsgEx->Msg.u.invite_indication.conference_id = conference_id;
  3322. pMsgEx->Msg.u.invite_indication.clear_password_required = clear_password_required;
  3323. pMsgEx->Msg.u.invite_indication.conference_is_locked = conference_is_locked;
  3324. pMsgEx->Msg.u.invite_indication.conference_is_listed = conference_is_listed;
  3325. pMsgEx->Msg.u.invite_indication.conference_is_conductible = conference_is_conductible;
  3326. pMsgEx->Msg.u.invite_indication.termination_method = termination_method;
  3327. pMsgEx->Msg.u.invite_indication.connection_handle = connection_handle;
  3328. // Queue up the message for delivery to the Node Controller.
  3329. PostIndCtrlSapMsg(pMsgEx);
  3330. MyExit:
  3331. if (GCC_NO_ERROR != rc)
  3332. {
  3333. FreeCtrlSapMsgEx(pMsgEx);
  3334. HandleResourceFailure(rc);
  3335. }
  3336. #endif // GCCNC_DIRECT_INDICATION
  3337. DebugExitINT(CControlSAP::ConfInviteIndication, rc);
  3338. return rc;
  3339. }
  3340. #ifdef TSTATUS_INDICATION
  3341. /*
  3342. * GCCError TransportStatusIndication()
  3343. *
  3344. * Public Function Description
  3345. * This function is called by the GCC Controller when it need to send a
  3346. * transport status indication to the node controller. It adds the
  3347. * message to a queue of messages to be sent to the node controller in
  3348. * the next heartbeat. This callback message uses Rogue Wave strings to
  3349. * store the message information. These strings are held in a
  3350. * TransportStatusInfo structure which is stored in a DataToBeDeleted
  3351. * structure which is freed up after the callback is issued.
  3352. */
  3353. GCCError CControlSAP::TransportStatusIndication ( PTransportStatus transport_status )
  3354. {
  3355. GCCError rc;
  3356. DebugEntry(CControlSAP::TransportStatusIndication);
  3357. #ifdef GCCNC_DIRECT_INDICATION
  3358. GCCCtrlSapMsg Msg;
  3359. Msg.message_type = GCC_TRANSPORT_STATUS_INDICATION;
  3360. Msg.u.transport_status.device_identifier = transport_status->device_identifier;
  3361. Msg.u.transport_status.remote_address = transport_status->remote_address;
  3362. Msg.u.transport_status.message = transport_status->message;
  3363. Msg.u.transport_status.state = transport_status->state;
  3364. SendCtrlSapMsg(&Msg);
  3365. rc = GCC_NO_ERROR;
  3366. #else
  3367. GCCCtrlSapMsgEx *pMsgEx;
  3368. //
  3369. // Allocate control sap message.
  3370. //
  3371. DBG_SAVE_FILE_LINE
  3372. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_TRANSPORT_STATUS_INDICATION, TRUE)))
  3373. {
  3374. // ::ZeroMemory(&(pMsgEx->Msg.u.transport_status), sizeof(pMsgEx->Msg.u.transport_status));
  3375. pMsgEx->Msg.u.transport_status.device_identifier = ::My_strdupA(transport_status->device_identifier);
  3376. pMsgEx->Msg.u.transport_status.remote_address = ::My_strdupA(transport_status->remote_address);
  3377. pMsgEx->Msg.u.transport_status.message = ::My_strdupA(transport_status->message);
  3378. pMsgEx->Msg.u.transport_status.state = transport_status->state;
  3379. PostIndCtrlSapMsg(pMsgEx);
  3380. rc = GCC_NO_ERROR;
  3381. }
  3382. else
  3383. {
  3384. ERROR_OUT(("CControlSAP::TransportStatusIndication: can't create GCCCtrlSapMsgEx"));
  3385. rc = GCC_ALLOCATION_FAILURE;
  3386. HandleResourceFailure();
  3387. }
  3388. #endif // GCCNC_DIRECT_INDICATION
  3389. DebugExitINT(CControlSAP::TransportStatusIndication, rc);
  3390. return rc;
  3391. }
  3392. /*
  3393. * StatusIndication()
  3394. *
  3395. * Public Function Description
  3396. * This function is called by the GCC Controller when it need to send a
  3397. * status indication to the node controller. It adds the message to a
  3398. * queue of messages to be sent to the node controller in the next
  3399. * heartbeat.
  3400. *
  3401. * Caveats
  3402. * Note that we do not handle a resource error here to avoid an
  3403. * endless loop that could occur when this routine is called from the
  3404. * HandleResourceError() routine.
  3405. */
  3406. GCCError CControlSAP::StatusIndication
  3407. (
  3408. GCCStatusMessageType status_message_type,
  3409. UINT parameter
  3410. )
  3411. {
  3412. GCCError rc;
  3413. DebugEntry(CControlSAP::StatusIndication);
  3414. #ifdef GCCNC_DIRECT_INDICATION
  3415. GCCCtrlSapMsg Msg;
  3416. Msg.message_type = GCC_STATUS_INDICATION;
  3417. Msg.u.status_indication.status_message_type = status_message_type;
  3418. Msg.u.status_indication.parameter = parameter;
  3419. SendCtrlSapMsg(&Msg);
  3420. rc = GCC_NO_ERROR;
  3421. #else
  3422. GCCCtrlSapMsgEx *pMsgEx;
  3423. //
  3424. // Allocate control sap message.
  3425. //
  3426. DBG_SAVE_FILE_LINE
  3427. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_STATUS_INDICATION)))
  3428. {
  3429. // ::ZeroMemory(&(pMsgEx->Msg.u.status_indication), sizeof(pMsgEx->Msg.u.status_indication));
  3430. pMsgEx->Msg.u.status_indication.status_message_type = status_message_type;
  3431. pMsgEx->Msg.u.status_indication.parameter = parameter;
  3432. // Queue up the message for delivery to the Node Controller.
  3433. PostIndCtrlSapMsg(pMsgEx);
  3434. rc = GCC_NO_ERROR;
  3435. }
  3436. else
  3437. {
  3438. rc = GCC_ALLOCATION_FAILURE;
  3439. HandleResourceFailure();
  3440. }
  3441. #endif // GCCNC_DIRECT_INDICATION
  3442. DebugExitINT(CControlSAP::StatusIndication, rc);
  3443. return rc;
  3444. }
  3445. #endif // TSTATUS_INDICATION
  3446. /*
  3447. * GCCError ConnectionBrokenIndication ()
  3448. *
  3449. * Public Function Description
  3450. * This function is called by the GCC Controller when it need to send a
  3451. * connection broken indication to the node controller. It adds the
  3452. * message to a queue of messages to be sent to the node controller in
  3453. * the next heartbeat.
  3454. */
  3455. GCCError CControlSAP::ConnectionBrokenIndication ( ConnectionHandle connection_handle )
  3456. {
  3457. GCCError rc;
  3458. DebugEntry(CControlSAP::ConnectionBrokenIndication);
  3459. #ifdef GCCNC_DIRECT_INDICATION
  3460. GCCCtrlSapMsg Msg;
  3461. Msg.message_type = GCC_CONNECTION_BROKEN_INDICATION;
  3462. Msg.u.connection_broken_indication.connection_handle = connection_handle;
  3463. SendCtrlSapMsg(&Msg);
  3464. rc = GCC_NO_ERROR;
  3465. #else
  3466. GCCCtrlSapMsgEx *pMsgEx;
  3467. //
  3468. // Allocate control sap message.
  3469. //
  3470. DBG_SAVE_FILE_LINE
  3471. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_CONNECTION_BROKEN_INDICATION)))
  3472. {
  3473. // ::ZeroMemory(&(pMsgEx->Msg.u.connection_broken_indication), sizeof(pMsgEx->Msg.u.connection_broken_indication));
  3474. pMsgEx->Msg.u.connection_broken_indication.connection_handle = connection_handle;
  3475. // Queue up the message for delivery to the Node Controller.
  3476. PostIndCtrlSapMsg(pMsgEx);
  3477. rc = GCC_NO_ERROR;
  3478. }
  3479. else
  3480. {
  3481. rc = GCC_ALLOCATION_FAILURE;
  3482. HandleResourceFailure();
  3483. }
  3484. #endif // GCCNC_DIRECT_INDICATION
  3485. DebugExitINT(CControlSAP::ConnectionBrokenIndication, rc);
  3486. return rc;
  3487. }
  3488. /*
  3489. * The following routines are virtual command target calls.
  3490. */
  3491. /*
  3492. * ConfCreateConfirm()
  3493. *
  3494. * Public Function Description
  3495. * This function is called by the CConf when it need to send a
  3496. * conference create confirm to the node controller. It adds the
  3497. * message to a queue of messages to be sent to the node controller in
  3498. * the next heartbeat.
  3499. */
  3500. GCCError CControlSAP::ConfCreateConfirm
  3501. (
  3502. PGCCConferenceName conference_name,
  3503. GCCNumericString conference_modifier,
  3504. GCCConfID conference_id,
  3505. PDomainParameters domain_parameters,
  3506. CUserDataListContainer *user_data_list,
  3507. GCCResult result,
  3508. ConnectionHandle connection_handle
  3509. )
  3510. {
  3511. GCCError rc;
  3512. DebugEntry(CControlSAP::ConfCreateConfirm);
  3513. #ifdef GCCNC_DIRECT_CONFIRM
  3514. GCCCtrlSapMsg Msg;
  3515. Msg.message_type = GCC_CREATE_CONFIRM;
  3516. /*
  3517. ** Copy the information that needs to be sent to the node
  3518. ** controller into local memory that can be deleted once the
  3519. ** information to be sent to the application is flushed. Note that
  3520. ** if an error occurs in one call to "CopyDataToGCCMessage" then no
  3521. ** action is taken on subsequent calls to that routine.
  3522. */
  3523. // start with success
  3524. rc = GCC_NO_ERROR;
  3525. // Copy the conference name
  3526. ::CSAP_CopyDataToGCCMessage_ConfName(
  3527. conference_name,
  3528. &(Msg.u.create_confirm.conference_name));
  3529. // Copy the conference name modifier
  3530. ::CSAP_CopyDataToGCCMessage_Modifier(
  3531. conference_modifier,
  3532. &(Msg.u.create_confirm.conference_modifier));
  3533. // Copy the Domain Parameters
  3534. DomainParameters _DomainParams;
  3535. ::CSAP_CopyDataToGCCMessage_DomainParams(
  3536. domain_parameters,
  3537. &(Msg.u.create_confirm.domain_parameters),
  3538. &_DomainParams);
  3539. // Copy the User Data
  3540. LPBYTE pUserDataMemory = NULL;
  3541. if (user_data_list != NULL)
  3542. {
  3543. rc = RetrieveUserDataList(
  3544. user_data_list,
  3545. &(Msg.u.create_confirm.number_of_user_data_members),
  3546. &(Msg.u.create_confirm.user_data_list),
  3547. &pUserDataMemory);
  3548. }
  3549. else
  3550. {
  3551. TRACE_OUT(("CControlSAP:ConfCreateConfirm: User Data List is NOT present"));
  3552. Msg.u.create_confirm.number_of_user_data_members = 0;
  3553. Msg.u.create_confirm.user_data_list = NULL;
  3554. }
  3555. if (GCC_NO_ERROR == rc)
  3556. {
  3557. Msg.nConfID = conference_id;
  3558. Msg.u.create_confirm.conference_id = conference_id;
  3559. Msg.u.create_confirm.result= result;
  3560. Msg.u.create_confirm.connection_handle= connection_handle;
  3561. SendCtrlSapMsg(&Msg);
  3562. // clean up
  3563. delete pUserDataMemory;
  3564. }
  3565. else
  3566. {
  3567. HandleResourceFailure(rc);
  3568. }
  3569. #else
  3570. GCCCtrlSapMsgEx *pMsgEx;
  3571. //
  3572. // Allocate control sap message.
  3573. //
  3574. DBG_SAVE_FILE_LINE
  3575. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_CREATE_CONFIRM, TRUE)))
  3576. {
  3577. ::ZeroMemory(&(pMsgEx->Msg.u.create_confirm), sizeof(pMsgEx->Msg.u.create_confirm));
  3578. }
  3579. else
  3580. {
  3581. ERROR_OUT(("CControlSAP::ConfCreateConfirm: can't create GCCCtrlSapMsgEx"));
  3582. rc = GCC_ALLOCATION_FAILURE;
  3583. goto MyExit;
  3584. }
  3585. /*
  3586. ** Copy the information that needs to be sent to the node
  3587. ** controller into local memory that can be deleted once the
  3588. ** information to be sent to the application is flushed. Note that
  3589. ** if an error occurs in one call to "CopyDataToGCCMessage" then no
  3590. ** action is taken on subsequent calls to that routine.
  3591. */
  3592. // start with success
  3593. rc = GCC_NO_ERROR;
  3594. // Copy the conference name
  3595. ::CSAP_CopyDataToGCCMessage_ConfName(
  3596. pMsgEx->pToDelete,
  3597. conference_name,
  3598. &(pMsgEx->Msg.u.create_confirm.conference_name),
  3599. &rc);
  3600. // Copy the conference name modifier
  3601. ::CSAP_CopyDataToGCCMessage_Modifier(
  3602. FALSE, // conference modifier
  3603. pMsgEx->pToDelete,
  3604. conference_modifier,
  3605. &(pMsgEx->Msg.u.create_confirm.conference_modifier),
  3606. &rc);
  3607. // Copy the Domain Parameters
  3608. ::CSAP_CopyDataToGCCMessage_DomainParams(
  3609. pMsgEx->pToDelete,
  3610. domain_parameters,
  3611. &(pMsgEx->Msg.u.create_confirm.domain_parameters),
  3612. &rc);
  3613. if (GCC_NO_ERROR != rc)
  3614. {
  3615. ERROR_OUT(("CControlSAP::ConfCreateConfirm: can't copy data to gcc message"));
  3616. goto MyExit;
  3617. }
  3618. // Copy the User Data
  3619. if (user_data_list != NULL)
  3620. {
  3621. rc = RetrieveUserDataList(
  3622. user_data_list,
  3623. &(pMsgEx->Msg.u.create_confirm.number_of_user_data_members),
  3624. &(pMsgEx->Msg.u.create_confirm.user_data_list),
  3625. &(pMsgEx->pToDelete->user_data_list_memory));
  3626. if (GCC_NO_ERROR != rc)
  3627. {
  3628. goto MyExit;
  3629. }
  3630. }
  3631. else
  3632. {
  3633. TRACE_OUT(("CControlSAP:ConfCreateConfirm: User Data List is NOT present"));
  3634. // pMsgEx->Msg.u.create_confirm.number_of_user_data_members = 0;
  3635. // pMsgEx->Msg.u.create_confirm.user_data_list = NULL;
  3636. }
  3637. // Queue up the message for delivery to the Node Controller.
  3638. pMsgEx->Msg.nConfID = conference_id;
  3639. pMsgEx->Msg.u.create_confirm.conference_id = conference_id;
  3640. pMsgEx->Msg.u.create_confirm.result= result;
  3641. pMsgEx->Msg.u.create_confirm.connection_handle= connection_handle;
  3642. PostConfirmCtrlSapMsg(pMsgEx);
  3643. MyExit:
  3644. /*
  3645. ** Clean up after any resource allocation error which may have occurred.
  3646. */
  3647. if (GCC_NO_ERROR != rc)
  3648. {
  3649. FreeCtrlSapMsgEx(pMsgEx);
  3650. HandleResourceFailure(rc);
  3651. }
  3652. #endif // GCCNC_DIRECT_CONFIRM
  3653. DebugExitINT(CControlSAP::ConfCreateConfirm, rc);
  3654. return rc;
  3655. }
  3656. /*
  3657. * ConfDisconnectIndication()
  3658. *
  3659. * Public Function Description
  3660. * This function is called by the CConf when it need to send a
  3661. * conference disconnect indication to the node controller. It adds the
  3662. * message to a queue of messages to be sent to the node controller in
  3663. * the next heartbeat.
  3664. */
  3665. GCCError CControlSAP::ConfDisconnectIndication
  3666. (
  3667. GCCConfID conference_id,
  3668. GCCReason reason,
  3669. UserID disconnected_node_id
  3670. )
  3671. {
  3672. GCCError rc;
  3673. DebugEntry(CControlSAP::ConfDisconnectIndication);
  3674. #ifdef GCCNC_DIRECT_INDICATION
  3675. GCCCtrlSapMsg Msg;
  3676. Msg.message_type = GCC_DISCONNECT_INDICATION;
  3677. Msg.nConfID = conference_id;
  3678. Msg.u.disconnect_indication.conference_id = conference_id;
  3679. Msg.u.disconnect_indication.reason = reason;
  3680. Msg.u.disconnect_indication.disconnected_node_id = disconnected_node_id;
  3681. SendCtrlSapMsg(&Msg);
  3682. rc = GCC_NO_ERROR;
  3683. #else
  3684. GCCCtrlSapMsgEx *pMsgEx;
  3685. //
  3686. // Allocate control sap message.
  3687. //
  3688. DBG_SAVE_FILE_LINE
  3689. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_DISCONNECT_INDICATION)))
  3690. {
  3691. // ::ZeroMemory(&(pMsgEx->Msg.u.disconnect_indication), sizeof(pMsgEx->Msg.u.disconnect_indication));
  3692. pMsgEx->Msg.nConfID = conference_id;
  3693. pMsgEx->Msg.u.disconnect_indication.conference_id = conference_id;
  3694. pMsgEx->Msg.u.disconnect_indication.reason = reason;
  3695. pMsgEx->Msg.u.disconnect_indication.disconnected_node_id = disconnected_node_id;
  3696. // Queue up the message for delivery to the Node Controller.
  3697. PostIndCtrlSapMsg(pMsgEx);
  3698. rc = GCC_NO_ERROR;
  3699. }
  3700. else
  3701. {
  3702. rc = GCC_ALLOCATION_FAILURE;
  3703. HandleResourceFailure();
  3704. }
  3705. #endif // GCCNC_DIRECT_INDICATION
  3706. DebugExitINT(CControlSAP::ConfDisconnectIndication, rc);
  3707. return rc;
  3708. }
  3709. /*
  3710. * ConfDisconnectConfirm ()
  3711. *
  3712. * Public Function Description
  3713. * This function is called by the CConf when it need to send a
  3714. * conference disconnect confirm to the node controller. It adds the
  3715. * message to a queue of messages to be sent to the node controller in
  3716. * the next heartbeat.
  3717. */
  3718. GCCError CControlSAP::ConfDisconnectConfirm
  3719. (
  3720. GCCConfID conference_id,
  3721. GCCResult result
  3722. )
  3723. {
  3724. GCCError rc;
  3725. DebugEntry(CControlSAP::ConfDisconnectConfirm);
  3726. #ifdef GCCNC_DIRECT_CONFIRM
  3727. //
  3728. // WPARAM: result.
  3729. // LPARAM: conf ID
  3730. //
  3731. PostAsynDirectConfirmMsg(GCC_DISCONNECT_CONFIRM, result, conference_id);
  3732. rc = GCC_NO_ERROR;
  3733. #else
  3734. GCCCtrlSapMsgEx *pMsgEx;
  3735. //
  3736. // Allocate control sap message.
  3737. //
  3738. DBG_SAVE_FILE_LINE
  3739. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_DISCONNECT_CONFIRM)))
  3740. {
  3741. // ::ZeroMemory(&(pMsgEx->Msg.u.disconnect_confirm), sizeof(pMsgEx->Msg.u.disconnect_confirm));
  3742. pMsgEx->Msg.nConfID = conference_id;
  3743. pMsgEx->Msg.u.disconnect_confirm.conference_id = conference_id;
  3744. pMsgEx->Msg.u.disconnect_confirm.result = result;
  3745. // Queue up the message for delivery to the Node Controller.
  3746. PostConfirmCtrlSapMsg(pMsgEx);
  3747. rc = GCC_NO_ERROR;
  3748. }
  3749. else
  3750. {
  3751. rc = GCC_ALLOCATION_FAILURE;
  3752. HandleResourceFailure();
  3753. }
  3754. #endif // GCCNC_DIRECT_CONFIRM
  3755. DebugExitINT(CControlSAP::ConfDisconnectConfirm, rc);
  3756. return rc;
  3757. }
  3758. /*
  3759. * GCCError ConfJoinIndication()
  3760. *
  3761. * Public Function Description
  3762. * This function is called by the CConf when it need to send a
  3763. * conference join indication to the node controller. It adds the
  3764. * message to a queue of messages to be sent to the node controller in
  3765. * the next heartbeat.
  3766. *
  3767. * Since this is received by the command target call we know that the
  3768. * response must be routed back to the same conference. We must also
  3769. * pass back the user_id when the response is made.
  3770. */
  3771. // LONCHANC: from Conf2/MCSUser/ProcessJoinRequestPDU.
  3772. // forwarded from an existing child node.
  3773. GCCError CControlSAP::ForwardedConfJoinIndication
  3774. (
  3775. UserID sender_id,
  3776. GCCConfID conference_id,
  3777. CPassword *convener_password,
  3778. CPassword *password_challenge,
  3779. LPWSTR pwszCallerID,
  3780. CUserDataListContainer *user_data_list
  3781. )
  3782. {
  3783. GCCError rc = GCC_NO_ERROR;
  3784. PJoinResponseStructure join_info;
  3785. LPWSTR caller_id_ptr;
  3786. DebugEntry(CControlSAP::ForwardedConfJoinIndication);
  3787. // First generate a Join Response Handle and add info to response list
  3788. while (1)
  3789. {
  3790. m_nJoinResponseTag++;
  3791. if (NULL == m_JoinResponseTagList2.Find(m_nJoinResponseTag))
  3792. break;
  3793. }
  3794. // Create a new "info" structure to hold the join information.
  3795. DBG_SAVE_FILE_LINE
  3796. join_info = new JoinResponseStructure;
  3797. if (join_info != NULL)
  3798. {
  3799. caller_id_ptr = pwszCallerID;
  3800. join_info->connection_handle = NULL;
  3801. join_info->conference_id = conference_id;
  3802. join_info->user_id = sender_id;
  3803. join_info->command_target_call = TRUE;
  3804. m_JoinResponseTagList2.Append(m_nJoinResponseTag, join_info);
  3805. // Queue up the message for delivery to the Node Controller.
  3806. rc = QueueJoinIndication(
  3807. m_nJoinResponseTag,
  3808. conference_id,
  3809. convener_password,
  3810. password_challenge,
  3811. caller_id_ptr,
  3812. NULL, // Transport address not supported here
  3813. NULL, // Transport address not supported here
  3814. user_data_list,
  3815. FALSE, // Not an intermediate node
  3816. 0);
  3817. }
  3818. else
  3819. {
  3820. rc = GCC_ALLOCATION_FAILURE;
  3821. HandleResourceFailure();
  3822. }
  3823. DebugExitINT(CControlSAP::ForwardedConfJoinIndication, rc);
  3824. return rc;
  3825. }
  3826. /*
  3827. * GCCError ConfJoinConfirm()
  3828. *
  3829. * Public Function Description
  3830. * This function is called by the CConf when it need to send a
  3831. * conference join confirm to the node controller. It adds the
  3832. * message to a queue of messages to be sent to the node controller in
  3833. * the next heartbeat.
  3834. */
  3835. GCCError CControlSAP::ConfJoinConfirm
  3836. (
  3837. PGCCConferenceName conference_name,
  3838. GCCNumericString remote_modifier,
  3839. GCCNumericString local_modifier,
  3840. GCCConfID conference_id,
  3841. CPassword *password_challenge,
  3842. PDomainParameters domain_parameters,
  3843. BOOL password_in_the_clear,
  3844. BOOL conference_is_locked,
  3845. BOOL conference_is_listed,
  3846. BOOL conference_is_conductible,
  3847. GCCTerminationMethod termination_method,
  3848. PPrivilegeListData conductor_privilege_list,
  3849. PPrivilegeListData conduct_mode_privilege_list,
  3850. PPrivilegeListData non_conduct_privilege_list,
  3851. LPWSTR pwszConfDescription,
  3852. CUserDataListContainer *user_data_list,
  3853. GCCResult result,
  3854. ConnectionHandle connection_handle,
  3855. PBYTE pbRemoteCred,
  3856. DWORD cbRemoteCred
  3857. )
  3858. {
  3859. GCCError rc;
  3860. DebugEntry(CControlSAP::ConfJoinConfirm);
  3861. #ifdef GCCNC_DIRECT_CONFIRM
  3862. GCCCtrlSapMsg Msg;
  3863. Msg.message_type = GCC_JOIN_CONFIRM;
  3864. /*
  3865. ** Copy the information that needs to be sent to the node
  3866. ** controller into local memory that can be deleted once the
  3867. ** information to be sent to the application is flushed. Note that
  3868. ** if an error occurs in one call to "CopyDataToGCCMessage" then no
  3869. ** action is taken on subsequent calls to that routine.
  3870. */
  3871. // start with success
  3872. rc = GCC_NO_ERROR;
  3873. // Copy the conference name
  3874. ::CSAP_CopyDataToGCCMessage_ConfName(
  3875. conference_name,
  3876. &(Msg.u.join_confirm.conference_name));
  3877. // Copy the remote modifier
  3878. ::CSAP_CopyDataToGCCMessage_Modifier(
  3879. remote_modifier,
  3880. &(Msg.u.join_confirm.called_node_modifier));
  3881. // Copy the local conference name modifier
  3882. ::CSAP_CopyDataToGCCMessage_Modifier(
  3883. local_modifier,
  3884. &(Msg.u.join_confirm.calling_node_modifier));
  3885. // Copy the Password challange
  3886. ::CSAP_CopyDataToGCCMessage_Challenge(
  3887. password_challenge,
  3888. &(Msg.u.join_confirm.password_challenge));
  3889. // Copy the Domain Parameters
  3890. DomainParameters _DomainParams;
  3891. ::CSAP_CopyDataToGCCMessage_DomainParams(
  3892. domain_parameters,
  3893. &(Msg.u.join_confirm.domain_parameters),
  3894. &_DomainParams);
  3895. // Copy the Conductor Privilege List
  3896. GCCConfPrivileges _ConductorPrivilegeList;
  3897. ::CSAP_CopyDataToGCCMessage_PrivilegeList(
  3898. conductor_privilege_list,
  3899. &(Msg.u.join_confirm.conductor_privilege_list),
  3900. &_ConductorPrivilegeList);
  3901. // Copy the Conducted-mode Conference Privilege List
  3902. GCCConfPrivileges _ConductedModePrivilegeList;
  3903. ::CSAP_CopyDataToGCCMessage_PrivilegeList(
  3904. conduct_mode_privilege_list,
  3905. &(Msg.u.join_confirm.conducted_mode_privilege_list),
  3906. &_ConductedModePrivilegeList);
  3907. // Copy the Non-Conducted-mode Conference Privilege List
  3908. GCCConfPrivileges _NonConductedModePrivilegeList;
  3909. ::CSAP_CopyDataToGCCMessage_PrivilegeList(
  3910. non_conduct_privilege_list,
  3911. &(Msg.u.join_confirm.non_conducted_privilege_list),
  3912. &_NonConductedModePrivilegeList);
  3913. // Copy the Conference Descriptor
  3914. ::CSAP_CopyDataToGCCMessage_IDvsDesc(
  3915. pwszConfDescription,
  3916. &(Msg.u.join_confirm.conference_descriptor));
  3917. // Copy the User Data
  3918. LPBYTE pUserDataMemory = NULL;
  3919. if (user_data_list != NULL)
  3920. {
  3921. rc = RetrieveUserDataList(
  3922. user_data_list,
  3923. &(Msg.u.join_confirm.number_of_user_data_members),
  3924. &(Msg.u.join_confirm.user_data_list),
  3925. &pUserDataMemory);
  3926. }
  3927. else
  3928. {
  3929. Msg.u.join_confirm.number_of_user_data_members = 0;
  3930. Msg.u.join_confirm.user_data_list = NULL;
  3931. }
  3932. if (GCC_NO_ERROR == rc)
  3933. {
  3934. Msg.nConfID = conference_id;
  3935. Msg.u.join_confirm.conference_id = conference_id;
  3936. Msg.u.join_confirm.clear_password_required = password_in_the_clear;
  3937. Msg.u.join_confirm.conference_is_locked = conference_is_locked;
  3938. Msg.u.join_confirm.conference_is_listed = conference_is_listed;
  3939. Msg.u.join_confirm.conference_is_conductible = conference_is_conductible;
  3940. Msg.u.join_confirm.termination_method = termination_method;
  3941. Msg.u.join_confirm.result = result;
  3942. Msg.u.join_confirm.connection_handle = connection_handle;
  3943. Msg.u.join_confirm.pb_remote_cred = pbRemoteCred;
  3944. Msg.u.join_confirm.cb_remote_cred = cbRemoteCred;
  3945. SendCtrlSapMsg(&Msg);
  3946. // clean up
  3947. delete pUserDataMemory;
  3948. }
  3949. else
  3950. {
  3951. HandleResourceFailure(rc);
  3952. }
  3953. #else
  3954. GCCCtrlSapMsgEx *pMsgEx;
  3955. //
  3956. // Allocate control sap message.
  3957. //
  3958. DBG_SAVE_FILE_LINE
  3959. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_JOIN_CONFIRM, TRUE)))
  3960. {
  3961. ::ZeroMemory(&(pMsgEx->Msg.u.join_confirm), sizeof(pMsgEx->Msg.u.join_confirm));
  3962. }
  3963. else
  3964. {
  3965. ERROR_OUT(("CControlSAP::ConfJoinConfirm: can't create GCCCtrlSapMsgEx"));
  3966. rc = GCC_ALLOCATION_FAILURE;
  3967. goto MyExit;
  3968. }
  3969. /*
  3970. ** Copy the information that needs to be sent to the node
  3971. ** controller into local memory that can be deleted once the
  3972. ** information to be sent to the application is flushed. Note that
  3973. ** if an error occurs in one call to "CopyDataToGCCMessage" then no
  3974. ** action is taken on subsequent calls to that routine.
  3975. */
  3976. // start with success
  3977. rc = GCC_NO_ERROR;
  3978. // Copy the conference name
  3979. ::CSAP_CopyDataToGCCMessage_ConfName(
  3980. pMsgEx->pToDelete,
  3981. conference_name,
  3982. &(pMsgEx->Msg.u.join_confirm.conference_name),
  3983. &rc);
  3984. // Copy the remote modifier
  3985. ::CSAP_CopyDataToGCCMessage_Modifier(
  3986. TRUE, // remote modifier
  3987. pMsgEx->pToDelete,
  3988. remote_modifier,
  3989. &(pMsgEx->Msg.u.join_confirm.called_node_modifier),
  3990. &rc);
  3991. // Copy the local conference name modifier
  3992. ::CSAP_CopyDataToGCCMessage_Modifier(
  3993. FALSE, // conference modifier
  3994. pMsgEx->pToDelete,
  3995. local_modifier,
  3996. &(pMsgEx->Msg.u.join_confirm.calling_node_modifier),
  3997. &rc);
  3998. // Copy the Password challange
  3999. ::CSAP_CopyDataToGCCMessage_Challenge(
  4000. pMsgEx->pToDelete,
  4001. password_challenge,
  4002. &(pMsgEx->Msg.u.join_confirm.password_challenge),
  4003. &rc);
  4004. // Copy the Domain Parameters
  4005. ::CSAP_CopyDataToGCCMessage_DomainParams(
  4006. pMsgEx->pToDelete,
  4007. domain_parameters,
  4008. &(pMsgEx->Msg.u.join_confirm.domain_parameters),
  4009. &rc);
  4010. // Copy the Conductor Privilege List
  4011. ::CSAP_CopyDataToGCCMessage_PrivilegeList(
  4012. conductor_privilege_list,
  4013. &(pMsgEx->Msg.u.join_confirm.conductor_privilege_list),
  4014. &rc);
  4015. pMsgEx->pToDelete->conductor_privilege_list = pMsgEx->Msg.u.join_confirm.conductor_privilege_list;
  4016. // Copy the Conducted-mode Conference Privilege List
  4017. ::CSAP_CopyDataToGCCMessage_PrivilegeList(
  4018. conduct_mode_privilege_list,
  4019. &(pMsgEx->Msg.u.join_confirm.conducted_mode_privilege_list),
  4020. &rc);
  4021. pMsgEx->pToDelete->conducted_mode_privilege_list = pMsgEx->Msg.u.join_confirm.conducted_mode_privilege_list;
  4022. // Copy the Non-Conducted-mode Conference Privilege List
  4023. ::CSAP_CopyDataToGCCMessage_PrivilegeList(
  4024. non_conduct_privilege_list,
  4025. &(pMsgEx->Msg.u.join_confirm.non_conducted_privilege_list),
  4026. &rc);
  4027. pMsgEx->pToDelete->non_conducted_privilege_list = pMsgEx->Msg.u.join_confirm.non_conducted_privilege_list;
  4028. // Copy the Conference Descriptor
  4029. ::CSAP_CopyDataToGCCMessage_IDvsDesc(
  4030. FALSE, // conference descriptor
  4031. pMsgEx->pToDelete,
  4032. pwszConfDescription,
  4033. &(pMsgEx->Msg.u.join_confirm.conference_descriptor),
  4034. &rc);
  4035. if (GCC_NO_ERROR != rc)
  4036. {
  4037. goto MyExit;
  4038. }
  4039. // Copy the User Data
  4040. if (user_data_list != NULL)
  4041. {
  4042. rc = RetrieveUserDataList(
  4043. user_data_list,
  4044. &(pMsgEx->Msg.u.join_confirm.number_of_user_data_members),
  4045. &(pMsgEx->Msg.u.join_confirm.user_data_list),
  4046. &(pMsgEx->pToDelete->user_data_list_memory));
  4047. if (GCC_NO_ERROR != rc)
  4048. {
  4049. goto MyExit;
  4050. }
  4051. }
  4052. else
  4053. {
  4054. // pMsgEx->Msg.u.join_confirm.number_of_user_data_members = 0;
  4055. // pMsgEx->Msg.u.join_confirm.user_data_list = NULL;
  4056. }
  4057. // Queue up the message for delivery to the Node Controller.
  4058. pMsgEx->Msg.nConfID = conference_id;
  4059. pMsgEx->Msg.u.join_confirm.conference_id = conference_id;
  4060. pMsgEx->Msg.u.join_confirm.clear_password_required = password_in_the_clear;
  4061. pMsgEx->Msg.u.join_confirm.conference_is_locked = conference_is_locked;
  4062. pMsgEx->Msg.u.join_confirm.conference_is_listed = conference_is_listed;
  4063. pMsgEx->Msg.u.join_confirm.conference_is_conductible = conference_is_conductible;
  4064. pMsgEx->Msg.u.join_confirm.termination_method = termination_method;
  4065. pMsgEx->Msg.u.join_confirm.result = result;
  4066. pMsgEx->Msg.u.join_confirm.connection_handle = connection_handle;
  4067. PostConfirmCtrlSapMsg(pMsgEx);
  4068. MyExit:
  4069. if (GCC_NO_ERROR != rc)
  4070. {
  4071. FreeCtrlSapMsgEx(pMsgEx);
  4072. HandleResourceFailure(rc);
  4073. }
  4074. #endif // GCCNC_DIRECT_CONFIRM
  4075. DebugExitINT(CControlSAP::ConfJoinConfirm, rc);
  4076. return rc;
  4077. }
  4078. /*
  4079. * GCCError ConfInviteConfirm ()
  4080. *
  4081. * Public Function Description
  4082. * This function is called by the CConf when it need to send a
  4083. * conference invite confirm to the node controller. It adds the
  4084. * message to a queue of messages to be sent to the node controller in
  4085. * the next heartbeat.
  4086. */
  4087. GCCError CControlSAP::ConfInviteConfirm
  4088. (
  4089. GCCConfID conference_id,
  4090. CUserDataListContainer *user_data_list,
  4091. GCCResult result,
  4092. ConnectionHandle connection_handle
  4093. )
  4094. {
  4095. GCCError rc = GCC_NO_ERROR;
  4096. DebugEntry(CControlSAP::ConfInviteConfirm);
  4097. #ifdef GCCNC_DIRECT_CONFIRM
  4098. GCCCtrlSapMsg Msg;
  4099. Msg.message_type = GCC_INVITE_CONFIRM;
  4100. // Copy the User Data
  4101. LPBYTE pUserDataMemory = NULL;
  4102. if (user_data_list != NULL)
  4103. {
  4104. rc = RetrieveUserDataList(
  4105. user_data_list,
  4106. &(Msg.u.invite_confirm.number_of_user_data_members),
  4107. &(Msg.u.invite_confirm.user_data_list),
  4108. &pUserDataMemory);
  4109. }
  4110. else
  4111. {
  4112. Msg.u.invite_confirm.number_of_user_data_members = 0;
  4113. Msg.u.invite_confirm.user_data_list = NULL;
  4114. }
  4115. if (GCC_NO_ERROR == rc)
  4116. {
  4117. Msg.nConfID = conference_id;
  4118. Msg.u.invite_confirm.conference_id = conference_id;
  4119. Msg.u.invite_confirm.result = result;
  4120. Msg.u.invite_confirm.connection_handle = connection_handle;
  4121. SendCtrlSapMsg(&Msg);
  4122. // clean up
  4123. delete pUserDataMemory;
  4124. }
  4125. else
  4126. {
  4127. HandleResourceFailure(rc);
  4128. }
  4129. #else
  4130. GCCCtrlSapMsgEx *pMsgEx;
  4131. //
  4132. // Allocate control sap message.
  4133. //
  4134. DBG_SAVE_FILE_LINE
  4135. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_INVITE_CONFIRM, TRUE)))
  4136. {
  4137. ::ZeroMemory(&(pMsgEx->Msg.u.invite_confirm), sizeof(pMsgEx->Msg.u.invite_confirm));
  4138. }
  4139. else
  4140. {
  4141. ERROR_OUT(("CControlSAP::ConfInviteConfirm: can't create GCCCtrlSapMsgEx"));
  4142. rc = GCC_ALLOCATION_FAILURE;
  4143. goto MyExit;
  4144. }
  4145. // Copy the User Data
  4146. if (user_data_list != NULL)
  4147. {
  4148. rc = RetrieveUserDataList(
  4149. user_data_list,
  4150. &(pMsgEx->Msg.u.invite_confirm.number_of_user_data_members),
  4151. &(pMsgEx->Msg.u.invite_confirm.user_data_list),
  4152. &(pMsgEx->pToDelete->user_data_list_memory));
  4153. if (GCC_NO_ERROR != rc)
  4154. {
  4155. goto MyExit;
  4156. }
  4157. }
  4158. else
  4159. {
  4160. // pMsgEx->Msg.u.invite_confirm.number_of_user_data_members = 0;
  4161. // pMsgEx->Msg.u.invite_confirm.user_data_list = NULL;
  4162. }
  4163. pMsgEx->Msg.nConfID = conference_id;
  4164. pMsgEx->Msg.u.invite_confirm.conference_id = conference_id;
  4165. pMsgEx->Msg.u.invite_confirm.result = result;
  4166. pMsgEx->Msg.u.invite_confirm.connection_handle = connection_handle;
  4167. // Queue up the message for delivery to the Node Controller.
  4168. PostConfirmCtrlSapMsg(pMsgEx);
  4169. MyExit:
  4170. if (GCC_NO_ERROR != rc)
  4171. {
  4172. FreeCtrlSapMsgEx(pMsgEx);
  4173. HandleResourceFailure(rc);
  4174. }
  4175. #endif // GCCNC_DIRECT_CONFIRM
  4176. DebugExitINT(CControlSAP::ConfInviteConfirm, rc);
  4177. return rc;
  4178. }
  4179. /*
  4180. * GCCError ConfTerminateIndication ()
  4181. *
  4182. * Public Function Description
  4183. * This function is called by the GCC Controller when it need to send a
  4184. * conference terminate indication to the node controller. It adds the
  4185. * message to a queue of messages to be sent to the node controller in
  4186. * the next heartbeat.
  4187. */
  4188. GCCError CControlSAP::
  4189. ConfTerminateIndication
  4190. (
  4191. GCCConfID conference_id,
  4192. UserID requesting_node_id,
  4193. GCCReason reason
  4194. )
  4195. {
  4196. GCCError rc;
  4197. DebugEntry(CControlSAP::ConfTerminateIndication);
  4198. #ifdef GCCNC_DIRECT_INDICATION
  4199. GCCCtrlSapMsg Msg;
  4200. Msg.message_type = GCC_TERMINATE_INDICATION;
  4201. Msg.nConfID = conference_id;
  4202. Msg.u.terminate_indication.conference_id = conference_id;
  4203. Msg.u.terminate_indication.requesting_node_id = requesting_node_id;
  4204. Msg.u.terminate_indication.reason = reason;
  4205. SendCtrlSapMsg(&Msg);
  4206. rc = GCC_NO_ERROR;
  4207. #else
  4208. GCCCtrlSapMsgEx *pMsgEx;
  4209. //
  4210. // Allocate control sap message.
  4211. //
  4212. DBG_SAVE_FILE_LINE
  4213. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_TERMINATE_INDICATION)))
  4214. {
  4215. // ::ZeroMemory(&(pMsgEx->Msg.u.terminate_indication), sizeof(pMsgEx->Msg.u.terminate_indication));
  4216. pMsgEx->Msg.nConfID = conference_id;
  4217. pMsgEx->Msg.u.terminate_indication.conference_id = conference_id;
  4218. pMsgEx->Msg.u.terminate_indication.requesting_node_id = requesting_node_id;
  4219. pMsgEx->Msg.u.terminate_indication.reason = reason;
  4220. // Queue up the message for delivery to the Node Controller.
  4221. PostIndCtrlSapMsg(pMsgEx);
  4222. rc = GCC_NO_ERROR;
  4223. }
  4224. else
  4225. {
  4226. rc = GCC_ALLOCATION_FAILURE;
  4227. HandleResourceFailure();
  4228. }
  4229. #endif // GCCNC_DIRECT_INDICATION
  4230. DebugExitINT(CControlSAP::ConfTerminateIndication, rc);
  4231. return rc;
  4232. }
  4233. /*
  4234. * ConfLockReport()
  4235. *
  4236. * Public Function Descrpition
  4237. * This function is called by the CConf when it need to send a
  4238. * conference lock report to the node controller. It adds the
  4239. * message to a queue of messages to be sent to the node controller in
  4240. * the next heartbeat.
  4241. */
  4242. #ifdef JASPER
  4243. GCCError CControlSAP::ConfLockReport
  4244. (
  4245. GCCConfID conference_id,
  4246. BOOL conference_is_locked
  4247. )
  4248. {
  4249. GCCError rc;
  4250. GCCCtrlSapMsgEx *pMsgEx;
  4251. DebugEntry(CControlSAP::ConfLockReport);
  4252. //
  4253. // Allocate control sap message.
  4254. //
  4255. DBG_SAVE_FILE_LINE
  4256. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_LOCK_REPORT_INDICATION)))
  4257. {
  4258. // ::ZeroMemory(&(pMsgEx->Msg.u.lock_report_indication), sizeof(pMsgEx->Msg.u.lock_report_indication));
  4259. pMsgEx->Msg.u.lock_report_indication.conference_id = conference_id;
  4260. pMsgEx->Msg.u.lock_report_indication.conference_is_locked = conference_is_locked;
  4261. // Queue up the message for delivery to the Node Controller.
  4262. PostIndCtrlSapMsg(pMsgEx);
  4263. rc = GCC_NO_ERROR;
  4264. }
  4265. else
  4266. {
  4267. rc = GCC_ALLOCATION_FAILURE;
  4268. HandleResourceFailure();
  4269. }
  4270. DebugExitINT(CControlSAP::ConfLockReport, rc);
  4271. return rc;
  4272. }
  4273. #endif // JASPER
  4274. /*
  4275. * ConfLockIndication()
  4276. *
  4277. * Public Function Descrpition:
  4278. * This function is called by the CConf when it need to send a
  4279. * conference lock indication to the node controller. It adds the
  4280. * message to a queue of messages to be sent to the node controller in
  4281. * the next heartbeat.
  4282. */
  4283. GCCError CControlSAP::ConfLockIndication
  4284. (
  4285. GCCConfID conference_id,
  4286. UserID source_node_id
  4287. )
  4288. {
  4289. GCCError rc;
  4290. DebugEntry(CControlSAP::ConfLockIndication);
  4291. #ifdef GCCNC_DIRECT_INDICATION
  4292. GCCCtrlSapMsg Msg;
  4293. Msg.message_type = GCC_LOCK_INDICATION;
  4294. Msg.u.lock_indication.conference_id = conference_id;
  4295. Msg.u.lock_indication.requesting_node_id = source_node_id;
  4296. SendCtrlSapMsg(&Msg);
  4297. rc = GCC_NO_ERROR;
  4298. #else
  4299. GCCCtrlSapMsgEx *pMsgEx;
  4300. //
  4301. // Allocate control sap message.
  4302. //
  4303. DBG_SAVE_FILE_LINE
  4304. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_LOCK_INDICATION)))
  4305. {
  4306. // ::ZeroMemory(&(pMsgEx->Msg.u.lock_indication), sizeof(pMsgEx->Msg.u.lock_indication));
  4307. pMsgEx->Msg.u.lock_indication.conference_id = conference_id;
  4308. pMsgEx->Msg.u.lock_indication.requesting_node_id = source_node_id;
  4309. // Queue up the message for delivery to the Node Controller.
  4310. PostIndCtrlSapMsg(pMsgEx);
  4311. rc = GCC_NO_ERROR;
  4312. }
  4313. else
  4314. {
  4315. rc = GCC_ALLOCATION_FAILURE;
  4316. HandleResourceFailure();
  4317. }
  4318. #endif // GCCNC_DIRECT_INDICATION
  4319. DebugExitINT(CControlSAP::ConfLockIndication, rc);
  4320. return rc;
  4321. }
  4322. /*
  4323. * ConfLockConfirm()
  4324. *
  4325. * Public Function Descrpition
  4326. * This function is called by the CConf when it need to send a
  4327. * conference lock confirm to the node controller. It adds the
  4328. * message to a queue of messages to be sent to the node controller in
  4329. * the next heartbeat.
  4330. */
  4331. #ifdef JASPER
  4332. GCCError CControlSAP::ConfLockConfirm
  4333. (
  4334. GCCResult result,
  4335. GCCConfID conference_id
  4336. )
  4337. {
  4338. GCCError rc;
  4339. DebugEntry(CControlSAP::ConfLockConfirm);
  4340. #ifdef GCCNC_DIRECT_CONFIRM
  4341. //
  4342. // WPARAM: result.
  4343. // LPARAM: conf ID
  4344. //
  4345. PostAsynDirectConfirmMsg(GCC_LOCK_CONFIRM, result, conference_id);
  4346. rc = GCC_NO_ERROR;
  4347. #else
  4348. GCCCtrlSapMsgEx *pMsgEx;
  4349. //
  4350. // Allocate control sap message.
  4351. //
  4352. DBG_SAVE_FILE_LINE
  4353. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_LOCK_CONFIRM)))
  4354. {
  4355. // ::ZeroMemory(&(pMsgEx->Msg.u.lock_confirm), sizeof(pMsgEx->Msg.u.lock_confirm));
  4356. pMsgEx->Msg.u.lock_confirm.conference_id = conference_id;
  4357. pMsgEx->Msg.u.lock_confirm.result = result;
  4358. // Queue up the message for delivery to the Node Controller.
  4359. PostConfirmCtrlSapMsg(pMsgEx);
  4360. rc = GCC_NO_ERROR;
  4361. }
  4362. else
  4363. {
  4364. rc = GCC_ALLOCATION_FAILURE;
  4365. HandleResourceFailure();
  4366. }
  4367. #endif // GCCNC_DIRECT_CONFIRM
  4368. DebugExitINT(CControlSAP::ConfLockConfirm, rc);
  4369. return rc;
  4370. }
  4371. #endif // JASPER
  4372. /*
  4373. * ConfUnlockIndication()
  4374. *
  4375. * Public Function Description
  4376. * This function is called by the CConf when it need to send a
  4377. * conference unlock indication to the node controller. It adds the
  4378. * message to a queue of messages to be sent to the node controller in
  4379. * the next heartbeat.
  4380. */
  4381. #ifdef JASPER
  4382. GCCError CControlSAP::ConfUnlockIndication
  4383. (
  4384. GCCConfID conference_id,
  4385. UserID source_node_id
  4386. )
  4387. {
  4388. GCCError rc;
  4389. DebugEntry(CControlSAP::ConfUnlockIndication);
  4390. #ifdef GCCNC_DIRECT_INDICATION
  4391. GCCCtrlSapMsg Msg;
  4392. Msg.message_type = GCC_UNLOCK_INDICATION;
  4393. Msg.u.unlock_indication.conference_id = conference_id;
  4394. Msg.u.unlock_indication.requesting_node_id = source_node_id;
  4395. SendCtrlSapMsg(&Msg);
  4396. rc = GCC_NO_ERROR;
  4397. #else
  4398. GCCCtrlSapMsgEx *pMsgEx;
  4399. //
  4400. // Allocate control sap message.
  4401. //
  4402. DBG_SAVE_FILE_LINE
  4403. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_UNLOCK_INDICATION)))
  4404. {
  4405. // ::ZeroMemory(&(pMsgEx->Msg.u.unlock_indication), sizeof(pMsgEx->Msg.u.unlock_indication));
  4406. pMsgEx->Msg.u.unlock_indication.conference_id = conference_id;
  4407. pMsgEx->Msg.u.unlock_indication.requesting_node_id = source_node_id;
  4408. // Queue up the message for delivery to the Node Controller.
  4409. PostIndCtrlSapMsg(pMsgEx);
  4410. rc = GCC_NO_ERROR;
  4411. }
  4412. else
  4413. {
  4414. rc = GCC_ALLOCATION_FAILURE;
  4415. HandleResourceFailure();
  4416. }
  4417. #endif // GCCNC_DIRECT_INDICATION
  4418. DebugExitINT(CControlSAP::ConfUnlockIndication, rc);
  4419. return rc;
  4420. }
  4421. #endif // JASPER
  4422. /*
  4423. * ConfUnlockConfirm()
  4424. *
  4425. * Public Function Descrpition
  4426. * This function is called by the CConf when it need to send a
  4427. * conference unlock confirm to the node controller. It adds the
  4428. * message to a queue of messages to be sent to the node controller in
  4429. * the next heartbeat.
  4430. */
  4431. #ifdef JASPER
  4432. GCCError CControlSAP::ConfUnlockConfirm
  4433. (
  4434. GCCResult result,
  4435. GCCConfID conference_id
  4436. )
  4437. {
  4438. GCCError rc;
  4439. DebugEntry(CControlSAP::ConfUnlockConfirm);
  4440. #ifdef GCCNC_DIRECT_CONFIRM
  4441. //
  4442. // WPARAM: result.
  4443. // LPARAM: conf ID
  4444. //
  4445. PostAsynDirectConfirmMsg(GCC_UNLOCK_CONFIRM, result, conference_id);
  4446. rc = GCC_NO_ERROR;
  4447. #else
  4448. GCCCtrlSapMsgEx *pMsgEx;
  4449. //
  4450. // Allocate control sap message.
  4451. //
  4452. DBG_SAVE_FILE_LINE
  4453. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_UNLOCK_CONFIRM)))
  4454. {
  4455. // ::ZeroMemory(&(pMsgEx->Msg.u.unlock_confirm), sizeof(pMsgEx->Msg.u.unlock_confirm));
  4456. pMsgEx->Msg.u.unlock_confirm.conference_id = conference_id;
  4457. pMsgEx->Msg.u.unlock_confirm.result = result;
  4458. // Queue up the message for delivery to the Node Controller.
  4459. PostConfirmCtrlSapMsg(pMsgEx);
  4460. rc = GCC_NO_ERROR;
  4461. }
  4462. else
  4463. {
  4464. rc = GCC_ALLOCATION_FAILURE;
  4465. HandleResourceFailure();
  4466. }
  4467. #endif // GCCNC_DIRECT_CONFIRM
  4468. DebugExitINT(CControlSAP::ConfUnlockConfirm, rc);
  4469. return rc;
  4470. }
  4471. #endif // JASPER
  4472. /*
  4473. * ConfPermissionToAnnounce ()
  4474. *
  4475. * Public Function Description
  4476. * This function is called by the CConf when it need to send a
  4477. * conference permission to announce to the node controller. It adds the
  4478. * message to a queue of messages to be sent to the node controller in
  4479. * the next heartbeat.
  4480. */
  4481. GCCError CControlSAP::ConfPermissionToAnnounce
  4482. (
  4483. GCCConfID conference_id,
  4484. UserID node_id
  4485. )
  4486. {
  4487. GCCError rc;
  4488. GCCCtrlSapMsgEx *pMsgEx;
  4489. DebugEntry(CControlSAP::ConfPermissionToAnnounce);
  4490. //
  4491. // Allocate control sap message.
  4492. //
  4493. DBG_SAVE_FILE_LINE
  4494. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_PERMIT_TO_ANNOUNCE_PRESENCE)))
  4495. {
  4496. // ::ZeroMemory(&(pMsgEx->Msg.u.permit_to_announce_presence), sizeof(pMsgEx->Msg.u.permit_to_announce_presence));
  4497. pMsgEx->Msg.nConfID = conference_id;
  4498. pMsgEx->Msg.u.permit_to_announce_presence.conference_id= conference_id;
  4499. pMsgEx->Msg.u.permit_to_announce_presence.node_id = node_id;
  4500. //
  4501. // LONCHANC: We should treat it as a confirm, even though it is
  4502. // an indication. When this node is a top provider, we may send this
  4503. // message in the middle of doing something. In essence, it behaves
  4504. // like a confirm.
  4505. //
  4506. // Queue up the message for delivery to the Node Controller.
  4507. PostConfirmCtrlSapMsg(pMsgEx);
  4508. rc = GCC_NO_ERROR;
  4509. }
  4510. else
  4511. {
  4512. rc = GCC_ALLOCATION_FAILURE;
  4513. HandleResourceFailure();
  4514. }
  4515. DebugExitINT(CControlSAP::ConfPermissionToAnnounce, rc);
  4516. return rc;
  4517. }
  4518. /*
  4519. * ConfAnnouncePresenceConfirm ()
  4520. *
  4521. * Public Function Description
  4522. * This function is called by the CConf when it need to send a
  4523. * conference announce presence confirm to the node controller. It adds the
  4524. * message to a queue of messages to be sent to the node controller in
  4525. * the next heartbeat.
  4526. */
  4527. GCCError CControlSAP::ConfAnnouncePresenceConfirm
  4528. (
  4529. GCCConfID conference_id,
  4530. GCCResult result
  4531. )
  4532. {
  4533. GCCError rc;
  4534. DebugEntry(CControlSAP::ConfAnnouncePresenceConfirm);
  4535. #ifdef GCCNC_DIRECT_CONFIRM
  4536. //
  4537. // WPARAM: result.
  4538. // LPARAM: conf ID
  4539. //
  4540. PostAsynDirectConfirmMsg(GCC_ANNOUNCE_PRESENCE_CONFIRM, result, conference_id);
  4541. rc = GCC_NO_ERROR;
  4542. #else
  4543. GCCCtrlSapMsgEx *pMsgEx;
  4544. //
  4545. // Allocate control sap message.
  4546. //
  4547. DBG_SAVE_FILE_LINE
  4548. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_ANNOUNCE_PRESENCE_CONFIRM)))
  4549. {
  4550. // ::ZeroMemory(&(pMsgEx->Msg.u.announce_presence_confirm), sizeof(pMsgEx->Msg.u.announce_presence_confirm));
  4551. pMsgEx->Msg.nConfID = conference_id;
  4552. pMsgEx->Msg.u.announce_presence_confirm.conference_id = conference_id;
  4553. pMsgEx->Msg.u.announce_presence_confirm.result = result;
  4554. // Queue up the message for delivery to the Node Controller.
  4555. PostConfirmCtrlSapMsg(pMsgEx);
  4556. rc = GCC_NO_ERROR;
  4557. }
  4558. else
  4559. {
  4560. rc = GCC_ALLOCATION_FAILURE;
  4561. HandleResourceFailure();
  4562. }
  4563. #endif // GCCNC_DIRECT_CONFIRM
  4564. DebugExitINT(CControlSAP::ConfAnnouncePresenceConfirm, rc);
  4565. return rc;
  4566. }
  4567. /*
  4568. * ConfTerminateConfirm ()
  4569. *
  4570. * Public Function Description
  4571. * This function is called by the CConf when it need to send a
  4572. * conference terminate confirm to the node controller. It adds the
  4573. * message to a queue of messages to be sent to the node controller in
  4574. * the next heartbeat.
  4575. */
  4576. GCCError CControlSAP::ConfTerminateConfirm
  4577. (
  4578. GCCConfID conference_id,
  4579. GCCResult result
  4580. )
  4581. {
  4582. GCCError rc;
  4583. DebugEntry(CControlSAP::ConfTerminateConfirm);
  4584. #ifdef GCCNC_DIRECT_CONFIRM
  4585. //
  4586. // WPARAM: result.
  4587. // LPARAM: conf ID
  4588. //
  4589. PostAsynDirectConfirmMsg(GCC_TERMINATE_CONFIRM, result, conference_id);
  4590. rc = GCC_NO_ERROR;
  4591. #else
  4592. GCCCtrlSapMsgEx *pMsgEx;
  4593. //
  4594. // Allocate control sap message.
  4595. //
  4596. DBG_SAVE_FILE_LINE
  4597. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_TERMINATE_CONFIRM)))
  4598. {
  4599. // ::ZeroMemory(&(pMsgEx->Msg.u.terminate_confirm), sizeof(pMsgEx->Msg.u.terminate_confirm));
  4600. pMsgEx->Msg.nConfID = conference_id;
  4601. pMsgEx->Msg.u.terminate_confirm.conference_id = conference_id;
  4602. pMsgEx->Msg.u.terminate_confirm.result = result;
  4603. // Queue up the message for delivery to the Node Controller.
  4604. PostConfirmCtrlSapMsg(pMsgEx);
  4605. rc = GCC_NO_ERROR;
  4606. }
  4607. else
  4608. {
  4609. rc = GCC_ALLOCATION_FAILURE;
  4610. HandleResourceFailure();
  4611. }
  4612. #endif // GCCNC_DIRECT_CONFIRM
  4613. DebugExitINT(CControlSAP::ConfTerminateConfirm, rc);
  4614. return rc;
  4615. }
  4616. /*
  4617. * ConfEjectUserIndication ()
  4618. *
  4619. * Public Function Description
  4620. * This function is called by the CConf when it need to send a
  4621. * conference eject user indication to the node controller. It adds the
  4622. * message to a queue of messages to be sent to the node controller in
  4623. * the next heartbeat.
  4624. */
  4625. GCCError CControlSAP::ConfEjectUserIndication
  4626. (
  4627. GCCConfID conference_id,
  4628. GCCReason reason,
  4629. UserID gcc_node_id
  4630. )
  4631. {
  4632. GCCError rc;
  4633. DebugEntry(CControlSAP::ConfEjectUserIndication);
  4634. #ifdef GCCNC_DIRECT_INDICATION
  4635. //
  4636. // WPARAM: reason, ejected node ID.
  4637. // LPARAM: conf ID
  4638. //
  4639. PostAsynDirectConfirmMsg(GCC_EJECT_USER_INDICATION, reason, gcc_node_id, conference_id);
  4640. rc = GCC_NO_ERROR;
  4641. #else
  4642. GCCCtrlSapMsgEx *pMsgEx;
  4643. //
  4644. // Allocate control sap message.
  4645. //
  4646. DBG_SAVE_FILE_LINE
  4647. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_EJECT_USER_INDICATION)))
  4648. {
  4649. // ::ZeroMemory(&(pMsgEx->Msg.u.eject_user_indication), sizeof(pMsgEx->Msg.u.eject_user_indication));
  4650. pMsgEx->Msg.nConfID = conference_id;
  4651. pMsgEx->Msg.u.eject_user_indication.conference_id = conference_id;
  4652. pMsgEx->Msg.u.eject_user_indication.ejected_node_id = gcc_node_id;
  4653. pMsgEx->Msg.u.eject_user_indication.reason = reason;
  4654. // Queue up the message for delivery to the Node Controller.
  4655. PostIndCtrlSapMsg(pMsgEx);
  4656. rc = GCC_NO_ERROR;
  4657. }
  4658. else
  4659. {
  4660. rc = GCC_ALLOCATION_FAILURE;
  4661. HandleResourceFailure();
  4662. }
  4663. #endif // GCCNC_DIRECT_INDICATION
  4664. DebugExitINT(CControlSAP::ConfEjectUserIndication, rc);
  4665. return rc;
  4666. }
  4667. /*
  4668. * ConfEjectUserConfirm ()
  4669. *
  4670. * Public Function Description
  4671. * This function is called by the CConf when it need to send a
  4672. * conference eject user confirm to the node controller. It adds the
  4673. * message to a queue of messages to be sent to the node controller in
  4674. * the next heartbeat.
  4675. */
  4676. #ifdef JASPER
  4677. GCCError CControlSAP::ConfEjectUserConfirm
  4678. (
  4679. GCCConfID conference_id,
  4680. UserID ejected_node_id,
  4681. GCCResult result
  4682. )
  4683. {
  4684. GCCError rc;
  4685. DebugEntry(CControlSAP::ConfEjectUserConfirm);
  4686. #ifdef GCCNC_DIRECT_CONFIRM
  4687. //
  4688. // WPARAM: LOWORD=result. HIWORD=nid.
  4689. // LPARAM: conf ID
  4690. //
  4691. PostAsynDirectConfirmMsg(GCC_EJECT_USER_CONFIRM, result, ejected_node_id, conference_id);
  4692. rc = GCC_NO_ERROR;
  4693. #else
  4694. GCCCtrlSapMsgEx *pMsgEx;
  4695. //
  4696. // Allocate control sap message.
  4697. //
  4698. DBG_SAVE_FILE_LINE
  4699. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_EJECT_USER_CONFIRM)))
  4700. {
  4701. // ::ZeroMemory(&(pMsgEx->Msg.u.eject_user_confirm), sizeof(pMsgEx->Msg.u.eject_user_confirm));
  4702. pMsgEx->Msg.u.eject_user_confirm.conference_id = conference_id;
  4703. pMsgEx->Msg.u.eject_user_confirm.ejected_node_id = ejected_node_id;
  4704. pMsgEx->Msg.u.eject_user_confirm.result = result;
  4705. // Queue up the message for delivery to the Node Controller.
  4706. PostConfirmCtrlSapMsg(pMsgEx);
  4707. rc = GCC_NO_ERROR;
  4708. }
  4709. else
  4710. {
  4711. rc = GCC_ALLOCATION_FAILURE;
  4712. HandleResourceFailure();
  4713. }
  4714. #endif // GCCNC_DIRECT_CONFIRM
  4715. DebugExitINT(CControlSAP::ConfEjectUserConfirm, rc);
  4716. return rc;
  4717. }
  4718. #endif // JASPER
  4719. /*
  4720. * ConductorAssignConfirm ()
  4721. *
  4722. * Public Function Description
  4723. * This function is called by the CConf when it need to send a
  4724. * conductor assign confirm to the node controller. It adds the
  4725. * message to a queue of messages to be sent to the node controller in
  4726. * the next heartbeat.
  4727. */
  4728. #ifdef JASPER
  4729. GCCError CControlSAP::ConductorAssignConfirm
  4730. (
  4731. GCCResult result,
  4732. GCCConfID conference_id
  4733. )
  4734. {
  4735. GCCError rc;
  4736. DebugEntry(CControlSAP::ConductorAssignConfirm);
  4737. #ifdef GCCNC_DIRECT_CONFIRM
  4738. //
  4739. // WPARAM: result.
  4740. // LPARAM: conf ID
  4741. //
  4742. PostAsynDirectConfirmMsg(GCC_CONDUCT_ASSIGN_CONFIRM, result, conference_id);
  4743. rc = GCC_NO_ERROR;
  4744. #else
  4745. GCCCtrlSapMsgEx *pMsgEx;
  4746. //
  4747. // Allocate control sap message.
  4748. //
  4749. DBG_SAVE_FILE_LINE
  4750. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_CONDUCT_ASSIGN_CONFIRM)))
  4751. {
  4752. // ::ZeroMemory(&(pMsgEx->Msg.u.conduct_assign_confirm), sizeof(pMsgEx->Msg.u.conduct_assign_confirm));
  4753. pMsgEx->Msg.u.conduct_assign_confirm.conference_id = conference_id;
  4754. pMsgEx->Msg.u.conduct_assign_confirm.result = result;
  4755. // Queue up the message for delivery to the Node Controller.
  4756. PostConfirmCtrlSapMsg(pMsgEx);
  4757. rc = GCC_NO_ERROR;
  4758. }
  4759. else
  4760. {
  4761. rc = GCC_ALLOCATION_FAILURE;
  4762. HandleResourceFailure();
  4763. }
  4764. #endif // GCCNC_DIRECT_CONFIRM
  4765. DebugExitINT(CControlSAP::ConductorAssignConfirm, rc);
  4766. return rc;
  4767. }
  4768. #endif // JASPER
  4769. /*
  4770. * ConductorReleaseConfirm ()
  4771. *
  4772. * Public Function Description
  4773. * This function is called by the CConf when it need to send a
  4774. * conductor release confirm to the node controller. It adds the
  4775. * message to a queue of messages to be sent to the node controller in
  4776. * the next heartbeat.
  4777. */
  4778. #ifdef JASPER
  4779. GCCError CControlSAP::ConductorReleaseConfirm
  4780. (
  4781. GCCResult result,
  4782. GCCConfID conference_id
  4783. )
  4784. {
  4785. GCCError rc;
  4786. DebugEntry(CControlSAP::ConductorReleaseConfirm);
  4787. #ifdef GCCNC_DIRECT_CONFIRM
  4788. //
  4789. // WPARAM: result.
  4790. // LPARAM: conf ID
  4791. //
  4792. PostAsynDirectConfirmMsg(GCC_CONDUCT_RELEASE_CONFIRM, result, conference_id);
  4793. rc = GCC_NO_ERROR;
  4794. #else
  4795. GCCCtrlSapMsgEx *pMsgEx;
  4796. //
  4797. // Allocate control sap message.
  4798. //
  4799. DBG_SAVE_FILE_LINE
  4800. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_CONDUCT_RELEASE_CONFIRM)))
  4801. {
  4802. // ::ZeroMemory(&(pMsgEx->Msg.u.conduct_release_confirm), sizeof(pMsgEx->Msg.u.conduct_release_confirm));
  4803. pMsgEx->Msg.u.conduct_release_confirm.conference_id = conference_id;
  4804. pMsgEx->Msg.u.conduct_release_confirm.result = result;
  4805. // Queue up the message for delivery to the Node Controller.
  4806. PostConfirmCtrlSapMsg(pMsgEx);
  4807. rc = GCC_NO_ERROR;
  4808. }
  4809. else
  4810. {
  4811. rc = GCC_ALLOCATION_FAILURE;
  4812. HandleResourceFailure();
  4813. }
  4814. #endif // GCCNC_DIRECT_CONFIRM
  4815. DebugExitINT(CControlSAP::ConductorReleaseConfirm, rc);
  4816. return rc;
  4817. }
  4818. #endif // JASPER
  4819. /*
  4820. * ConductorPleaseIndication ()
  4821. *
  4822. * Public Function Description
  4823. * This function is called by the CConf when it need to send a
  4824. * conductor please indication to the node controller. It adds the
  4825. * message to a queue of messages to be sent to the node controller in
  4826. * the next heartbeat.
  4827. */
  4828. #ifdef JASPER
  4829. GCCError CControlSAP::ConductorPleaseIndication
  4830. (
  4831. GCCConfID conference_id,
  4832. UserID requester_node_id
  4833. )
  4834. {
  4835. GCCError rc;
  4836. DebugEntry(CControlSAP::ConductorPleaseIndication);
  4837. #ifdef GCCNC_DIRECT_INDICATION
  4838. GCCCtrlSapMsg Msg;
  4839. Msg.message_type = GCC_CONDUCT_PLEASE_INDICATION;
  4840. Msg.u.conduct_please_indication.conference_id = conference_id;
  4841. Msg.u.conduct_please_indication.requester_node_id = requester_node_id;
  4842. SendCtrlSapMsg(&Msg);
  4843. rc = GCC_NO_ERROR;
  4844. #else
  4845. GCCCtrlSapMsgEx *pMsgEx;
  4846. //
  4847. // Allocate control sap message.
  4848. //
  4849. DBG_SAVE_FILE_LINE
  4850. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_CONDUCT_PLEASE_INDICATION)))
  4851. {
  4852. // ::ZeroMemory(&(pMsgEx->Msg.u.conduct_please_indication), sizeof(pMsgEx->Msg.u.conduct_please_indication));
  4853. pMsgEx->Msg.u.conduct_please_indication.conference_id = conference_id;
  4854. pMsgEx->Msg.u.conduct_please_indication.requester_node_id = requester_node_id;
  4855. // Queue up the message for delivery to the Node Controller.
  4856. PostCtrlSapMsg(pMsgEx);
  4857. rc = GCC_NO_ERROR;
  4858. }
  4859. else
  4860. {
  4861. rc = GCC_ALLOCATION_FAILURE;
  4862. HandleResourceFailure();
  4863. }
  4864. #endif // GCCNC_DIRECT_INDICATION
  4865. DebugExitINT(CControlSAP::ConductorPleaseIndication, rc);
  4866. return rc;
  4867. }
  4868. #endif // JASPER
  4869. /*
  4870. * ConductorPleaseConfirm ()
  4871. *
  4872. * Public Function Description
  4873. * This function is called by the CConf when it need to send a
  4874. * conductor please confirm to the node controller. It adds the
  4875. * message to a queue of messages to be sent to the node controller in
  4876. * the next heartbeat.
  4877. */
  4878. #ifdef JASPER
  4879. GCCError CControlSAP::ConductorPleaseConfirm
  4880. (
  4881. GCCResult result,
  4882. GCCConfID conference_id
  4883. )
  4884. {
  4885. GCCError rc;
  4886. DebugEntry(CControlSAP::ConductorPleaseConfirm);
  4887. #ifdef GCCNC_DIRECT_CONFIRM
  4888. //
  4889. // WPARAM: result.
  4890. // LPARAM: conf ID
  4891. //
  4892. PostAsynDirectConfirmMsg(GCC_CONDUCT_PLEASE_CONFIRM, result, conference_id);
  4893. rc = GCC_NO_ERROR;
  4894. #else
  4895. GCCCtrlSapMsgEx *pMsgEx;
  4896. //
  4897. // Allocate control sap message.
  4898. //
  4899. DBG_SAVE_FILE_LINE
  4900. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_CONDUCT_PLEASE_CONFIRM)))
  4901. {
  4902. // ::ZeroMemory(&(pMsgEx->Msg.u.conduct_please_confirm), sizeof(pMsgEx->Msg.u.conduct_please_confirm));
  4903. pMsgEx->Msg.u.conduct_please_confirm.conference_id = conference_id;
  4904. pMsgEx->Msg.u.conduct_please_confirm.result = result;
  4905. // Queue up the message for delivery to the Node Controller.
  4906. PostConfirmCtrlSapMsg(pMsgEx);
  4907. rc = GCC_NO_ERROR;
  4908. }
  4909. else
  4910. {
  4911. rc = GCC_ALLOCATION_FAILURE;
  4912. HandleResourceFailure();
  4913. }
  4914. #endif // GCCNC_DIRECT_CONFIRM
  4915. DebugExitINT(CControlSAP::ConductorPleaseConfirm, rc);
  4916. return rc;
  4917. }
  4918. #endif // JASPER
  4919. /*
  4920. * ConductorGiveIndication ()
  4921. *
  4922. * Public Function Description
  4923. * This function is called by the CConf when it need to send a
  4924. * conductor give indication to the node controller. It adds the
  4925. * message to a queue of messages to be sent to the node controller in
  4926. * the next heartbeat.
  4927. */
  4928. GCCError CControlSAP::ConductorGiveIndication ( GCCConfID conference_id )
  4929. {
  4930. GCCError rc;
  4931. DebugEntry(CControlSAP::ConductorGiveIndication);
  4932. #ifdef GCCNC_DIRECT_INDICATION
  4933. GCCCtrlSapMsg Msg;
  4934. Msg.message_type = GCC_CONDUCT_GIVE_INDICATION;
  4935. Msg.u.conduct_give_indication.conference_id = conference_id;
  4936. SendCtrlSapMsg(&Msg);
  4937. rc = GCC_NO_ERROR;
  4938. #else
  4939. GCCCtrlSapMsgEx *pMsgEx;
  4940. //
  4941. // Allocate control sap message.
  4942. //
  4943. DBG_SAVE_FILE_LINE
  4944. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_CONDUCT_GIVE_INDICATION)))
  4945. {
  4946. // ::ZeroMemory(&(pMsgEx->Msg.u.conduct_give_indication), sizeof(pMsgEx->Msg.u.conduct_give_indication));
  4947. pMsgEx->Msg.u.conduct_give_indication.conference_id = conference_id;
  4948. // Queue up the message for delivery to the Node Controller.
  4949. PostIndCtrlSapMsg(pMsgEx);
  4950. rc = GCC_NO_ERROR;
  4951. }
  4952. else
  4953. {
  4954. rc = GCC_ALLOCATION_FAILURE;
  4955. HandleResourceFailure();
  4956. }
  4957. #endif // GCCNC_DIRECT_INDICATION
  4958. DebugExitINT(CControlSAP::ConductorGiveIndication, rc);
  4959. return rc;
  4960. }
  4961. /*
  4962. * ConductorGiveConfirm ()
  4963. *
  4964. * Public Function Description
  4965. * This function is called by the CConf when it need to send a
  4966. * conductor give confirm to the node controller. It adds the
  4967. * message to a queue of messages to be sent to the node controller in
  4968. * the next heartbeat.
  4969. */
  4970. #ifdef JASPER
  4971. GCCError CControlSAP::ConductorGiveConfirm
  4972. (
  4973. GCCResult result,
  4974. GCCConfID conference_id,
  4975. UserID recipient_node
  4976. )
  4977. {
  4978. GCCError rc;
  4979. DebugEntry(CControlSAP::ConductorGiveConfirm);
  4980. #ifdef GCCNC_DIRECT_CONFIRM
  4981. //
  4982. // WPARAM: LOWORD=result. HIWORD=nid.
  4983. // LPARAM: conf ID
  4984. //
  4985. PostAsynDirectConfirmMsg(GCC_CONDUCT_GIVE_CONFIRM, result, recipient_node, conference_id);
  4986. rc = GCC_NO_ERROR;
  4987. #else
  4988. GCCCtrlSapMsgEx *pMsgEx;
  4989. //
  4990. // Allocate control sap message.
  4991. //
  4992. DBG_SAVE_FILE_LINE
  4993. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_CONDUCT_GIVE_CONFIRM)))
  4994. {
  4995. // ::ZeroMemory(&(pMsgEx->Msg.u.conduct_give_confirm), sizeof(pMsgEx->Msg.u.conduct_give_confirm));
  4996. pMsgEx->Msg.u.conduct_give_confirm.conference_id = conference_id;
  4997. pMsgEx->Msg.u.conduct_give_confirm.result = result;
  4998. pMsgEx->Msg.u.conduct_give_confirm.recipient_node_id = recipient_node;
  4999. // Queue up the message for delivery to the Node Controller.
  5000. PostConfirmCtrlSapMsg(pMsgEx);
  5001. rc = GCC_NO_ERROR;
  5002. }
  5003. else
  5004. {
  5005. rc = GCC_ALLOCATION_FAILURE;
  5006. HandleResourceFailure();
  5007. }
  5008. #endif // GCCNC_DIRECT_CONFIRM
  5009. DebugExitINT(CControlSAP::ConductorGiveConfirm, rc);
  5010. return rc;
  5011. }
  5012. #endif // JASPER
  5013. /*
  5014. * ConductorPermitAskIndication ()
  5015. *
  5016. * Public Function Description
  5017. * This function is called by the CConf when it need to send a
  5018. * conductor permit ask indication to the node controller. It adds the
  5019. * message to a queue of messages to be sent to the node controller in
  5020. * the next heartbeat.
  5021. */
  5022. #ifdef JASPER
  5023. GCCError CControlSAP::ConductorPermitAskIndication
  5024. (
  5025. GCCConfID conference_id,
  5026. BOOL grant_flag,
  5027. UserID requester_id
  5028. )
  5029. {
  5030. GCCError rc;
  5031. DebugEntry(CControlSAP::ConductorPermitAskIndication);
  5032. #ifdef GCCNC_DIRECT_INDICATION
  5033. GCCCtrlSapMsg Msg;
  5034. Msg.message_type = GCC_CONDUCT_ASK_INDICATION;
  5035. Msg.u.conduct_permit_ask_indication.conference_id = conference_id;
  5036. Msg.u.conduct_permit_ask_indication.permission_is_granted = grant_flag;
  5037. Msg.u.conduct_permit_ask_indication.requester_node_id = requester_id;
  5038. SendCtrlSapMsg(&Msg);
  5039. rc = GCC_NO_ERROR;
  5040. #else
  5041. GCCCtrlSapMsgEx *pMsgEx;
  5042. //
  5043. // Allocate control sap message.
  5044. //
  5045. DBG_SAVE_FILE_LINE
  5046. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_CONDUCT_ASK_INDICATION)))
  5047. {
  5048. // ::ZeroMemory(&(pMsgEx->Msg.u.conduct_permit_ask_indication), sizeof(pMsgEx->Msg.u.conduct_permit_ask_indication));
  5049. pMsgEx->Msg.u.conduct_permit_ask_indication.conference_id = conference_id;
  5050. pMsgEx->Msg.u.conduct_permit_ask_indication.permission_is_granted = grant_flag;
  5051. pMsgEx->Msg.u.conduct_permit_ask_indication.requester_node_id = requester_id;
  5052. // Queue up the message for delivery to the Node Controller.
  5053. PostIndCtrlSapMsg(pMsgEx);
  5054. rc = GCC_NO_ERROR;
  5055. }
  5056. else
  5057. {
  5058. rc = GCC_ALLOCATION_FAILURE;
  5059. HandleResourceFailure();
  5060. }
  5061. #endif // GCCNC_DIRECT_INDICATION
  5062. DebugExitINT(CControlSAP::ConductorPermitAskIndication, rc);
  5063. return rc;
  5064. }
  5065. #endif // JASPER
  5066. /*
  5067. * ConductorPermitAskConfirm ()
  5068. *
  5069. * Public Function Description
  5070. * This function is called by the CConf when it need to send a
  5071. * conductor permit ask confirm to the node controller. It adds the
  5072. * message to a queue of messages to be sent to the node controller in
  5073. * the next heartbeat.
  5074. */
  5075. #ifdef JASPER
  5076. GCCError CControlSAP::ConductorPermitAskConfirm
  5077. (
  5078. GCCResult result,
  5079. BOOL grant_permission,
  5080. GCCConfID conference_id
  5081. )
  5082. {
  5083. GCCError rc;
  5084. GCCCtrlSapMsgEx *pMsgEx;
  5085. DebugEntry(CControlSAP::ConductorPermitAskConfirm);
  5086. #ifdef GCCNC_DIRECT_CONFIRM
  5087. //
  5088. // WPARAM: LOWORD=result. HIWORD=permission.
  5089. // LPARAM: conf ID
  5090. //
  5091. PostAsynDirectConfirmMsg(GCC_CONDUCT_ASK_CONFIRM, result, grant_permission, conference_id);
  5092. rc = GCC_NO_ERROR;
  5093. #else
  5094. GCCCtrlSapMsgEx *pMsgEx;
  5095. //
  5096. // Allocate control sap message.
  5097. //
  5098. DBG_SAVE_FILE_LINE
  5099. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_CONDUCT_ASK_CONFIRM)))
  5100. {
  5101. // ::ZeroMemory(&(pMsgEx->Msg.u.conduct_permit_ask_confirm), sizeof(pMsgEx->Msg.u.conduct_permit_ask_confirm));
  5102. pMsgEx->Msg.u.conduct_permit_ask_confirm.conference_id = conference_id;
  5103. pMsgEx->Msg.u.conduct_permit_ask_confirm.result = result;
  5104. pMsgEx->Msg.u.conduct_permit_ask_confirm.permission_is_granted = grant_permission;
  5105. // Queue up the message for delivery to the Node Controller.
  5106. PostConfirmCtrlSapMsg(pMsgEx);
  5107. rc = GCC_NO_ERROR;
  5108. }
  5109. else
  5110. {
  5111. rc = GCC_ALLOCATION_FAILURE;
  5112. HandleResourceFailure();
  5113. }
  5114. #endif // GCCNC_DIRECT_CONFIRM
  5115. DebugExitINT(CControlSAP::ConductorPermitAskConfirm, rc);
  5116. return rc;
  5117. }
  5118. #endif // JASPER
  5119. /*
  5120. * ConductorPermitGrantConfirm ()
  5121. *
  5122. * Public Function Description
  5123. * This function is called by the CConf when it need to send a
  5124. * conductor permit grant confirm to the node controller. It adds the
  5125. * message to a queue of messages to be sent to the node controller in
  5126. * the next heartbeat.
  5127. */
  5128. #ifdef JASPER
  5129. GCCError CControlSAP::ConductorPermitGrantConfirm
  5130. (
  5131. GCCResult result,
  5132. GCCConfID conference_id
  5133. )
  5134. {
  5135. GCCError rc;
  5136. DebugEntry(CControlSAP::ConductorPermitGrantConfirm);
  5137. #ifdef GCCNC_DIRECT_CONFIRM
  5138. //
  5139. // WPARAM: result.
  5140. // LPARAM: conf ID
  5141. //
  5142. PostAsynDirectConfirmMsg(GCC_CONDUCT_GRANT_CONFIRM, result, conference_id);
  5143. rc = GCC_NO_ERROR;
  5144. #else
  5145. GCCCtrlSapMsgEx *pMsgEx;
  5146. //
  5147. // Allocate control sap message.
  5148. //
  5149. DBG_SAVE_FILE_LINE
  5150. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_CONDUCT_GRANT_CONFIRM)))
  5151. {
  5152. // ::ZeroMemory(&(pMsgEx->Msg.u.conduct_permit_grant_confirm), sizeof(pMsgEx->Msg.u.conduct_permit_grant_confirm));
  5153. pMsgEx->Msg.u.conduct_permit_grant_confirm.conference_id = conference_id;
  5154. pMsgEx->Msg.u.conduct_permit_grant_confirm.result = result;
  5155. // Queue up the message for delivery to the Node Controller.
  5156. PostConfirmCtrlSapMsg(pMsgEx);
  5157. rc = GCC_NO_ERROR;
  5158. }
  5159. else
  5160. {
  5161. rc = GCC_ALLOCATION_FAILURE;
  5162. HandleResourceFailure();
  5163. }
  5164. #endif // GCCNC_DIRECT_CONFIRM
  5165. DebugExitINT(CControlSAP::ConductorPermitGrantConfirm, rc);
  5166. return rc;
  5167. }
  5168. #endif // JASPER
  5169. /*
  5170. * ConfTimeRemainingIndication ()
  5171. *
  5172. * Public Function Description
  5173. * This function is called by the CConf when it need to send a
  5174. * conference time remaining indication to the node controller. It adds the
  5175. * message to a queue of messages to be sent to the node controller in
  5176. * the next heartbeat.
  5177. */
  5178. #ifdef JASPER
  5179. GCCError CControlSAP::ConfTimeRemainingIndication
  5180. (
  5181. GCCConfID conference_id,
  5182. UserID source_node_id,
  5183. UserID node_id,
  5184. UINT time_remaining
  5185. )
  5186. {
  5187. GCCError rc;
  5188. DebugEntry(CControlSAP::ConfTimeRemainingIndication);
  5189. #ifdef GCCNC_DIRECT_INDICATION
  5190. GCCCtrlSapMsg Msg;
  5191. Msg.message_type = GCC_TIME_REMAINING_INDICATION;
  5192. Msg.u.time_remaining_indication.conference_id = conference_id;
  5193. Msg.u.time_remaining_indication.source_node_id= source_node_id;
  5194. Msg.u.time_remaining_indication.node_id = node_id;
  5195. Msg.u.time_remaining_indication.time_remaining= time_remaining;
  5196. SendCtrlSapMsg(&Msg);
  5197. rc = GCC_NO_ERROR;
  5198. #else
  5199. //GCCCtrlSapMsgEx *pMsgEx;
  5200. //
  5201. // Allocate control sap message.
  5202. //
  5203. DBG_SAVE_FILE_LINE
  5204. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_TIME_REMAINING_INDICATION)))
  5205. {
  5206. // ::ZeroMemory(&(pMsgEx->Msg.u.time_remaining_indication), sizeof(pMsgEx->Msg.u.time_remaining_indication));
  5207. pMsgEx->Msg.u.time_remaining_indication.conference_id = conference_id;
  5208. pMsgEx->Msg.u.time_remaining_indication.source_node_id= source_node_id;
  5209. pMsgEx->Msg.u.time_remaining_indication.node_id = node_id;
  5210. pMsgEx->Msg.u.time_remaining_indication.time_remaining= time_remaining;
  5211. // Queue up the message for delivery to the Node Controller.
  5212. PostIndCtrlSapMsg(pMsgEx);
  5213. rc = GCC_NO_ERROR;
  5214. }
  5215. else
  5216. {
  5217. rc = GCC_ALLOCATION_FAILURE;
  5218. HandleResourceFailure();
  5219. }
  5220. #endif // GCCNC_DIRECT_INDICATION
  5221. DebugExitINT(CControlSAP::ConfTimeRemainingIndication, rc);
  5222. return rc;
  5223. }
  5224. #endif // JASPER
  5225. /*
  5226. * ConfTimeRemainingConfirm ()
  5227. *
  5228. * Public Function Description
  5229. * This function is called by the CConf when it need to send a
  5230. * conference time remaining confirm to the node controller. It adds the
  5231. * message to a queue of messages to be sent to the node controller in
  5232. * the next heartbeat.
  5233. */
  5234. #ifdef JASPER
  5235. GCCError CControlSAP::ConfTimeRemainingConfirm
  5236. (
  5237. GCCConfID conference_id,
  5238. GCCResult result
  5239. )
  5240. {
  5241. GCCError rc;
  5242. DebugEntry(CControlSAP::ConfTimeRemainingConfirm);
  5243. #ifdef GCCNC_DIRECT_CONFIRM
  5244. //
  5245. // WPARAM: result.
  5246. // LPARAM: conf ID
  5247. //
  5248. PostAsynDirectConfirmMsg(GCC_TIME_REMAINING_CONFIRM, result, conference_id);
  5249. rc = GCC_NO_ERROR;
  5250. #else
  5251. GCCCtrlSapMsgEx *pMsgEx;
  5252. //
  5253. // Allocate control sap message.
  5254. //
  5255. DBG_SAVE_FILE_LINE
  5256. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_TIME_REMAINING_CONFIRM)))
  5257. {
  5258. // ::ZeroMemory(&(pMsgEx->Msg.u.time_remaining_confirm), sizeof(pMsgEx->Msg.u.time_remaining_confirm));
  5259. pMsgEx->Msg.u.time_remaining_confirm.conference_id = conference_id;
  5260. pMsgEx->Msg.u.time_remaining_confirm.result= result;
  5261. // Queue up the message for delivery to the Node Controller.
  5262. PostConfirmCtrlSapMsg(pMsgEx);
  5263. rc = GCC_NO_ERROR;
  5264. }
  5265. else
  5266. {
  5267. rc = GCC_ALLOCATION_FAILURE;
  5268. HandleResourceFailure();
  5269. }
  5270. #endif // GCCNC_DIRECT_CONFIRM
  5271. DebugExitINT(CControlSAP::ConfTimeRemainingConfirm, rc);
  5272. return rc;
  5273. }
  5274. #endif // JASPER
  5275. /*
  5276. * ConfTimeInquireIndication()
  5277. *
  5278. * Public Function Description
  5279. * This function is called by the CConf when it need to send a
  5280. * conference time inquire indication to the node controller. It adds the
  5281. * message to a queue of messages to be sent to the node controller in
  5282. * the next heartbeat.
  5283. */
  5284. GCCError CControlSAP::ConfTimeInquireIndication
  5285. (
  5286. GCCConfID conference_id,
  5287. BOOL time_is_conference_wide,
  5288. UserID requesting_node_id
  5289. )
  5290. {
  5291. GCCError rc;
  5292. DebugEntry(CControlSAP::ConfTimeInquireIndication);
  5293. #ifdef GCCNC_DIRECT_INDICATION
  5294. GCCCtrlSapMsg Msg;
  5295. Msg.message_type = GCC_TIME_INQUIRE_INDICATION;
  5296. Msg.u.time_inquire_indication.conference_id = conference_id;
  5297. Msg.u.time_inquire_indication.time_is_conference_wide = time_is_conference_wide;
  5298. Msg.u.time_inquire_indication.requesting_node_id = requesting_node_id;
  5299. SendCtrlSapMsg(&Msg);
  5300. rc = GCC_NO_ERROR;
  5301. #else
  5302. GCCCtrlSapMsgEx *pMsgEx;
  5303. //
  5304. // Allocate control sap message.
  5305. //
  5306. DBG_SAVE_FILE_LINE
  5307. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_TIME_INQUIRE_INDICATION)))
  5308. {
  5309. // ::ZeroMemory(&(pMsgEx->Msg.u.time_inquire_indication), sizeof(pMsgEx->Msg.u.time_inquire_indication));
  5310. pMsgEx->Msg.u.time_inquire_indication.conference_id = conference_id;
  5311. pMsgEx->Msg.u.time_inquire_indication.time_is_conference_wide = time_is_conference_wide;
  5312. pMsgEx->Msg.u.time_inquire_indication.requesting_node_id = requesting_node_id;
  5313. // Queue up the message for delivery to the Node Controller.
  5314. PostIndCtrlSapMsg(pMsgEx);
  5315. rc = GCC_NO_ERROR;
  5316. }
  5317. else
  5318. {
  5319. rc = GCC_ALLOCATION_FAILURE;
  5320. HandleResourceFailure();
  5321. }
  5322. #endif // GCCNC_DIRECT_INDICATION
  5323. DebugExitINT(CControlSAP::ConfTimeInquireIndication, rc);
  5324. return rc;
  5325. }
  5326. /*
  5327. * ConfTimeInquireConfirm ()
  5328. *
  5329. * Public Function Description
  5330. * This function is called by the CConf when it need to send a
  5331. * conference time inquire confirm to the node controller. It adds the
  5332. * message to a queue of messages to be sent to the node controller in
  5333. * the next heartbeat.
  5334. */
  5335. #ifdef JASPER
  5336. GCCError CControlSAP::ConfTimeInquireConfirm
  5337. (
  5338. GCCConfID conference_id,
  5339. GCCResult result
  5340. )
  5341. {
  5342. GCCError rc;
  5343. DebugEntry(CControlSAP::ConfTimeInquireConfirm);
  5344. #ifdef GCCNC_DIRECT_CONFIRM
  5345. //
  5346. // WPARAM: result.
  5347. // LPARAM: conf ID
  5348. //
  5349. PostAsynDirectConfirmMsg(GCC_TIME_INQUIRE_CONFIRM, result, conference_id);
  5350. rc = GCC_NO_ERROR;
  5351. #else
  5352. GCCCtrlSapMsgEx *pMsgEx;
  5353. //
  5354. // Allocate control sap message.
  5355. //
  5356. DBG_SAVE_FILE_LINE
  5357. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_TIME_INQUIRE_CONFIRM)))
  5358. {
  5359. // ::ZeroMemory(&(pMsgEx->Msg.u.time_inquire_confirm), sizeof(pMsgEx->Msg.u.time_inquire_confirm));
  5360. pMsgEx->Msg.u.time_inquire_confirm.conference_id = conference_id;
  5361. pMsgEx->Msg.u.time_inquire_confirm.result = result;
  5362. // Queue up the message for delivery to the Node Controller.
  5363. PostConfirmCtrlSapMsg(pMsgEx);
  5364. rc = GCC_NO_ERROR;
  5365. }
  5366. else
  5367. {
  5368. rc = GCC_ALLOCATION_FAILURE;
  5369. HandleResourceFailure();
  5370. }
  5371. #endif // GCCNC_DIRECT_CONFIRM
  5372. DebugExitINT(CControlSAP::ConfTimeInquireConfirm, rc);
  5373. return rc;
  5374. }
  5375. #endif // JASPER
  5376. /*
  5377. * ConfExtendIndication ()
  5378. *
  5379. * Public Function Description
  5380. * This function is called by the CConf when it need to send a
  5381. * conference extend indication to the node controller. It adds the
  5382. * message to a queue of messages to be sent to the node controller in
  5383. * the next heartbeat.
  5384. */
  5385. #ifdef JASPER
  5386. GCCError CControlSAP::ConfExtendIndication
  5387. (
  5388. GCCConfID conference_id,
  5389. UINT extension_time,
  5390. BOOL time_is_conference_wide,
  5391. UserID requesting_node_id
  5392. )
  5393. {
  5394. GCCError rc;
  5395. DebugEntry(CControlSAP::ConfExtendIndication);
  5396. #ifdef GCCNC_DIRECT_INDICATION
  5397. GCCCtrlSapMsg Msg;
  5398. Msg.message_type = GCC_CONFERENCE_EXTEND_INDICATION;
  5399. Msg.u.conference_extend_indication.conference_id = conference_id;
  5400. Msg.u.conference_extend_indication.extension_time = extension_time;
  5401. Msg.u.conference_extend_indication.time_is_conference_wide = time_is_conference_wide;
  5402. Msg.u.conference_extend_indication.requesting_node_id = requesting_node_id;
  5403. SendCtrlSapMsg(&Msg);
  5404. rc = GCC_NO_ERROR;
  5405. #else
  5406. GCCCtrlSapMsgEx *pMsgEx;
  5407. //
  5408. // Allocate control sap message.
  5409. //
  5410. DBG_SAVE_FILE_LINE
  5411. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_CONFERENCE_EXTEND_INDICATION)))
  5412. {
  5413. // ::ZeroMemory(&(pMsgEx->Msg.u.conference_extend_indication), sizeof(pMsgEx->Msg.u.conference_extend_indication));
  5414. pMsgEx->Msg.u.conference_extend_indication.conference_id = conference_id;
  5415. pMsgEx->Msg.u.conference_extend_indication.extension_time = extension_time;
  5416. pMsgEx->Msg.u.conference_extend_indication.time_is_conference_wide = time_is_conference_wide;
  5417. pMsgEx->Msg.u.conference_extend_indication.requesting_node_id = requesting_node_id;
  5418. // Queue up the message for delivery to the Node Controller.
  5419. PostIndCtrlSapMsg(pMsgEx);
  5420. rc = GCC_NO_ERROR;
  5421. }
  5422. else
  5423. {
  5424. rc = GCC_ALLOCATION_FAILURE;
  5425. HandleResourceFailure();
  5426. }
  5427. #endif // GCCNC_DIRECT_INDICATION
  5428. DebugExitINT(CControlSAP::ConfExtendIndication, rc);
  5429. return rc;
  5430. }
  5431. #endif // JASPER
  5432. /*
  5433. * ConfExtendConfirm ()
  5434. *
  5435. * Public Function Description
  5436. * This function is called by the CConf when it need to send a
  5437. * conference extend confirm to the node controller. It adds the
  5438. * message to a queue of messages to be sent to the node controller in
  5439. * the next heartbeat.
  5440. */
  5441. #ifdef JASPER
  5442. GCCError CControlSAP::ConfExtendConfirm
  5443. (
  5444. GCCConfID conference_id,
  5445. UINT extension_time,
  5446. GCCResult result
  5447. )
  5448. {
  5449. GCCError rc;
  5450. GCCCtrlSapMsgEx *pMsgEx;
  5451. DebugEntry(CControlSAP::ConfExtendConfirm);
  5452. //
  5453. // Allocate control sap message.
  5454. //
  5455. DBG_SAVE_FILE_LINE
  5456. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_CONFERENCE_EXTEND_CONFIRM)))
  5457. {
  5458. // ::ZeroMemory(&(pMsgEx->Msg.u.conference_extend_confirm), sizeof(pMsgEx->Msg.u.conference_extend_confirm));
  5459. pMsgEx->Msg.u.conference_extend_confirm.conference_id = conference_id;
  5460. pMsgEx->Msg.u.conference_extend_confirm.extension_time = extension_time;
  5461. pMsgEx->Msg.u.conference_extend_confirm.result = result;
  5462. // Queue up the message for delivery to the Node Controller.
  5463. PostConfirmCtrlSapMsg(pMsgEx);
  5464. rc = GCC_NO_ERROR;
  5465. }
  5466. else
  5467. {
  5468. rc = GCC_ALLOCATION_FAILURE;
  5469. HandleResourceFailure();
  5470. }
  5471. DebugExitINT(CControlSAP::ConfExtendConfirm, rc);
  5472. return rc;
  5473. }
  5474. #endif // JASPER
  5475. /*
  5476. * ConfAssistanceIndication ()
  5477. *
  5478. * Public Function Description
  5479. * This function is called by the CConf when it need to send a
  5480. * conference assistance indication to the node controller. It adds the
  5481. * message to a queue of messages to be sent to the node controller in
  5482. * the next heartbeat.
  5483. */
  5484. #ifdef JASPER
  5485. GCCError CControlSAP::ConfAssistanceIndication
  5486. (
  5487. GCCConfID conference_id,
  5488. CUserDataListContainer *user_data_list,
  5489. UserID source_node_id
  5490. )
  5491. {
  5492. GCCError rc;
  5493. DebugEntry(CControlSAP::ConfAssistanceIndication);
  5494. #ifdef GCCNC_DIRECT_INDICATION
  5495. GCCCtrlSapMsg Msg;
  5496. Msg.message_type = GCC_ASSISTANCE_INDICATION;
  5497. rc = GCC_NO_ERROR;
  5498. // Copy the User Data if it exists.
  5499. LPBYTE pUserDataMemory = NULL;
  5500. if (user_data_list != NULL)
  5501. {
  5502. rc = RetrieveUserDataList(
  5503. user_data_list,
  5504. &(Msg.u.conference_assist_indication.number_of_user_data_members),
  5505. &(Msg.u.conference_assist_indication.user_data_list),
  5506. &pUserDataMemory);
  5507. ASSERT(GCC_NO_ERROR == rc);
  5508. }
  5509. else
  5510. {
  5511. Msg.u.conference_assist_indication.number_of_user_data_members = 0;
  5512. Msg.u.conference_assist_indication.user_data_list = NULL;
  5513. }
  5514. if (GCC_NO_ERROR == rc)
  5515. {
  5516. Msg.u.conference_assist_indication.conference_id = conference_id;
  5517. Msg.u.conference_assist_indication.source_node_id = source_node_id;
  5518. SendCtrlSapMsg(&Msg);
  5519. delete pUserDataMemory;
  5520. }
  5521. #else
  5522. GCCCtrlSapMsgEx *pMsgEx;
  5523. //
  5524. // Allocate control sap message.
  5525. //
  5526. DBG_SAVE_FILE_LINE
  5527. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_ASSISTANCE_INDICATION)))
  5528. {
  5529. ::ZeroMemory(&(pMsgEx->Msg.u.conference_assist_indication), sizeof(pMsgEx->Msg.u.conference_assist_indication));
  5530. rc = GCC_NO_ERROR;
  5531. // Copy the User Data if it exists.
  5532. if (user_data_list != NULL)
  5533. {
  5534. rc = RetrieveUserDataList(
  5535. user_data_list,
  5536. &(pMsgEx->Msg.u.conference_assist_indication.number_of_user_data_members),
  5537. &(pMsgEx->Msg.u.conference_assist_indication.user_data_list),
  5538. &(pMsgEx->pToDelete->user_data_list_memory));
  5539. ASSERT(GCC_NO_ERROR == rc);
  5540. }
  5541. else
  5542. {
  5543. // pMsgEx->Msg.u.conference_assist_indication.number_of_user_data_members = 0;
  5544. // pMsgEx->Msg.u.conference_assist_indication.user_data_list = NULL;
  5545. }
  5546. if (GCC_NO_ERROR == rc)
  5547. {
  5548. pMsgEx->Msg.u.conference_assist_indication.conference_id = conference_id;
  5549. pMsgEx->Msg.u.conference_assist_indication.source_node_id = source_node_id;
  5550. // Queue up the message for delivery to the Node Controller.
  5551. PostIndCtrlSapMsg(pMsgEx);
  5552. }
  5553. }
  5554. else
  5555. {
  5556. ERROR_OUT(("CControlSAP::ConfAssistanceIndication: can't create CreateCtrlSapMsgEx"));
  5557. rc = GCC_ALLOCATION_FAILURE;
  5558. }
  5559. /*
  5560. ** Clean up after any resource allocation error which may have occurred.
  5561. */
  5562. if (GCC_NO_ERROR != rc)
  5563. {
  5564. FreeCtrlSapMsgEx(pMsgEx);
  5565. HandleResourceFailure(rc);
  5566. }
  5567. #endif // GCCNC_DIRECT_INDICATION
  5568. DebugExitINT(CControlSAP::ConfAssistanceIndication, rc);
  5569. return rc;
  5570. }
  5571. #endif // JASPER
  5572. /*
  5573. * ConfAssistanceConfirm ()
  5574. *
  5575. * Public Function Description
  5576. * This function is called by the CConf when it need to send a
  5577. * conference assistance confirm to the node controller. It adds the
  5578. * message to a queue of messages to be sent to the node controller in
  5579. * the next heartbeat.
  5580. */
  5581. #ifdef JASPER
  5582. GCCError CControlSAP::ConfAssistanceConfirm
  5583. (
  5584. GCCConfID conference_id,
  5585. GCCResult result
  5586. )
  5587. {
  5588. GCCError rc;
  5589. DebugEntry(CControlSAP::ConfAssistanceConfirm);
  5590. #ifdef GCCNC_DIRECT_CONFIRM
  5591. //
  5592. // WPARAM: result.
  5593. // LPARAM: conf ID
  5594. //
  5595. PostAsynDirectConfirmMsg(GCC_ASSISTANCE_CONFIRM, result, conference_id);
  5596. rc = GCC_NO_ERROR;
  5597. #else
  5598. GCCCtrlSapMsgEx *pMsgEx;
  5599. //
  5600. // Allocate control sap message.
  5601. //
  5602. DBG_SAVE_FILE_LINE
  5603. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_ASSISTANCE_CONFIRM)))
  5604. {
  5605. // ::ZeroMemory(&(pMsgEx->Msg.u.conference_assist_confirm), sizeof(pMsgEx->Msg.u.conference_assist_confirm));
  5606. pMsgEx->Msg.u.conference_assist_confirm.conference_id = conference_id;
  5607. pMsgEx->Msg.u.conference_assist_confirm.result = result;
  5608. // Queue up the message for delivery to the Node Controller.
  5609. PostConfirmCtrlSapMsg(pMsgEx);
  5610. rc = GCC_NO_ERROR;
  5611. }
  5612. else
  5613. {
  5614. rc = GCC_ALLOCATION_FAILURE;
  5615. HandleResourceFailure();
  5616. }
  5617. #endif // GCCNC_DIRECT_CONFIRM
  5618. DebugExitINT(CControlSAP::ConfAssistanceConfirm, rc);
  5619. return rc;
  5620. }
  5621. #endif // JASPER
  5622. /*
  5623. * TextMessageIndication ()
  5624. *
  5625. * Public Function Description
  5626. * This function is called by the CConf when it need to send a
  5627. * text message indication to the node controller. It adds the
  5628. * message to a queue of messages to be sent to the node controller in
  5629. * the next heartbeat.
  5630. */
  5631. #ifdef JASPER
  5632. GCCError CControlSAP::TextMessageIndication
  5633. (
  5634. GCCConfID conference_id,
  5635. LPWSTR pwszTextMsg,
  5636. UserID source_node_id
  5637. )
  5638. {
  5639. GCCError rc;
  5640. DebugEntry(CControlSAP::TextMessageIndication);
  5641. #ifdef GCCNC_DIRECT_INDICATION
  5642. GCCCtrlSapMsg Msg;
  5643. Msg.message_type = GCC_TEXT_MESSAGE_INDICATION;
  5644. Msg.u.text_message_indication.text_message = pwszTextMsg;
  5645. Msg.u.text_message_indication.conference_id = conference_id;
  5646. Msg.u.text_message_indication.source_node_id = source_node_id;
  5647. SendCtrlSapMsg(&Msg);
  5648. rc = GCC_NO_ERROR;
  5649. #else
  5650. GCCCtrlSapMsgEx *pMsgEx;
  5651. //
  5652. // Allocate control sap message.
  5653. //
  5654. DBG_SAVE_FILE_LINE
  5655. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_TEXT_MESSAGE_INDICATION)))
  5656. {
  5657. // ::ZeroMemory(&(pMsgEx->Msg.u.text_message_indication), sizeof(pMsgEx->Msg.u.text_message_indication));
  5658. if (NULL != (pMsgEx->Msg.u.text_message_indication.text_message = ::My_strdupW(pwszTextMsg)))
  5659. {
  5660. pMsgEx->Msg.u.text_message_indication.conference_id = conference_id;
  5661. pMsgEx->Msg.u.text_message_indication.source_node_id = source_node_id;
  5662. // Queue up the message for delivery to the Node Controller.
  5663. PostIndCtrlSapMsg(pMsgEx);
  5664. rc = GCC_NO_ERROR;
  5665. }
  5666. }
  5667. else
  5668. {
  5669. rc = GCC_ALLOCATION_FAILURE;
  5670. HandleResourceFailure();
  5671. }
  5672. #endif // GCCNC_DIRECT_INDICATION
  5673. DebugExitINT(CControlSAP::TextMessageIndication, rc);
  5674. return rc;
  5675. }
  5676. #endif // JASPER
  5677. /*
  5678. * TextMessageConfirm ()
  5679. *
  5680. * Public Function Description
  5681. * This function is called by the CConf when it need to send a
  5682. * text message confirm to the node controller. It adds the message
  5683. * to a queue of messages to be sent to the node controller in the
  5684. * next heartbeat.
  5685. */
  5686. #ifdef JASPER
  5687. GCCError CControlSAP::TextMessageConfirm
  5688. (
  5689. GCCConfID conference_id,
  5690. GCCResult result
  5691. )
  5692. {
  5693. GCCError rc;
  5694. DebugEntry(CControlSAP::TextMessageConfirm);
  5695. #ifdef GCCNC_DIRECT_CONFIRM
  5696. //
  5697. // WPARAM: result.
  5698. // LPARAM: conf ID
  5699. //
  5700. PostAsynDirectConfirmMsg(GCC_TEXT_MESSAGE_CONFIRM, result, conference_id);
  5701. rc = GCC_NO_ERROR;
  5702. #else
  5703. GCCCtrlSapMsgEx *pMsgEx;
  5704. //
  5705. // Allocate control sap message.
  5706. //
  5707. DBG_SAVE_FILE_LINE
  5708. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_TEXT_MESSAGE_CONFIRM)))
  5709. {
  5710. // ::ZeroMemory(&(pMsgEx->Msg.u.text_message_confirm), sizeof(pMsgEx->Msg.u.text_message_confirm));
  5711. pMsgEx->Msg.u.text_message_confirm.conference_id = conference_id;
  5712. pMsgEx->Msg.u.text_message_confirm.result = result;
  5713. // Queue up the message for delivery to the Node Controller.
  5714. PostConfirmCtrlSapMsg(pMsgEx);
  5715. rc = GCC_NO_ERROR;
  5716. }
  5717. else
  5718. {
  5719. rc = GCC_ALLOCATION_FAILURE;
  5720. HandleResourceFailure();
  5721. }
  5722. #endif // GCCNC_DIRECT_CONFIRM
  5723. DebugExitINT(CControlSAP::TextMessageConfirm, rc);
  5724. return rc;
  5725. }
  5726. #endif // JASPER
  5727. /*
  5728. * ConfTransferIndication ()
  5729. *
  5730. * Public Function Description
  5731. * This function is called by the CConf when it need to send a
  5732. * conference transfer indication to the node controller. It adds the
  5733. * message to a queue of messages to be sent to the node controller in
  5734. * the next heartbeat.
  5735. */
  5736. #ifdef JASPER
  5737. GCCError CControlSAP::ConfTransferIndication
  5738. (
  5739. GCCConfID conference_id,
  5740. PGCCConferenceName destination_conference_name,
  5741. GCCNumericString destination_conference_modifier,
  5742. CNetAddrListContainer *destination_address_list,
  5743. CPassword *password
  5744. )
  5745. {
  5746. GCCError rc = GCC_NO_ERROR;
  5747. DebugEntry(CControlSAP::ConfTransferIndication);
  5748. #ifdef GCCNC_DIRECT_INDICATION
  5749. GCCCtrlSapMsg Msg;
  5750. Msg.message_type = GCC_TRANSFER_INDICATION;
  5751. //
  5752. // Copy the information that needs to be sent to the node
  5753. // controller into local memory that can be deleted once the
  5754. // information to be sent to the application is flushed. Note that
  5755. // if an error occurs in one call to "CopyDataToGCCMessage" then no
  5756. // action is taken on subsequent calls to that routine.
  5757. //
  5758. // Copy the conference name
  5759. ::CSAP_CopyDataToGCCMessage_ConfName(
  5760. destination_conference_name,
  5761. &(Msg.u.transfer_indication.destination_conference_name));
  5762. // Copy the conference name modifier
  5763. ::CSAP_CopyDataToGCCMessage_Modifier(
  5764. destination_conference_modifier,
  5765. &(Msg.u.transfer_indication.destination_conference_modifier));
  5766. // Copy the Password
  5767. ::CSAP_CopyDataToGCCMessage_Password(
  5768. password,
  5769. &(Msg.u.transfer_indication.password));
  5770. LPBYTE pDstAddrListData = NULL;
  5771. if (destination_address_list != NULL)
  5772. {
  5773. //
  5774. // First determine the size of the block required to hold all
  5775. // of the network address list data.
  5776. //
  5777. UINT block_size = destination_address_list->LockNetworkAddressList();
  5778. DBG_SAVE_FILE_LINE
  5779. if (NULL != (pDstAddrListData = new BYTE[block_size]))
  5780. {
  5781. destination_address_list->GetNetworkAddressListAPI(
  5782. &(Msg.u.transfer_indication.number_of_destination_addresses),
  5783. &(Msg.u.transfer_indication.destination_address_list),
  5784. pDstAddrListData);
  5785. }
  5786. else
  5787. {
  5788. ERROR_OUT(("CControlSAP::ConfTransferIndication: can't create net addr memory, size=%u", (UINT) block_size));
  5789. rc = GCC_ALLOCATION_FAILURE;
  5790. }
  5791. // Unlock the network address list data.
  5792. destination_address_list->UnLockNetworkAddressList();
  5793. }
  5794. else
  5795. {
  5796. Msg.u.transfer_indication.number_of_destination_addresses = 0;
  5797. Msg.u.transfer_indication.destination_address_list = NULL;
  5798. }
  5799. if (rc == GCC_NO_ERROR)
  5800. {
  5801. Msg.u.transfer_indication.conference_id = conference_id;
  5802. SendCtrlSapMsg(&Msg);
  5803. delete pDstAddrListData;
  5804. }
  5805. #else
  5806. GCCCtrlSapMsgEx *pMsgEx;
  5807. UINT block_size;
  5808. /*
  5809. ** Allocate the GCC callback message and fill it in with the
  5810. ** appropriate values.
  5811. */
  5812. DBG_SAVE_FILE_LINE
  5813. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_TRANSFER_INDICATION, TRUE)))
  5814. {
  5815. ::ZeroMemory(&(pMsgEx->Msg.u.transfer_indication), sizeof(pMsgEx->Msg.u.transfer_indication));
  5816. /*
  5817. ** Copy the information that needs to be sent to the node
  5818. ** controller into local memory that can be deleted once the
  5819. ** information to be sent to the application is flushed. Note that
  5820. ** if an error occurs in one call to "CopyDataToGCCMessage" then no
  5821. ** action is taken on subsequent calls to that routine.
  5822. */
  5823. // Copy the conference name
  5824. ::CSAP_CopyDataToGCCMessage_ConfName(
  5825. pMsgEx->pToDelete,
  5826. destination_conference_name,
  5827. &(pMsgEx->Msg.u.transfer_indication.destination_conference_name),
  5828. &rc);
  5829. // Copy the conference name modifier
  5830. ::CSAP_CopyDataToGCCMessage_Modifier(
  5831. FALSE, // conference modifier
  5832. pMsgEx->pToDelete,
  5833. destination_conference_modifier,
  5834. &(pMsgEx->Msg.u.transfer_indication.destination_conference_modifier),
  5835. &rc);
  5836. // Copy the Password
  5837. ::CSAP_CopyDataToGCCMessage_Password(
  5838. FALSE, // non-convener password
  5839. pMsgEx->pToDelete,
  5840. password,
  5841. &(pMsgEx->Msg.u.transfer_indication.password),
  5842. &rc);
  5843. if ((rc == GCC_NO_ERROR) &&
  5844. (destination_address_list != NULL))
  5845. {
  5846. /*
  5847. ** First determine the size of the block required to hold all
  5848. ** of the network address list data.
  5849. */
  5850. block_size = destination_address_list->LockNetworkAddressList();
  5851. DBG_SAVE_FILE_LINE
  5852. if (NULL != (pMsgEx->pBuf = new BYTE[block_size]))
  5853. {
  5854. destination_address_list->GetNetworkAddressListAPI(
  5855. &(pMsgEx->Msg.u.transfer_indication.number_of_destination_addresses),
  5856. &(pMsgEx->Msg.u.transfer_indication.destination_address_list),
  5857. pMsgEx->pBuf);
  5858. }
  5859. else
  5860. {
  5861. ERROR_OUT(("CControlSAP::ConfTransferIndication: can't create net addr memory, size=%u", (UINT) block_size));
  5862. rc = GCC_ALLOCATION_FAILURE;
  5863. }
  5864. // Unlock the network address list data.
  5865. destination_address_list->UnLockNetworkAddressList();
  5866. }
  5867. else
  5868. {
  5869. // pMsgEx->Msg.u.transfer_indication.number_of_destination_addresses = 0;
  5870. // pMsgEx->Msg.u.transfer_indication.destination_address_list = NULL;
  5871. }
  5872. if (rc == GCC_NO_ERROR)
  5873. {
  5874. pMsgEx->Msg.u.transfer_indication.conference_id = conference_id;
  5875. // Queue up the message for delivery to the Node Controller.
  5876. PostIndCtrlSapMsg(pMsgEx);
  5877. }
  5878. }
  5879. else
  5880. {
  5881. ERROR_OUT(("CControlSAP::ConfTransferIndication: can't create GCCCtrlSapMsgEx"));
  5882. rc = GCC_ALLOCATION_FAILURE;
  5883. }
  5884. if (GCC_NO_ERROR != rc)
  5885. {
  5886. FreeCtrlSapMsgEx(pMsgEx);
  5887. HandleResourceFailure(rc);
  5888. }
  5889. #endif // GCCNC_DIRECT_INDICATION
  5890. DebugExitINT(CControlSAP::ConfTransferIndication, rc);
  5891. return rc;
  5892. }
  5893. #endif // JASPER
  5894. /*
  5895. * ConfTransferConfirm ()
  5896. *
  5897. * Public Function Description
  5898. * This function is called by the CConf when it need to send a
  5899. * conference transfer confirm to the node controller. It adds the
  5900. * message to a queue of messages to be sent to the node controller in
  5901. * the next heartbeat.
  5902. */
  5903. #ifdef JASPER
  5904. GCCError CControlSAP::ConfTransferConfirm
  5905. (
  5906. GCCConfID conference_id,
  5907. PGCCConferenceName destination_conference_name,
  5908. GCCNumericString destination_conference_modifier,
  5909. UINT number_of_destination_nodes,
  5910. PUserID destination_node_list,
  5911. GCCResult result
  5912. )
  5913. {
  5914. GCCError rc = GCC_NO_ERROR;
  5915. GCCCtrlSapMsgEx *pMsgEx;
  5916. UINT i;
  5917. DebugEntry(CControlSAP::ConfTransferConfirm);
  5918. /*
  5919. ** Allocate the GCC callback message and fill it in with the
  5920. ** appropriate values.
  5921. */
  5922. DBG_SAVE_FILE_LINE
  5923. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_TRANSFER_CONFIRM, TRUE)))
  5924. {
  5925. ::ZeroMemory(&(pMsgEx->Msg.u.transfer_confirm), sizeof(pMsgEx->Msg.u.transfer_confirm));
  5926. /*
  5927. ** Copy the information that needs to be sent to the node
  5928. ** controller into local memory that can be deleted once the
  5929. ** information to be sent to the application is flushed. Note that
  5930. ** if an error occurs in one call to "CopyDataToGCCMessage" then no
  5931. ** action is taken on subsequent calls to that routine.
  5932. */
  5933. // Copy the conference name
  5934. ::CSAP_CopyDataToGCCMessage_ConfName(
  5935. pMsgEx->pToDelete,
  5936. destination_conference_name,
  5937. &(pMsgEx->Msg.u.transfer_confirm.destination_conference_name),
  5938. &rc);
  5939. // Copy the conference name modifier
  5940. ::CSAP_CopyDataToGCCMessage_Modifier(
  5941. FALSE, // conference modifier
  5942. pMsgEx->pToDelete,
  5943. destination_conference_modifier,
  5944. &(pMsgEx->Msg.u.transfer_confirm.destination_conference_modifier),
  5945. &rc);
  5946. if ((rc == GCC_NO_ERROR) &&
  5947. (number_of_destination_nodes != 0))
  5948. {
  5949. // Allocate memory to hold the list of nodes.
  5950. DBG_SAVE_FILE_LINE
  5951. if (NULL != (pMsgEx->pBuf = new BYTE[number_of_destination_nodes * sizeof (UserID)]))
  5952. {
  5953. /*
  5954. * Retrieve the actual pointer to memory from the Memory
  5955. * object.
  5956. */
  5957. pMsgEx->Msg.u.transfer_confirm.destination_node_list = (UserID *) pMsgEx->pBuf;
  5958. for (i = 0; i < number_of_destination_nodes; i++)
  5959. {
  5960. pMsgEx->Msg.u.transfer_confirm.destination_node_list[i] = destination_node_list[i];
  5961. }
  5962. }
  5963. else
  5964. {
  5965. ERROR_OUT(("CControlSAP::ConfTransferConfirm: Error allocating memory"));
  5966. rc = GCC_ALLOCATION_FAILURE;
  5967. }
  5968. }
  5969. if (rc == GCC_NO_ERROR)
  5970. {
  5971. pMsgEx->Msg.u.transfer_confirm.number_of_destination_nodes = number_of_destination_nodes;
  5972. pMsgEx->Msg.u.transfer_confirm.conference_id = conference_id;
  5973. pMsgEx->Msg.u.transfer_confirm.result = result;
  5974. // Queue up the message for delivery to the Node Controller.
  5975. PostConfirmCtrlSapMsg(pMsgEx);
  5976. }
  5977. }
  5978. else
  5979. {
  5980. ERROR_OUT(("CControlSAP::ConfTransferConfirm: can't create GCCCtrlSapMsgEx"));
  5981. rc = GCC_ALLOCATION_FAILURE;
  5982. }
  5983. if (GCC_NO_ERROR != rc)
  5984. {
  5985. FreeCtrlSapMsgEx(pMsgEx);
  5986. HandleResourceFailure();
  5987. }
  5988. DebugExitINT(CControlSAP::ConfTransferConfirm, rc);
  5989. return rc;
  5990. }
  5991. #endif // JASPER
  5992. /*
  5993. * ConfAddIndication ()
  5994. *
  5995. * Public Function Description
  5996. * This function is called by the CConf when it need to send a
  5997. * conference add indication to the node controller. It adds the
  5998. * message to a queue of messages to be sent to the node controller in
  5999. * the next heartbeat.
  6000. */
  6001. GCCError CControlSAP::ConfAddIndication
  6002. (
  6003. GCCConfID conference_id,
  6004. GCCResponseTag add_response_tag,
  6005. CNetAddrListContainer *network_address_list,
  6006. CUserDataListContainer *user_data_list,
  6007. UserID requesting_node
  6008. )
  6009. {
  6010. GCCError rc = GCC_NO_ERROR;
  6011. DebugEntry(CControlSAP::ConfAddIndication);
  6012. #ifdef GCCNC_DIRECT_INDICATION
  6013. GCCCtrlSapMsg Msg;
  6014. Msg.message_type = GCC_ADD_INDICATION;
  6015. //
  6016. // First determine the size of the block required to hold all
  6017. // of the network address list data.
  6018. //
  6019. UINT block_size = network_address_list->LockNetworkAddressList();
  6020. //
  6021. // Add the size of the user data block if any user data exists
  6022. //
  6023. if (user_data_list != NULL)
  6024. {
  6025. block_size += user_data_list->LockUserDataList();
  6026. }
  6027. //
  6028. // Allocate memory to hold the user data and network addresses.
  6029. //
  6030. LPBYTE pData;
  6031. DBG_SAVE_FILE_LINE
  6032. if (NULL != (pData = new BYTE[block_size]))
  6033. {
  6034. //
  6035. // Retrieve the network address list data from the container
  6036. // and unlock the container data.
  6037. //
  6038. pData += network_address_list->GetNetworkAddressListAPI(
  6039. &(Msg.u.add_indication.number_of_network_addresses),
  6040. &(Msg.u.add_indication.network_address_list),
  6041. pData);
  6042. network_address_list->UnLockNetworkAddressList();
  6043. //
  6044. // Retrieve the user data from the container if it exists
  6045. // and unlock the container data.
  6046. //
  6047. if (user_data_list != NULL)
  6048. {
  6049. user_data_list->GetUserDataList(
  6050. &(Msg.u.add_indication.number_of_user_data_members),
  6051. &(Msg.u.add_indication.user_data_list),
  6052. pData);
  6053. user_data_list->UnLockUserDataList();
  6054. }
  6055. else
  6056. {
  6057. Msg.u.add_indication.number_of_user_data_members = 0;
  6058. Msg.u.add_indication.user_data_list = NULL;
  6059. }
  6060. Msg.u.add_indication.conference_id = conference_id;
  6061. Msg.u.add_indication.requesting_node_id = requesting_node;
  6062. Msg.u.add_indication.add_response_tag = add_response_tag;
  6063. SendCtrlSapMsg(&Msg);
  6064. rc = GCC_NO_ERROR;
  6065. delete pData;
  6066. }
  6067. else
  6068. {
  6069. ERROR_OUT(("CControlSAP::ConfAddIndication: can't allocate buffer, size=%u", (UINT) block_size));
  6070. rc = GCC_ALLOCATION_FAILURE;
  6071. }
  6072. #else
  6073. GCCCtrlSapMsgEx *pMsgEx;
  6074. UINT block_size;
  6075. LPBYTE memory_ptr;
  6076. /*
  6077. ** Allocate the GCC callback message and fill it in with the
  6078. ** appropriate values.
  6079. */
  6080. DBG_SAVE_FILE_LINE
  6081. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_ADD_INDICATION)))
  6082. {
  6083. ::ZeroMemory(&(pMsgEx->Msg.u.add_indication), sizeof(pMsgEx->Msg.u.add_indication));
  6084. /*
  6085. ** First determine the size of the block required to hold all
  6086. ** of the network address list data.
  6087. */
  6088. block_size = network_address_list->LockNetworkAddressList();
  6089. /*
  6090. ** Add the size of the user data block if any user data exists
  6091. */
  6092. if (user_data_list != NULL)
  6093. {
  6094. block_size += user_data_list->LockUserDataList();
  6095. }
  6096. /*
  6097. ** Allocate memory to hold the user data and network addresses.
  6098. */
  6099. DBG_SAVE_FILE_LINE
  6100. if (NULL != (pMsgEx->pBuf = new BYTE[block_size]))
  6101. {
  6102. memory_ptr = pMsgEx->pBuf;
  6103. /*
  6104. * Retrieve the network address list data from the container
  6105. * and unlock the container data.
  6106. */
  6107. memory_ptr += network_address_list->GetNetworkAddressListAPI(
  6108. &(pMsgEx->Msg.u.add_indication.number_of_network_addresses),
  6109. &(pMsgEx->Msg.u.add_indication.network_address_list),
  6110. memory_ptr);
  6111. network_address_list->UnLockNetworkAddressList();
  6112. /*
  6113. * Retrieve the user data from the container if it exists
  6114. * and unlock the container data.
  6115. */
  6116. if (user_data_list != NULL)
  6117. {
  6118. user_data_list->GetUserDataList(
  6119. &(pMsgEx->Msg.u.add_indication.number_of_user_data_members),
  6120. &(pMsgEx->Msg.u.add_indication.user_data_list),
  6121. memory_ptr);
  6122. user_data_list->UnLockUserDataList();
  6123. }
  6124. else
  6125. {
  6126. // pMsgEx->Msg.u.add_indication.number_of_user_data_members = 0;
  6127. // pMsgEx->Msg.u.add_indication.user_data_list = NULL;
  6128. }
  6129. pMsgEx->Msg.u.add_indication.conference_id = conference_id;
  6130. pMsgEx->Msg.u.add_indication.requesting_node_id = requesting_node;
  6131. pMsgEx->Msg.u.add_indication.add_response_tag = add_response_tag;
  6132. // Queue up the message for delivery to the Node Controller.
  6133. PostIndCtrlSapMsg(pMsgEx);
  6134. rc = GCC_NO_ERROR;
  6135. }
  6136. else
  6137. {
  6138. ERROR_OUT(("CControlSAP::ConfAddIndication: can't allocate buffer, size=%u", (UINT) block_size));
  6139. rc = GCC_ALLOCATION_FAILURE;
  6140. }
  6141. }
  6142. else
  6143. {
  6144. ERROR_OUT(("CControlSAP::ConfAddIndication: can't create GCCCtrlSapMsgEx"));
  6145. rc = GCC_ALLOCATION_FAILURE;
  6146. }
  6147. if (GCC_NO_ERROR != rc)
  6148. {
  6149. FreeCtrlSapMsgEx(pMsgEx);
  6150. HandleResourceFailure(rc);
  6151. }
  6152. #endif // GCCNC_DIRECT_INDICATION
  6153. DebugExitINT(CControlSAP::ConfAddIndication, rc);
  6154. return rc;
  6155. }
  6156. /*
  6157. * ConfAddConfirm
  6158. *
  6159. * Public Function Description
  6160. * This function is called by the CConf when it need to send a
  6161. * conference add confirm to the node controller. It adds the
  6162. * message to a queue of messages to be sent to the node controller in
  6163. * the next heartbeat.
  6164. */
  6165. GCCError CControlSAP::ConfAddConfirm
  6166. (
  6167. GCCConfID conference_id,
  6168. CNetAddrListContainer *network_address_list,
  6169. CUserDataListContainer *user_data_list,
  6170. GCCResult result
  6171. )
  6172. {
  6173. GCCError rc = GCC_NO_ERROR;
  6174. DebugEntry(CControlSAP::ConfAddConfirm);
  6175. #ifdef GCCNC_DIRECT_CONFIRM
  6176. GCCCtrlSapMsg Msg;
  6177. Msg.message_type = GCC_ADD_CONFIRM;
  6178. //
  6179. // First determine the size of the block required to hold all
  6180. // of the network address list data.
  6181. //
  6182. UINT cbDataSize = network_address_list->LockNetworkAddressList();
  6183. //
  6184. // Add the size of the user data block if any user data exists
  6185. //
  6186. if (user_data_list != NULL)
  6187. {
  6188. cbDataSize += user_data_list->LockUserDataList();
  6189. }
  6190. //
  6191. // Allocate memory to hold the user data and network addresses.
  6192. //
  6193. DBG_SAVE_FILE_LINE
  6194. LPBYTE pAllocated = new BYTE[cbDataSize];
  6195. LPBYTE pData;
  6196. if (NULL != (pData = pAllocated))
  6197. {
  6198. //
  6199. // Retrieve the network address list data from the container
  6200. // and unlock the container data.
  6201. //
  6202. pData += network_address_list->GetNetworkAddressListAPI(
  6203. &(Msg.u.add_confirm.number_of_network_addresses),
  6204. &(Msg.u.add_confirm.network_address_list),
  6205. pData);
  6206. network_address_list->UnLockNetworkAddressList();
  6207. //
  6208. // Retrieve the user data from the container if it exists
  6209. // and unlock the container data.
  6210. //
  6211. if (user_data_list != NULL)
  6212. {
  6213. user_data_list->GetUserDataList(
  6214. &(Msg.u.add_confirm.number_of_user_data_members),
  6215. &(Msg.u.add_confirm.user_data_list),
  6216. pData);
  6217. user_data_list->UnLockUserDataList();
  6218. }
  6219. else
  6220. {
  6221. Msg.u.add_confirm.number_of_user_data_members = 0;
  6222. Msg.u.add_confirm.user_data_list = NULL;
  6223. }
  6224. Msg.nConfID = conference_id;
  6225. Msg.u.add_confirm.conference_id = conference_id;
  6226. Msg.u.add_confirm.result = result;
  6227. SendCtrlSapMsg(&Msg);
  6228. rc = GCC_NO_ERROR;
  6229. // clean up
  6230. delete pAllocated;
  6231. }
  6232. else
  6233. {
  6234. ERROR_OUT(("CControlSAP::ConfAddConfirm: can't allocate buffer, size=%u", (UINT) cbDataSize));
  6235. rc = GCC_ALLOCATION_FAILURE;
  6236. HandleResourceFailure(rc);
  6237. }
  6238. #else
  6239. GCCCtrlSapMsgEx *pMsgEx;
  6240. UINT block_size;
  6241. LPBYTE memory_ptr;
  6242. /*
  6243. ** Allocate the GCC callback message and fill it in with the
  6244. ** appropriate values.
  6245. */
  6246. DBG_SAVE_FILE_LINE
  6247. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_ADD_CONFIRM)))
  6248. {
  6249. ::ZeroMemory(&(pMsgEx->Msg.u.add_confirm), sizeof(pMsgEx->Msg.u.add_confirm));
  6250. /*
  6251. ** First determine the size of the block required to hold all
  6252. ** of the network address list data.
  6253. */
  6254. block_size = network_address_list->LockNetworkAddressList();
  6255. /*
  6256. ** Add the size of the user data block if any user data exists
  6257. */
  6258. if (user_data_list != NULL)
  6259. block_size += user_data_list->LockUserDataList();
  6260. /*
  6261. ** Allocate memory to hold the user data and network addresses.
  6262. */
  6263. DBG_SAVE_FILE_LINE
  6264. if (NULL != (pMsgEx->pBuf = (LPBYTE) new BYTE[block_size]))
  6265. {
  6266. memory_ptr = pMsgEx->pBuf;
  6267. /*
  6268. * Retrieve the network address list data from the container
  6269. * and unlock the container data.
  6270. */
  6271. memory_ptr += network_address_list->GetNetworkAddressListAPI(
  6272. &(pMsgEx->Msg.u.add_confirm.number_of_network_addresses),
  6273. &(pMsgEx->Msg.u.add_confirm.network_address_list),
  6274. memory_ptr);
  6275. network_address_list->UnLockNetworkAddressList();
  6276. /*
  6277. * Retrieve the user data from the container if it exists
  6278. * and unlock the container data.
  6279. */
  6280. if (user_data_list != NULL)
  6281. {
  6282. user_data_list->GetUserDataList(
  6283. &(pMsgEx->Msg.u.add_confirm.number_of_user_data_members),
  6284. &(pMsgEx->Msg.u.add_confirm.user_data_list),
  6285. memory_ptr);
  6286. user_data_list->UnLockUserDataList();
  6287. }
  6288. else
  6289. {
  6290. // pMsgEx->Msg.u.add_confirm.number_of_user_data_members = 0;
  6291. // pMsgEx->Msg.u.add_confirm.user_data_list = NULL;
  6292. }
  6293. pMsgEx->Msg.nConfID = conference_id;
  6294. pMsgEx->Msg.u.add_confirm.conference_id = conference_id;
  6295. pMsgEx->Msg.u.add_confirm.result = result;
  6296. // Queue up the message for delivery to the Node Controller.
  6297. PostConfirmCtrlSapMsg(pMsgEx);
  6298. rc = GCC_NO_ERROR;
  6299. }
  6300. else
  6301. {
  6302. ERROR_OUT(("CControlSAP::ConfAddConfirm: can't allocate buffer, size=%u", (UINT) block_size));
  6303. rc = GCC_ALLOCATION_FAILURE;
  6304. }
  6305. }
  6306. else
  6307. {
  6308. ERROR_OUT(("CControlSAP::ConfAddConfirm: can't create GCCCtrlSapMsgEx"));
  6309. rc = GCC_ALLOCATION_FAILURE;
  6310. }
  6311. if (GCC_NO_ERROR != rc)
  6312. {
  6313. FreeCtrlSapMsgEx(pMsgEx);
  6314. HandleResourceFailure(rc);
  6315. }
  6316. #endif // GCCNC_DIRECT_CONFIRM
  6317. DebugExitINT(CControlSAP::ConfAddConfirm, rc);
  6318. return rc;
  6319. }
  6320. /*
  6321. * SubInitializationCompleteIndication ()
  6322. *
  6323. * Public Function Description
  6324. * This function is called by the CConf when it need to send a
  6325. * sub-initialization complete indication to the node controller. It adds
  6326. * the message to a queue of messages to be sent to the node controller in
  6327. * the next heartbeat.
  6328. */
  6329. GCCError CControlSAP::SubInitializationCompleteIndication
  6330. (
  6331. UserID user_id,
  6332. ConnectionHandle connection_handle
  6333. )
  6334. {
  6335. GCCError rc;
  6336. DebugEntry(CControlSAP::SubInitializationCompleteIndication);
  6337. #ifdef GCCNC_DIRECT_INDICATION
  6338. GCCCtrlSapMsg Msg;
  6339. Msg.message_type = GCC_SUB_INITIALIZED_INDICATION;
  6340. Msg.u.conf_sub_initialized_indication.subordinate_node_id = user_id;
  6341. Msg.u.conf_sub_initialized_indication.connection_handle =connection_handle;
  6342. SendCtrlSapMsg(&Msg);
  6343. rc = GCC_NO_ERROR;
  6344. #else
  6345. GCCCtrlSapMsgEx *pMsgEx;
  6346. //
  6347. // Allocate control sap message.
  6348. //
  6349. DBG_SAVE_FILE_LINE
  6350. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_SUB_INITIALIZED_INDICATION)))
  6351. {
  6352. // ::ZeroMemory(&(pMsgEx->Msg.u.conf_sub_initialized_indication), sizeof(pMsgEx->Msg.u.conf_sub_initialized_indication));
  6353. pMsgEx->Msg.u.conf_sub_initialized_indication.subordinate_node_id = user_id;
  6354. pMsgEx->Msg.u.conf_sub_initialized_indication.connection_handle =connection_handle;
  6355. // Queue up the message for delivery to the Node Controller.
  6356. PostIndCtrlSapMsg(pMsgEx);
  6357. rc = GCC_NO_ERROR;
  6358. }
  6359. else
  6360. {
  6361. rc = GCC_ALLOCATION_FAILURE;
  6362. HandleResourceFailure();
  6363. }
  6364. #endif // GCCNC_DIRECT_INDICATION
  6365. DebugExitINT(CControlSAP::SubInitializationCompleteIndication, rc);
  6366. return rc;
  6367. }
  6368. /*
  6369. * Private member functions of the CControlSAP object.
  6370. */
  6371. /*
  6372. * BOOL CControlSAP::IsNumericNameValid(
  6373. * GCCNumericString numeric_string)
  6374. *
  6375. * Public member function of CControlSAP.
  6376. *
  6377. * Function Description:
  6378. * This routine is used to validate a numeric string by checking to make
  6379. * sure that none of the constraints imposed by the ASN.1 specification
  6380. * are violated.
  6381. *
  6382. * Formal Parameters:
  6383. * numeric_string (i) The numeric string to validate.
  6384. *
  6385. * Return Value:
  6386. * TRUE - The numeric string is valid.
  6387. * FALSE - The numeric string violates an ASN.1 constraint.
  6388. *
  6389. * Side Effects:
  6390. * None.
  6391. *
  6392. * Caveats:
  6393. * None.
  6394. */
  6395. BOOL CControlSAP::IsNumericNameValid ( GCCNumericString numeric_string )
  6396. {
  6397. BOOL rc = TRUE;
  6398. UINT numeric_string_length = 0;
  6399. //
  6400. // LONCHANC: We should change it such that the default is FALSE
  6401. // because many cases except one can be FALSE.
  6402. //
  6403. if (numeric_string != NULL)
  6404. {
  6405. if (*numeric_string == 0)
  6406. rc = FALSE;
  6407. else
  6408. {
  6409. while (*numeric_string != 0)
  6410. {
  6411. /*
  6412. ** Check to make sure the characters in the numeric string are
  6413. ** within the allowable range.
  6414. */
  6415. if ((*numeric_string < '0') ||
  6416. (*numeric_string > '9'))
  6417. {
  6418. rc = FALSE;
  6419. break;
  6420. }
  6421. numeric_string++;
  6422. numeric_string_length++;
  6423. /*
  6424. ** Check to make sure that the length of the string is within
  6425. ** the allowable range.
  6426. */
  6427. if (numeric_string_length > MAXIMUM_CONFERENCE_NAME_LENGTH)
  6428. {
  6429. rc = FALSE;
  6430. break;
  6431. }
  6432. }
  6433. }
  6434. }
  6435. else
  6436. rc = FALSE;
  6437. return rc;
  6438. }
  6439. /*
  6440. * BOOL CControlSAP::IsTextNameValid (LPWSTR text_string)
  6441. *
  6442. * Public member function of CControlSAP.
  6443. *
  6444. * Function Description:
  6445. * This routine is used to validate a text string by checking to make
  6446. * sure that none of the constraints imposed by the ASN.1 specification
  6447. * are violated.
  6448. *
  6449. * Formal Parameters:
  6450. * text_string (i) The text string to validate.
  6451. *
  6452. * Return Value:
  6453. * TRUE - The text string is valid.
  6454. * FALSE - The text string violates an ASN.1 constraint.
  6455. *
  6456. * Side Effects:
  6457. * None.
  6458. *
  6459. * Caveats:
  6460. * None.
  6461. */
  6462. BOOL CControlSAP::IsTextNameValid ( LPWSTR text_string )
  6463. {
  6464. BOOL rc = TRUE;
  6465. UINT text_string_length = 0;
  6466. if (text_string != NULL)
  6467. {
  6468. /*
  6469. ** Check to make sure that the length of the string is within
  6470. ** the allowable range.
  6471. */
  6472. while (*text_string != 0)
  6473. {
  6474. text_string++;
  6475. text_string_length++;
  6476. if (text_string_length > MAXIMUM_CONFERENCE_NAME_LENGTH)
  6477. {
  6478. rc = FALSE;
  6479. break;
  6480. }
  6481. }
  6482. }
  6483. else
  6484. rc = FALSE;
  6485. return rc;
  6486. }
  6487. /*
  6488. * GCCError CControlSAP::QueueJoinIndication(
  6489. * GCCResponseTag response_tag,
  6490. * GCCConfID conference_id,
  6491. * CPassword *convener_password,
  6492. * CPassword *password_challenge,
  6493. * LPWSTR pwszCallerID,
  6494. * TransportAddress calling_address,
  6495. * TransportAddress called_address,
  6496. * CUserDataListContainer *user_data_list,
  6497. * BOOL intermediate_node,
  6498. * ConnectionHandle connection_handle)
  6499. *
  6500. * Public member function of CControlSAP.
  6501. *
  6502. * Function Description:
  6503. * This routine is used to place join indications into the queue of
  6504. * messages to be delivered to the node controller.
  6505. *
  6506. * Formal Parameters:
  6507. * response_tag (i) Unique tag associated with this join .
  6508. * conference_id (i) The conference identifier.
  6509. * convener_password (i) Password used to obtain convener privileges.
  6510. * password_challenge (i) Password used to join the conference.
  6511. * pwszCallerID (i) Identifier of party initiating call.
  6512. * calling_address (i) Transport address of party making call.
  6513. * called_address (i) Transport address of party being called.
  6514. * user_data_list (i) User data carried in the join.
  6515. * intermediate_node (i) Flag indicating whether join is made at
  6516. * intermediate node.
  6517. * connection_handle (i) Handle for the logical connection.
  6518. *
  6519. * Return Value:
  6520. * GCC_NO_ERROR - Message successfully queued.
  6521. * GCC_ALLOCATION_FAILURE - A resource allocation failure occurred.
  6522. *
  6523. * Side Effects:
  6524. * None.
  6525. *
  6526. * Caveats:
  6527. * None.
  6528. */
  6529. GCCError CControlSAP::QueueJoinIndication
  6530. (
  6531. GCCResponseTag response_tag,
  6532. GCCConfID conference_id,
  6533. CPassword *convener_password,
  6534. CPassword *password_challenge,
  6535. LPWSTR pwszCallerID,
  6536. TransportAddress calling_address,
  6537. TransportAddress called_address,
  6538. CUserDataListContainer *user_data_list,
  6539. BOOL intermediate_node,
  6540. ConnectionHandle connection_handle
  6541. )
  6542. {
  6543. GCCError rc;
  6544. DebugEntry(CControlSAP::QueueJoinIndication);
  6545. #ifdef GCCNC_DIRECT_INDICATION
  6546. GCCCtrlSapMsg Msg;
  6547. Msg.message_type = GCC_JOIN_INDICATION;
  6548. /*
  6549. ** Copy the information that needs to be sent to the node
  6550. ** controller into local memory that can be deleted once the
  6551. ** information to be sent to the application is flushed. Note that
  6552. ** if an error occurs in one call to "CopyDataToGCCMessage" then no
  6553. ** action is taken on subsequent calls to that routine.
  6554. */
  6555. // start with success
  6556. rc = GCC_NO_ERROR;
  6557. // Copy the Convener Password
  6558. ::CSAP_CopyDataToGCCMessage_Password(
  6559. convener_password,
  6560. &(Msg.u.join_indication.convener_password));
  6561. // Copy the Password
  6562. ::CSAP_CopyDataToGCCMessage_Challenge(
  6563. password_challenge,
  6564. &(Msg.u.join_indication.password_challenge));
  6565. // Copy the Caller Identifier
  6566. ::CSAP_CopyDataToGCCMessage_IDvsDesc(
  6567. pwszCallerID,
  6568. &(Msg.u.join_indication.caller_identifier));
  6569. // Copy the Calling Address
  6570. ::CSAP_CopyDataToGCCMessage_Call(
  6571. calling_address,
  6572. &(Msg.u.join_indication.calling_address));
  6573. // Copy the Called Address
  6574. ::CSAP_CopyDataToGCCMessage_Call(
  6575. called_address,
  6576. &(Msg.u.join_indication.called_address));
  6577. // Copy the User Data if it exists.
  6578. LPBYTE pUserDataMemory = NULL;
  6579. if (user_data_list != NULL)
  6580. {
  6581. rc = RetrieveUserDataList(
  6582. user_data_list,
  6583. &(Msg.u.join_indication.number_of_user_data_members),
  6584. &(Msg.u.join_indication.user_data_list),
  6585. &pUserDataMemory);
  6586. }
  6587. else
  6588. {
  6589. Msg.u.join_indication.number_of_user_data_members = 0;
  6590. Msg.u.join_indication.user_data_list = NULL;
  6591. }
  6592. if (GCC_NO_ERROR == rc)
  6593. {
  6594. /*
  6595. ** Filling in the rest of the information that needs to be sent
  6596. ** to the application.
  6597. */
  6598. Msg.u.join_indication.join_response_tag = response_tag;
  6599. Msg.u.join_indication.conference_id = conference_id ;
  6600. Msg.u.join_indication.node_is_intermediate = intermediate_node;
  6601. Msg.u.join_indication.connection_handle = connection_handle;
  6602. SendCtrlSapMsg(&Msg);
  6603. delete pUserDataMemory;
  6604. if (NULL != convener_password)
  6605. {
  6606. convener_password->UnLockPasswordData();
  6607. }
  6608. if (NULL != password_challenge)
  6609. {
  6610. password_challenge->UnLockPasswordData();
  6611. }
  6612. }
  6613. #else
  6614. GCCCtrlSapMsgEx *pMsgEx;
  6615. /*
  6616. ** Allocate the GCC callback message and fill it in with the
  6617. ** appropriate values.
  6618. */
  6619. DBG_SAVE_FILE_LINE
  6620. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_JOIN_INDICATION, TRUE)))
  6621. {
  6622. ::ZeroMemory(&(pMsgEx->Msg.u.join_indication), sizeof(pMsgEx->Msg.u.join_indication));
  6623. /*
  6624. ** Copy the information that needs to be sent to the node
  6625. ** controller into local memory that can be deleted once the
  6626. ** information to be sent to the application is flushed. Note that
  6627. ** if an error occurs in one call to "CopyDataToGCCMessage" then no
  6628. ** action is taken on subsequent calls to that routine.
  6629. */
  6630. // start with success
  6631. rc = GCC_NO_ERROR;
  6632. // Copy the Convener Password
  6633. ::CSAP_CopyDataToGCCMessage_Password(
  6634. TRUE, // convener password
  6635. pMsgEx->pToDelete,
  6636. convener_password,
  6637. &(pMsgEx->Msg.u.join_indication.convener_password),
  6638. &rc);
  6639. // Copy the Password
  6640. ::CSAP_CopyDataToGCCMessage_Challenge(
  6641. pMsgEx->pToDelete,
  6642. password_challenge,
  6643. &(pMsgEx->Msg.u.join_indication.password_challenge),
  6644. &rc);
  6645. // Copy the Caller Identifier
  6646. ::CSAP_CopyDataToGCCMessage_IDvsDesc(
  6647. TRUE, // caller id
  6648. pMsgEx->pToDelete,
  6649. pwszCallerID,
  6650. &(pMsgEx->Msg.u.join_indication.caller_identifier),
  6651. &rc);
  6652. // Copy the Calling Address
  6653. ::CSAP_CopyDataToGCCMessage_Call(
  6654. TRUE, // calling address
  6655. pMsgEx->pToDelete,
  6656. calling_address,
  6657. &(pMsgEx->Msg.u.join_indication.calling_address),
  6658. &rc);
  6659. // Copy the Called Address
  6660. ::CSAP_CopyDataToGCCMessage_Call(
  6661. FALSE, // called address
  6662. pMsgEx->pToDelete,
  6663. called_address,
  6664. &(pMsgEx->Msg.u.join_indication.called_address),
  6665. &rc);
  6666. if (GCC_NO_ERROR == rc)
  6667. {
  6668. // Copy the User Data if it exists.
  6669. if (user_data_list != NULL)
  6670. {
  6671. rc = RetrieveUserDataList(
  6672. user_data_list,
  6673. &(pMsgEx->Msg.u.join_indication.number_of_user_data_members),
  6674. &(pMsgEx->Msg.u.join_indication.user_data_list),
  6675. &(pMsgEx->pToDelete->user_data_list_memory));
  6676. ASSERT(GCC_NO_ERROR == rc);
  6677. }
  6678. else
  6679. {
  6680. // pMsgEx->Msg.u.join_indication.number_of_user_data_members = 0;
  6681. // pMsgEx->Msg.u.join_indication.user_data_list = NULL;
  6682. }
  6683. if (GCC_NO_ERROR == rc)
  6684. {
  6685. /*
  6686. ** Filling in the rest of the information that needs to be sent
  6687. ** to the application.
  6688. */
  6689. pMsgEx->Msg.u.join_indication.join_response_tag = response_tag;
  6690. pMsgEx->Msg.u.join_indication.conference_id = conference_id ;
  6691. pMsgEx->Msg.u.join_indication.node_is_intermediate = intermediate_node;
  6692. pMsgEx->Msg.u.join_indication.connection_handle = connection_handle;
  6693. // Queue up the message for delivery to the Node Controller.
  6694. PostIndCtrlSapMsg(pMsgEx);
  6695. }
  6696. }
  6697. }
  6698. else
  6699. {
  6700. ERROR_OUT(("CControlSAP::QueueJoinIndication: can't create GCCCtrlSapMsgEx"));
  6701. rc = GCC_ALLOCATION_FAILURE;
  6702. }
  6703. if (GCC_NO_ERROR != rc)
  6704. {
  6705. FreeCtrlSapMsgEx(pMsgEx);
  6706. HandleResourceFailure(rc);
  6707. }
  6708. #endif // GCCNC_DIRECT_INDICATION
  6709. DebugExitINT(CControlSAP::QueueJoinIndication, rc);
  6710. return rc;
  6711. }
  6712. /*
  6713. * GCCError CControlSAP::RetrieveUserDataList(
  6714. * CUserDataListContainer *user_data_list_object,
  6715. * PUShort number_of_data_members,
  6716. * PGCCUserData **user_data_list,
  6717. * LPBYTE *pUserDataMemory)
  6718. *
  6719. * Public member function of CControlSAP.
  6720. *
  6721. * Function Description:
  6722. * This routine is used to fill in a user data list using a CUserDataListContainer
  6723. * container. The memory needed to hold the user data will be allocated
  6724. * by this routine.
  6725. *
  6726. * Formal Parameters:
  6727. * user_data_list_object (i) The CUserDataListContainer container holding the
  6728. * user data.
  6729. * number_of_data_members (o) The number of elements in the list of
  6730. * user data.
  6731. * user_data_list (o) The "API" user data list to fill in.
  6732. * data_to_be_deleted (o) Structure which will hold the memory
  6733. * allocated for the user data.
  6734. *
  6735. * Return Value:
  6736. * GCC_NO_ERROR - User data successfully retrieved.
  6737. * GCC_ALLOCATION_FAILURE - A resource allocation failure occurred.
  6738. *
  6739. * Side Effects:
  6740. * None.
  6741. *
  6742. * Caveats:
  6743. * None.
  6744. */
  6745. GCCError CControlSAP::RetrieveUserDataList
  6746. (
  6747. CUserDataListContainer *user_data_list_object,
  6748. UINT *number_of_data_members,
  6749. PGCCUserData **user_data_list,
  6750. LPBYTE *ppUserDataMemory
  6751. )
  6752. {
  6753. GCCError rc = GCC_NO_ERROR;
  6754. UINT user_data_length;
  6755. DebugEntry(CControlSAP::RetrieveUserDataList);
  6756. /*
  6757. * Lock the user data list object in order to determine the amount of
  6758. * memory to allocate to hold the user data.
  6759. */
  6760. user_data_length = user_data_list_object->LockUserDataList ();
  6761. DBG_SAVE_FILE_LINE
  6762. if (NULL != (*ppUserDataMemory = new BYTE[user_data_length]))
  6763. {
  6764. /*
  6765. * The CUserDataListContainer "Get" call will set the user_data_list
  6766. * pointer equal to this memory pointer.
  6767. */
  6768. user_data_list_object->GetUserDataList(
  6769. number_of_data_members,
  6770. user_data_list,
  6771. *ppUserDataMemory);
  6772. }
  6773. else
  6774. {
  6775. ERROR_OUT(("CControlSAP::RetrieveUserDataList: Error allocating memory"));
  6776. rc = GCC_ALLOCATION_FAILURE;
  6777. }
  6778. /*
  6779. * Unlock the data for the user data list object.
  6780. */
  6781. user_data_list_object->UnLockUserDataList ();
  6782. DebugExitINT(CControlSAP::RetrieveUserDataList, rc);
  6783. return rc;
  6784. }
  6785. /* ------ pure virtual in CBaseSap (shared with CAppSap) ------ */
  6786. /*
  6787. * ConfRosterInquireConfirm()
  6788. *
  6789. * Public Function Description
  6790. * This routine is called in order to return a requested conference
  6791. * roster to an application or the node controller.
  6792. */
  6793. GCCError CControlSAP::ConfRosterInquireConfirm
  6794. (
  6795. GCCConfID conference_id,
  6796. PGCCConferenceName conference_name,
  6797. GCCNumericString conference_modifier,
  6798. LPWSTR pwszConfDescriptor,
  6799. CConfRoster *conference_roster,
  6800. GCCResult result,
  6801. GCCAppSapMsgEx **ppAppSapMsgEx
  6802. )
  6803. {
  6804. GCCCtrlSapMsgEx *pMsgEx;
  6805. GCCError rc = GCC_NO_ERROR;
  6806. UINT memory_block_size = 0;
  6807. int name_unicode_string_length;
  6808. int descriptor_unicode_string_length;
  6809. LPBYTE pBuf = NULL;
  6810. LPBYTE memory_pointer;
  6811. DebugEntry(CControlSAP::ConfRosterInquireConfirm);
  6812. ASSERT(NULL == ppAppSapMsgEx);
  6813. /*
  6814. ** Create a new message structure to hold the message to be delivered
  6815. ** to the application or node controller.
  6816. */
  6817. DBG_SAVE_FILE_LINE
  6818. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_ROSTER_INQUIRE_CONFIRM)))
  6819. {
  6820. ::ZeroMemory(&(pMsgEx->Msg.u.conf_roster_inquire_confirm), sizeof(pMsgEx->Msg.u.conf_roster_inquire_confirm));
  6821. /*
  6822. * Determine the length of the numeric portion of the conference name.
  6823. */
  6824. if (conference_name->numeric_string != NULL)
  6825. {
  6826. memory_block_size += (::lstrlenA(conference_name->numeric_string) + 1);
  6827. memory_block_size = ROUNDTOBOUNDARY(memory_block_size);
  6828. }
  6829. /*
  6830. * Determine the length of the text portion of the conference name if it
  6831. * exists. A UnicodeString object is created temporarily to determine
  6832. * the length of the string.
  6833. */
  6834. if (conference_name->text_string != NULL)
  6835. {
  6836. name_unicode_string_length = ROUNDTOBOUNDARY(
  6837. (::lstrlenW(conference_name->text_string) + 1) * sizeof(WCHAR));
  6838. memory_block_size += name_unicode_string_length;
  6839. }
  6840. /*
  6841. * Determine the length of the conference modifier.
  6842. */
  6843. if (conference_modifier != NULL)
  6844. {
  6845. memory_block_size += (::lstrlenA(conference_modifier) + 1);
  6846. memory_block_size = ROUNDTOBOUNDARY(memory_block_size);
  6847. }
  6848. /*
  6849. * Determine the length of the conference descriptor. A UnicodeString
  6850. * object is created temporarily to determine the length of the string.
  6851. */
  6852. if (pwszConfDescriptor != NULL)
  6853. {
  6854. descriptor_unicode_string_length = ROUNDTOBOUNDARY(
  6855. (::lstrlenW(pwszConfDescriptor) + 1) * sizeof(WCHAR));
  6856. memory_block_size += descriptor_unicode_string_length;
  6857. }
  6858. /*
  6859. * Lock the data for the conference roster. The lock call will
  6860. * return the length of the data to be serialized for the roster so
  6861. * add that length to the total memory block size and allocate the
  6862. * memory block.
  6863. */
  6864. memory_block_size += conference_roster->LockConferenceRoster();
  6865. /*
  6866. * If the memory was successfully allocated, get a pointer to the
  6867. * memory. The first pointer in the roster inquire confirm message
  6868. * will be set to this location and all serialized data written into
  6869. * the memory block.
  6870. */
  6871. DBG_SAVE_FILE_LINE
  6872. if (NULL != (pMsgEx->pBuf = new BYTE[memory_block_size]))
  6873. {
  6874. memory_pointer = pMsgEx->pBuf;
  6875. /*
  6876. * Write the conference name string(s) into memory and set the
  6877. * message structure pointers.
  6878. */
  6879. if (conference_name->numeric_string != NULL)
  6880. {
  6881. ::lstrcpyA((LPSTR)memory_pointer, (LPSTR)conference_name->numeric_string);
  6882. pMsgEx->Msg.u.conf_roster_inquire_confirm.conference_name.
  6883. numeric_string = (LPSTR) memory_pointer;
  6884. memory_pointer += ROUNDTOBOUNDARY(
  6885. ::lstrlenA(conference_name->numeric_string) + 1);
  6886. }
  6887. else
  6888. {
  6889. // pMsgEx->Msg.u.conf_roster_inquire_confirm.conference_name.numeric_string = NULL;
  6890. }
  6891. /*
  6892. * Copy the text portion of the conference name if it exists.
  6893. */
  6894. if (conference_name->text_string != NULL)
  6895. {
  6896. ::CopyMemory(memory_pointer, (LPSTR)conference_name->text_string, name_unicode_string_length);
  6897. pMsgEx->Msg.u.conf_roster_inquire_confirm.conference_name.text_string = (LPWSTR)memory_pointer;
  6898. memory_pointer += name_unicode_string_length;
  6899. }
  6900. else
  6901. {
  6902. // pMsgEx->Msg.u.conf_roster_inquire_confirm.conference_name.text_string = NULL;
  6903. }
  6904. /*
  6905. * Copy the conference modifier is it exists
  6906. */
  6907. if (conference_modifier != NULL)
  6908. {
  6909. ::lstrcpyA((LPSTR)memory_pointer, (LPSTR)conference_modifier);
  6910. pMsgEx->Msg.u.conf_roster_inquire_confirm.conference_modifier = (LPSTR) memory_pointer;
  6911. memory_pointer += ROUNDTOBOUNDARY(::lstrlenA(conference_modifier) + 1);
  6912. }
  6913. else
  6914. {
  6915. // pMsgEx->Msg.u.conf_roster_inquire_confirm.conference_modifier = NULL;
  6916. }
  6917. /*
  6918. * Copy the conference descriptor.
  6919. */
  6920. if (pwszConfDescriptor != NULL)
  6921. {
  6922. ::CopyMemory(memory_pointer, (LPSTR)pwszConfDescriptor, descriptor_unicode_string_length);
  6923. pMsgEx->Msg.u.conf_roster_inquire_confirm.conference_descriptor = (LPWSTR) memory_pointer;
  6924. memory_pointer += descriptor_unicode_string_length;
  6925. }
  6926. else
  6927. {
  6928. // pMsgEx->Msg.u.conf_roster_inquire_confirm.conference_descriptor = NULL;
  6929. }
  6930. /*
  6931. * Retrieve the conference roster data from the roster object.
  6932. * The roster object will serialize any referenced data into
  6933. * the memory block passed in to the "Get" call.
  6934. */
  6935. conference_roster->GetConfRoster(
  6936. &pMsgEx->Msg.u.conf_roster_inquire_confirm.conference_roster,
  6937. memory_pointer);
  6938. pMsgEx->Msg.nConfID = conference_id;
  6939. pMsgEx->Msg.u.conf_roster_inquire_confirm.conference_id = conference_id;
  6940. pMsgEx->Msg.u.conf_roster_inquire_confirm.result = result;
  6941. /*
  6942. * Add the message to the queue for delivery to the application or
  6943. * node controller.
  6944. */
  6945. PostConfirmCtrlSapMsg(pMsgEx);
  6946. rc = GCC_NO_ERROR;
  6947. }
  6948. else
  6949. {
  6950. ERROR_OUT(("CControlSAP::ConfRosterInquireConfirm: can't allocate buffer, size=%u", (UINT) memory_block_size));
  6951. rc = GCC_ALLOCATION_FAILURE;
  6952. }
  6953. /*
  6954. * Unlock the data for the conference roster.
  6955. */
  6956. conference_roster->UnLockConferenceRoster();
  6957. }
  6958. else
  6959. {
  6960. ERROR_OUT(("CControlSAP::ConfRosterInquireConfirm: can't create GCCCtrlSapMsgEx"));
  6961. rc = GCC_ALLOCATION_FAILURE;
  6962. }
  6963. if (rc != GCC_NO_ERROR)
  6964. {
  6965. FreeCtrlSapMsgEx(pMsgEx);
  6966. ASSERT(GCC_ALLOCATION_FAILURE == rc);
  6967. HandleResourceFailure();
  6968. }
  6969. DebugExitINT(CControlSAP::ConfRosterInquireConfirm, rc);
  6970. return (rc);
  6971. }
  6972. /*
  6973. * AppRosterInquireConfirm()
  6974. *
  6975. * Public Function Description
  6976. * This routine is called in order to return a requested list of
  6977. * application rosters to an application or the node controller.
  6978. */
  6979. GCCError CControlSAP::AppRosterInquireConfirm
  6980. (
  6981. GCCConfID conference_id,
  6982. CAppRosterMsg *roster_message,
  6983. GCCResult result,
  6984. GCCAppSapMsgEx **ppAppSapMsgEx
  6985. )
  6986. {
  6987. #ifdef JASPER
  6988. GCCError rc = GCC_NO_ERROR;
  6989. GCCCtrlSapMsgEx *pMsgEx;
  6990. UINT number_of_rosters;
  6991. LPBYTE pBuf = NULL;
  6992. DebugEntry(CControlSAP::AppRosterInquireConfirm);
  6993. ASSERT(NULL == ppAppSapMsgEx);
  6994. /*
  6995. ** Create a new message structure to hold the message to be delivered
  6996. ** to the application or node controller.
  6997. */
  6998. DBG_SAVE_FILE_LINE
  6999. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_APP_ROSTER_INQUIRE_CONFIRM, TRUE)))
  7000. {
  7001. // ::ZeroMemory(&(pMsgEx->Msg.u.app_roster_inquire_confirm), sizeof(pMsgEx->Msg.u.app_roster_inquire_confirm));
  7002. /*
  7003. * Lock the data for the roster message and retrieve the data.
  7004. */
  7005. rc = roster_message->LockApplicationRosterMessage();
  7006. if (rc == GCC_NO_ERROR)
  7007. {
  7008. rc = roster_message->GetAppRosterMsg(&pBuf, &number_of_rosters);
  7009. if (rc == GCC_NO_ERROR)
  7010. {
  7011. /*
  7012. * Retrieve the memory pointer and save it in the list of
  7013. * GCCApplicationRoster pointers.
  7014. */
  7015. pMsgEx->Msg.u.app_roster_inquire_confirm.application_roster_list =
  7016. (PGCCApplicationRoster *) pBuf;
  7017. }
  7018. else
  7019. {
  7020. /*
  7021. * Cleanup after an error.
  7022. */
  7023. roster_message->UnLockApplicationRosterMessage();
  7024. }
  7025. }
  7026. /*
  7027. * If everything is OK up to here, send the message on up.
  7028. */
  7029. if (rc == GCC_NO_ERROR)
  7030. {
  7031. pMsgEx->pToDelete->application_roster_message = roster_message;
  7032. pMsgEx->Msg.u.app_roster_inquire_confirm.conference_id = conference_id;
  7033. pMsgEx->Msg.u.app_roster_inquire_confirm.number_of_rosters = number_of_rosters;
  7034. pMsgEx->Msg.u.app_roster_inquire_confirm.result = result;
  7035. /*
  7036. * Add the message to the queue for delivery to the application
  7037. * or node controller.
  7038. */
  7039. PostConfirmCtrlSapMsg(pMsgEx);
  7040. }
  7041. }
  7042. else
  7043. {
  7044. ERROR_OUT(("CControlSAP::AppRosterInquireConfirm: can't create GCCCtrlSapMsgEx"));
  7045. rc = GCC_ALLOCATION_FAILURE;
  7046. }
  7047. if (rc != GCC_NO_ERROR)
  7048. {
  7049. FreeCtrlSapMsgEx(pMsgEx);
  7050. HandleResourceFailure(rc);
  7051. }
  7052. DebugExitINT(CControlSAP::AppRosterInquireConfirm, rc);
  7053. return (rc);
  7054. #else
  7055. return GCC_NO_ERROR;
  7056. #endif // JASPER
  7057. }
  7058. /*
  7059. * ConductorInquireConfirm ()
  7060. *
  7061. * Public Function Description
  7062. * This routine is called in order to return conductorship information
  7063. * which has been requested.
  7064. *
  7065. */
  7066. GCCError CControlSAP::ConductorInquireConfirm
  7067. (
  7068. GCCNodeID conductor_node_id,
  7069. GCCResult result,
  7070. BOOL permission_flag,
  7071. BOOL conducted_mode,
  7072. GCCConfID conference_id
  7073. )
  7074. {
  7075. #ifdef JASPER
  7076. GCCError rc;
  7077. GCCCtrlSapMsgEx *pMsgEx;
  7078. DebugEntry(CControlSAP::ConductorInquireConfirm);
  7079. /*
  7080. ** Create a new message structure to hold the message to be delivered
  7081. ** to the application or node controller.
  7082. */
  7083. DBG_SAVE_FILE_LINE
  7084. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_CONDUCT_INQUIRE_CONFIRM)))
  7085. {
  7086. // ::ZeroMemory(&(pMsgEx->Msg.u.conduct_inquire_confirm), sizeof(pMsgEx->Msg.u.conduct_inquire_confirm));
  7087. pMsgEx->Msg.u.conduct_inquire_confirm.conference_id = conference_id;
  7088. pMsgEx->Msg.u.conduct_inquire_confirm.result = result;
  7089. pMsgEx->Msg.u.conduct_inquire_confirm.mode_is_conducted = conducted_mode;
  7090. pMsgEx->Msg.u.conduct_inquire_confirm.conductor_node_id = conductor_node_id;
  7091. pMsgEx->Msg.u.conduct_inquire_confirm.permission_is_granted = permission_flag;
  7092. /*
  7093. * Add the message to the queue for delivery to the application or
  7094. * node controller.
  7095. */
  7096. PostConfirmCtrlSapMsg(pMsgEx);
  7097. rc = GCC_NO_ERROR;
  7098. }
  7099. else
  7100. {
  7101. rc = GCC_ALLOCATION_FAILURE;
  7102. HandleResourceFailure();
  7103. }
  7104. DebugExitINT(CControlSAP::ConductorInquireConfirm, rc);
  7105. return rc;
  7106. #else
  7107. return GCC_NO_ERROR;
  7108. #endif // JASPER
  7109. }
  7110. /*
  7111. * AppInvokeConfirm ()
  7112. *
  7113. * Public Function Description
  7114. * This routine is called in order to confirm a call requesting application
  7115. * invocation.
  7116. */
  7117. GCCError CControlSAP::AppInvokeConfirm
  7118. (
  7119. GCCConfID conference_id,
  7120. CInvokeSpecifierListContainer *invoke_list,
  7121. GCCResult result,
  7122. GCCRequestTag nReqTag
  7123. )
  7124. {
  7125. GCCCtrlSapMsgEx *pMsgEx;
  7126. GCCError rc = GCC_NO_ERROR;
  7127. UINT invoke_list_memory_length;
  7128. DebugEntry(CControlSAP::AppInvokeConfirm);
  7129. /*
  7130. ** Create a new message structure to hold the message to be delivered
  7131. ** to the application or node controller.
  7132. */
  7133. DBG_SAVE_FILE_LINE
  7134. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_APPLICATION_INVOKE_CONFIRM)))
  7135. {
  7136. ::ZeroMemory(&(pMsgEx->Msg.u.application_invoke_confirm), sizeof(pMsgEx->Msg.u.application_invoke_confirm));
  7137. /*
  7138. ** Determine the amount of memory necessary to hold the list of
  7139. ** invoke specifiers and allocate that memory.
  7140. */
  7141. invoke_list_memory_length = invoke_list->LockApplicationInvokeSpecifierList();
  7142. if (invoke_list_memory_length != 0)
  7143. {
  7144. /*
  7145. * If the memory was successfully allocated, get a pointer
  7146. * to the memory and save it in the app_protocol_entity_list
  7147. * pointer of the GCC message. Call the
  7148. * CInvokeSpecifierList object to fill in the
  7149. * list.
  7150. */
  7151. DBG_SAVE_FILE_LINE
  7152. if (NULL != (pMsgEx->pBuf = new BYTE[invoke_list_memory_length]))
  7153. {
  7154. pMsgEx->Msg.u.application_invoke_confirm.app_protocol_entity_list =
  7155. (GCCAppProtocolEntity **) pMsgEx->pBuf;
  7156. invoke_list->GetApplicationInvokeSpecifierList(
  7157. &(pMsgEx->Msg.u.application_invoke_confirm.number_of_app_protocol_entities),
  7158. pMsgEx->pBuf);
  7159. pMsgEx->Msg.u.application_invoke_confirm.conference_id = conference_id;
  7160. pMsgEx->Msg.u.application_invoke_confirm.result = result;
  7161. /*
  7162. * Add the message to the queue for delivery to the application
  7163. * or node controller.
  7164. */
  7165. PostConfirmCtrlSapMsg(pMsgEx);
  7166. rc = GCC_NO_ERROR;
  7167. }
  7168. else
  7169. {
  7170. ERROR_OUT(("CControlSAP::AppInvokeConfirm: can't allocate buffer, size=%u", (UINT) invoke_list_memory_length));
  7171. rc = GCC_ALLOCATION_FAILURE;
  7172. }
  7173. }
  7174. /*
  7175. ** Unlock the data for the invoke specifier list.
  7176. */
  7177. invoke_list->UnLockApplicationInvokeSpecifierList();
  7178. }
  7179. else
  7180. {
  7181. ERROR_OUT(("CControlSAP::AppInvokeConfirm: can't create GCCCtrlSapMsgEx"));
  7182. rc = GCC_ALLOCATION_FAILURE;
  7183. }
  7184. if (rc != GCC_NO_ERROR)
  7185. {
  7186. FreeCtrlSapMsgEx(pMsgEx);
  7187. ASSERT(GCC_ALLOCATION_FAILURE == rc);
  7188. HandleResourceFailure();
  7189. }
  7190. DebugExitINT(CControlSAP::AppInvokeConfirm, rc);
  7191. return rc;
  7192. }
  7193. /*
  7194. * AppInvokeIndication ()
  7195. *
  7196. * Public Function Description
  7197. * This routine is called in order to send an indication to an application
  7198. * or node controller that a request for application invocation has been
  7199. * made.
  7200. */
  7201. GCCError CControlSAP::AppInvokeIndication
  7202. (
  7203. GCCConfID conference_id,
  7204. CInvokeSpecifierListContainer *invoke_list,
  7205. GCCNodeID invoking_node_id
  7206. )
  7207. {
  7208. GCCError rc = GCC_NO_ERROR;
  7209. DebugEntry(CControlSAP::AppInvokeIndication);
  7210. #ifdef GCCNC_DIRECT_INDICATION
  7211. GCCCtrlSapMsg Msg;
  7212. Msg.message_type = GCC_APPLICATION_INVOKE_INDICATION;
  7213. UINT invoke_list_memory_length;
  7214. /*
  7215. ** Determine the amount of memory necessary to hold the list of
  7216. ** invoke specifiers and allocate that memory.
  7217. */
  7218. invoke_list_memory_length = invoke_list->LockApplicationInvokeSpecifierList();
  7219. if (invoke_list_memory_length != 0)
  7220. {
  7221. LPBYTE pBuf;
  7222. /*
  7223. * If the memory was successfully allocated, get a pointer
  7224. * to the memory and save it in the app_protocol_entity_list
  7225. * pointer of the GCC message. Call the
  7226. * CInvokeSpecifierList object to fill in the
  7227. * list.
  7228. */
  7229. DBG_SAVE_FILE_LINE
  7230. if (NULL != (pBuf = new BYTE[invoke_list_memory_length]))
  7231. {
  7232. Msg.u.application_invoke_indication.app_protocol_entity_list = (GCCAppProtocolEntity **) pBuf;
  7233. invoke_list->GetApplicationInvokeSpecifierList(
  7234. &(Msg.u.application_invoke_indication.number_of_app_protocol_entities),
  7235. pBuf);
  7236. Msg.u.application_invoke_indication.conference_id = conference_id;
  7237. Msg.u.application_invoke_indication.invoking_node_id = invoking_node_id;
  7238. SendCtrlSapMsg(&Msg);
  7239. // rc = GCC_NO_ERROR;
  7240. delete pBuf;
  7241. }
  7242. else
  7243. {
  7244. ERROR_OUT(("CControlSAP::AppInvokeIndication: can't allocate buffer, size=%u", (UINT) invoke_list_memory_length));
  7245. rc = GCC_ALLOCATION_FAILURE;
  7246. }
  7247. }
  7248. /*
  7249. ** Unlock the data for the invoke specifier list.
  7250. */
  7251. invoke_list->UnLockApplicationInvokeSpecifierList ();
  7252. #else
  7253. GCCCtrlSapMsgEx *pMsgEx;
  7254. UINT invoke_list_memory_length;
  7255. /*
  7256. ** Create a new message structure to hold the message to be delivered
  7257. ** to the application or node controller.
  7258. */
  7259. DBG_SAVE_FILE_LINE
  7260. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_APPLICATION_INVOKE_INDICATION)))
  7261. {
  7262. ::ZeroMemory(&(pMsgEx->Msg.u.application_invoke_indication), sizeof(pMsgEx->Msg.u.application_invoke_indication));
  7263. /*
  7264. ** Determine the amount of memory necessary to hold the list of
  7265. ** invoke specifiers and allocate that memory.
  7266. */
  7267. invoke_list_memory_length = invoke_list->LockApplicationInvokeSpecifierList();
  7268. if (invoke_list_memory_length != 0)
  7269. {
  7270. /*
  7271. * If the memory was successfully allocated, get a pointer
  7272. * to the memory and save it in the app_protocol_entity_list
  7273. * pointer of the GCC message. Call the
  7274. * CInvokeSpecifierList object to fill in the
  7275. * list.
  7276. */
  7277. DBG_SAVE_FILE_LINE
  7278. if (NULL != (pMsgEx->pBuf = new BYTE[invoke_list_memory_length]))
  7279. {
  7280. pMsgEx->Msg.u.application_invoke_indication.app_protocol_entity_list =
  7281. (GCCAppProtocolEntity **) pMsgEx->pBuf;
  7282. invoke_list->GetApplicationInvokeSpecifierList(
  7283. &(pMsgEx->Msg.u.application_invoke_indication.number_of_app_protocol_entities),
  7284. pMsgEx->pBuf);
  7285. pMsgEx->Msg.u.application_invoke_indication.conference_id = conference_id;
  7286. pMsgEx->Msg.u.application_invoke_indication.invoking_node_id = invoking_node_id;
  7287. PostIndCtrlSapMsg(pMsgEx);
  7288. rc = GCC_NO_ERROR;
  7289. }
  7290. else
  7291. {
  7292. ERROR_OUT(("CControlSAP::AppInvokeIndication: can't allocate buffer, size=%u", (UINT) invoke_list_memory_length));
  7293. rc = GCC_ALLOCATION_FAILURE;
  7294. }
  7295. }
  7296. /*
  7297. ** Unlock the data for the invoke specifier list.
  7298. */
  7299. invoke_list->UnLockApplicationInvokeSpecifierList ();
  7300. }
  7301. else
  7302. {
  7303. ERROR_OUT(("CControlSAP::AppInvokeIndication: can't create GCCCtrlSapMsgEx"));
  7304. rc = GCC_ALLOCATION_FAILURE;
  7305. }
  7306. if (rc != GCC_NO_ERROR)
  7307. {
  7308. FreeCtrlSapMsgEx(pMsgEx);
  7309. ASSERT(GCC_ALLOCATION_FAILURE == rc);
  7310. HandleResourceFailure();
  7311. }
  7312. #endif // GCCNC_DIRECT_INDICATION
  7313. DebugExitINT(CControlSAP::AppInvokeIndication, rc);
  7314. return rc;
  7315. }
  7316. /*
  7317. * ConfRosterReportIndication ()
  7318. *
  7319. * Public Function Description
  7320. * This routine is called in order to indicate to applications and the
  7321. * node controller that the conference roster has been updated.
  7322. */
  7323. GCCError CControlSAP::ConfRosterReportIndication
  7324. (
  7325. GCCConfID conference_id,
  7326. CConfRosterMsg *roster_message
  7327. )
  7328. {
  7329. GCCError rc = GCC_NO_ERROR;
  7330. DebugEntry(CControlSAP::ConfRosterReportIndication);
  7331. #ifdef GCCNC_DIRECT_INDICATION
  7332. GCCCtrlSapMsg Msg;
  7333. Msg.message_type = GCC_ROSTER_REPORT_INDICATION;
  7334. /*
  7335. * Lock the conference roster message in order to force the object
  7336. * to serialize the data into its internal memory.
  7337. */
  7338. rc = roster_message->LockConferenceRosterMessage();
  7339. if (rc == GCC_NO_ERROR)
  7340. {
  7341. LPBYTE pBuf = NULL;
  7342. /*
  7343. * Retrieve the actual pointer to memory object that the
  7344. * serialized conference roster is contained in from the
  7345. * conference roster message.
  7346. */
  7347. rc = roster_message->GetConferenceRosterMessage(&pBuf);
  7348. if (rc == GCC_NO_ERROR)
  7349. {
  7350. Msg.nConfID = conference_id;
  7351. Msg.u.conf_roster_report_indication.conference_id = conference_id;
  7352. Msg.u.conf_roster_report_indication.conference_roster = (PGCCConferenceRoster) pBuf;
  7353. SendCtrlSapMsg(&Msg);
  7354. }
  7355. else
  7356. {
  7357. ERROR_OUT(("CControlSAP::ConfRosterReportIndication: can't get conf roster message"));
  7358. }
  7359. roster_message->UnLockConferenceRosterMessage();
  7360. }
  7361. else
  7362. {
  7363. ERROR_OUT(("CControlSAP::ConfRosterReportIndication: can't lock conf roster message"));
  7364. }
  7365. #else
  7366. GCCCtrlSapMsgEx *pMsgEx;
  7367. /*
  7368. ** Create a new message structure to hold the message to be delivered
  7369. ** to the application or node controller.
  7370. */
  7371. DBG_SAVE_FILE_LINE
  7372. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_ROSTER_REPORT_INDICATION, TRUE)))
  7373. {
  7374. // ::ZeroMemory(&(pMsgEx->Msg.u.conf_roster_report_indication), sizeof(pMsgEx->Msg.u.conf_roster_report_indication));
  7375. /*
  7376. * Lock the conference roster message in order to force the object
  7377. * to serialize the data into its internal memory.
  7378. */
  7379. rc = roster_message->LockConferenceRosterMessage();
  7380. if (rc == GCC_NO_ERROR)
  7381. {
  7382. LPBYTE pBuf = NULL;
  7383. /*
  7384. * Retrieve the actual pointer to memory object that the
  7385. * serialized conference roster is contained in from the
  7386. * conference roster message.
  7387. */
  7388. rc = roster_message->GetConferenceRosterMessage(&pBuf);
  7389. if (rc == GCC_NO_ERROR)
  7390. {
  7391. pMsgEx->Msg.u.conf_roster_report_indication.conference_roster =
  7392. (PGCCConferenceRoster) pBuf;
  7393. /*
  7394. * Fill in the roster's conference ID and then queue up the
  7395. * message.
  7396. */
  7397. pMsgEx->Msg.nConfID = conference_id;
  7398. pMsgEx->Msg.u.conf_roster_report_indication.conference_id = conference_id;
  7399. pMsgEx->pToDelete->conference_roster_message = roster_message;
  7400. PostIndCtrlSapMsg(pMsgEx);
  7401. }
  7402. else
  7403. {
  7404. ERROR_OUT(("CControlSAP::ConfRosterReportIndication: can't get conf roster message"));
  7405. }
  7406. }
  7407. else
  7408. {
  7409. ERROR_OUT(("CControlSAP::ConfRosterReportIndication: can't lock conf roster message"));
  7410. }
  7411. }
  7412. else
  7413. {
  7414. ERROR_OUT(("CControlSAP::ConfRosterReportIndication: can't create GCCCtrlSapMsgEx"));
  7415. rc = GCC_ALLOCATION_FAILURE;
  7416. }
  7417. if (rc != GCC_NO_ERROR)
  7418. {
  7419. FreeCtrlSapMsgEx(pMsgEx);
  7420. HandleResourceFailure(rc);
  7421. }
  7422. #endif // GCCNC_DIRECT_INDICATION
  7423. DebugExitINT(CControlSAP::ConfRosterReportIndication, rc);
  7424. return rc;
  7425. }
  7426. /*
  7427. * AppRosterReportIndication()
  7428. *
  7429. * Public Function Description
  7430. * This routine is called in order to indicate to applications and the
  7431. * node controller that the list of application rosters has been updated.
  7432. */
  7433. GCCError CControlSAP::AppRosterReportIndication
  7434. (
  7435. GCCConfID conference_id,
  7436. CAppRosterMsg *roster_message
  7437. )
  7438. {
  7439. GCCError rc = GCC_NO_ERROR;
  7440. DebugEntry(CControlSAP::AppRosterReportIndication);
  7441. #ifdef GCCNC_DIRECT_INDICATION
  7442. GCCCtrlSapMsg Msg;
  7443. Msg.message_type = GCC_APP_ROSTER_REPORT_INDICATION;
  7444. /*
  7445. * Determine the amount of memory needed to hold the list of
  7446. * application rosters and allocate that memory.
  7447. */
  7448. rc = roster_message->LockApplicationRosterMessage();
  7449. if (rc == GCC_NO_ERROR)
  7450. {
  7451. LPBYTE pBuf = NULL;
  7452. ULONG cRosters;
  7453. rc = roster_message->GetAppRosterMsg(&pBuf, &cRosters);
  7454. if (rc == GCC_NO_ERROR)
  7455. {
  7456. Msg.u.app_roster_report_indication.conference_id = conference_id;
  7457. Msg.u.app_roster_report_indication.application_roster_list = (PGCCApplicationRoster *) pBuf;
  7458. Msg.u.app_roster_report_indication.number_of_rosters = cRosters;
  7459. SendCtrlSapMsg(&Msg);
  7460. }
  7461. else
  7462. {
  7463. ERROR_OUT(("CControlSAP: AppRosterReportIndication: GetAppRosterMsg failed"));
  7464. }
  7465. roster_message->UnLockApplicationRosterMessage();
  7466. }
  7467. else
  7468. {
  7469. ERROR_OUT(("CControlSAP: AppRosterReportIndication: LockApplicationRosterMessage failed"));
  7470. }
  7471. #else
  7472. GCCCtrlSapMsgEx *pMsgEx;
  7473. LPBYTE pBuf = NULL;
  7474. UINT cRosters;
  7475. /*
  7476. ** Create a new message structure to hold the message to be delivered
  7477. ** to the application or node controller.
  7478. */
  7479. DBG_SAVE_FILE_LINE
  7480. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_APP_ROSTER_REPORT_INDICATION, TRUE)))
  7481. {
  7482. // ::ZeroMemory(&(pMsgEx->Msg.u.app_roster_report_indication), sizeof(pMsgEx->Msg.u.app_roster_report_indication));
  7483. /*
  7484. * Determine the amount of memory needed to hold the list of
  7485. * application rosters and allocate that memory.
  7486. */
  7487. rc = roster_message->LockApplicationRosterMessage();
  7488. if (rc == GCC_NO_ERROR)
  7489. {
  7490. rc = roster_message->GetAppRosterMsg(&pBuf, &cRosters);
  7491. if (rc == GCC_NO_ERROR)
  7492. {
  7493. /*
  7494. * Save it in the list of GCCApplicationRoster pointers.
  7495. */
  7496. pMsgEx->Msg.u.app_roster_report_indication.application_roster_list =
  7497. (PGCCApplicationRoster *) pBuf;
  7498. }
  7499. else
  7500. {
  7501. /*
  7502. * Cleanup after an error.
  7503. */
  7504. ERROR_OUT(("CControlSAP: AppRosterReportIndication: GetAppRosterMsg failed"));
  7505. roster_message->UnLockApplicationRosterMessage();
  7506. }
  7507. }
  7508. else
  7509. {
  7510. ERROR_OUT(("CControlSAP: AppRosterReportIndication: LockApplicationRosterMessage failed"));
  7511. }
  7512. /*
  7513. * If everything is OK up to here, send the message on up.
  7514. */
  7515. if (rc == GCC_NO_ERROR)
  7516. {
  7517. pMsgEx->Msg.u.app_roster_report_indication.conference_id = conference_id;
  7518. pMsgEx->Msg.u.app_roster_report_indication.number_of_rosters = cRosters;
  7519. pMsgEx->pToDelete->application_roster_message = roster_message;
  7520. /*
  7521. * Add the message to the queue for delivery to the application
  7522. * or node controller.
  7523. */
  7524. PostIndCtrlSapMsg(pMsgEx);
  7525. }
  7526. }
  7527. else
  7528. {
  7529. ERROR_OUT(("CControlSAP: AppRosterReportIndication: Failed to allocate a GCC message"));
  7530. rc = GCC_ALLOCATION_FAILURE;
  7531. }
  7532. if (rc != GCC_NO_ERROR)
  7533. {
  7534. FreeCtrlSapMsgEx(pMsgEx);
  7535. HandleResourceFailure(rc);
  7536. }
  7537. #endif // GCCNC_DIRECT_INDICATION
  7538. DebugExitINT(CControlSAP::AppRosterReportIndication, rc);
  7539. return rc;
  7540. }
  7541. /* ------ from CBaseSap ------ */
  7542. /*
  7543. * ConductorAssignIndication ()
  7544. *
  7545. * Public Function Description
  7546. * This routine is called in order to send an indication to an application
  7547. * or node controller that a request has been made to assign conductorship.
  7548. */
  7549. GCCError CControlSAP::ConductorAssignIndication
  7550. (
  7551. UserID conductor_node_id,
  7552. GCCConfID conference_id
  7553. )
  7554. {
  7555. #ifdef JASPER
  7556. GCCError rc;
  7557. DebugEntry(CControlSAP::ConductorAssignIndication);
  7558. #ifdef GCCNC_DIRECT_INDICATION
  7559. GCCCtrlSapMsg Msg;
  7560. Msg.message_type = GCC_CONDUCT_ASSIGN_INDICATION;
  7561. Msg.u.conduct_assign_indication.conference_id = conference_id;
  7562. Msg.u.conduct_assign_indication.node_id = conductor_node_id;
  7563. SendCtrlSapMsg(&Msg);
  7564. rc = GCC_NO_ERROR;
  7565. #else
  7566. GCCCtrlSapMsgEx *pMsgEx;
  7567. /*
  7568. ** Create a new message structure to hold the message to be delivered
  7569. ** to the application or node controller.
  7570. */
  7571. DBG_SAVE_FILE_LINE
  7572. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_CONDUCT_ASSIGN_INDICATION)))
  7573. {
  7574. // ::ZeroMemory(&(pMsgEx->Msg.u.conduct_assign_indication), sizeof(pMsgEx->Msg.u.conduct_assign_indication));
  7575. pMsgEx->Msg.u.conduct_assign_indication.conference_id = conference_id;
  7576. pMsgEx->Msg.u.conduct_assign_indication.node_id = conductor_node_id;
  7577. /*
  7578. * Add the message to the queue for delivery to the application or
  7579. * node controller.
  7580. */
  7581. PostIndCtrlSapMsg(pMsgEx);
  7582. rc = GCC_NO_ERROR;
  7583. }
  7584. else
  7585. {
  7586. rc = GCC_ALLOCATION_FAILURE;
  7587. HandleResourceFailure();
  7588. }
  7589. #endif // GCCNC_DIRECT_INDICATION
  7590. DebugExitINT(CControlSAP::ConductorAssignIndication, rc);
  7591. return rc;
  7592. #else
  7593. return GCC_NO_ERROR;
  7594. #endif // JASPER
  7595. }
  7596. /*
  7597. * ConductorReleaseIndication ()
  7598. *
  7599. * Public Function Description
  7600. * This routine is called in order to send an indication to an application
  7601. * or node controller that a request for releasing conductorship has been
  7602. * made.
  7603. */
  7604. GCCError CControlSAP::
  7605. ConductorReleaseIndication ( GCCConfID conference_id )
  7606. {
  7607. #ifdef JASPER
  7608. GCCError rc;
  7609. DebugEntry(CControlSAP::ConductorReleaseIndication);
  7610. #ifdef GCCNC_DIRECT_INDICATION
  7611. GCCCtrlSapMsg Msg;
  7612. Msg.message_type = GCC_CONDUCT_RELEASE_INDICATION;
  7613. Msg.u.conduct_release_indication.conference_id = conference_id;
  7614. SendCtrlSapMsg(&Msg);
  7615. rc = GCC_NO_ERROR;
  7616. #else
  7617. GCCCtrlSapMsgEx *pMsgEx;
  7618. /*
  7619. ** Create a new message structure to hold the message to be delivered
  7620. ** to the application or node controller.
  7621. */
  7622. DBG_SAVE_FILE_LINE
  7623. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_CONDUCT_RELEASE_INDICATION)))
  7624. {
  7625. // ::ZeroMemory(&(pMsgEx->Msg.u.conduct_release_indication), sizeof(pMsgEx->Msg.u.conduct_release_indication));
  7626. pMsgEx->Msg.u.conduct_release_indication.conference_id = conference_id;
  7627. /*
  7628. * Add the message to the queue for delivery to the application or
  7629. * node controller.
  7630. */
  7631. PostIndCtrlSapMsg(pMsgEx);
  7632. rc = GCC_NO_ERROR;
  7633. }
  7634. else
  7635. {
  7636. rc = GCC_ALLOCATION_FAILURE;
  7637. HandleResourceFailure();
  7638. }
  7639. #endif // GCCNC_DIRECT_INDICATION
  7640. DebugExitINT(CControlSAP::ConductorReleaseIndication, rc);
  7641. return rc;
  7642. #else
  7643. return GCC_NO_ERROR;
  7644. #endif // JASPER
  7645. }
  7646. /*
  7647. * ConductorPermitGrantIndication ()
  7648. *
  7649. * Public Function Description
  7650. * This routine is called in order to send an indication to an application
  7651. * or node controller that a request for permission from the conductor
  7652. * has been made.
  7653. */
  7654. GCCError CControlSAP::ConductorPermitGrantIndication
  7655. (
  7656. GCCConfID conference_id,
  7657. UINT number_granted,
  7658. GCCNodeID *granted_node_list,
  7659. UINT number_waiting,
  7660. GCCNodeID *waiting_node_list,
  7661. BOOL permission_is_granted
  7662. )
  7663. {
  7664. #ifdef JASPER
  7665. GCCError rc = GCC_NO_ERROR;
  7666. DebugEntry(CControlSAP::ConductorPermitGrantIndication);
  7667. #ifdef GCCNC_DIRECT_INDICATION
  7668. GCCCtrlSapMsg Msg;
  7669. Msg.message_type = GCC_CONDUCT_GRANT_INDICATION;
  7670. Msg.u.conduct_permit_grant_indication.conference_id = conference_id;
  7671. Msg.u.conduct_permit_grant_indication.number_granted = number_granted;
  7672. Msg.u.conduct_permit_grant_indication.granted_node_list = granted_node_list;
  7673. Msg.u.conduct_permit_grant_indication.number_waiting = number_waiting;
  7674. Msg.u.conduct_permit_grant_indication.waiting_node_list = waiting_node_list;
  7675. Msg.u.conduct_permit_grant_indication.permission_is_granted = permission_is_granted;
  7676. SendCtrlSapMsg(&Msg);
  7677. #else
  7678. GCCCtrlSapMsgEx *pMsgEx;
  7679. int bulk_memory_size;
  7680. LPBYTE memory_pointer;
  7681. UINT i;
  7682. /*
  7683. ** Create a new message structure to hold the message to be delivered
  7684. ** to the application or node controller.
  7685. */
  7686. DBG_SAVE_FILE_LINE
  7687. if (NULL != (pMsgEx = CreateCtrlSapMsgEx(GCC_CONDUCT_GRANT_INDICATION)))
  7688. {
  7689. ::ZeroMemory(&(pMsgEx->Msg.u.conduct_permit_grant_indication), sizeof(pMsgEx->Msg.u.conduct_permit_grant_indication));
  7690. /*
  7691. ** Here we determine if bulk memory is necessary.
  7692. */
  7693. if ((number_granted != 0) || (number_waiting != 0))
  7694. {
  7695. /*
  7696. ** We must first determine how big the bulk memory block will be
  7697. ** and allocate that memory.
  7698. */
  7699. bulk_memory_size = (ROUNDTOBOUNDARY(sizeof(UserID)) * number_granted) +
  7700. (ROUNDTOBOUNDARY(sizeof(UserID)) * number_waiting);
  7701. DBG_SAVE_FILE_LINE
  7702. if (NULL != (pMsgEx->pBuf = new BYTE[bulk_memory_size]))
  7703. {
  7704. memory_pointer = pMsgEx->pBuf;
  7705. }
  7706. else
  7707. {
  7708. ERROR_OUT(("CControlSAP::ConductorPermitGrantIndication: can't allocate buffer, size=%u", (UINT) bulk_memory_size));
  7709. rc = GCC_ALLOCATION_FAILURE;
  7710. }
  7711. }
  7712. if (rc == GCC_NO_ERROR)
  7713. {
  7714. /*
  7715. ** If there are any nodes in the permission list copy them over.
  7716. */
  7717. if (number_granted != 0)
  7718. {
  7719. TRACE_OUT(("CControlSAP::ConductorPermitGrantIndication:"
  7720. " number_granted = %d", number_granted));
  7721. pMsgEx->Msg.u.conduct_permit_grant_indication.
  7722. granted_node_list = (PUserID)memory_pointer;
  7723. for (i = 0; i < number_granted; i++)
  7724. {
  7725. pMsgEx->Msg.u.conduct_permit_grant_indication.
  7726. granted_node_list[i] = granted_node_list[i];
  7727. }
  7728. memory_pointer += ROUNDTOBOUNDARY(sizeof(UserID)) * number_granted;
  7729. }
  7730. else
  7731. {
  7732. // pMsgEx->Msg.u.conduct_permit_grant_indication.granted_node_list = NULL;
  7733. }
  7734. /*
  7735. ** If there are any nodes in the waiting list copy them over.
  7736. */
  7737. if (number_waiting != 0)
  7738. {
  7739. TRACE_OUT(("CControlSAP::ConductorPermitGrantIndication:"
  7740. " number_waiting = %d", number_waiting));
  7741. pMsgEx->Msg.u.conduct_permit_grant_indication.
  7742. waiting_node_list = (PUserID)memory_pointer;
  7743. for (i = 0; i < number_waiting; i++)
  7744. {
  7745. pMsgEx->Msg.u.conduct_permit_grant_indication.
  7746. waiting_node_list[i] = waiting_node_list[i];
  7747. }
  7748. }
  7749. else
  7750. {
  7751. // pMsgEx->Msg.u.conduct_permit_grant_indication.waiting_node_list = NULL;
  7752. }
  7753. pMsgEx->Msg.u.conduct_permit_grant_indication.conference_id = conference_id;
  7754. pMsgEx->Msg.u.conduct_permit_grant_indication.number_granted = number_granted;
  7755. pMsgEx->Msg.u.conduct_permit_grant_indication.number_waiting = number_waiting;
  7756. pMsgEx->Msg.u.conduct_permit_grant_indication.permission_is_granted = permission_is_granted;
  7757. /*
  7758. * Add the message to the queue for delivery to the application or
  7759. * node controller.
  7760. */
  7761. PostIndCtrlSapMsg(pMsgEx);
  7762. }
  7763. }
  7764. else
  7765. {
  7766. ERROR_OUT(("CControlSAP::ConductorPermitGrantIndication: can't create GCCCtrlSapMsgEx"));
  7767. rc = GCC_ALLOCATION_FAILURE;
  7768. }
  7769. if (rc != GCC_NO_ERROR)
  7770. {
  7771. FreeCtrlSapMsgEx(pMsgEx);
  7772. ASSERT(GCC_ALLOCATION_FAILURE == rc);
  7773. HandleResourceFailure();
  7774. }
  7775. #endif // GCCNC_DIRECT_INDICATION
  7776. DebugExitINT(CControlSAP::ConductorPermitGrantIndication, rc);
  7777. return (rc);
  7778. #else
  7779. return GCC_NO_ERROR;
  7780. #endif // JASPER
  7781. }
  7782. GCCError CControlSAP::AppletInvokeRequest
  7783. (
  7784. GCCConfID nConfID,
  7785. UINT number_of_app_protcol_entities,
  7786. GCCAppProtocolEntity **app_protocol_entity_list,
  7787. UINT number_of_destination_nodes,
  7788. UserID *list_of_destination_nodes
  7789. )
  7790. {
  7791. GCCAppProtEntityList ApeList;
  7792. GCCSimpleNodeList NodeList;
  7793. GCCRequestTag nReqTag;
  7794. ApeList.cApes = number_of_app_protcol_entities;
  7795. ApeList.apApes = app_protocol_entity_list;
  7796. NodeList.cNodes = number_of_destination_nodes;
  7797. NodeList.aNodeIDs = list_of_destination_nodes;
  7798. return CBaseSap::AppInvoke(nConfID, &ApeList, &NodeList, &nReqTag);
  7799. }
  7800. GCCError CControlSAP::ConfRosterInqRequest
  7801. (
  7802. GCCConfID nConfID
  7803. )
  7804. {
  7805. return CBaseSap::ConfRosterInquire(nConfID, NULL);
  7806. }
  7807. #ifdef JASPER
  7808. GCCError CControlSAP::ConductorInquireRequest
  7809. (
  7810. GCCConfID nConfID
  7811. )
  7812. {
  7813. return CBaseSap::ConductorInquire(nConfID);
  7814. }
  7815. #endif // JASPER
  7816. //
  7817. // LONCHANC: The following SAP_*** stuff are all app sap related
  7818. // because FreeCallbackMessage() in CControlSAP does not handle
  7819. // the DataToBeDeleted stuff.
  7820. //
  7821. /*
  7822. * void CopyDataToGCCMessage(
  7823. * SapCopyType copy_type,
  7824. * PDataToBeDeleted data_to_be_deleted,
  7825. * LPVOID source_ptr,
  7826. * LPVOID destination_ptr,
  7827. * PGCCError rc)
  7828. *
  7829. * Protected member function of CControlSAP.
  7830. *
  7831. * Function Description:
  7832. * This routine is used to fill in the various components of the message
  7833. * structures to be delivered to applications or the node controller.
  7834. *
  7835. * Formal Parameters:
  7836. * copy_type (i) Enumerated type indicating what field is to be
  7837. * copied.
  7838. * data_to_be_deleted (o) Structure to hold part of the data to be
  7839. * delivered in the message.
  7840. * source_ptr (i) Pointer to structure to copy from.
  7841. * destination_ptr (o) Pointer to structure to copy into.
  7842. * rc (o) Return value for routine.
  7843. *
  7844. * Return Value:
  7845. * None.
  7846. *
  7847. * Side Effects:
  7848. * None.
  7849. *
  7850. * Caveats:
  7851. * The return value should be setup before it is passed into this
  7852. * routine. This allows the error checking to be done in one place
  7853. * (this routine).
  7854. */
  7855. void CSAP_CopyDataToGCCMessage_ConfName
  7856. (
  7857. PDataToBeDeleted data_to_be_deleted,
  7858. PGCCConferenceName source_conference_name,
  7859. PGCCConferenceName destination_conference_name,
  7860. PGCCError pRetCode
  7861. )
  7862. {
  7863. if (GCC_NO_ERROR == *pRetCode)
  7864. {
  7865. LPSTR pszNumeric;
  7866. LPWSTR pwszText;
  7867. if (source_conference_name != NULL)
  7868. {
  7869. if (source_conference_name->numeric_string != NULL)
  7870. {
  7871. /*
  7872. * First copy the numeric conference name if one exists.
  7873. */
  7874. if (NULL != (pszNumeric = ::My_strdupA(source_conference_name->numeric_string)))
  7875. {
  7876. destination_conference_name->numeric_string = (GCCNumericString) pszNumeric;
  7877. data_to_be_deleted->pszNumericConfName = pszNumeric;
  7878. }
  7879. else
  7880. {
  7881. *pRetCode = GCC_ALLOCATION_FAILURE;
  7882. }
  7883. }
  7884. else
  7885. {
  7886. // destination_conference_name->numeric_string = NULL;
  7887. }
  7888. /*
  7889. * Next copy the text conference name if one exists.
  7890. */
  7891. if ((source_conference_name->text_string != NULL) &&
  7892. (*pRetCode == GCC_NO_ERROR))
  7893. {
  7894. if (NULL != (pwszText = ::My_strdupW(source_conference_name->text_string)))
  7895. {
  7896. destination_conference_name->text_string = pwszText;
  7897. data_to_be_deleted->pwszTextConfName = pwszText;
  7898. }
  7899. else
  7900. {
  7901. *pRetCode = GCC_ALLOCATION_FAILURE;
  7902. }
  7903. }
  7904. else
  7905. {
  7906. // destination_conference_name->text_string = NULL;
  7907. }
  7908. }
  7909. else
  7910. {
  7911. // destination_conference_name->numeric_string = NULL;
  7912. // destination_conference_name->text_string = NULL;
  7913. }
  7914. ASSERT(GCC_NO_ERROR == *pRetCode);
  7915. }
  7916. }
  7917. void CSAP_CopyDataToGCCMessage_Modifier
  7918. (
  7919. BOOL fRemoteModifier,
  7920. PDataToBeDeleted data_to_be_deleted,
  7921. GCCNumericString source_numeric_string,
  7922. GCCNumericString *destination_numeric_string,
  7923. PGCCError pRetCode
  7924. )
  7925. {
  7926. if (GCC_NO_ERROR == *pRetCode)
  7927. {
  7928. LPSTR numeric_ptr;
  7929. if (source_numeric_string != NULL)
  7930. {
  7931. if (NULL != (numeric_ptr = ::My_strdupA(source_numeric_string)))
  7932. {
  7933. *destination_numeric_string = (GCCNumericString) numeric_ptr;
  7934. if (fRemoteModifier)
  7935. {
  7936. data_to_be_deleted->pszRemoteModifier = numeric_ptr;
  7937. }
  7938. else
  7939. {
  7940. data_to_be_deleted->pszConfNameModifier = numeric_ptr;
  7941. }
  7942. TRACE_OUT(("CopyDataToGCCMessage_Modifier: modifier = %s", *destination_numeric_string));
  7943. }
  7944. else
  7945. {
  7946. // *destination_numeric_string = NULL;
  7947. *pRetCode = GCC_ALLOCATION_FAILURE;
  7948. }
  7949. }
  7950. else
  7951. {
  7952. // *destination_numeric_string = NULL;
  7953. }
  7954. ASSERT(GCC_NO_ERROR == *pRetCode);
  7955. }
  7956. }
  7957. void CSAP_CopyDataToGCCMessage_Password
  7958. (
  7959. BOOL fConvener,
  7960. PDataToBeDeleted data_to_be_deleted,
  7961. CPassword *source_password,
  7962. PGCCPassword *destination_password,
  7963. PGCCError pRetCode
  7964. )
  7965. {
  7966. if (GCC_NO_ERROR == *pRetCode)
  7967. {
  7968. if (source_password != NULL)
  7969. {
  7970. source_password->LockPasswordData();
  7971. source_password->GetPasswordData (destination_password);
  7972. if (fConvener)
  7973. {
  7974. data_to_be_deleted->convener_password = source_password;
  7975. }
  7976. else
  7977. {
  7978. data_to_be_deleted->password = source_password;
  7979. }
  7980. }
  7981. else
  7982. {
  7983. // *destination_password = NULL;
  7984. }
  7985. ASSERT(GCC_NO_ERROR == *pRetCode);
  7986. }
  7987. }
  7988. void CSAP_CopyDataToGCCMessage_Challenge
  7989. (
  7990. PDataToBeDeleted data_to_be_deleted,
  7991. CPassword *source_password,
  7992. PGCCChallengeRequestResponse *password_challenge,
  7993. PGCCError pRetCode
  7994. )
  7995. {
  7996. if (GCC_NO_ERROR == *pRetCode)
  7997. {
  7998. if (source_password != NULL)
  7999. {
  8000. source_password->LockPasswordData();
  8001. source_password->GetPasswordChallengeData (password_challenge);
  8002. data_to_be_deleted->password = source_password;
  8003. }
  8004. else
  8005. {
  8006. // *password_challenge = NULL;
  8007. }
  8008. ASSERT(GCC_NO_ERROR == *pRetCode);
  8009. }
  8010. }
  8011. void CSAP_CopyDataToGCCMessage_PrivilegeList
  8012. (
  8013. PPrivilegeListData source_privilege_list_data,
  8014. PGCCConferencePrivileges *destination_privilege_list,
  8015. PGCCError pRetCode
  8016. )
  8017. {
  8018. if (GCC_NO_ERROR == *pRetCode)
  8019. {
  8020. if (source_privilege_list_data != NULL)
  8021. {
  8022. DBG_SAVE_FILE_LINE
  8023. if (NULL != (*destination_privilege_list = new GCCConferencePrivileges))
  8024. {
  8025. **destination_privilege_list =
  8026. *(source_privilege_list_data->GetPrivilegeListData());
  8027. }
  8028. else
  8029. {
  8030. *pRetCode = GCC_ALLOCATION_FAILURE;
  8031. }
  8032. }
  8033. else
  8034. {
  8035. // *destination_privilege_list = NULL;
  8036. }
  8037. ASSERT(GCC_NO_ERROR == *pRetCode);
  8038. }
  8039. }
  8040. void CSAP_CopyDataToGCCMessage_IDvsDesc
  8041. (
  8042. BOOL fCallerID,
  8043. PDataToBeDeleted data_to_be_deleted,
  8044. LPWSTR source_text_string,
  8045. LPWSTR *destination_text_string,
  8046. PGCCError pRetCode
  8047. )
  8048. {
  8049. if (GCC_NO_ERROR == *pRetCode)
  8050. {
  8051. if (source_text_string != NULL)
  8052. {
  8053. if (NULL != (*destination_text_string = ::My_strdupW(source_text_string)))
  8054. {
  8055. if (fCallerID)
  8056. {
  8057. data_to_be_deleted->pwszCallerID = *destination_text_string;
  8058. }
  8059. else
  8060. {
  8061. data_to_be_deleted->pwszConfDescriptor = *destination_text_string;
  8062. }
  8063. }
  8064. else
  8065. {
  8066. *pRetCode = GCC_ALLOCATION_FAILURE;
  8067. }
  8068. }
  8069. else
  8070. {
  8071. // *destination_text_string = NULL;
  8072. }
  8073. ASSERT(GCC_NO_ERROR == *pRetCode);
  8074. }
  8075. }
  8076. //
  8077. // LONCHANC: TransportAddress is defined as LPSTR (i.e. char *)
  8078. //
  8079. void CSAP_CopyDataToGCCMessage_Call
  8080. (
  8081. BOOL fCalling,
  8082. PDataToBeDeleted data_to_be_deleted,
  8083. TransportAddress source_transport_address,
  8084. TransportAddress *destination_transport_address,
  8085. PGCCError pRetCode
  8086. )
  8087. {
  8088. if (GCC_NO_ERROR == *pRetCode)
  8089. {
  8090. if (source_transport_address != NULL)
  8091. {
  8092. if (NULL != (*destination_transport_address = ::My_strdupA(source_transport_address)))
  8093. {
  8094. if (fCalling)
  8095. {
  8096. data_to_be_deleted->pszCallingAddress = *destination_transport_address ;
  8097. }
  8098. else
  8099. {
  8100. data_to_be_deleted->pszCalledAddress = *destination_transport_address ;
  8101. }
  8102. }
  8103. else
  8104. {
  8105. *pRetCode = GCC_ALLOCATION_FAILURE;
  8106. }
  8107. }
  8108. else
  8109. {
  8110. // *destination_transport_address = NULL;
  8111. }
  8112. ASSERT(GCC_NO_ERROR == *pRetCode);
  8113. }
  8114. }
  8115. void CSAP_CopyDataToGCCMessage_DomainParams
  8116. (
  8117. PDataToBeDeleted data_to_be_deleted,
  8118. PDomainParameters source_domain_parameters,
  8119. PDomainParameters *destination_domain_parameters,
  8120. PGCCError pRetCode
  8121. )
  8122. {
  8123. if (GCC_NO_ERROR == *pRetCode)
  8124. {
  8125. if (source_domain_parameters != NULL)
  8126. {
  8127. DBG_SAVE_FILE_LINE
  8128. if (NULL != (*destination_domain_parameters = new DomainParameters))
  8129. {
  8130. **destination_domain_parameters = *source_domain_parameters;
  8131. data_to_be_deleted->pDomainParams = *destination_domain_parameters;
  8132. }
  8133. else
  8134. {
  8135. *pRetCode = GCC_ALLOCATION_FAILURE;
  8136. }
  8137. }
  8138. else
  8139. {
  8140. // *destination_domain_parameters = NULL;
  8141. }
  8142. ASSERT(GCC_NO_ERROR == *pRetCode);
  8143. }
  8144. }
  8145. void CControlSAP::NotifyProc ( GCCCtrlSapMsgEx *pCtrlSapMsgEx )
  8146. {
  8147. if (NULL != m_pfnNCCallback)
  8148. {
  8149. pCtrlSapMsgEx->Msg.user_defined = m_pNCData;
  8150. (*m_pfnNCCallback)(&(pCtrlSapMsgEx->Msg));
  8151. }
  8152. //
  8153. // Free this callback message.
  8154. //
  8155. FreeCtrlSapMsgEx(pCtrlSapMsgEx);
  8156. }
  8157. void CControlSAP::WndMsgHandler
  8158. (
  8159. UINT uMsg,
  8160. WPARAM wParam,
  8161. LPARAM lParam
  8162. )
  8163. {
  8164. ASSERT(uMsg >= CSAPCONFIRM_BASE);
  8165. GCCCtrlSapMsg Msg;
  8166. Msg.message_type = (GCCMessageType) (uMsg - CSAPCONFIRM_BASE);
  8167. Msg.nConfID = (GCCConfID) lParam;
  8168. GCCResult nResult = (GCCResult) LOWORD(wParam);
  8169. switch (Msg.message_type)
  8170. {
  8171. case GCC_EJECT_USER_CONFIRM:
  8172. #ifdef JASPER
  8173. Msg.u.eject_user_confirm.conference_id = Msg.nConfID;
  8174. Msg.u.eject_user_confirm.result = nResult;
  8175. Msg.u.eject_user_confirm.ejected_node_id = (GCCNodeID) HIWORD(wParam);
  8176. #endif // JASPER
  8177. break;
  8178. case GCC_CONDUCT_GIVE_CONFIRM:
  8179. #ifdef JASPER
  8180. Msg.u.conduct_give_confirm.conference_id = Msg.nConfID;
  8181. Msg.u.conduct_give_confirm.result = nResult;
  8182. Msg.u.conduct_give_confirm.recipient_node_id = (GCCNodeID) HIWORD(wParam);
  8183. #endif // JASPER
  8184. break;
  8185. case GCC_CONDUCT_ASK_CONFIRM:
  8186. #ifdef JASPER
  8187. Msg.u.conduct_permit_ask_confirm.conference_id = Msg.nConfID;
  8188. Msg.u.conduct_permit_ask_confirm.result = nResult;
  8189. Msg.u.conduct_permit_ask_confirm.permission_is_granted = HIWORD(wParam);;
  8190. #endif // JASPER
  8191. break;
  8192. case GCC_EJECT_USER_INDICATION:
  8193. Msg.u.eject_user_indication.conference_id = Msg.nConfID;
  8194. Msg.u.eject_user_indication.ejected_node_id = (GCCNodeID) HIWORD(wParam);
  8195. Msg.u.eject_user_indication.reason = (GCCReason) LOWORD(wParam);
  8196. break;
  8197. // case GCC_DISCONNECT_CONFIRM:
  8198. // case GCC_LOCK_CONFIRM:
  8199. // case GCC_UNLOCK_CONFIRM:
  8200. // case GCC_ANNOUNCE_PRESENCE_CONFIRM:
  8201. // case GCC_TERMINATE_CONFIRM:
  8202. // case GCC_CONDUCT_ASSIGN_CONFIRM:
  8203. // case GCC_CONDUCT_RELEASE_CONFIRM:
  8204. // case GCC_CONDUCT_PLEASE_CONFIRM:
  8205. // case GCC_CONDUCT_GRANT_CONFIRM:
  8206. // case GCC_TIME_REMAINING_CONFIRM:
  8207. // case GCC_TIME_INQUIRE_CONFIRM:
  8208. // case GCC_ASSISTANCE_CONFIRM:
  8209. // case GCC_TEXT_MESSAGE_CONFIRM:
  8210. default:
  8211. // This is a shortcut to fill in conf id and gcc result.
  8212. Msg.u.simple_confirm.conference_id = Msg.nConfID;
  8213. Msg.u.simple_confirm.result = nResult;
  8214. break;
  8215. }
  8216. SendCtrlSapMsg(&Msg);
  8217. }
  8218. GCCCtrlSapMsgEx * CControlSAP::CreateCtrlSapMsgEx
  8219. (
  8220. GCCMessageType eMsgType,
  8221. BOOL fUseToDelete
  8222. )
  8223. {
  8224. GCCCtrlSapMsgEx *pMsgEx;
  8225. UINT cbSize = fUseToDelete ?
  8226. sizeof(GCCCtrlSapMsgEx) + sizeof(DataToBeDeleted) :
  8227. sizeof(GCCCtrlSapMsgEx);
  8228. DBG_SAVE_FILE_LINE
  8229. if (NULL != (pMsgEx = (GCCCtrlSapMsgEx *) new BYTE[cbSize]))
  8230. {
  8231. pMsgEx->Msg.message_type = eMsgType;
  8232. pMsgEx->pBuf = NULL;
  8233. if (fUseToDelete)
  8234. {
  8235. pMsgEx->pToDelete = (DataToBeDeleted *) (pMsgEx + 1);
  8236. ::ZeroMemory(pMsgEx->pToDelete, sizeof(DataToBeDeleted));
  8237. }
  8238. else
  8239. {
  8240. pMsgEx->pToDelete = NULL;
  8241. }
  8242. }
  8243. return pMsgEx;
  8244. }
  8245. void CControlSAP::FreeCtrlSapMsgEx ( GCCCtrlSapMsgEx *pMsgEx )
  8246. {
  8247. switch (pMsgEx->Msg.message_type)
  8248. {
  8249. case GCC_QUERY_INDICATION:
  8250. delete pMsgEx->Msg.u.query_indication.asymmetry_indicator;
  8251. break;
  8252. #ifndef GCCNC_DIRECT_CONFIRM
  8253. case GCC_QUERY_CONFIRM:
  8254. delete pMsgEx->Msg.u.query_confirm.asymmetry_indicator;
  8255. break;
  8256. #endif
  8257. #ifdef JASPER
  8258. case GCC_TEXT_MESSAGE_INDICATION:
  8259. delete pMsgEx->Msg.u.text_message_indication.text_message;
  8260. break;
  8261. #endif // JASPER
  8262. #ifdef TSTATUS_INDICATION
  8263. case GCC_TRANSPORT_STATUS_INDICATION:
  8264. delete pMsgEx->Msg.u.transport_status.device_identifier;
  8265. delete pMsgEx->Msg.u.transport_status.remote_address;
  8266. delete pMsgEx->Msg.u.transport_status.message;
  8267. break;
  8268. #endif
  8269. }
  8270. //
  8271. // Now free up the data to be deleted,
  8272. //
  8273. if (NULL != pMsgEx->pToDelete)
  8274. {
  8275. DataToBeDeleted *p = pMsgEx->pToDelete;
  8276. delete p->pszNumericConfName;
  8277. delete p->pwszTextConfName;
  8278. delete p->pszConfNameModifier;
  8279. delete p->pszRemoteModifier;
  8280. delete p->pwszConfDescriptor;
  8281. delete p->pwszCallerID;
  8282. delete p->pszCalledAddress;
  8283. delete p->pszCallingAddress;
  8284. delete p->user_data_list_memory;
  8285. delete p->pDomainParams;
  8286. delete p->conductor_privilege_list;
  8287. delete p->conducted_mode_privilege_list;
  8288. delete p->non_conducted_privilege_list;
  8289. if (p->convener_password != NULL)
  8290. {
  8291. p->convener_password->UnLockPasswordData();
  8292. }
  8293. if (p->password != NULL)
  8294. {
  8295. p->password->UnLockPasswordData();
  8296. }
  8297. if (p->conference_list != NULL)
  8298. {
  8299. p->conference_list->UnLockConferenceDescriptorList();
  8300. }
  8301. if (p->conference_roster_message != NULL)
  8302. {
  8303. //
  8304. // Set bulk memory back to NULL here since the conference
  8305. // roster message object is responsible for freeing this up.
  8306. //
  8307. pMsgEx->pBuf = NULL;
  8308. p->conference_roster_message->UnLockConferenceRosterMessage();
  8309. }
  8310. if (p->application_roster_message != NULL)
  8311. {
  8312. //
  8313. // Set bulk memory back to NULL here since the application
  8314. // roster message object is responsible for freeing this up.
  8315. //
  8316. pMsgEx->pBuf = NULL;
  8317. //
  8318. // App roster indication can definitely be sent to app sap.
  8319. //
  8320. ::EnterCriticalSection(&g_csGCCProvider);
  8321. p->application_roster_message->UnLockApplicationRosterMessage();
  8322. ::LeaveCriticalSection(&g_csGCCProvider);
  8323. }
  8324. }
  8325. //
  8326. // Next free up any bulk memory used.
  8327. //
  8328. delete pMsgEx->pBuf;
  8329. //
  8330. // Finally, free the structure itself.
  8331. //
  8332. delete pMsgEx;
  8333. }
  8334.