Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

869 lines
24 KiB

  1. #include "precomp.h"
  2. DEBUG_FILEZONE(ZONE_T120_GCCNC);
  3. /*
  4. * conflist.cpp
  5. *
  6. * Copyright (c) 1995 by DataBeam Corporation, Lexington, KY
  7. *
  8. * Abstract:
  9. * This is the implementation file for the class CConfDescriptorListContainer.
  10. * Instances of this class represent the Conference Descriptor list that is
  11. * generated by a call to GCCConferenceQueryRequest. This class hides most
  12. * of the complexity associated with building this list. It also handles
  13. * building the set of conference descriptors used in the
  14. * ConferenceQueryResponse PDU and the conference descriptor list passed
  15. * to the GCC interface. This class is designed so that a CControlSAP
  16. * object can use it to create a GCC_CONFERENCE_QUERY_CONFIRM message by
  17. * requesting a pointer to a list of Conference Descriptor pointers from
  18. * it. Objects of this type only live long enough to service a particular
  19. * query request. After a message callback has returned or a PDU has been
  20. * sent to MCS, the CConfDescriptorListContainer object is deleted.
  21. *
  22. * Protected Instance Variables:
  23. * m_ppGCCConfDescriptorList
  24. * The list holding the conference descriptors in the API form.
  25. * m_pSetOfConfDescriptors
  26. * The list holding the conference descriptors in the PDU form.
  27. * m_cDescriptors
  28. * The number of descriptors in the list.
  29. * m_pDescriptorListMemory
  30. * The memory object used to hold the memory for the API list of
  31. * conference descriptors.
  32. * m_ConfDescriptorList
  33. * The Rogue Wave list used to hold the descriptor data in the
  34. * internal form.
  35. * m_pNetAddrListMemory
  36. * The memory object used to hold the memory for the network address
  37. * list part of the API conference descriptor list.
  38. * m_pNetAddrMemoryPointer
  39. * A pointer used to keep track of where the network addresses for
  40. * the API form of the descriptor list are written.
  41. *
  42. * Private Member Functions:
  43. * GetConferenceDescriptor
  44. * The routine used to fill in an API conference descriptor
  45. * structure from an internal descriptor data structure.
  46. *
  47. * Caveats:
  48. * The set of conference descriptors uses pointers owned by the conferences
  49. * pointed to by the passed in list. Therefore, it is important not to
  50. * use the set of descriptors held by this class after a conference is
  51. * deleted. At this point the set of descriptors is invalid. Ideally,
  52. * the decriptor set built by this class should be used immediately after
  53. * construction.
  54. *
  55. * Author:
  56. * blp
  57. */
  58. #include "ms_util.h"
  59. #include "conflist.h"
  60. CONF_DESCRIPTOR::CONF_DESCRIPTOR(void)
  61. :
  62. pszNumericConfName(NULL),
  63. pwszTextConfName(NULL),
  64. pszConfModifier(NULL),
  65. pwszConfDescription(NULL),
  66. network_address_list(NULL)
  67. {
  68. }
  69. CONF_DESCRIPTOR::~CONF_DESCRIPTOR(void)
  70. {
  71. delete pszNumericConfName;
  72. delete pwszTextConfName;
  73. delete pszConfModifier;
  74. delete pwszConfDescription;
  75. if (NULL != network_address_list)
  76. {
  77. network_address_list->Release();
  78. }
  79. }
  80. /*
  81. * CConfDescriptorListContainer ()
  82. *
  83. * Public Function Description
  84. * This is a constructor for the CConfDescriptorListContainer class. It
  85. * saves the memory manager which is passed in and initializes instance
  86. * variables.
  87. */
  88. CConfDescriptorListContainer::CConfDescriptorListContainer(void)
  89. :
  90. CRefCount(MAKE_STAMP_ID('C','D','L','C')),
  91. m_ppGCCConfDescriptorList(NULL),
  92. m_pSetOfConfDescriptors(NULL),
  93. m_pDescriptorListMemory(NULL),
  94. m_pNetAddrListMemory(NULL),
  95. m_pNetAddrMemoryPointer(NULL),
  96. m_cDescriptors(0)
  97. {
  98. }
  99. /*
  100. * CConfDescriptorListContainer ()
  101. *
  102. * Public Function Description
  103. * This constructor builds a List of conference descriptors that can
  104. * be passed on to the GCC interface. This list is built from a set
  105. * of conference descriptors which is part of a query response PDU.
  106. */
  107. CConfDescriptorListContainer::CConfDescriptorListContainer(
  108. PSetOfConferenceDescriptors conference_list,
  109. PGCCError gcc_error)
  110. :
  111. CRefCount(MAKE_STAMP_ID('C','D','L','C')),
  112. m_ppGCCConfDescriptorList(NULL),
  113. m_pSetOfConfDescriptors(NULL),
  114. m_pDescriptorListMemory(NULL),
  115. m_pNetAddrListMemory(NULL),
  116. m_pNetAddrMemoryPointer(NULL),
  117. m_cDescriptors(0)
  118. {
  119. PSetOfConferenceDescriptors descriptor_pdu;
  120. CONF_DESCRIPTOR *descriptor_data;
  121. GCCError error_value;
  122. /*
  123. * Initialize the return parameter and instance variables.
  124. */
  125. *gcc_error = GCC_NO_ERROR;
  126. descriptor_pdu = conference_list;
  127. while (descriptor_pdu != NULL)
  128. {
  129. /*
  130. * Allocate the structure used to hold internal data.
  131. */
  132. DBG_SAVE_FILE_LINE
  133. descriptor_data = new CONF_DESCRIPTOR;
  134. if (descriptor_data == NULL)
  135. {
  136. *gcc_error = GCC_ALLOCATION_FAILURE;
  137. break;
  138. }
  139. /*
  140. * Fill in the descriptor flags.
  141. */
  142. descriptor_data->conference_is_locked = descriptor_pdu->value.conference_is_locked;
  143. descriptor_data->password_in_the_clear = descriptor_pdu->value.clear_password_required;
  144. /*
  145. * Copy the numeric portion of the conference name.
  146. */
  147. descriptor_data->pszNumericConfName = ::My_strdupA(descriptor_pdu->value.conference_name.numeric);
  148. /*
  149. * Copy the text portion of the name if it exists.
  150. */
  151. if (descriptor_pdu->value.conference_name.bit_mask &
  152. CONFERENCE_NAME_TEXT_PRESENT)
  153. {
  154. if (NULL == (descriptor_data->pwszTextConfName = ::My_strdupW2(
  155. descriptor_pdu->value.conference_name.conference_name_text.length,
  156. descriptor_pdu->value.conference_name.conference_name_text.value)))
  157. {
  158. *gcc_error = GCC_ALLOCATION_FAILURE;
  159. }
  160. }
  161. else
  162. {
  163. ASSERT(NULL == descriptor_data->pwszTextConfName);
  164. }
  165. /*
  166. * Next copy the conference name modifier if it exists.
  167. */
  168. if (descriptor_pdu->value.bit_mask & CONFERENCE_NAME_MODIFIER_PRESENT)
  169. {
  170. if (NULL == (descriptor_data->pszConfModifier = ::My_strdupA(
  171. descriptor_pdu->value.conference_name_modifier)))
  172. {
  173. *gcc_error = GCC_ALLOCATION_FAILURE;
  174. }
  175. }
  176. else
  177. {
  178. ASSERT(NULL == descriptor_data->pszConfModifier);
  179. }
  180. /*
  181. * Next copy the conference description if it exists.
  182. */
  183. if (descriptor_pdu->value.bit_mask & CONFERENCE_DESCRIPTION_PRESENT)
  184. {
  185. if (NULL == (descriptor_data->pwszConfDescription = ::My_strdupW2(
  186. descriptor_pdu->value.conference_description.length,
  187. descriptor_pdu->value.conference_description.value)))
  188. {
  189. *gcc_error = GCC_ALLOCATION_FAILURE;
  190. }
  191. }
  192. else
  193. {
  194. ASSERT(NULL == descriptor_data->pwszConfDescription);
  195. }
  196. /*
  197. * Next copy the network address list if it exists.
  198. */
  199. if (descriptor_pdu->value.bit_mask & DESCRIPTOR_NET_ADDRESS_PRESENT)
  200. {
  201. DBG_SAVE_FILE_LINE
  202. descriptor_data->network_address_list = new CNetAddrListContainer(
  203. descriptor_pdu->value.descriptor_net_address,
  204. &error_value);
  205. if ((descriptor_data->network_address_list == NULL) ||
  206. (error_value != GCC_NO_ERROR))
  207. {
  208. *gcc_error = GCC_ALLOCATION_FAILURE;
  209. }
  210. }
  211. else
  212. {
  213. ASSERT(NULL == descriptor_data->network_address_list);
  214. }
  215. /*
  216. * If no error has occurred, set up the next pointer and add the data
  217. * structure to the list of conference descriptor data.
  218. */
  219. if (*gcc_error == GCC_NO_ERROR)
  220. {
  221. descriptor_pdu = descriptor_pdu->next;
  222. m_ConfDescriptorList.Append(descriptor_data);
  223. }
  224. else
  225. {
  226. delete descriptor_data;
  227. break;
  228. }
  229. }
  230. }
  231. /*
  232. * ~CConfDescriptorListContainer ()
  233. *
  234. * Public Function Description
  235. * This is the destructor for the CConfDescriptorListContainer class. It is
  236. * responsible for freeing up any resources allocated during the life of
  237. * this object.
  238. */
  239. CConfDescriptorListContainer::~CConfDescriptorListContainer(void)
  240. {
  241. UINT i;
  242. CONF_DESCRIPTOR *lpConfDescData;
  243. if (m_pSetOfConfDescriptors != NULL)
  244. FreeConferenceDescriptorListPDU ();
  245. /*
  246. * Free all resources allocated by this object by iterating through the
  247. * internal list of decriptor data structures.
  248. */
  249. m_ConfDescriptorList.Reset();
  250. while (NULL != (lpConfDescData = m_ConfDescriptorList.Iterate()))
  251. {
  252. delete lpConfDescData;
  253. }
  254. /*
  255. * Free up any other allocated resources.
  256. */
  257. if (m_pDescriptorListMemory != NULL)
  258. {
  259. for (i = 0; i < m_cDescriptors; i++)
  260. {
  261. delete m_ppGCCConfDescriptorList[i];
  262. }
  263. delete m_pDescriptorListMemory;
  264. }
  265. delete m_pNetAddrListMemory;
  266. }
  267. /*
  268. * AddConferenceDescriptorToList ()
  269. *
  270. * Public Function Description
  271. * This routine is used to add a single new conference descriptor to the
  272. * list of conference descriptors.
  273. */
  274. GCCError CConfDescriptorListContainer::AddConferenceDescriptorToList(
  275. LPSTR pszNumericConfName,
  276. LPWSTR pwszConfTextName,
  277. LPSTR pszConfModifier,
  278. BOOL locked_conference,
  279. BOOL password_in_the_clear,
  280. LPWSTR pwszConfDescription,
  281. CNetAddrListContainer *network_address_list)
  282. {
  283. GCCError rc = GCC_NO_ERROR;
  284. CONF_DESCRIPTOR *descriptor_data;
  285. /*
  286. * If PDU data has been allocated, free it so that the next "GetPDU" call
  287. * will result in a rebuild of the PDU data and will therefore include the
  288. * data being added in this routine.
  289. */
  290. if (m_pSetOfConfDescriptors != NULL)
  291. FreeConferenceDescriptorListPDU ();
  292. /*
  293. * Next allocate the structure used to hold the data internally.
  294. */
  295. DBG_SAVE_FILE_LINE
  296. descriptor_data = new CONF_DESCRIPTOR;
  297. if (descriptor_data != NULL)
  298. {
  299. /*
  300. * Fill in the descriptor flags.
  301. */
  302. descriptor_data->conference_is_locked = locked_conference;
  303. descriptor_data->password_in_the_clear = password_in_the_clear;
  304. /*
  305. * Copy the numeric portion of the conference name.
  306. */
  307. if (pszNumericConfName != NULL)
  308. {
  309. descriptor_data->pszNumericConfName = ::My_strdupA(pszNumericConfName);
  310. }
  311. else
  312. {
  313. ASSERT(NULL == descriptor_data->pszNumericConfName);
  314. rc = GCC_ALLOCATION_FAILURE;
  315. }
  316. /*
  317. * Copy the text portion of the name if it exists
  318. */
  319. if (pwszConfTextName != NULL)
  320. {
  321. if (NULL == (descriptor_data->pwszTextConfName =
  322. ::My_strdupW(pwszConfTextName)))
  323. {
  324. rc = GCC_ALLOCATION_FAILURE;
  325. }
  326. }
  327. else
  328. {
  329. ASSERT(NULL == descriptor_data->pwszTextConfName);
  330. }
  331. /*
  332. * Next copy the conference name modifier if it exists.
  333. */
  334. if (pszConfModifier != NULL)
  335. {
  336. if (NULL == (descriptor_data->pszConfModifier = ::My_strdupA(pszConfModifier)))
  337. {
  338. rc = GCC_ALLOCATION_FAILURE;
  339. }
  340. }
  341. else
  342. {
  343. ASSERT(NULL == descriptor_data->pszConfModifier);
  344. }
  345. /*
  346. * Next copy the conference description if it exists.
  347. */
  348. if (pwszConfDescription != NULL)
  349. {
  350. if (NULL == (descriptor_data->pwszConfDescription =
  351. ::My_strdupW(pwszConfDescription)))
  352. {
  353. rc = GCC_ALLOCATION_FAILURE;
  354. }
  355. }
  356. else
  357. {
  358. ASSERT(NULL == descriptor_data->pwszConfDescription);
  359. }
  360. /*
  361. * Next copy the network address list if it exists.
  362. */
  363. if (network_address_list != NULL)
  364. {
  365. DBG_SAVE_FILE_LINE
  366. descriptor_data->network_address_list =
  367. new CNetAddrListContainer(network_address_list, &rc);
  368. if (descriptor_data->network_address_list == NULL)
  369. {
  370. rc = GCC_ALLOCATION_FAILURE;
  371. }
  372. }
  373. else
  374. {
  375. ASSERT(NULL == descriptor_data->network_address_list);
  376. }
  377. }
  378. else
  379. {
  380. rc = GCC_ALLOCATION_FAILURE;
  381. }
  382. if (GCC_NO_ERROR == rc)
  383. {
  384. /*
  385. * Add the structure to the descriptor list.
  386. */
  387. m_ConfDescriptorList.Append(descriptor_data);
  388. }
  389. else
  390. {
  391. delete descriptor_data;
  392. }
  393. return rc;
  394. }
  395. /*
  396. * GetConferenceDescriptorListPDU ()
  397. *
  398. * Public Function Description
  399. * This routine is used to retrieve the PDU form of the conference
  400. * descriptor list which is a list of "SetOfConferenceDescriptors"
  401. * structures.
  402. */
  403. GCCError CConfDescriptorListContainer::GetConferenceDescriptorListPDU(
  404. PSetOfConferenceDescriptors * conference_list)
  405. {
  406. GCCError rc = GCC_NO_ERROR;
  407. PSetOfConferenceDescriptors last_descriptor = NULL;
  408. PSetOfConferenceDescriptors new_descriptor;
  409. CONF_DESCRIPTOR *descriptor_data;
  410. if (m_pSetOfConfDescriptors == NULL)
  411. {
  412. m_ConfDescriptorList.Reset();
  413. while (NULL != (descriptor_data = m_ConfDescriptorList.Iterate()))
  414. {
  415. /*
  416. * First allocate the new descriptor.
  417. */
  418. DBG_SAVE_FILE_LINE
  419. new_descriptor = new SetOfConferenceDescriptors;
  420. if (new_descriptor == NULL)
  421. {
  422. rc = GCC_ALLOCATION_FAILURE;
  423. break;
  424. }
  425. /*
  426. * Next we add the new descriptor to the list..
  427. */
  428. if (m_pSetOfConfDescriptors == NULL)
  429. m_pSetOfConfDescriptors = new_descriptor;
  430. else
  431. last_descriptor->next = new_descriptor;
  432. /*
  433. * Set up the previous descriptor pointer.
  434. */
  435. last_descriptor = new_descriptor;
  436. /*
  437. * Now fill in the new descriptor with the passed in parameters.
  438. */
  439. new_descriptor->next = NULL;
  440. new_descriptor->value.bit_mask = 0;
  441. new_descriptor->value.conference_is_locked =
  442. (ASN1bool_t)descriptor_data->conference_is_locked;
  443. new_descriptor->value.clear_password_required =
  444. (ASN1bool_t)descriptor_data->password_in_the_clear;
  445. /*
  446. * Get the numeric conference name.
  447. */
  448. new_descriptor->value.conference_name.bit_mask = 0;
  449. ::lstrcpyA(new_descriptor->value.conference_name.numeric,
  450. descriptor_data->pszNumericConfName);
  451. /*
  452. * Get the text conference name, if it exists.
  453. */
  454. if (descriptor_data->pwszTextConfName != NULL)
  455. {
  456. new_descriptor->value.conference_name.bit_mask |= CONFERENCE_NAME_TEXT_PRESENT;
  457. new_descriptor->value.conference_name.conference_name_text.value =
  458. descriptor_data->pwszTextConfName;
  459. new_descriptor->value.conference_name.conference_name_text.length =
  460. ::lstrlenW(descriptor_data->pwszTextConfName);
  461. }
  462. /*
  463. * Check for a conference name modifier.
  464. */
  465. if (descriptor_data->pszConfModifier != NULL)
  466. {
  467. new_descriptor->value.bit_mask |= CONFERENCE_NAME_MODIFIER_PRESENT;
  468. ::lstrcpyA(new_descriptor->value.conference_name_modifier,
  469. descriptor_data->pszConfModifier);
  470. }
  471. /*
  472. * Get the conference description if one exists.
  473. */
  474. if (descriptor_data->pwszConfDescription != NULL)
  475. {
  476. new_descriptor->value.bit_mask |=CONFERENCE_DESCRIPTION_PRESENT;
  477. new_descriptor->value.conference_description.value =
  478. descriptor_data->pwszConfDescription;
  479. new_descriptor->value.conference_description.length =
  480. ::lstrlenW(descriptor_data->pwszConfDescription);
  481. }
  482. /*
  483. * Get the Network Address list if it exists.
  484. */
  485. if (descriptor_data->network_address_list != NULL)
  486. {
  487. new_descriptor->value.bit_mask |=DESCRIPTOR_NET_ADDRESS_PRESENT;
  488. descriptor_data->network_address_list->
  489. GetNetworkAddressListPDU(&new_descriptor->value.
  490. descriptor_net_address);
  491. }
  492. }
  493. }
  494. *conference_list = (rc == GCC_NO_ERROR) ?
  495. m_pSetOfConfDescriptors :
  496. NULL;
  497. return rc;
  498. }
  499. /*
  500. * FreeConferenceDescriptorListPDU ()
  501. *
  502. * Public Function Description
  503. * This routine is used to free up any resources allocated to hold the PDU
  504. * form of the conference descriptor list.
  505. */
  506. void CConfDescriptorListContainer::FreeConferenceDescriptorListPDU(void)
  507. {
  508. PSetOfConferenceDescriptors pCurr, pNext;
  509. CONF_DESCRIPTOR *lpConfDescData;
  510. /*
  511. * Loop through the list of descriptors, deleting each element.
  512. */
  513. for (pCurr = m_pSetOfConfDescriptors; NULL != pCurr; pCurr = pNext)
  514. {
  515. pNext = pCurr->next;
  516. delete pCurr;
  517. }
  518. /*
  519. * Free the PDU data for any network address lists which may exist.
  520. */
  521. m_ConfDescriptorList.Reset();
  522. while (NULL != (lpConfDescData = m_ConfDescriptorList.Iterate()))
  523. {
  524. if (NULL != lpConfDescData->network_address_list)
  525. {
  526. lpConfDescData->network_address_list->FreeNetworkAddressListPDU();
  527. }
  528. }
  529. m_pSetOfConfDescriptors = NULL;
  530. }
  531. /*
  532. * LockConferenceDescriptorList ()
  533. *
  534. * Public Function Description
  535. * This routine is used to "lock" the API form of the conference descriptor
  536. * list. The lock count is incremented and the API form of the list
  537. * created in preparation for a "GetConferenceDescriptorList" call used to
  538. * retrieve the API form of the list. The memory necessary to hold the
  539. * API list is allocated by this routine.
  540. */
  541. GCCError CConfDescriptorListContainer::LockConferenceDescriptorList(void)
  542. {
  543. GCCError rc = GCC_NO_ERROR;
  544. UINT i;
  545. UINT network_address_data_length = 0;
  546. CONF_DESCRIPTOR *lpConfDescData;
  547. if (Lock() == 1)
  548. {
  549. m_cDescriptors = m_ConfDescriptorList.GetCount();
  550. if (m_cDescriptors != 0)
  551. {
  552. /*
  553. * Allocate space to hold pointers to all descriptors in the
  554. * conference.
  555. */
  556. DBG_SAVE_FILE_LINE
  557. m_pDescriptorListMemory = new BYTE[m_cDescriptors * sizeof(PGCCConferenceDescriptor)];
  558. if (m_pDescriptorListMemory != NULL)
  559. {
  560. m_ppGCCConfDescriptorList = (PGCCConferenceDescriptor *) m_pDescriptorListMemory;
  561. /*
  562. * Set up an iterator for the internal descriptor list. Iterate
  563. * through the list, locking each network address list object
  564. * and adding up the amount of memory needed to hold all of the
  565. * data for the network address lists. Allocate the necessary
  566. * amount of memory and save a pointer to the memory.
  567. */
  568. m_ConfDescriptorList.Reset();
  569. while (NULL != (lpConfDescData = m_ConfDescriptorList.Iterate()))
  570. {
  571. if (lpConfDescData->network_address_list != NULL)
  572. {
  573. network_address_data_length += lpConfDescData->network_address_list->LockNetworkAddressList();
  574. }
  575. }
  576. if (network_address_data_length != 0)
  577. {
  578. DBG_SAVE_FILE_LINE
  579. m_pNetAddrListMemory = new BYTE[network_address_data_length];
  580. if (m_pNetAddrListMemory != NULL)
  581. {
  582. m_pNetAddrMemoryPointer = m_pNetAddrListMemory;
  583. }
  584. else
  585. {
  586. rc = GCC_ALLOCATION_FAILURE;
  587. }
  588. }
  589. if (rc == GCC_NO_ERROR)
  590. {
  591. m_ConfDescriptorList.Reset();
  592. for (i = 0; i < m_cDescriptors; i++)
  593. {
  594. lpConfDescData = m_ConfDescriptorList.Iterate();
  595. ASSERT(NULL != lpConfDescData);
  596. /*
  597. * Allocate the API structure used at the interface.
  598. * Call the routine which converts the descriptor data
  599. * from its internal form into API form.
  600. */
  601. DBG_SAVE_FILE_LINE
  602. m_ppGCCConfDescriptorList[i] = new GCCConferenceDescriptor;
  603. if (m_ppGCCConfDescriptorList[i] != NULL)
  604. {
  605. GetConferenceDescriptor(m_ppGCCConfDescriptorList[i], lpConfDescData);
  606. }
  607. else
  608. {
  609. rc = GCC_ALLOCATION_FAILURE;
  610. }
  611. }
  612. }
  613. }
  614. else
  615. {
  616. rc = GCC_ALLOCATION_FAILURE;
  617. }
  618. }
  619. if (rc != GCC_NO_ERROR)
  620. {
  621. Unlock();
  622. }
  623. }
  624. return rc;
  625. }
  626. /*
  627. * GetConferenceDescriptorList ()
  628. *
  629. * Public Function Description
  630. * This routine is used to retrieve the API form of the conference
  631. * descriptor list.
  632. */
  633. void CConfDescriptorListContainer::GetConferenceDescriptorList(
  634. PGCCConferenceDescriptor ** conference_list,
  635. UINT * number_of_descriptors)
  636. {
  637. /*
  638. * Check to see if the object has been locked. Fill in the API descriptor
  639. * list if it has, report an error if it has not.
  640. */
  641. if (GetLockCount() > 0)
  642. {
  643. *conference_list = m_ppGCCConfDescriptorList;
  644. *number_of_descriptors = (USHORT) m_cDescriptors;
  645. }
  646. else
  647. {
  648. ERROR_OUT(("CConfDescriptorListContainer::GetConferenceDescriptorList: Error, data not locked"));
  649. *conference_list = NULL;
  650. *number_of_descriptors = 0;
  651. }
  652. }
  653. /*
  654. * UnLockConferenceDescriptorList ()
  655. *
  656. * Public Function Description
  657. * This routine is used to "unlock" the "API" data for this object. This
  658. * results in the lock count for this object being decremented. When the
  659. * lock count transitions from 1 to 0, a check is made to determine
  660. * whether the object has been freed through a call to
  661. * FreeConferenceDescriptorList. If so, the object will automatically
  662. * delete itself. If not, any resources allocated to hold the API form
  663. * of the decriptor list are freed.
  664. */
  665. void CConfDescriptorListContainer::UnLockConferenceDescriptorList(void)
  666. {
  667. UINT i;
  668. /*
  669. * If the lock count is zero, delete the object if it is "freed". If the
  670. * lock count is zero but the obect is not "freed", free any resources
  671. * allocated to hold the API data.
  672. */
  673. if (Unlock(FALSE) == 0)
  674. {
  675. CONF_DESCRIPTOR *lpConfDescData;
  676. if (m_pDescriptorListMemory != NULL)
  677. {
  678. for (i = 0; i < m_cDescriptors; i++)
  679. {
  680. delete m_ppGCCConfDescriptorList[i];
  681. }
  682. delete m_pDescriptorListMemory;
  683. m_pDescriptorListMemory = NULL;
  684. m_ppGCCConfDescriptorList = NULL;
  685. }
  686. /*
  687. * Free the memory for the network address lists if it exists.
  688. * Iterate through the internal descriptor list, unlocking any
  689. * network address list objects which exist.
  690. */
  691. if (m_pNetAddrListMemory != NULL)
  692. {
  693. delete m_pNetAddrListMemory;
  694. m_pNetAddrListMemory = NULL;
  695. m_pNetAddrMemoryPointer = NULL;
  696. }
  697. m_ConfDescriptorList.Reset();
  698. while (NULL != (lpConfDescData = m_ConfDescriptorList.Iterate()))
  699. {
  700. if (lpConfDescData->network_address_list != NULL)
  701. {
  702. lpConfDescData->network_address_list->UnLockNetworkAddressList ();
  703. }
  704. }
  705. }
  706. // we have to call Release() because we used Unlock(FALSE)
  707. Release();
  708. }
  709. /*
  710. * void GetConferenceDescriptor (
  711. * PGCCConferenceDescriptor gcc_descriptor,
  712. * CONF_DESCRIPTOR *descriptor_data)
  713. *
  714. * Private member function of CConfDescriptorListContainer.
  715. *
  716. * Function Description:
  717. * This routine is used to fill in an API conference descriptor structure
  718. * from an internal descriptor data structure.
  719. *
  720. * Formal Parameters:
  721. * gcc_descriptor (o) The API descriptor structure to fill in.
  722. * descriptor_data (i) The internal structure holding the data which is
  723. * to be copied into the API structure.
  724. *
  725. * Return Value:
  726. * None.
  727. *
  728. * Side Effects:
  729. * None.
  730. *
  731. * Caveats:
  732. * None.
  733. */
  734. void CConfDescriptorListContainer::GetConferenceDescriptor(
  735. PGCCConferenceDescriptor gcc_descriptor,
  736. CONF_DESCRIPTOR *descriptor_data)
  737. {
  738. UINT network_address_data_length;
  739. /*
  740. * Fill in the descriptor flags.
  741. */
  742. gcc_descriptor->conference_is_locked =
  743. descriptor_data->conference_is_locked;
  744. gcc_descriptor->password_in_the_clear_required =
  745. descriptor_data->password_in_the_clear;
  746. /*
  747. * Get the numeric portion of the conference name.
  748. */
  749. gcc_descriptor->conference_name.numeric_string =
  750. (GCCNumericString) descriptor_data->pszNumericConfName;
  751. /*
  752. * Get the text portion of the conference name, if it exists.
  753. */
  754. gcc_descriptor->conference_name.text_string = descriptor_data->pwszTextConfName;
  755. /*
  756. * Get the conference modifier.
  757. */
  758. if (descriptor_data->pszConfModifier != NULL)
  759. {
  760. gcc_descriptor->conference_name_modifier =
  761. (GCCNumericString) descriptor_data->pszConfModifier;
  762. }
  763. else
  764. gcc_descriptor->conference_name_modifier = NULL;
  765. /*
  766. * Get the conference description.
  767. */
  768. gcc_descriptor->conference_descriptor = descriptor_data->pwszConfDescription;
  769. /*
  770. * Fill in the network address list if it exists. Otherwise, set the
  771. * number of address to zero and the structure pointer to NULL.
  772. */
  773. if (descriptor_data->network_address_list != NULL)
  774. {
  775. network_address_data_length = descriptor_data->network_address_list->
  776. GetNetworkAddressListAPI(
  777. &gcc_descriptor->number_of_network_addresses,
  778. &gcc_descriptor->network_address_list,
  779. m_pNetAddrMemoryPointer);
  780. /*
  781. * Move the network address list memory pointer past the data written
  782. * into memory by the "Get" call. The data for the next network address
  783. * list will then be written there on subsequent "Get" calls.
  784. */
  785. m_pNetAddrMemoryPointer += network_address_data_length;
  786. }
  787. else
  788. {
  789. gcc_descriptor->number_of_network_addresses = 0;
  790. gcc_descriptor->network_address_list = NULL;
  791. }
  792. }
  793.