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.

3302 lines
115 KiB

  1. /******************************************************************************
  2. *
  3. * INTEL Corporation Proprietary Information
  4. * Copyright (c) 1994, 1995, 1996 Intel Corporation.
  5. *
  6. * This listing is supplied under the terms of a license agreement
  7. * with INTEL Corporation and may not be used, copied, nor disclosed
  8. * except in accordance with the terms of that agreement.
  9. *
  10. *****************************************************************************/
  11. /******************************************************************************
  12. *
  13. * AUTHOR: cjutzi (Curt Jutzi)
  14. *
  15. * $Workfile: api_util.c $
  16. * $Revision: 1.35 $
  17. * $Modtime: 25 Feb 1997 10:36:12 $
  18. * $Log: S:/STURGEON/SRC/H245/SRC/VCS/api_util.c_v $
  19. *
  20. * Rev 1.35 25 Feb 1997 11:18:44 MANDREWS
  21. *
  22. * Fixed dynamic term cap ID generation; dynamic term cap IDs now
  23. * start at 32K + 1 and increase from there. Static term cap IDs
  24. * (specified by the client) are now restricted to the range of 1..32K.
  25. *
  26. * Rev 1.34 29 Jan 1997 16:25:06 EHOWARDX
  27. * Changed del_cap_descriptor() to match changes to set_cap_descriptor().
  28. *
  29. * Rev 1.33 29 Jan 1997 14:44:36 MANDREWS
  30. * Fixed warning that occured in release mode build.
  31. *
  32. * Rev 1.32 28 Jan 1997 14:46:58 EHOWARDX
  33. * Potential fix for capability descriptor problem.
  34. *
  35. * Rev 1.31 14 Oct 1996 14:01:20 EHOWARDX
  36. * Unicode changes.
  37. *
  38. * Rev 1.30 16 Sep 1996 19:46:18 EHOWARDX
  39. * Added del_mux_cap for local and remote multiplex capability
  40. * to api_deinit to (hopefully) fix memory leak.
  41. *
  42. * Rev 1.29 11 Oct 1996 15:19:42 EHOWARDX
  43. * Fixed H245CopyCap() bug.
  44. *
  45. * Rev 1.28 28 Aug 1996 11:37:22 EHOWARDX
  46. * const changes.
  47. *
  48. * Rev 1.27 05 Aug 1996 15:31:42 EHOWARDX
  49. *
  50. * Fixed error in CopyH2250Cap.
  51. *
  52. * Rev 1.26 02 Aug 1996 21:10:42 EHOWARDX
  53. *
  54. * H.225.0 Mux cap bug second pass - see if this works.
  55. *
  56. * Rev 1.25 02 Aug 1996 20:34:20 EHOWARDX
  57. * First pass at H.225.0 Mux cap bug.
  58. *
  59. * Rev 1.24 19 Jul 1996 12:16:30 EHOWARDX
  60. *
  61. * Rewrite of api_fsm_event() debug routine.
  62. *
  63. * Rev 1.23 16 Jul 1996 11:47:18 EHOWARDX
  64. *
  65. * Eliminated H245_ERROR_MUX_CAPS_ALREADY_SET from debug error text function.
  66. *
  67. * Rev 1.22 09 Jul 1996 17:10:24 EHOWARDX
  68. * Fixed pointer offset bug in processing DataType from received
  69. * OpenLogicalChannel.
  70. *
  71. * Rev 1.21 01 Jul 1996 22:12:42 EHOWARDX
  72. *
  73. * Added Conference and CommunicationMode structures and functions.
  74. *
  75. * Rev 1.20 24 Jun 1996 12:27:02 EHOWARDX
  76. *
  77. * Same as 1.17.1.0.
  78. *
  79. * Rev 1.19 17 Jun 1996 18:10:06 EHOWARDX
  80. *
  81. * Changed first argument to build_totcap_cap_n_client_from_capability()
  82. * from VOID to struct capability *.
  83. *
  84. * Rev 1.18 14 Jun 1996 18:57:56 EHOWARDX
  85. * Geneva update.
  86. *
  87. * Rev 1.17 10 Jun 1996 16:56:56 EHOWARDX
  88. * Removed #include "h245init.x"
  89. *
  90. * Rev 1.16 06 Jun 1996 18:48:36 EHOWARDX
  91. * Fine-tuning tracker functions.
  92. *
  93. * Rev 1.15 04 Jun 1996 13:56:40 EHOWARDX
  94. * Fixed Release build warnings.
  95. *
  96. * Rev 1.14 31 May 1996 18:21:08 EHOWARDX
  97. * Changed map_api_error to reflect updated error codes.
  98. *
  99. * Rev 1.13 30 May 1996 23:39:02 EHOWARDX
  100. * Cleanup.
  101. *
  102. * Rev 1.12 29 May 1996 15:20:10 EHOWARDX
  103. * Change to use HRESULT.
  104. *
  105. * Rev 1.11 28 May 1996 14:25:28 EHOWARDX
  106. * Tel Aviv update.
  107. *
  108. * Rev 1.10 20 May 1996 22:15:46 EHOWARDX
  109. * Completed NonStandard Message and H.225.0 Maximum Skew indication
  110. * implementation. Added ASN.1 validation to H245SetLocalCap and
  111. * H245SetCapDescriptor. Check-in from Microsoft drop on 17-May-96.
  112. *
  113. * Rev 1.9 20 May 1996 14:35:16 EHOWARDX
  114. * Got rid of asynchronous H245EndConnection/H245ShutDown stuff...
  115. *
  116. * Rev 1.8 16 May 1996 19:40:48 EHOWARDX
  117. * Fixed multiplex capability bug.
  118. *
  119. * Rev 1.7 16 May 1996 16:53:58 EHOWARDX
  120. * Fixed bug in set_capability() - need to set capability entry number
  121. * AFTER doing load_cap().
  122. *
  123. * Rev 1.6 16 May 1996 15:59:26 EHOWARDX
  124. * Fine-tuning H245SetLocalCap/H245DelLocalCap/H245SetCapDescriptor/
  125. * H245DelCapDescriptor behaviour.
  126. *
  127. * Rev 1.5 15 May 1996 19:53:28 unknown
  128. * Fixed H245SetCapDescriptor.
  129. *
  130. * Rev 1.4 14 May 1996 13:58:04 EHOWARDX
  131. * Fixed capability list order (made fifo).
  132. * Added support for NonStandard and H.222 mux capabilities to set_cap_descrip
  133. *
  134. * Rev 1.3 14 May 1996 12:27:24 EHOWARDX
  135. * Check-in for integration.
  136. * Still need to fix non-standard and H.222 mux capabilities.
  137. *
  138. * Rev 1.2 13 May 1996 23:16:46 EHOWARDX
  139. * Fixed remote terminal capability handling.
  140. *
  141. * Rev 1.1 11 May 1996 20:33:08 EHOWARDX
  142. * Checking in for the night...
  143. *
  144. * Rev 1.0 09 May 1996 21:06:10 EHOWARDX
  145. * Initial revision.
  146. *
  147. * Rev 1.23.1.8 09 May 1996 19:30:56 EHOWARDX
  148. * Redesigned thread locking logic.
  149. * Added new API functions.
  150. *
  151. * Rev 1.23.1.7 27 Apr 1996 21:09:46 EHOWARDX
  152. * Changed Channel Numbers to words, added H.225.0 support.
  153. *
  154. * Rev 1.23.1.6 26 Apr 1996 15:53:52 EHOWARDX
  155. * Added H.225.0 Capability support; Changed Capability indication
  156. * to only callback once with PDU.
  157. *
  158. * Rev 1.23.1.5 24 Apr 1996 20:54:36 EHOWARDX
  159. * Added new OpenLogicalChannelAck/OpenLogicalChannelReject support.
  160. *
  161. * Rev 1.23.1.4 23 Apr 1996 14:47:20 EHOWARDX
  162. * Disabled dump_pdu.
  163. *
  164. * Rev 1.23.1.3 19 Apr 1996 12:54:18 EHOWARDX
  165. * Updated to 1.28.
  166. *
  167. * Rev 1.23.1.2 15 Apr 1996 15:10:52 EHOWARDX
  168. * Updated to match Curt's current version.
  169. *
  170. * Rev 1.23.1.1 03 Apr 1996 17:14:56 EHOWARDX
  171. * Integrated latest H.323 changes.
  172. *
  173. * Rev 1.23.1.0 03 Apr 1996 15:54:26 cjutzi
  174. * Branched for H.323.
  175. *
  176. * Rev 1.22 01 Apr 1996 16:43:18 cjutzi
  177. *
  178. * - Completed ENdConnection, and made asynch.. rather
  179. * than sync.. as before
  180. * - Changed H245ShutDown to be sync rather than async..
  181. *
  182. * Rev 1.21 29 Mar 1996 09:35:16 cjutzi
  183. *
  184. * -
  185. * - fixed ring3 build error message for check_pdu
  186. *
  187. * Rev 1.20 27 Mar 1996 08:37:28 cjutzi
  188. *
  189. * - removed error from routine .. was unreferenced variable..
  190. *
  191. * Rev 1.19 19 Mar 1996 20:31:06 cjutzi
  192. *
  193. * - added bi-directional channel stuff
  194. *
  195. * Rev 1.18 13 Mar 1996 14:12:52 cjutzi
  196. *
  197. * - clean up..
  198. *
  199. * Rev 1.17 13 Mar 1996 09:25:34 cjutzi
  200. *
  201. * - removed LPCRITICIAL -> CRITICAL SECTION *
  202. *
  203. * Rev 1.16 12 Mar 1996 16:40:50 cjutzi
  204. *
  205. * - removed deadlock..
  206. *
  207. * Rev 1.15 12 Mar 1996 15:51:08 cjutzi
  208. *
  209. * - added locking
  210. * - implented End Session
  211. * - fixed callback bug for deleting caps on cleanup..
  212. *
  213. * Rev 1.14 08 Mar 1996 14:04:48 cjutzi
  214. *
  215. * - added mux table entry code.
  216. * - parse all mux table entries.. (as much as needed at this point)
  217. *
  218. * Rev 1.13 06 Mar 1996 12:35:02 cjutzi
  219. *
  220. * - typeo.. :-).. for ANS1 error ..
  221. *
  222. * Rev 1.12 06 Mar 1996 08:49:42 cjutzi
  223. *
  224. * - added H245_ERROR_ASN1
  225. * - #ifdef'ed the call to check pdu.. in api_fsm
  226. *
  227. * Rev 1.11 05 Mar 1996 17:37:14 cjutzi
  228. *
  229. * - implemented Send Local Mux Table..
  230. * - removed bzero/bcopy and changed free api
  231. *
  232. *
  233. * Rev 1.10 01 Mar 1996 13:49:00 cjutzi
  234. *
  235. * - added hani's new fsm id's
  236. * - added debug print for events.
  237. *
  238. * Rev 1.9 29 Feb 1996 08:38:14 cjutzi
  239. *
  240. * - added error messages ..
  241. *
  242. * Rev 1.8 26 Feb 1996 16:33:28 cjutzi
  243. *
  244. * - fixed GP for tracker. p_prev was not initialized to NULL
  245. *
  246. *
  247. * Rev 1.7 26 Feb 1996 11:06:18 cjutzi
  248. *
  249. * - added simltanious caps.. and fixed bugs..
  250. * lot's o-changes..
  251. *
  252. * Rev 1.6 16 Feb 1996 13:02:34 cjutzi
  253. *
  254. * - got open / close / request close working in both directions.
  255. *
  256. * Rev 1.5 15 Feb 1996 10:53:10 cjutzi
  257. *
  258. * - termcaps working
  259. * - changed API interface for MUX_T
  260. * - modifed H223 stuff
  261. * - cleaned up open
  262. *
  263. * Rev 1.4 09 Feb 1996 16:58:40 cjutzi
  264. *
  265. * - cleanup.. and some fixes..
  266. * - added and or changed headers to reflect the log of changes
  267. *
  268. *****************************************************************************/
  269. /****************************************************************************/
  270. /****************************************************************************/
  271. /****************************************************************************/
  272. /**** *****/
  273. /**** NOTES TO THE READER *****/
  274. /**** *****/
  275. /**** This program has been put together using a a screen which is *****/
  276. /**** wider than 80 characters.. It is best if a similar screen size is *****/
  277. /**** used.. Of course emacs is my preference but 80 col screens will *****/
  278. /**** cause you much frustration.. *****/
  279. /**** *****/
  280. /**** Tabs are set to 8 *****/
  281. /**** *****/
  282. /****************************************************************************/
  283. /****************************************************************************/
  284. /****************************************************************************/
  285. #undef UNICODE
  286. #ifndef STRICT
  287. #define STRICT
  288. #endif
  289. #include "precomp.h"
  290. /***********************/
  291. /* H245 INCLUDES */
  292. /***********************/
  293. #include "h245api.h"
  294. #include "h245com.h"
  295. #include "h245sys.x"
  296. #include "fsmexpor.h"
  297. #include "api_util.x"
  298. #include "api_debu.x"
  299. #include "h245deb.x"
  300. // This array is used to map user-specified Client Type into correct Data Type
  301. BYTE DataTypeMap[] =
  302. {
  303. H245_DATA_DONTCARE, // H245_CLIENT_DONTCARE,
  304. H245_DATA_NONSTD, // H245_CLIENT_NONSTD,
  305. H245_DATA_VIDEO, // H245_CLIENT_VID_NONSTD,
  306. H245_DATA_VIDEO, // H245_CLIENT_VID_H261,
  307. H245_DATA_VIDEO, // H245_CLIENT_VID_H262,
  308. H245_DATA_VIDEO, // H245_CLIENT_VID_H263,
  309. H245_DATA_VIDEO, // H245_CLIENT_VID_IS11172,
  310. H245_DATA_AUDIO, // H245_CLIENT_AUD_NONSTD,
  311. H245_DATA_AUDIO, // H245_CLIENT_AUD_G711_ALAW64,
  312. H245_DATA_AUDIO, // H245_CLIENT_AUD_G711_ALAW56,
  313. H245_DATA_AUDIO, // H245_CLIENT_AUD_G711_ULAW64,
  314. H245_DATA_AUDIO, // H245_CLIENT_AUD_G711_ULAW56,
  315. H245_DATA_AUDIO, // H245_CLIENT_AUD_G722_64,
  316. H245_DATA_AUDIO, // H245_CLIENT_AUD_G722_56,
  317. H245_DATA_AUDIO, // H245_CLIENT_AUD_G722_48,
  318. H245_DATA_AUDIO, // H245_CLIENT_AUD_G723,
  319. H245_DATA_AUDIO, // H245_CLIENT_AUD_G728,
  320. H245_DATA_AUDIO, // H245_CLIENT_AUD_G729,
  321. H245_DATA_AUDIO, // H245_CLIENT_AUD_GDSVD,
  322. H245_DATA_AUDIO, // H245_CLIENT_AUD_IS11172,
  323. H245_DATA_AUDIO, // H245_CLIENT_AUD_IS13818,
  324. H245_DATA_DATA, // H245_CLIENT_DAT_NONSTD,
  325. H245_DATA_DATA, // H245_CLIENT_DAT_T120,
  326. H245_DATA_DATA, // H245_CLIENT_DAT_DSMCC,
  327. H245_DATA_DATA, // H245_CLIENT_DAT_USERDATA,
  328. H245_DATA_DATA, // H245_CLIENT_DAT_T84,
  329. H245_DATA_DATA, // H245_CLIENT_DAT_T434,
  330. H245_DATA_DATA, // H245_CLIENT_DAT_H224,
  331. H245_DATA_DATA, // H245_CLIENT_DAT_NLPID,
  332. H245_DATA_DATA, // H245_CLIENT_DAT_DSVD,
  333. H245_DATA_DATA, // H245_CLIENT_DAT_H222,
  334. H245_DATA_ENCRYPT_D, // H245_CLIENT_ENCRYPTION_TX,
  335. H245_DATA_ENCRYPT_D, // H245_CLIENT_ENCRYPTION_RX,
  336. H245_DATA_CONFERENCE, // H245_CLIENT_CONFERENCE,
  337. // Multiplex capabilities
  338. H245_DATA_MUX, // H245_CLIENT_MUX_NONSTD,
  339. H245_DATA_MUX, // H245_CLIENT_MUX_H222,
  340. H245_DATA_MUX, // H245_CLIENT_MUX_H223,
  341. H245_DATA_MUX, // H245_CLIENT_MUX_VGMUX,
  342. H245_DATA_MUX, // H245_CLIENT_MUX_H2250
  343. };
  344. unsigned ObjectIdLength (const NonStandardIdentifier *pIdentifier)
  345. {
  346. register unsigned uLength = 0;
  347. register POBJECTID pObject = pIdentifier->u.object;
  348. ASSERT(pIdentifier->choice == object_chosen);
  349. while (pObject)
  350. {
  351. ++uLength;
  352. pObject = pObject->next;
  353. }
  354. return uLength;
  355. } // ObjectIdLength()
  356. void FreeNonStandardIdentifier(NonStandardIdentifier *pFree)
  357. {
  358. register POBJECTID pObject;
  359. if (pFree->choice == object_chosen)
  360. {
  361. // Free Object Identifier
  362. while (pFree->u.object)
  363. {
  364. pObject = pFree->u.object;
  365. pFree->u.object = pObject->next;
  366. MemFree(pObject);
  367. }
  368. }
  369. } // FreeNonStandardIdentifier()
  370. HRESULT CopyNonStandardIdentifier(NonStandardIdentifier *pNew, const NonStandardIdentifier *pOld)
  371. {
  372. // Copy the base structure
  373. *pNew = *pOld;
  374. if (pOld->choice == object_chosen)
  375. {
  376. // Copy Object Identifier
  377. POBJECTID pObjectList;
  378. POBJECTID pObjectOld;
  379. POBJECTID pObjectNew;
  380. pNew->u.object = NULL;
  381. pObjectList = NULL;
  382. pObjectOld = pOld->u.object;
  383. while (pObjectOld)
  384. {
  385. // Allocate new structure
  386. pObjectNew = MemAlloc(sizeof(*pObjectNew));
  387. if (pObjectNew == NULL)
  388. {
  389. H245TRACE(0,1,"API:CopyNonStandardIdentifier - malloc failed");
  390. FreeNonStandardIdentifier(pNew);
  391. return H245_ERROR_NOMEM;
  392. }
  393. // Copy old structure to new structure
  394. pObjectNew->value = pObjectOld->value;
  395. // Add new structure to list
  396. pObjectNew->next = NULL;
  397. if (pNew->u.object == NULL)
  398. {
  399. pNew->u.object = pObjectNew;
  400. }
  401. else
  402. {
  403. pObjectList->next = pObjectNew;
  404. }
  405. pObjectList = pObjectNew;
  406. // Get next old structure to copy
  407. pObjectOld = pObjectOld->next;
  408. }
  409. }
  410. return H245_ERROR_OK;
  411. } // CopyNonStandardIdentifier()
  412. void FreeNonStandardParameter(NonStandardParameter *pFree)
  413. {
  414. FreeNonStandardIdentifier(&pFree->nonStandardIdentifier);
  415. if (pFree->data.value)
  416. {
  417. MemFree(pFree->data.value);
  418. pFree->data.value = NULL;
  419. }
  420. } // FreeNonStandardParameter()
  421. HRESULT CopyNonStandardParameter(NonStandardParameter *pNew, const NonStandardParameter *pOld)
  422. {
  423. // Copy the base structure
  424. *pNew = *pOld;
  425. if (pOld->nonStandardIdentifier.choice == object_chosen)
  426. {
  427. HRESULT lResult = CopyNonStandardIdentifier(&pNew->nonStandardIdentifier, &pOld->nonStandardIdentifier);
  428. if (lResult != H245_ERROR_OK)
  429. {
  430. pNew->data.value = NULL;
  431. return lResult;
  432. }
  433. }
  434. if (pOld->data.length && pOld->data.value)
  435. {
  436. // Copy value
  437. pNew->data.value = MemAlloc(pOld->data.length);
  438. if (pNew->data.value == NULL)
  439. {
  440. H245TRACE(0,1,"API:CopyNonStandardParameter - malloc failed");
  441. return H245_ERROR_NOMEM;
  442. }
  443. memcpy(pNew->data.value, pOld->data.value, pOld->data.length);
  444. }
  445. return H245_ERROR_OK;
  446. } // CopyNonStandardParameter()
  447. void FreeH222Cap(H222Capability *pFree)
  448. {
  449. register VCCapabilityLink pVC;
  450. while (pFree->vcCapability)
  451. {
  452. pVC = pFree->vcCapability;
  453. pFree->vcCapability = pVC->next;
  454. MemFree(pVC);
  455. }
  456. } // FreeH222Cap()
  457. HRESULT CopyH222Cap(H222Capability *pNew, const H222Capability *pOld)
  458. {
  459. VCCapabilityLink pVcNew;
  460. VCCapabilityLink pVcOld;
  461. VCCapabilityLink pVcList;
  462. pNew->numberOfVCs = pOld->numberOfVCs;
  463. pNew->vcCapability = NULL;
  464. pVcList = NULL;
  465. pVcOld = pOld->vcCapability;
  466. while (pVcOld)
  467. {
  468. // Allocate new structure
  469. pVcNew = MemAlloc(sizeof(*pVcNew));
  470. if (pVcNew == NULL)
  471. {
  472. H245TRACE(0,1,"API:CopyH222Cap - malloc failed");
  473. FreeH222Cap(pNew);
  474. return H245_ERROR_NOMEM;
  475. }
  476. // Copy old structure to new structure
  477. *pVcNew = *pVcOld;
  478. // Add new structure to list
  479. pVcNew->next = NULL;
  480. if (pNew->vcCapability == NULL)
  481. {
  482. pNew->vcCapability = pVcNew;
  483. }
  484. else if (NULL != pVcList)
  485. {
  486. pVcList->next = pVcNew;
  487. }
  488. pVcList = pVcNew;
  489. // Get next old structure to copy
  490. pVcOld = pVcOld->next;
  491. }
  492. return H245_ERROR_OK;
  493. } // CopyH222Cap()
  494. void FreeMediaDistributionCap(MediaDistributionCapability *pFree)
  495. {
  496. if (pFree->bit_mask & centralizedData_present)
  497. {
  498. register CentralizedDataLink pLink;
  499. while (pFree->centralizedData)
  500. {
  501. pLink = pFree->centralizedData;
  502. pFree->centralizedData = pLink->next;
  503. switch (pLink->value.application.choice)
  504. {
  505. case DACy_applctn_nnStndrd_chosen:
  506. FreeNonStandardParameter(&pLink->value.application.u.DACy_applctn_nnStndrd);
  507. break;
  508. case DACy_applctn_nlpd_chosen:
  509. if (pLink->value.application.u.DACy_applctn_nlpd.nlpidData.value != NULL)
  510. {
  511. MemFree(pLink->value.application.u.DACy_applctn_nlpd.nlpidData.value);
  512. }
  513. // Fall-through to next case
  514. case DACy_applctn_t120_chosen:
  515. case DACy_applctn_dsm_cc_chosen:
  516. case DACy_applctn_usrDt_chosen:
  517. case DACy_applctn_t84_chosen:
  518. case DACy_applctn_t434_chosen:
  519. case DACy_applctn_h224_chosen:
  520. case DACy_an_h222DtPrttnng_chosen :
  521. if (pLink->value.application.u.DACy_applctn_t120.choice == DtPrtclCpblty_nnStndrd_chosen)
  522. {
  523. FreeNonStandardParameter(&pLink->value.application.u.DACy_applctn_t120.u.DtPrtclCpblty_nnStndrd);
  524. }
  525. break;
  526. case DACy_applctn_dsvdCntrl_chosen:
  527. // Do nothing
  528. break;
  529. } // switch
  530. MemFree(pLink);
  531. }
  532. }
  533. if (pFree->bit_mask & distributedData_present)
  534. {
  535. register DistributedDataLink pLink;
  536. while (pFree->distributedData)
  537. {
  538. pLink = pFree->distributedData;
  539. pFree->distributedData = pLink->next;
  540. switch (pLink->value.application.choice)
  541. {
  542. case DACy_applctn_nnStndrd_chosen:
  543. FreeNonStandardParameter(&pLink->value.application.u.DACy_applctn_nnStndrd);
  544. break;
  545. case DACy_applctn_nlpd_chosen:
  546. if (pLink->value.application.u.DACy_applctn_nlpd.nlpidData.value != NULL)
  547. {
  548. MemFree(pLink->value.application.u.DACy_applctn_nlpd.nlpidData.value);
  549. }
  550. // Fall-through to next case
  551. case DACy_applctn_t120_chosen:
  552. case DACy_applctn_dsm_cc_chosen:
  553. case DACy_applctn_usrDt_chosen:
  554. case DACy_applctn_t84_chosen:
  555. case DACy_applctn_t434_chosen:
  556. case DACy_applctn_h224_chosen:
  557. case DACy_an_h222DtPrttnng_chosen :
  558. if (pLink->value.application.u.DACy_applctn_t120.choice == DtPrtclCpblty_nnStndrd_chosen)
  559. {
  560. FreeNonStandardParameter(&pLink->value.application.u.DACy_applctn_t120.u.DtPrtclCpblty_nnStndrd);
  561. }
  562. break;
  563. case DACy_applctn_dsvdCntrl_chosen:
  564. // Do nothing
  565. break;
  566. } // switch
  567. MemFree(pLink);
  568. }
  569. }
  570. } // FreeMediaDistributionCap()
  571. HRESULT CopyMediaDistributionCap(MediaDistributionCapability *pNew,
  572. const MediaDistributionCapability *pOld)
  573. {
  574. HRESULT lResult = H245_ERROR_OK;
  575. *pNew = *pOld;
  576. pNew->centralizedData = NULL;
  577. pNew->distributedData = NULL;
  578. if (pOld->bit_mask & centralizedData_present)
  579. {
  580. CentralizedDataLink pLinkList = NULL;
  581. CentralizedDataLink pLinkOld = pOld->centralizedData;
  582. CentralizedDataLink pLinkNew;
  583. while (pLinkOld)
  584. {
  585. // Allocate new structure
  586. pLinkNew = MemAlloc(sizeof(*pLinkNew));
  587. if (pLinkNew == NULL)
  588. {
  589. H245TRACE(0,1,"API:CopyMediaDistributionCap - malloc failed");
  590. FreeMediaDistributionCap(pNew);
  591. return H245_ERROR_NOMEM;
  592. }
  593. // Copy old structure to new structure
  594. *pLinkNew = *pLinkOld;
  595. // Add new structure to list
  596. pLinkNew->next = NULL;
  597. if (pNew->centralizedData == NULL)
  598. {
  599. pNew->centralizedData = pLinkNew;
  600. }
  601. else
  602. {
  603. pLinkList->next = pLinkNew;
  604. }
  605. pLinkList = pLinkNew;
  606. // Allocate new memory for each pointer in new structure
  607. switch (pLinkOld->value.application.choice)
  608. {
  609. case DACy_applctn_nnStndrd_chosen:
  610. lResult = CopyNonStandardParameter(&pLinkNew->value.application.u.DACy_applctn_nnStndrd,
  611. &pLinkOld->value.application.u.DACy_applctn_nnStndrd);
  612. break;
  613. case DACy_applctn_nlpd_chosen:
  614. if (pLinkOld->value.application.u.DACy_applctn_nlpd.nlpidData.value != NULL)
  615. {
  616. pLinkNew->value.application.u.DACy_applctn_nlpd.nlpidData.value =
  617. MemAlloc(pLinkNew->value.application.u.DACy_applctn_nlpd.nlpidData.length);
  618. if (pLinkNew->value.application.u.DACy_applctn_nlpd.nlpidData.value == NULL)
  619. {
  620. H245TRACE(0,1,"API:CopyMediaDistributionCap - malloc failed");
  621. FreeMediaDistributionCap(pNew);
  622. return H245_ERROR_NOMEM;
  623. }
  624. memcpy(pLinkNew->value.application.u.DACy_applctn_nlpd.nlpidData.value,
  625. pLinkOld->value.application.u.DACy_applctn_nlpd.nlpidData.value,
  626. pLinkNew->value.application.u.DACy_applctn_nlpd.nlpidData.length);
  627. }
  628. // Fall-through to next case
  629. case DACy_applctn_t120_chosen:
  630. case DACy_applctn_dsm_cc_chosen:
  631. case DACy_applctn_usrDt_chosen:
  632. case DACy_applctn_t84_chosen:
  633. case DACy_applctn_t434_chosen:
  634. case DACy_applctn_h224_chosen:
  635. case DACy_an_h222DtPrttnng_chosen :
  636. if (pLinkOld->value.application.u.DACy_applctn_t120.choice == DtPrtclCpblty_nnStndrd_chosen)
  637. {
  638. lResult = CopyNonStandardParameter(&pLinkNew->value.application.u.DACy_applctn_t120.u.DtPrtclCpblty_nnStndrd,
  639. &pLinkOld->value.application.u.DACy_applctn_t120.u.DtPrtclCpblty_nnStndrd);
  640. }
  641. break;
  642. case DACy_applctn_dsvdCntrl_chosen:
  643. // Do nothing
  644. break;
  645. } // switch
  646. if (lResult != H245_ERROR_OK)
  647. {
  648. FreeMediaDistributionCap(pNew);
  649. return lResult;
  650. }
  651. // Get next old structure to copy
  652. pLinkOld = pLinkOld->next;
  653. }
  654. }
  655. if (pOld->bit_mask & distributedData_present)
  656. {
  657. DistributedDataLink pLinkList = NULL;
  658. DistributedDataLink pLinkOld = pOld->distributedData;
  659. DistributedDataLink pLinkNew;
  660. while (pLinkOld)
  661. {
  662. // Allocate new structure
  663. pLinkNew = MemAlloc(sizeof(*pLinkNew));
  664. if (pLinkNew == NULL)
  665. {
  666. H245TRACE(0,1,"API:CopyMediaDistributionCap - malloc failed");
  667. FreeMediaDistributionCap(pNew);
  668. return H245_ERROR_NOMEM;
  669. }
  670. // Copy old structure to new structure
  671. *pLinkNew = *pLinkOld;
  672. // Add new structure to list
  673. pLinkNew->next = NULL;
  674. if (pNew->distributedData == NULL)
  675. {
  676. pNew->distributedData = pLinkNew;
  677. }
  678. else
  679. {
  680. pLinkList->next = pLinkNew;
  681. }
  682. pLinkList = pLinkNew;
  683. // Allocate new memory for each pointer in new structure
  684. switch (pLinkOld->value.application.choice)
  685. {
  686. case DACy_applctn_nnStndrd_chosen:
  687. lResult = CopyNonStandardParameter(&pLinkNew->value.application.u.DACy_applctn_nnStndrd,
  688. &pLinkOld->value.application.u.DACy_applctn_nnStndrd);
  689. break;
  690. case DACy_applctn_nlpd_chosen:
  691. if (pLinkOld->value.application.u.DACy_applctn_nlpd.nlpidData.value != NULL)
  692. {
  693. pLinkNew->value.application.u.DACy_applctn_nlpd.nlpidData.value =
  694. MemAlloc(pLinkNew->value.application.u.DACy_applctn_nlpd.nlpidData.length);
  695. if (pLinkNew->value.application.u.DACy_applctn_nlpd.nlpidData.value == NULL)
  696. {
  697. H245TRACE(0,1,"API:CopyMediaDistributionCap - malloc failed");
  698. FreeMediaDistributionCap(pNew);
  699. return H245_ERROR_NOMEM;
  700. }
  701. memcpy(pLinkNew->value.application.u.DACy_applctn_nlpd.nlpidData.value,
  702. pLinkOld->value.application.u.DACy_applctn_nlpd.nlpidData.value,
  703. pLinkNew->value.application.u.DACy_applctn_nlpd.nlpidData.length);
  704. }
  705. // Fall-through to next case
  706. case DACy_applctn_t120_chosen:
  707. case DACy_applctn_dsm_cc_chosen:
  708. case DACy_applctn_usrDt_chosen:
  709. case DACy_applctn_t84_chosen:
  710. case DACy_applctn_t434_chosen:
  711. case DACy_applctn_h224_chosen:
  712. case DACy_an_h222DtPrttnng_chosen :
  713. if (pLinkOld->value.application.u.DACy_applctn_t120.choice == DtPrtclCpblty_nnStndrd_chosen)
  714. {
  715. lResult = CopyNonStandardParameter(&pLinkNew->value.application.u.DACy_applctn_t120.u.DtPrtclCpblty_nnStndrd,
  716. &pLinkOld->value.application.u.DACy_applctn_t120.u.DtPrtclCpblty_nnStndrd);
  717. }
  718. break;
  719. case DACy_applctn_dsvdCntrl_chosen:
  720. // Do nothing
  721. break;
  722. } // switch
  723. if (lResult != H245_ERROR_OK)
  724. {
  725. FreeMediaDistributionCap(pNew);
  726. return lResult;
  727. }
  728. // Get next old structure to copy
  729. pLinkOld = pLinkOld->next;
  730. }
  731. }
  732. return H245_ERROR_OK;
  733. } // CopyMediaDistributionCap()
  734. void FreeH2250Cap(H2250Capability *pFree)
  735. {
  736. register MediaDistributionCapabilityLink pLink;
  737. while (pFree->receiveMultipointCapability.mediaDistributionCapability)
  738. {
  739. pLink = pFree->receiveMultipointCapability.mediaDistributionCapability;
  740. pFree->receiveMultipointCapability.mediaDistributionCapability = pLink->next;
  741. FreeMediaDistributionCap(&pLink->value);
  742. MemFree(pLink);
  743. }
  744. while (pFree->transmitMultipointCapability.mediaDistributionCapability)
  745. {
  746. pLink = pFree->transmitMultipointCapability.mediaDistributionCapability;
  747. pFree->transmitMultipointCapability.mediaDistributionCapability = pLink->next;
  748. FreeMediaDistributionCap(&pLink->value);
  749. MemFree(pLink);
  750. }
  751. while (pFree->rcvAndTrnsmtMltpntCpblty.mediaDistributionCapability)
  752. {
  753. pLink = pFree->rcvAndTrnsmtMltpntCpblty.mediaDistributionCapability;
  754. pFree->rcvAndTrnsmtMltpntCpblty.mediaDistributionCapability = pLink->next;
  755. FreeMediaDistributionCap(&pLink->value);
  756. MemFree(pLink);
  757. }
  758. } // FreeH2250Cap()
  759. HRESULT CopyH2250Cap(H2250Capability *pNew, const H2250Capability *pOld)
  760. {
  761. MediaDistributionCapabilityLink pLinkList;
  762. MediaDistributionCapabilityLink pLinkOld;
  763. MediaDistributionCapabilityLink pLinkNew;
  764. HRESULT lResult;
  765. // Copy base structure
  766. *pNew = *pOld;
  767. pNew->receiveMultipointCapability.mediaDistributionCapability = NULL;
  768. pNew->transmitMultipointCapability.mediaDistributionCapability = NULL;
  769. pNew->rcvAndTrnsmtMltpntCpblty.mediaDistributionCapability = NULL;
  770. pLinkList = NULL;
  771. pLinkOld = pOld->receiveMultipointCapability.mediaDistributionCapability;
  772. while (pLinkOld)
  773. {
  774. // Allocate new structure
  775. pLinkNew = MemAlloc(sizeof(*pLinkNew));
  776. if (pLinkNew == NULL)
  777. {
  778. H245TRACE(0,1,"API:CopyH2250Cap - malloc failed");
  779. FreeH2250Cap(pNew);
  780. return H245_ERROR_NOMEM;
  781. }
  782. // Add new structure to list
  783. pLinkNew->next = NULL;
  784. if (pNew->receiveMultipointCapability.mediaDistributionCapability == NULL)
  785. {
  786. pNew->receiveMultipointCapability.mediaDistributionCapability = pLinkNew;
  787. }
  788. else
  789. {
  790. pLinkList->next = pLinkNew;
  791. }
  792. pLinkList = pLinkNew;
  793. // Copy old structure to new
  794. lResult = CopyMediaDistributionCap(&pLinkNew->value, &pLinkOld->value);
  795. if (lResult != H245_ERROR_OK)
  796. {
  797. FreeH2250Cap(pNew);
  798. return lResult;
  799. }
  800. // Get next old structure to copy
  801. pLinkOld = pLinkOld->next;
  802. }
  803. pLinkList = NULL;
  804. pLinkOld = pOld->transmitMultipointCapability.mediaDistributionCapability;
  805. while (pLinkOld)
  806. {
  807. // Allocate new structure
  808. pLinkNew = MemAlloc(sizeof(*pLinkNew));
  809. if (pLinkNew == NULL)
  810. {
  811. H245TRACE(0,1,"API:CopyH2250Cap - malloc failed");
  812. FreeH2250Cap(pNew);
  813. return H245_ERROR_NOMEM;
  814. }
  815. // Add new structure to list
  816. pLinkNew->next = NULL;
  817. if (pNew->transmitMultipointCapability.mediaDistributionCapability == NULL)
  818. {
  819. pNew->transmitMultipointCapability.mediaDistributionCapability = pLinkNew;
  820. }
  821. else
  822. {
  823. pLinkList->next = pLinkNew;
  824. }
  825. pLinkList = pLinkNew;
  826. // Copy old structure to new
  827. lResult = CopyMediaDistributionCap(&pLinkNew->value, &pLinkOld->value);
  828. if (lResult != H245_ERROR_OK)
  829. {
  830. FreeH2250Cap(pNew);
  831. return lResult;
  832. }
  833. // Get next old structure to copy
  834. pLinkOld = pLinkOld->next;
  835. }
  836. pLinkList = NULL;
  837. pLinkOld = pOld->rcvAndTrnsmtMltpntCpblty.mediaDistributionCapability;
  838. while (pLinkOld)
  839. {
  840. // Allocate new structure
  841. pLinkNew = MemAlloc(sizeof(*pLinkNew));
  842. if (pLinkNew == NULL)
  843. {
  844. H245TRACE(0,1,"API:CopyH2250Cap - malloc failed");
  845. FreeH2250Cap(pNew);
  846. return H245_ERROR_NOMEM;
  847. }
  848. // Add new structure to list
  849. pLinkNew->next = NULL;
  850. if (pNew->rcvAndTrnsmtMltpntCpblty.mediaDistributionCapability == NULL)
  851. {
  852. pNew->rcvAndTrnsmtMltpntCpblty.mediaDistributionCapability = pLinkNew;
  853. }
  854. else
  855. {
  856. pLinkList->next = pLinkNew;
  857. }
  858. pLinkList = pLinkNew;
  859. // Copy old structure to new
  860. lResult = CopyMediaDistributionCap(&pLinkNew->value, &pLinkOld->value);
  861. if (lResult != H245_ERROR_OK)
  862. {
  863. FreeH2250Cap(pNew);
  864. return lResult;
  865. }
  866. // Get next old structure to copy
  867. pLinkOld = pLinkOld->next;
  868. }
  869. return H245_ERROR_OK;
  870. } // CopyH2250Cap()
  871. HRESULT set_cap_descriptor(
  872. struct InstanceStruct *pInstance,
  873. H245_CAPDESC_T *pCapDesc,
  874. H245_CAPDESCID_T *pCapDescId,
  875. struct TerminalCapabilitySet *pTermCapSet)
  876. {
  877. CapabilityDescriptor *p_cap_desc;
  878. unsigned int uId;
  879. BOOL bNewDescriptor;
  880. unsigned int sim_cap;
  881. SmltnsCpbltsLink p_sim_cap;
  882. SmltnsCpbltsLink p_sim_cap_lst = NULL;
  883. unsigned int alt_cap;
  884. H245TRACE(pInstance->dwInst,10,"API:set_cap_descriptor");
  885. ASSERT(*pCapDescId < 256);
  886. /* Check if capability descriptor already exists */
  887. p_cap_desc = NULL;
  888. for (uId = 0; uId < pTermCapSet->capabilityDescriptors.count; ++uId)
  889. {
  890. if (pTermCapSet->capabilityDescriptors.value[uId].capabilityDescriptorNumber == *pCapDescId)
  891. {
  892. p_cap_desc = &pTermCapSet->capabilityDescriptors.value[uId];
  893. break;
  894. }
  895. }
  896. if (p_cap_desc == NULL)
  897. {
  898. ASSERT(pTermCapSet->capabilityDescriptors.count < 256);
  899. p_cap_desc = &pTermCapSet->capabilityDescriptors.value[pTermCapSet->capabilityDescriptors.count];
  900. p_cap_desc->capabilityDescriptorNumber = (CapabilityDescriptorNumber) *pCapDescId;
  901. bNewDescriptor = TRUE;
  902. }
  903. else
  904. {
  905. bNewDescriptor = FALSE;
  906. }
  907. if (p_cap_desc->smltnsCpblts)
  908. dealloc_simultaneous_cap (p_cap_desc);
  909. /* for every entry in the altcap list */
  910. for (sim_cap = 0; sim_cap < pCapDesc->Length; ++sim_cap)
  911. {
  912. /* check for out of bounds error or memory allocation failure */
  913. if ((pCapDesc->SimCapArray[sim_cap].Length > 256) ||
  914. (!(p_sim_cap = (SmltnsCpbltsLink)alloc_link(sizeof(*p_sim_cap)))))
  915. {
  916. if (p_cap_desc->smltnsCpblts)
  917. dealloc_simultaneous_cap (p_cap_desc);
  918. H245TRACE(pInstance->dwInst,1,"API:set_cap_descriptor - no memory");
  919. return H245_ERROR_NOMEM;
  920. }
  921. if (!p_cap_desc->smltnsCpblts)
  922. {
  923. /* first time through */
  924. p_cap_desc->smltnsCpblts = p_sim_cap;
  925. }
  926. else
  927. {
  928. /* every other time through */
  929. ASSERT (p_sim_cap_lst);
  930. p_sim_cap_lst->next = p_sim_cap;
  931. }
  932. /* setup for next time through */
  933. p_sim_cap_lst = p_sim_cap;
  934. /* load up the new simultanoius cap */
  935. for (alt_cap = 0; alt_cap < pCapDesc->SimCapArray[sim_cap].Length; ++alt_cap)
  936. {
  937. if (!(find_capid_by_entrynumber (&pInstance->API.PDU_LocalTermCap.TERMCAPSET,
  938. pCapDesc->SimCapArray[sim_cap].AltCaps[alt_cap])))
  939. {
  940. if (p_cap_desc->smltnsCpblts)
  941. dealloc_simultaneous_cap (p_cap_desc);
  942. return H245_ERROR_INVALID_CAPID;
  943. }
  944. /* assign Altcap */
  945. p_sim_cap->value.value[alt_cap] = (unsigned short)pCapDesc->SimCapArray[sim_cap].AltCaps[alt_cap];
  946. } /* for C*/
  947. /* set count */
  948. p_sim_cap->value.count = (unsigned short)pCapDesc->SimCapArray[sim_cap].Length;
  949. } /* for */
  950. /* Success! */
  951. /* Set the simultaneous capabilities present bit */
  952. /* Increment the capability descriptor count */
  953. /* Set the descriptors present bit even though it may already be set */
  954. p_cap_desc->bit_mask |= smltnsCpblts_present;
  955. if (bNewDescriptor)
  956. pTermCapSet->capabilityDescriptors.count++;
  957. pTermCapSet->bit_mask |= capabilityDescriptors_present;
  958. return H245_ERROR_OK;
  959. }
  960. HRESULT del_cap_descriptor (struct InstanceStruct *pInstance,
  961. H245_CAPDESCID_T CapDescId,
  962. struct TerminalCapabilitySet *pTermCapSet)
  963. {
  964. CapabilityDescriptor *p_cap_desc;
  965. unsigned int uId;
  966. /* Check if capability descriptor already exists and if it is valid */
  967. p_cap_desc = NULL;
  968. for (uId = 0; uId < pTermCapSet->capabilityDescriptors.count; ++uId)
  969. {
  970. if (pTermCapSet->capabilityDescriptors.value[uId].capabilityDescriptorNumber == CapDescId)
  971. {
  972. p_cap_desc = &pTermCapSet->capabilityDescriptors.value[uId];
  973. break;
  974. }
  975. }
  976. if (p_cap_desc == NULL ||
  977. p_cap_desc->smltnsCpblts == NULL ||
  978. (p_cap_desc->bit_mask & smltnsCpblts_present) == 0)
  979. {
  980. H245TRACE(pInstance->dwInst,1,"API:del_cap_descriptor - invalid cap descriptor");
  981. return H245_ERROR_INVALID_CAPDESCID;
  982. }
  983. /* free up the list */
  984. dealloc_simultaneous_cap (p_cap_desc);
  985. pTermCapSet->capabilityDescriptors.count--;
  986. pTermCapSet->capabilityDescriptors.value[uId] =
  987. pTermCapSet->capabilityDescriptors.value[pTermCapSet->capabilityDescriptors.count];
  988. if (pTermCapSet->capabilityDescriptors.count == 0)
  989. pTermCapSet->bit_mask &= ~capabilityDescriptors_present;
  990. return H245_ERROR_OK;
  991. }
  992. /*****************************************************************************
  993. *
  994. * TYPE: Local
  995. *
  996. * PROCEDURE: free_object_id
  997. *
  998. * DESCRIPTION
  999. *
  1000. * RETURN: none
  1001. *
  1002. * ASSUMES: none
  1003. *
  1004. *****************************************************************************/
  1005. void
  1006. free_object_id (POBJECTID p_obj_id)
  1007. {
  1008. register POBJECTID p_obj_tmp;
  1009. /* free all the objects */
  1010. while (p_obj_id != NULL)
  1011. {
  1012. p_obj_tmp = p_obj_id;
  1013. p_obj_id = p_obj_id->next;
  1014. MemFree (p_obj_tmp);
  1015. }
  1016. }
  1017. /*****************************************************************************
  1018. *
  1019. * TYPE: GLOBAL
  1020. *
  1021. * PROCEDURE: free_mux_element
  1022. *
  1023. * DESCRIPTION
  1024. * free mux element desciptor list
  1025. *
  1026. * RETURN:
  1027. *
  1028. * ASSUME: List is Locked
  1029. *
  1030. *****************************************************************************/
  1031. void free_mux_element (MultiplexElement *p_ASN_mux_el)
  1032. {
  1033. int count = 0;
  1034. if (p_ASN_mux_el->type.choice == subElementList_chosen)
  1035. {
  1036. if (p_ASN_mux_el->type.u.subElementList)
  1037. {
  1038. for (count = p_ASN_mux_el->type.u.subElementList->count;
  1039. count;
  1040. count--)
  1041. {
  1042. free_mux_element (&(p_ASN_mux_el->type.u.subElementList->value[count]));
  1043. }
  1044. MemFree (p_ASN_mux_el->type.u.subElementList);
  1045. }
  1046. }
  1047. }
  1048. /*****************************************************************************
  1049. *
  1050. * TYPE: GLOBAL
  1051. *
  1052. * PROCEDURE: free_mux_desc_list
  1053. *
  1054. * DESCRIPTION
  1055. * free mux element desciptor list
  1056. *
  1057. * RETURN:
  1058. *
  1059. * ASSUME: List is Locked
  1060. *
  1061. *****************************************************************************/
  1062. void
  1063. free_mux_desc_list (MultiplexEntryDescriptorLink p_ASN_med_link)
  1064. {
  1065. MultiplexEntryDescriptorLink p_ASN_med_link_tofree;
  1066. /* free all entries on descriptor list */
  1067. while (p_ASN_med_link)
  1068. {
  1069. int count = 0;
  1070. for (count = p_ASN_med_link->value.elementList.count;
  1071. count;
  1072. count--)
  1073. {
  1074. free_mux_element (&(p_ASN_med_link->value.elementList.value[count]));
  1075. }
  1076. p_ASN_med_link_tofree = p_ASN_med_link;
  1077. p_ASN_med_link = p_ASN_med_link->next;
  1078. MemFree (p_ASN_med_link_tofree);
  1079. }
  1080. }
  1081. /*****************************************************************************
  1082. *
  1083. * TYPE:
  1084. *
  1085. * PROCEDURE: alloc_link
  1086. *
  1087. * DESCRIPTION:
  1088. *
  1089. * RETURN:
  1090. *
  1091. *****************************************************************************/
  1092. H245_LINK_T *
  1093. alloc_link (int size)
  1094. {
  1095. H245_LINK_T *p_link = (H245_LINK_T *)MemAlloc (size);
  1096. if (p_link)
  1097. p_link->p_next = NULL;
  1098. return p_link;
  1099. }
  1100. /*****************************************************************************
  1101. *
  1102. * TYPE:
  1103. *
  1104. * PROCEDURE: alloc_new_capid -
  1105. *
  1106. * DESCRIPTION:
  1107. *
  1108. * ASSUMES: Capability Table is locked before call
  1109. * Caller marks the bit_mask indicating when
  1110. * the table entry can be used.
  1111. *
  1112. * RETURN: NULL if not found
  1113. * pCapLink if found
  1114. *
  1115. *****************************************************************************/
  1116. CapabilityTableLink
  1117. alloc_link_cap_entry ( struct TerminalCapabilitySet *pTermCapSet)
  1118. {
  1119. register CapabilityTableLink pCapLink;
  1120. register CapabilityTableLink pCapLinkSearch;
  1121. ASSERT(pTermCapSet != NULL);
  1122. pCapLink = (CapabilityTableLink)MemAlloc(sizeof(*pCapLink));
  1123. if (pCapLink)
  1124. {
  1125. pCapLink->next = NULL;
  1126. pCapLink->value.bit_mask = 0;
  1127. pCapLinkSearch = pTermCapSet->capabilityTable;
  1128. // Insert at END of linked list
  1129. if (pCapLinkSearch)
  1130. {
  1131. while (pCapLinkSearch->next)
  1132. {
  1133. pCapLinkSearch = pCapLinkSearch->next;
  1134. }
  1135. pCapLinkSearch->next = pCapLink;
  1136. }
  1137. else
  1138. {
  1139. pTermCapSet->capabilityTable = pCapLink;
  1140. }
  1141. }
  1142. return pCapLink;
  1143. } // alloc_link_cap_entry()
  1144. /*****************************************************************************
  1145. *
  1146. * TYPE: GLOBAL
  1147. *
  1148. * PROCEDURE: dealloc_simultaneous_cap - deallocate alternative Cap Set
  1149. *
  1150. * DESCRIPTION
  1151. *
  1152. * RETURN: N/A
  1153. *
  1154. * ASSUME: List is Locked
  1155. *
  1156. *****************************************************************************/
  1157. void dealloc_simultaneous_cap (CapabilityDescriptor *pCapdes)
  1158. {
  1159. SmltnsCpbltsLink p_sim_cap;
  1160. SmltnsCpbltsLink p_sim_cap_tmp;
  1161. pCapdes->bit_mask &= ~smltnsCpblts_present;
  1162. for (p_sim_cap = pCapdes->smltnsCpblts;
  1163. p_sim_cap;
  1164. )
  1165. {
  1166. p_sim_cap_tmp = p_sim_cap->next;
  1167. MemFree (p_sim_cap);
  1168. p_sim_cap = p_sim_cap_tmp;
  1169. } /* for */
  1170. pCapdes->smltnsCpblts = NULL;
  1171. } /* procedrue */
  1172. /*****************************************************************************
  1173. *
  1174. * TYPE: local
  1175. *
  1176. * PROCEDURE: find_capid_by_entrynumber -
  1177. *
  1178. * DESCRIPTION:
  1179. *
  1180. * RETURN: NULL - if error
  1181. * capabiliytTableLink if ok
  1182. *
  1183. * ASSUME: List is Locked
  1184. *
  1185. *****************************************************************************/
  1186. CapabilityTableLink
  1187. find_capid_by_entrynumber (
  1188. struct TerminalCapabilitySet *pTermCapSet,
  1189. H245_CAPID_T cap_id
  1190. )
  1191. {
  1192. register CapabilityTableLink pCapLink;
  1193. ASSERT (pTermCapSet != NULL);
  1194. for (pCapLink = pTermCapSet->capabilityTable;
  1195. pCapLink;
  1196. pCapLink = pCapLink->next)
  1197. {
  1198. if (pCapLink->value.capabilityTableEntryNumber == cap_id &&
  1199. pCapLink->value.bit_mask == capability_present)
  1200. {
  1201. return pCapLink;
  1202. }
  1203. }
  1204. return NULL;
  1205. }
  1206. /*****************************************************************************
  1207. *
  1208. * TYPE: Global
  1209. *
  1210. * PROCEDURE: load_cap
  1211. *
  1212. * DESCRIPTION: Takes a totcap and loads a capability structure
  1213. * i.e. Input is the total capability
  1214. * Output is the *pCapability
  1215. * NOTE: Non Standard Capabilities.. allocate memory
  1216. * which needs to be free'd later..
  1217. *
  1218. * RETURN:
  1219. *
  1220. *****************************************************************************/
  1221. HRESULT
  1222. load_cap (struct Capability *pCapability, /* output */
  1223. const H245_TOTCAP_T *pTotCap ) /* input */
  1224. {
  1225. HRESULT lError = H245_ERROR_OK;
  1226. H245TRACE(0,10,"API:laod_cap <-");
  1227. switch (pTotCap->ClientType)
  1228. {
  1229. /* General NON Standard Cap */
  1230. case H245_CLIENT_NONSTD:
  1231. H245TRACE(0,20,"API:load_cap - H245_CLIENT_NONSTD");
  1232. lError = CopyNonStandardParameter(&pCapability->u.Capability_nonStandard,
  1233. &pTotCap->Cap.H245_NonStd);
  1234. break;
  1235. /* VIDEO */
  1236. case H245_CLIENT_VID_NONSTD:
  1237. H245TRACE(0,20,"API:load_cap - H245_CLIENT_VID_NONSTD");
  1238. lError = CopyNonStandardParameter(&pCapability->u.receiveVideoCapability.u.VdCpblty_nonStandard,
  1239. &pTotCap->Cap.H245Vid_NONSTD);
  1240. pCapability->u.receiveVideoCapability.choice = VdCpblty_nonStandard_chosen;
  1241. break;
  1242. case H245_CLIENT_VID_H261:
  1243. H245TRACE(0,20,"API:load_cap - H245_CLIENT_VID_H261");
  1244. pCapability->u.receiveVideoCapability.u.h261VideoCapability = pTotCap->Cap.H245Vid_H261;
  1245. pCapability->u.receiveVideoCapability.choice = h261VideoCapability_chosen;
  1246. break;
  1247. case H245_CLIENT_VID_H262:
  1248. H245TRACE(0,20,"API:load_cap - H245_CLIENT_VID_H262");
  1249. pCapability->u.receiveVideoCapability.u.h262VideoCapability = pTotCap->Cap.H245Vid_H262;
  1250. pCapability->u.receiveVideoCapability.choice = h262VideoCapability_chosen;
  1251. break;
  1252. case H245_CLIENT_VID_H263:
  1253. H245TRACE(0,20,"API:load_cap - H245_CLIENT_VID_H263");
  1254. pCapability->u.receiveVideoCapability.u.h263VideoCapability = pTotCap->Cap.H245Vid_H263;
  1255. pCapability->u.receiveVideoCapability.choice = h263VideoCapability_chosen;
  1256. break;
  1257. case H245_CLIENT_VID_IS11172:
  1258. H245TRACE(0,20,"API:load_cap - H245_CLIENT_VID_IS11172");
  1259. pCapability->u.receiveVideoCapability.u.is11172VideoCapability = pTotCap->Cap.H245Vid_IS11172;
  1260. pCapability->u.receiveVideoCapability.choice = is11172VideoCapability_chosen;
  1261. break;
  1262. /* AUDIO */
  1263. case H245_CLIENT_AUD_NONSTD:
  1264. H245TRACE(0,20,"API:load_cap - H245_CLIENT_AUD_NONSTD");
  1265. lError = CopyNonStandardParameter(&pCapability->u.receiveAudioCapability.u.AdCpblty_nonStandard,
  1266. &pTotCap->Cap.H245Aud_NONSTD);
  1267. pCapability->u.receiveAudioCapability.choice = AdCpblty_nonStandard_chosen;
  1268. break;
  1269. case H245_CLIENT_AUD_G711_ALAW64:
  1270. H245TRACE(0,20,"API:load_cap - H245_CLIENT_AUD_G711_ALAW64");
  1271. pCapability->u.receiveAudioCapability.u.AdCpblty_g711Alaw64k = pTotCap->Cap.H245Aud_G711_ALAW64;
  1272. pCapability->u.receiveAudioCapability.choice = AdCpblty_g711Alaw64k_chosen;
  1273. break;
  1274. case H245_CLIENT_AUD_G711_ALAW56:
  1275. H245TRACE(0,20,"API:load_cap - H245_CLIENT_AUD_G711_ALAW56");
  1276. pCapability->u.receiveAudioCapability.u.AdCpblty_g711Alaw56k = pTotCap->Cap.H245Aud_G711_ALAW56;
  1277. pCapability->u.receiveAudioCapability.choice = AdCpblty_g711Alaw56k_chosen;
  1278. break;
  1279. case H245_CLIENT_AUD_G711_ULAW64:
  1280. H245TRACE(0,20,"API:load_cap - H245_CLIENT_AUD_G711_ULAW64");
  1281. pCapability->u.receiveAudioCapability.u.AdCpblty_g711Ulaw64k = pTotCap->Cap.H245Aud_G711_ULAW64;
  1282. pCapability->u.receiveAudioCapability.choice = AdCpblty_g711Ulaw64k_chosen;
  1283. break;
  1284. case H245_CLIENT_AUD_G711_ULAW56:
  1285. H245TRACE(0,20,"API:load_cap - H245_CLIENT_AUD_G711_ULAW56");
  1286. pCapability->u.receiveAudioCapability.u.AdCpblty_g711Ulaw56k = pTotCap->Cap.H245Aud_G711_ULAW56;
  1287. pCapability->u.receiveAudioCapability.choice = AdCpblty_g711Ulaw56k_chosen;
  1288. break;
  1289. case H245_CLIENT_AUD_G722_64:
  1290. H245TRACE(0,20,"API:load_cap - H245_CLIENT_AUD_G722_64");
  1291. pCapability->u.receiveAudioCapability.u.AudioCapability_g722_64k = pTotCap->Cap.H245Aud_G722_64;
  1292. pCapability->u.receiveAudioCapability.choice = AudioCapability_g722_64k_chosen;
  1293. break;
  1294. case H245_CLIENT_AUD_G722_56:
  1295. H245TRACE(0,20,"API:load_cap - H245_CLIENT_AUD_G722_56");
  1296. pCapability->u.receiveAudioCapability.u.AudioCapability_g722_56k = pTotCap->Cap.H245Aud_G722_56;
  1297. pCapability->u.receiveAudioCapability.choice = AudioCapability_g722_56k_chosen;
  1298. break;
  1299. case H245_CLIENT_AUD_G722_48:
  1300. H245TRACE(0,20,"API:load_cap - H245_CLIENT_AUD_G722_48");
  1301. pCapability->u.receiveAudioCapability.u.AudioCapability_g722_48k = pTotCap->Cap.H245Aud_G722_48;
  1302. pCapability->u.receiveAudioCapability.choice = AudioCapability_g722_48k_chosen;
  1303. break;
  1304. case H245_CLIENT_AUD_G723:
  1305. H245TRACE(0,20,"API:load_cap - H245_CLIENT_AUD_G723");
  1306. pCapability->u.receiveAudioCapability.u.AudioCapability_g7231 = pTotCap->Cap.H245Aud_G723;
  1307. pCapability->u.receiveAudioCapability.choice = AudioCapability_g7231_chosen;
  1308. break;
  1309. case H245_CLIENT_AUD_G728:
  1310. H245TRACE(0,20,"API:load_cap - H245_CLIENT_AUD_G728");
  1311. pCapability->u.receiveAudioCapability.u.AudioCapability_g728 = pTotCap->Cap.H245Aud_G728;
  1312. pCapability->u.receiveAudioCapability.choice = AudioCapability_g728_chosen;
  1313. break;
  1314. case H245_CLIENT_AUD_G729:
  1315. H245TRACE(0,20,"API:load_cap - H245_CLIENT_AUD_G729");
  1316. pCapability->u.receiveAudioCapability.u.AudioCapability_g729 = pTotCap->Cap.H245Aud_G729;
  1317. pCapability->u.receiveAudioCapability.choice = AudioCapability_g729_chosen;
  1318. break;
  1319. case H245_CLIENT_AUD_GDSVD:
  1320. H245TRACE(0,20,"API:load_cap - H245_CLIENT_AUD_GDSVD");
  1321. pCapability->u.receiveAudioCapability.u.AdCpblty_g729AnnexA = pTotCap->Cap.H245Aud_GDSVD;
  1322. pCapability->u.receiveAudioCapability.choice = AdCpblty_g729AnnexA_chosen;
  1323. break;
  1324. case H245_CLIENT_AUD_IS11172:
  1325. H245TRACE(0,20,"API:load_cap - H245_CLIENT_AUD_IS11172");
  1326. pCapability->u.receiveAudioCapability.u.is11172AudioCapability = pTotCap->Cap.H245Aud_IS11172;
  1327. pCapability->u.receiveAudioCapability.choice = is11172AudioCapability_chosen;
  1328. break;
  1329. case H245_CLIENT_AUD_IS13818:
  1330. H245TRACE(0,20,"API:load_cap - H245_CLIENT_AUD_IS13818");
  1331. pCapability->u.receiveAudioCapability.u.is13818AudioCapability = pTotCap->Cap.H245Aud_IS13818;
  1332. pCapability->u.receiveAudioCapability.choice = is13818AudioCapability_chosen;
  1333. break;
  1334. /* DATA */
  1335. case H245_CLIENT_DAT_NONSTD:
  1336. H245TRACE(0,20,"API:load_cap - H245_CLIENT_DAT_NONSTD");
  1337. pCapability->u.rcvDtApplctnCpblty = pTotCap->Cap.H245Dat_NONSTD;
  1338. lError = CopyNonStandardParameter(&pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_nnStndrd,
  1339. &pTotCap->Cap.H245Dat_NONSTD.application.u.DACy_applctn_nnStndrd);
  1340. pCapability->u.rcvDtApplctnCpblty.application.choice = DACy_applctn_nnStndrd_chosen;
  1341. break;
  1342. case H245_CLIENT_DAT_T120:
  1343. H245TRACE(0,20,"API:load_cap - H245_CLIENT_DAT_T120");
  1344. pCapability->u.rcvDtApplctnCpblty = pTotCap->Cap.H245Dat_T120;
  1345. if (pTotCap->Cap.H245Dat_T120.application.u.DACy_applctn_t120.choice == DtPrtclCpblty_nnStndrd_chosen) {
  1346. lError = CopyNonStandardParameter(&pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_t120.u.DtPrtclCpblty_nnStndrd,
  1347. &pTotCap->Cap.H245Dat_T120.application.u.DACy_applctn_t120.u.DtPrtclCpblty_nnStndrd);
  1348. }
  1349. pCapability->u.rcvDtApplctnCpblty.application.choice = DACy_applctn_t120_chosen;
  1350. break;
  1351. case H245_CLIENT_DAT_DSMCC:
  1352. H245TRACE(0,20,"API:load_cap - H245_CLIENT_DAT_DSMCC");
  1353. pCapability->u.rcvDtApplctnCpblty = pTotCap->Cap.H245Dat_DSMCC;
  1354. if (pTotCap->Cap.H245Dat_DSMCC.application.u.DACy_applctn_dsm_cc.choice == DtPrtclCpblty_nnStndrd_chosen)
  1355. {
  1356. lError = CopyNonStandardParameter(&pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_dsm_cc.u.DtPrtclCpblty_nnStndrd,
  1357. &pTotCap->Cap.H245Dat_DSMCC.application.u.DACy_applctn_dsm_cc.u.DtPrtclCpblty_nnStndrd);
  1358. }
  1359. pCapability->u.rcvDtApplctnCpblty.application.choice = DACy_applctn_dsm_cc_chosen;
  1360. break;
  1361. case H245_CLIENT_DAT_USERDATA:
  1362. H245TRACE(0,20,"API:load_cap - H245_CLIENT_DAT_USERDATA");
  1363. pCapability->u.rcvDtApplctnCpblty = pTotCap->Cap.H245Dat_USERDATA;
  1364. if (pTotCap->Cap.H245Dat_USERDATA.application.u.DACy_applctn_usrDt.choice == DtPrtclCpblty_nnStndrd_chosen)
  1365. {
  1366. lError = CopyNonStandardParameter(&pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_usrDt.u.DtPrtclCpblty_nnStndrd,
  1367. &pTotCap->Cap.H245Dat_USERDATA.application.u.DACy_applctn_usrDt.u.DtPrtclCpblty_nnStndrd);
  1368. }
  1369. pCapability->u.rcvDtApplctnCpblty.application.choice = DACy_applctn_usrDt_chosen;
  1370. break;
  1371. case H245_CLIENT_DAT_T84:
  1372. H245TRACE(0,20,"API:load_cap - H245_CLIENT_DAT_T84");
  1373. pCapability->u.rcvDtApplctnCpblty = pTotCap->Cap.H245Dat_T84;
  1374. if (pTotCap->Cap.H245Dat_T84.application.u.DACy_applctn_t84.t84Protocol.choice == DtPrtclCpblty_nnStndrd_chosen)
  1375. {
  1376. lError = CopyNonStandardParameter(&pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_t84.t84Protocol.u.DtPrtclCpblty_nnStndrd,
  1377. &pTotCap->Cap.H245Dat_T84.application.u.DACy_applctn_t84.t84Protocol.u.DtPrtclCpblty_nnStndrd);
  1378. }
  1379. pCapability->u.rcvDtApplctnCpblty.application.choice = DACy_applctn_t84_chosen;
  1380. break;
  1381. case H245_CLIENT_DAT_T434:
  1382. H245TRACE(0,20,"API:load_cap - H245_CLIENT_DAT_T434");
  1383. pCapability->u.rcvDtApplctnCpblty = pTotCap->Cap.H245Dat_T434;
  1384. if (pTotCap->Cap.H245Dat_T434.application.u.DACy_applctn_t434.choice == DtPrtclCpblty_nnStndrd_chosen)
  1385. {
  1386. lError = CopyNonStandardParameter(&pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_t434.u.DtPrtclCpblty_nnStndrd,
  1387. &pTotCap->Cap.H245Dat_T434.application.u.DACy_applctn_t434.u.DtPrtclCpblty_nnStndrd);
  1388. }
  1389. pCapability->u.rcvDtApplctnCpblty.application.choice = DACy_applctn_t434_chosen;
  1390. break;
  1391. case H245_CLIENT_DAT_H224:
  1392. H245TRACE(0,20,"API:load_cap - H245_CLIENT_DAT_H224");
  1393. pCapability->u.rcvDtApplctnCpblty = pTotCap->Cap.H245Dat_H224;
  1394. if (pTotCap->Cap.H245Dat_H224.application.u.DACy_applctn_h224.choice == DtPrtclCpblty_nnStndrd_chosen)
  1395. {
  1396. lError = CopyNonStandardParameter(&pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_h224.u.DtPrtclCpblty_nnStndrd,
  1397. &pTotCap->Cap.H245Dat_H224.application.u.DACy_applctn_h224.u.DtPrtclCpblty_nnStndrd);
  1398. }
  1399. pCapability->u.rcvDtApplctnCpblty.application.choice = DACy_applctn_h224_chosen;
  1400. break;
  1401. case H245_CLIENT_DAT_NLPID:
  1402. H245TRACE(0,20,"API:load_cap - H245_CLIENT_DAT_NLPID");
  1403. pCapability->u.rcvDtApplctnCpblty = pTotCap->Cap.H245Dat_NLPID;
  1404. if (pTotCap->Cap.H245Dat_NLPID.application.u.DACy_applctn_nlpd.nlpidProtocol.choice == DtPrtclCpblty_nnStndrd_chosen)
  1405. {
  1406. lError = CopyNonStandardParameter(&pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_nlpd.nlpidProtocol.u.DtPrtclCpblty_nnStndrd,
  1407. &pTotCap->Cap.H245Dat_NLPID.application.u.DACy_applctn_nlpd.nlpidProtocol.u.DtPrtclCpblty_nnStndrd);
  1408. }
  1409. if (lError == H245_ERROR_OK && pTotCap->Cap.H245Dat_NLPID.application.u.DACy_applctn_nlpd.nlpidData.length != 0)
  1410. {
  1411. pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_nlpd.nlpidData.value =
  1412. MemAlloc(pTotCap->Cap.H245Dat_NLPID.application.u.DACy_applctn_nlpd.nlpidData.length);
  1413. if (pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_nlpd.nlpidData.value)
  1414. {
  1415. memcpy(pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_nlpd.nlpidData.value,
  1416. pTotCap->Cap.H245Dat_NLPID.application.u.DACy_applctn_nlpd.nlpidData.value,
  1417. pTotCap->Cap.H245Dat_NLPID.application.u.DACy_applctn_nlpd.nlpidData.length);
  1418. }
  1419. else
  1420. lError = H245_ERROR_NOMEM;
  1421. }
  1422. else
  1423. pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_nlpd.nlpidData.value = NULL;
  1424. pCapability->u.rcvDtApplctnCpblty.application.choice = DACy_applctn_nlpd_chosen;
  1425. break;
  1426. case H245_CLIENT_DAT_DSVD:
  1427. H245TRACE(0,20,"API:load_cap - H245_CLIENT_DAT_DSVD");
  1428. pCapability->u.rcvDtApplctnCpblty = pTotCap->Cap.H245Dat_DSMCC;
  1429. pCapability->u.rcvDtApplctnCpblty.application.choice = DACy_applctn_dsvdCntrl_chosen;
  1430. break;
  1431. case H245_CLIENT_DAT_H222:
  1432. H245TRACE(0,20,"API:load_cap - H245_CLIENT_DAT_H222");
  1433. pCapability->u.rcvDtApplctnCpblty = pTotCap->Cap.H245Dat_H222;
  1434. if (pTotCap->Cap.H245Dat_H222.application.u.DACy_an_h222DtPrttnng.choice == DtPrtclCpblty_nnStndrd_chosen)
  1435. {
  1436. lError = CopyNonStandardParameter(&pCapability->u.rcvDtApplctnCpblty.application.u.DACy_an_h222DtPrttnng.u.DtPrtclCpblty_nnStndrd,
  1437. &pTotCap->Cap.H245Dat_H222.application.u.DACy_an_h222DtPrttnng.u.DtPrtclCpblty_nnStndrd);
  1438. }
  1439. pCapability->u.rcvDtApplctnCpblty.application.choice = DACy_an_h222DtPrttnng_chosen ;
  1440. break;
  1441. default:
  1442. H245TRACE(0,20,"API:load_cap - default");
  1443. lError = H245_ERROR_NOSUP;
  1444. } /* switch */
  1445. if (lError != H245_ERROR_OK)
  1446. H245TRACE(0,1,"API:load_cap -> %s",map_api_error(lError));
  1447. else
  1448. H245TRACE(0,10,"API:load_cap -> OK");
  1449. return lError;
  1450. }
  1451. void
  1452. free_cap (struct Capability * pCapability, // input, output
  1453. const H245_TOTCAP_T *pTotCap) // input
  1454. {
  1455. ASSERT(!IsBadWritePtr(pCapability, sizeof(*pCapability)));
  1456. switch (pTotCap->ClientType)
  1457. {
  1458. case H245_CLIENT_NONSTD:
  1459. FreeNonStandardParameter(&pCapability->u.Capability_nonStandard);
  1460. break;
  1461. case H245_CLIENT_VID_NONSTD:
  1462. FreeNonStandardParameter(&pCapability->u.receiveVideoCapability.u.VdCpblty_nonStandard);
  1463. break;
  1464. case H245_CLIENT_AUD_NONSTD:
  1465. FreeNonStandardParameter(&pCapability->u.receiveAudioCapability.u.AdCpblty_nonStandard);
  1466. break;
  1467. case H245_CLIENT_DAT_NONSTD:
  1468. FreeNonStandardParameter(&pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_nnStndrd);
  1469. break;
  1470. case H245_CLIENT_DAT_T120:
  1471. if (pTotCap->Cap.H245Dat_T120.application.u.DACy_applctn_t120.choice == DtPrtclCpblty_nnStndrd_chosen)
  1472. {
  1473. FreeNonStandardParameter(&pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_t120.u.DtPrtclCpblty_nnStndrd);
  1474. }
  1475. else
  1476. {
  1477. if (pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_t120.u.DtPrtclCpblty_nnStndrd.data.value)
  1478. {
  1479. WARNING_OUT(("H245_CLIENT_DAT_T120 no non-standard parameter to free"));
  1480. }
  1481. }
  1482. break;
  1483. case H245_CLIENT_DAT_DSMCC:
  1484. if (pTotCap->Cap.H245Dat_DSMCC.application.u.DACy_applctn_dsm_cc.choice == DtPrtclCpblty_nnStndrd_chosen)
  1485. {
  1486. FreeNonStandardParameter(&pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_dsm_cc.u.DtPrtclCpblty_nnStndrd);
  1487. }
  1488. break;
  1489. case H245_CLIENT_DAT_USERDATA:
  1490. if (pTotCap->Cap.H245Dat_USERDATA.application.u.DACy_applctn_usrDt.choice == DtPrtclCpblty_nnStndrd_chosen)
  1491. {
  1492. FreeNonStandardParameter(&pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_usrDt.u.DtPrtclCpblty_nnStndrd);
  1493. }
  1494. break;
  1495. case H245_CLIENT_DAT_T84:
  1496. if (pTotCap->Cap.H245Dat_T84.application.u.DACy_applctn_t84.t84Protocol.choice == DtPrtclCpblty_nnStndrd_chosen)
  1497. {
  1498. FreeNonStandardParameter(&pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_t84.t84Protocol.u.DtPrtclCpblty_nnStndrd);
  1499. }
  1500. break;
  1501. case H245_CLIENT_DAT_T434:
  1502. if (pTotCap->Cap.H245Dat_T434.application.u.DACy_applctn_t434.choice == DtPrtclCpblty_nnStndrd_chosen)
  1503. {
  1504. FreeNonStandardParameter(&pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_t434.u.DtPrtclCpblty_nnStndrd);
  1505. }
  1506. break;
  1507. case H245_CLIENT_DAT_H224:
  1508. if (pTotCap->Cap.H245Dat_H224.application.u.DACy_applctn_h224.choice == DtPrtclCpblty_nnStndrd_chosen)
  1509. {
  1510. FreeNonStandardParameter(&pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_h224.u.DtPrtclCpblty_nnStndrd);
  1511. }
  1512. break;
  1513. case H245_CLIENT_DAT_NLPID:
  1514. if (pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_nlpd.nlpidData.value)
  1515. {
  1516. MemFree(pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_nlpd.nlpidData.value);
  1517. }
  1518. if (pTotCap->Cap.H245Dat_NLPID.application.u.DACy_applctn_nlpd.nlpidProtocol.choice == DtPrtclCpblty_nnStndrd_chosen)
  1519. {
  1520. FreeNonStandardParameter(&pCapability->u.rcvDtApplctnCpblty.application.u.DACy_applctn_nlpd.nlpidProtocol.u.DtPrtclCpblty_nnStndrd);
  1521. }
  1522. break;
  1523. case H245_CLIENT_DAT_H222:
  1524. if (pTotCap->Cap.H245Dat_H222.application.u.DACy_an_h222DtPrttnng.choice == DtPrtclCpblty_nnStndrd_chosen)
  1525. {
  1526. FreeNonStandardParameter(&pCapability->u.rcvDtApplctnCpblty.application.u.DACy_an_h222DtPrttnng.u.DtPrtclCpblty_nnStndrd);
  1527. }
  1528. break;
  1529. }
  1530. }
  1531. /*****************************************************************************
  1532. *
  1533. * TYPE: Global
  1534. *
  1535. * PROCEDURE: build_totcap_from_mux
  1536. *
  1537. * DESCRIPTION:
  1538. * called by both top down , and bottom up..
  1539. *
  1540. * RETURN:
  1541. *
  1542. * ASSUMES:
  1543. *
  1544. *****************************************************************************/
  1545. HRESULT
  1546. build_totcap_from_mux(H245_TOTCAP_T *pTotCap, MultiplexCapability *pMuxCap, H245_CAPDIR_T Dir)
  1547. {
  1548. H245TRACE(0,10,"API:build_totcap_from_mux <-");
  1549. /* initialize TotCap */
  1550. pTotCap->Dir = Dir;
  1551. pTotCap->DataType = H245_DATA_MUX;
  1552. pTotCap->ClientType = H245_CLIENT_DONTCARE;
  1553. pTotCap->CapId = 0;
  1554. switch (pMuxCap->choice)
  1555. {
  1556. case MltplxCpblty_nonStandard_chosen:
  1557. H245TRACE(0,20,"API:build_totcap_from_mux - MltplxCpblty_nonStandard_chosen");
  1558. pTotCap->Cap.H245Mux_NONSTD = pMuxCap->u.MltplxCpblty_nonStandard;
  1559. pTotCap->ClientType = H245_CLIENT_MUX_NONSTD;
  1560. // TBD - copy nonstandard parameter
  1561. H245PANIC();
  1562. break;
  1563. case h222Capability_chosen:
  1564. H245TRACE(0,20,"API:build_totcap_from_mux - h222Capability_chosen");
  1565. pTotCap->Cap.H245Mux_H222 = pMuxCap->u.h222Capability;
  1566. pTotCap->ClientType = H245_CLIENT_MUX_H222;
  1567. break;
  1568. case h223Capability_chosen:
  1569. H245TRACE(0,20,"API:build_totcap_from_mux - h223Capability_chosen");
  1570. pTotCap->Cap.H245Mux_H223 = pMuxCap->u.h223Capability;
  1571. pTotCap->ClientType = H245_CLIENT_MUX_H223;
  1572. break;
  1573. case v76Capability_chosen:
  1574. H245TRACE(0,20,"API:build_totcap_from_mux - v76Capability_chosen");
  1575. pTotCap->Cap.H245Mux_VGMUX = pMuxCap->u.v76Capability;
  1576. pTotCap->ClientType = H245_CLIENT_MUX_VGMUX;
  1577. break;
  1578. case h2250Capability_chosen:
  1579. H245TRACE(0,20,"API:build_totcap_from_mux - h2250Capability_chosen");
  1580. pTotCap->Cap.H245Mux_H2250 = pMuxCap->u.h2250Capability;
  1581. pTotCap->ClientType = H245_CLIENT_MUX_H2250;
  1582. break;
  1583. default:
  1584. H245TRACE(0,20,"API:build_totcap_from_mux - unrecogized choice %d", pMuxCap->choice);
  1585. return H245_ERROR_NOSUP;
  1586. }
  1587. H245TRACE(0,10,"API:build_totcap_from_mux -> OK");
  1588. return H245_ERROR_OK;
  1589. }
  1590. /*****************************************************************************
  1591. *
  1592. * TYPE: Global
  1593. *
  1594. * PROCEDURE: build_totcap_from_captbl
  1595. *
  1596. * DESCRIPTION:
  1597. * called by both top down , and bottom up..
  1598. *
  1599. * RETURN:
  1600. *
  1601. * ASSUMES:
  1602. *
  1603. *****************************************************************************/
  1604. HRESULT
  1605. build_totcap_from_captbl (H245_TOTCAP_T *pTotCap,
  1606. CapabilityTableLink pCapLink,
  1607. int lcl_rmt)
  1608. {
  1609. unsigned short choice;
  1610. DWORD error;
  1611. H245TRACE(0,10,"API:build_totcap_from_captbl <-");
  1612. /* initialize TotCap */
  1613. pTotCap->Dir = H245_CAPDIR_DONTCARE;
  1614. pTotCap->DataType = H245_DATA_DONTCARE;
  1615. pTotCap->ClientType = H245_CLIENT_DONTCARE;
  1616. pTotCap->CapId = 0;
  1617. /* note.. this has to come first if using for deleted caps */
  1618. /* capability entry number will be present, however if */
  1619. /* the capability is not present that indicates that the */
  1620. /* capability should be deleted */
  1621. pTotCap->CapId = pCapLink->value.capabilityTableEntryNumber;
  1622. if (!(pCapLink->value.bit_mask & capability_present))
  1623. return H245_ERROR_OK;
  1624. switch (pCapLink->value.capability.choice)
  1625. {
  1626. case Capability_nonStandard_chosen:
  1627. H245TRACE(0,20,"API:build_totcap_from_captbl - Capability_nonStandard_chosen");
  1628. pTotCap->DataType = H245_DATA_NONSTD;
  1629. pTotCap->Dir = lcl_rmt==H245_LOCAL?H245_CAPDIR_LCLRX:H245_CAPDIR_RMTRX;
  1630. choice = Capability_nonStandard_chosen;
  1631. break;
  1632. case receiveVideoCapability_chosen:
  1633. H245TRACE(0,20,"API:build_totcap_from_captbl - receiveVideoCapability_chosen");
  1634. pTotCap->DataType = H245_DATA_VIDEO;
  1635. pTotCap->Dir = lcl_rmt==H245_LOCAL?H245_CAPDIR_LCLRX:H245_CAPDIR_RMTRX;
  1636. choice = pCapLink->value.capability.u.receiveVideoCapability.choice;
  1637. break;
  1638. case transmitVideoCapability_chosen:
  1639. H245TRACE(0,20,"API:build_totcap_from_captbl - transmitVideoCapability_chosen");
  1640. pTotCap->DataType = H245_DATA_VIDEO;
  1641. pTotCap->Dir = lcl_rmt==H245_LOCAL?H245_CAPDIR_LCLTX:H245_CAPDIR_RMTTX;
  1642. choice = pCapLink->value.capability.u.transmitVideoCapability.choice;
  1643. break;
  1644. case rcvAndTrnsmtVdCpblty_chosen:
  1645. H245TRACE(0,20,"API:build_totcap_from_captbl - rcvAndTrnsmtVdCpblty_chosen");
  1646. pTotCap->DataType = H245_DATA_VIDEO;
  1647. pTotCap->Dir = lcl_rmt==H245_LOCAL?H245_CAPDIR_LCLRXTX:H245_CAPDIR_RMTRXTX;
  1648. choice = pCapLink->value.capability.u.rcvAndTrnsmtVdCpblty.choice;
  1649. break;
  1650. case receiveAudioCapability_chosen:
  1651. H245TRACE(0,20,"API:build_totcap_from_captbl - receiveAudioCapability_chosen");
  1652. pTotCap->DataType = H245_DATA_AUDIO;
  1653. pTotCap->Dir = lcl_rmt==H245_LOCAL?H245_CAPDIR_LCLRX:H245_CAPDIR_RMTRX;
  1654. choice = pCapLink->value.capability.u.receiveAudioCapability.choice;
  1655. break;
  1656. case transmitAudioCapability_chosen:
  1657. H245TRACE(0,20,"API:build_totcap_from_captbl - transmitAudioCapability_chosen");
  1658. pTotCap->DataType = H245_DATA_AUDIO;
  1659. pTotCap->Dir = lcl_rmt==H245_LOCAL?H245_CAPDIR_LCLTX:H245_CAPDIR_RMTTX;
  1660. choice = pCapLink->value.capability.u.transmitAudioCapability.choice;
  1661. break;
  1662. case rcvAndTrnsmtAdCpblty_chosen:
  1663. H245TRACE(0,20,"API:build_totcap_from_captbl - rcvAndTrnsmtAdCpblty_chosen");
  1664. pTotCap->DataType = H245_DATA_AUDIO;
  1665. pTotCap->Dir = lcl_rmt==H245_LOCAL?H245_CAPDIR_LCLRXTX:H245_CAPDIR_RMTRXTX;
  1666. choice = pCapLink->value.capability.u.rcvAndTrnsmtAdCpblty.choice;
  1667. break;
  1668. case rcvDtApplctnCpblty_chosen:
  1669. H245TRACE(0,20,"API:build_totcap_from_captbl - rcvDtApplctnCpblty_chosen");
  1670. pTotCap->DataType = H245_DATA_DATA;
  1671. pTotCap->Dir = lcl_rmt==H245_LOCAL?H245_CAPDIR_LCLRX:H245_CAPDIR_RMTRX;
  1672. choice = pCapLink->value.capability.u.rcvDtApplctnCpblty.application.choice;
  1673. break;
  1674. case trnsmtDtApplctnCpblty_chosen:
  1675. H245TRACE(0,20,"API:build_totcap_from_captbl - trnsmtDtApplctnCpblty_chosen");
  1676. pTotCap->DataType = H245_DATA_DATA;
  1677. pTotCap->Dir = lcl_rmt==H245_LOCAL?H245_CAPDIR_LCLTX:H245_CAPDIR_RMTTX;
  1678. choice = pCapLink->value.capability.u.trnsmtDtApplctnCpblty.application.choice;
  1679. break;
  1680. case rATDACy_chosen:
  1681. H245TRACE(0,20,"API:build_totcap_from_captbl - rATDACy_chosen");
  1682. pTotCap->DataType = H245_DATA_DATA;
  1683. pTotCap->Dir = lcl_rmt==H245_LOCAL?H245_CAPDIR_LCLRX:H245_CAPDIR_RMTRX;
  1684. choice = pCapLink->value.capability.u.rATDACy.application.choice;
  1685. break;
  1686. case h233EncryptnTrnsmtCpblty_chosen:
  1687. H245TRACE(0,20,"API:build_totcap_from_captbl - h233EncryptnTrnsmtCpblty_chosen");
  1688. pTotCap->DataType = H245_DATA_ENCRYPT_D;
  1689. pTotCap->Dir = lcl_rmt==H245_LOCAL?H245_CAPDIR_LCLRXTX:H245_CAPDIR_RMTRXTX;
  1690. /* (TBC) */
  1691. return H245_ERROR_NOSUP;
  1692. break;
  1693. case h233EncryptnRcvCpblty_chosen:
  1694. H245TRACE(0,20,"API:build_totcap_from_captbl - h233EncryptnRcvCpblty_chosen");
  1695. pTotCap->DataType = H245_DATA_ENCRYPT_D;
  1696. pTotCap->Dir = lcl_rmt==H245_LOCAL?H245_CAPDIR_LCLRXTX:H245_CAPDIR_RMTRXTX;
  1697. /* (TBC) */
  1698. return H245_ERROR_NOSUP;
  1699. break;
  1700. default:
  1701. H245TRACE(0,20,"API:build_totcap_from_captbl - default");
  1702. /* TBC .. */
  1703. return H245_ERROR_NOSUP;
  1704. break;
  1705. }
  1706. /* load the tot cap's capability and client from capability */
  1707. if ((error = build_totcap_cap_n_client_from_capability (&pCapLink->value.capability,
  1708. pTotCap->DataType,
  1709. choice,
  1710. pTotCap)) != H245_ERROR_OK)
  1711. {
  1712. H245TRACE(0,1,"API:build_totcap_from_captbl -> %s",map_api_error(error));
  1713. return error;
  1714. }
  1715. H245TRACE(0,10,"API:build_totcap_from_captbl -> OK");
  1716. return H245_ERROR_OK;
  1717. }
  1718. /*****************************************************************************
  1719. *
  1720. * TYPE: Global
  1721. *
  1722. * PROCEDURE: build_totcap_n_client_from_capbility
  1723. *
  1724. * DESCRIPTION:
  1725. * Take a capability structure (pCapability),
  1726. * data type (audio/video/data) choice...
  1727. * Which is found in the pdu . and the totcap;
  1728. * NOTE: does not handle H245_DATA_MUX_T
  1729. *
  1730. * RETURN:
  1731. *
  1732. * ASSUMES:
  1733. * ONLY HANDLES Terminal Caps.. Does not handle MUX Caps.
  1734. *
  1735. * totcap.DataType is defined
  1736. * totcap.CapId is defined
  1737. * totcap.Cap is non NULL
  1738. *
  1739. *****************************************************************************/
  1740. HRESULT
  1741. build_totcap_cap_n_client_from_capability (struct Capability *pCapability,
  1742. H245_DATA_T data_type,
  1743. unsigned short choice,
  1744. H245_TOTCAP_T *pTotCap)
  1745. {
  1746. H245TRACE(0,10,"API:build_totcap_cap_n_client_from_capability <-");
  1747. switch (data_type)
  1748. {
  1749. case H245_DATA_NONSTD:
  1750. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - H245_DATA_NONSTD");
  1751. pTotCap->ClientType = H245_CLIENT_NONSTD;
  1752. pTotCap->Cap.H245_NonStd = pCapability->u.Capability_nonStandard;
  1753. break;
  1754. case H245_DATA_AUDIO:
  1755. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - H245_DATA_AUDIO");
  1756. switch (choice)
  1757. {
  1758. case AdCpblty_nonStandard_chosen:
  1759. H245TRACE(0,20, "API:build_totcap_cap_n_client_from_capability - choice - AdCpblty_nonStandard_chosen");
  1760. pTotCap->ClientType = H245_CLIENT_AUD_NONSTD;
  1761. pTotCap->Cap.H245Aud_NONSTD = pCapability->u.receiveAudioCapability.u.AdCpblty_nonStandard;
  1762. break;
  1763. case AdCpblty_g711Alaw64k_chosen:
  1764. H245TRACE(0,20, "API:build_totcap_cap_n_client_from_capability - choice - AdCpblty_g711Alaw64k_chosen");
  1765. pTotCap->ClientType = H245_CLIENT_AUD_G711_ALAW64;
  1766. pTotCap->Cap.H245Aud_G711_ALAW64 = pCapability->u.receiveAudioCapability.u.AdCpblty_g711Alaw64k;
  1767. break;
  1768. case AdCpblty_g711Alaw56k_chosen:
  1769. H245TRACE(0,20, "API:build_totcap_cap_n_client_from_capability - choice - AdCpblty_g711Alaw56k_chosen");
  1770. pTotCap->ClientType = H245_CLIENT_AUD_G711_ALAW56;
  1771. pTotCap->Cap.H245Aud_G711_ALAW56 = pCapability->u.receiveAudioCapability.u.AdCpblty_g711Alaw56k;
  1772. break;
  1773. case AdCpblty_g711Ulaw64k_chosen:
  1774. H245TRACE(0,20, "API:build_totcap_cap_n_client_from_capability - choice - AdCpblty_g711Ulaw64k_chosen");
  1775. pTotCap->ClientType = H245_CLIENT_AUD_G711_ULAW64;
  1776. pTotCap->Cap.H245Aud_G711_ULAW64 = pCapability->u.receiveAudioCapability.u.AdCpblty_g711Ulaw64k;
  1777. break;
  1778. case AdCpblty_g711Ulaw56k_chosen:
  1779. H245TRACE(0,20, "API:build_totcap_cap_n_client_from_capability - choice - AdCpblty_g711Ulaw56k_chosen");
  1780. pTotCap->ClientType = H245_CLIENT_AUD_G711_ULAW56;
  1781. pTotCap->Cap.H245Aud_G711_ULAW56 = pCapability->u.receiveAudioCapability.u.AdCpblty_g711Ulaw56k;
  1782. break;
  1783. case AudioCapability_g722_64k_chosen:
  1784. H245TRACE(0,20, "API:build_totcap_cap_n_client_from_capability - choice - AudioCapability_g722_64k_chosen");
  1785. pTotCap->ClientType = H245_CLIENT_AUD_G722_64;
  1786. pTotCap->Cap.H245Aud_G722_64 = pCapability->u.receiveAudioCapability.u.AudioCapability_g722_64k;
  1787. break;
  1788. case AudioCapability_g722_56k_chosen:
  1789. H245TRACE(0,20, "API:build_totcap_cap_n_client_from_capability - choice - AudioCapability_g722_56k_chosen");
  1790. pTotCap->ClientType = H245_CLIENT_AUD_G722_56;
  1791. pTotCap->Cap.H245Aud_G722_56 = pCapability->u.receiveAudioCapability.u.AudioCapability_g722_56k;
  1792. break;
  1793. case AudioCapability_g722_48k_chosen:
  1794. H245TRACE(0,20, "API:build_totcap_cap_n_client_from_capability - choice - AudioCapability_g722_48k_chosen");
  1795. pTotCap->ClientType = H245_CLIENT_AUD_G722_48;
  1796. pTotCap->Cap.H245Aud_G722_48 = pCapability->u.receiveAudioCapability.u.AudioCapability_g722_48k;
  1797. break;
  1798. case AudioCapability_g7231_chosen:
  1799. H245TRACE(0,20, "API:build_totcap_cap_n_client_from_capability - choice - AudioCapability_g7231_chosen");
  1800. pTotCap->ClientType = H245_CLIENT_AUD_G723;
  1801. pTotCap->Cap.H245Aud_G723 = pCapability->u.receiveAudioCapability.u.AudioCapability_g7231;
  1802. break;
  1803. case AudioCapability_g728_chosen:
  1804. H245TRACE(0,20, "API:build_totcap_cap_n_client_from_capability - choice - AudioCapability_g728_chosen");
  1805. pTotCap->ClientType = H245_CLIENT_AUD_G728;
  1806. pTotCap->Cap.H245Aud_G728 = pCapability->u.receiveAudioCapability.u.AudioCapability_g728;
  1807. break;
  1808. case AudioCapability_g729_chosen:
  1809. H245TRACE(0,20, "API:build_totcap_cap_n_client_from_capability - choice - AudioCapability_g729_chosen");
  1810. pTotCap->ClientType = H245_CLIENT_AUD_G729;
  1811. pTotCap->Cap.H245Aud_G729 = pCapability->u.receiveAudioCapability.u.AudioCapability_g729;
  1812. break;
  1813. case AdCpblty_g729AnnexA_chosen:
  1814. H245TRACE(0,20, "API:build_totcap_cap_n_client_from_capability - choice - AdCpblty_g729AnnexA_chosen");
  1815. pTotCap->ClientType = H245_CLIENT_AUD_GDSVD;
  1816. pTotCap->Cap.H245Aud_GDSVD = pCapability->u.receiveAudioCapability.u.AdCpblty_g729AnnexA;
  1817. break;
  1818. case is11172AudioCapability_chosen:
  1819. H245TRACE(0,20, "API:build_totcap_cap_n_client_from_capability - choice - is11172AudioCapability_chosen");
  1820. pTotCap->ClientType = H245_CLIENT_AUD_IS11172;
  1821. pTotCap->Cap.H245Aud_IS11172 = pCapability->u.receiveAudioCapability.u.is11172AudioCapability;
  1822. break;
  1823. case is13818AudioCapability_chosen:
  1824. H245TRACE(0,20, "API:build_totcap_cap_n_client_from_capability - choice - is13818AudioCapability_chosen");
  1825. pTotCap->ClientType = H245_CLIENT_AUD_IS13818;
  1826. pTotCap->Cap.H245Aud_IS13818 = pCapability->u.receiveAudioCapability.u.is13818AudioCapability;
  1827. break;
  1828. default:
  1829. pTotCap->ClientType = 0;
  1830. H245TRACE(0,20, "API:build_totcap_cap_n_client_from_capability - choice - default");
  1831. return H245_ERROR_NOSUP;
  1832. break;
  1833. }
  1834. break;
  1835. case H245_DATA_VIDEO:
  1836. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - H245_DATA_VIDEO");
  1837. switch (choice)
  1838. {
  1839. case VdCpblty_nonStandard_chosen:
  1840. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - choice - VdCpblty_nonStandard_chosen");
  1841. pTotCap->ClientType = H245_CLIENT_VID_NONSTD;
  1842. pTotCap->Cap.H245Vid_NONSTD = pCapability->u.receiveVideoCapability.u.VdCpblty_nonStandard;
  1843. break;
  1844. case h261VideoCapability_chosen:
  1845. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - choice - h261VideoCapability_chosen");
  1846. pTotCap->ClientType = H245_CLIENT_VID_H261;
  1847. pTotCap->Cap.H245Vid_H261 = pCapability->u.receiveVideoCapability.u.h261VideoCapability;
  1848. break;
  1849. case h262VideoCapability_chosen:
  1850. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - choice - h262VideoCapability_chosen");
  1851. pTotCap->ClientType = H245_CLIENT_VID_H262;
  1852. pTotCap->Cap.H245Vid_H262 = pCapability->u.receiveVideoCapability.u.h262VideoCapability;
  1853. break;
  1854. case h263VideoCapability_chosen:
  1855. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - choice - h263VideoCapability_chosen");
  1856. pTotCap->ClientType = H245_CLIENT_VID_H263;
  1857. pTotCap->Cap.H245Vid_H263 = pCapability->u.receiveVideoCapability.u.h263VideoCapability;
  1858. break;
  1859. case is11172VideoCapability_chosen:
  1860. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - choice - is11172VideoCapability_chosen");
  1861. pTotCap->ClientType = H245_CLIENT_VID_IS11172;
  1862. pTotCap->Cap.H245Vid_IS11172 = pCapability->u.receiveVideoCapability.u.is11172VideoCapability;
  1863. break;
  1864. default:
  1865. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - choice - default");
  1866. pTotCap->ClientType = 0;
  1867. return H245_ERROR_NOSUP;
  1868. break;
  1869. }
  1870. break;
  1871. case H245_DATA_DATA:
  1872. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - H245_DATA_DATA");
  1873. pTotCap->Cap.H245Dat_NONSTD = pCapability->u.rcvDtApplctnCpblty;
  1874. switch (choice)
  1875. {
  1876. case DACy_applctn_nnStndrd_chosen:
  1877. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - choice - DACy_applctn_nnStndrd_chosen");
  1878. pTotCap->ClientType = H245_CLIENT_DAT_NONSTD;
  1879. break;
  1880. case DACy_applctn_t120_chosen:
  1881. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - choice - DACy_applctn_t120_chosen");
  1882. pTotCap->ClientType = H245_CLIENT_DAT_T120;
  1883. break;
  1884. case DACy_applctn_dsm_cc_chosen:
  1885. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - choice - DACy_applctn_dsm_cc_chosen");
  1886. pTotCap->ClientType = H245_CLIENT_DAT_DSMCC;
  1887. break;
  1888. case DACy_applctn_usrDt_chosen:
  1889. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - choice - DACy_applctn_usrDt_chosen");
  1890. pTotCap->ClientType = H245_CLIENT_DAT_USERDATA;
  1891. break;
  1892. case DACy_applctn_t84_chosen:
  1893. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - choice - DACy_applctn_t84_chosen");
  1894. pTotCap->ClientType = H245_CLIENT_DAT_T84;
  1895. break;
  1896. case DACy_applctn_t434_chosen:
  1897. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - choice - DACy_applctn_t434_chosen");
  1898. pTotCap->ClientType = H245_CLIENT_DAT_T434;
  1899. break;
  1900. case DACy_applctn_h224_chosen:
  1901. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - choice - DACy_applctn_h224_chosen");
  1902. pTotCap->ClientType = H245_CLIENT_DAT_H224;
  1903. break;
  1904. case DACy_applctn_nlpd_chosen:
  1905. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - choice - DACy_applctn_nlpd_chosen");
  1906. pTotCap->ClientType = H245_CLIENT_DAT_NLPID;
  1907. break;
  1908. case DACy_applctn_dsvdCntrl_chosen:
  1909. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - choice - DACy_applctn_dsvdCntrl_chosen");
  1910. pTotCap->ClientType = H245_CLIENT_DAT_DSVD;
  1911. break;
  1912. case DACy_an_h222DtPrttnng_chosen:
  1913. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - choice - DACy_an_h222DtPrttnng_chosen");
  1914. pTotCap->ClientType = H245_CLIENT_DAT_H222;
  1915. break;
  1916. default:
  1917. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - choice - default");
  1918. pTotCap->ClientType = 0;
  1919. return H245_ERROR_NOSUP;
  1920. break;
  1921. }
  1922. break;
  1923. case H245_DATA_ENCRYPT_D:
  1924. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - H245_DATA_ENCRYPT_D");
  1925. pTotCap->ClientType = 0;
  1926. H245PANIC();
  1927. return H245_ERROR_NOSUP;
  1928. break;
  1929. case H245_DATA_MUX:
  1930. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - H245_DATA_MUX");
  1931. pTotCap->ClientType = 0;
  1932. H245PANIC();
  1933. return H245_ERROR_NOSUP;
  1934. break;
  1935. default:
  1936. H245TRACE(0,20,"API:build_totcap_cap_n_client_from_capability - default");
  1937. pTotCap->ClientType = 0;
  1938. H245PANIC();
  1939. return H245_ERROR_NOSUP;
  1940. }
  1941. H245TRACE(0,10,"API:build_totcap_cap_n_client_from_capability -> OK");
  1942. return H245_ERROR_OK;
  1943. }
  1944. /*****************************************************************************
  1945. *
  1946. * TYPE:
  1947. *
  1948. * PROCEDURE: del_link
  1949. *
  1950. * DESCRIPTION:
  1951. *
  1952. * RETURN:
  1953. *
  1954. * ASSUME: List is Locked
  1955. *
  1956. *****************************************************************************/
  1957. HRESULT
  1958. del_link (
  1959. H245_LINK_T **pp_link_start,
  1960. H245_LINK_T *p_link
  1961. )
  1962. {
  1963. struct H245_LINK_T *p_link_look = NULL;
  1964. struct H245_LINK_T *p_link_lst = NULL;
  1965. H245TRACE(0,10,"API:del_link <-");
  1966. /* get current count on table */
  1967. for (p_link_look = *pp_link_start;
  1968. p_link_look && (p_link_look != p_link);
  1969. p_link_lst = p_link_look,
  1970. p_link_look = p_link_look->p_next
  1971. );
  1972. /* cap was not in list */
  1973. if (!p_link_look)
  1974. {
  1975. H245TRACE(0,1,"API:del_link -> link not found!");
  1976. return H245_ERROR_PARAM;
  1977. }
  1978. /* modify entry in table */
  1979. if (!p_link_lst)
  1980. *pp_link_start = p_link_look->p_next;
  1981. else
  1982. p_link_lst->p_next = p_link_look->p_next;
  1983. MemFree (p_link_look);
  1984. H245TRACE(0,10,"API:del_link -> OK");
  1985. return H245_ERROR_OK;
  1986. }
  1987. /*****************************************************************************
  1988. *
  1989. * TYPE:
  1990. *
  1991. * PROCEDURE: del_cap_link
  1992. *
  1993. * DESCRIPTION:
  1994. *
  1995. * ASSUMES: Capability Table is locked before call
  1996. *
  1997. * RETURN: None
  1998. *
  1999. * ASSUME: List is Locked
  2000. *
  2001. *
  2002. *****************************************************************************/
  2003. HRESULT
  2004. del_cap_link (
  2005. struct TerminalCapabilitySet *pTermCapSet, /* capabilty set */
  2006. CapabilityTableLink pCapLink
  2007. )
  2008. {
  2009. CapabilityTableLink pCapLink_look = NULL;
  2010. CapabilityTableLink pCapLink_lst = NULL;
  2011. CapabilityTableEntry *pCap_entry = NULL;
  2012. unsigned char *p_char_to_free = NULL;
  2013. POBJECTID p_objid_to_free = NULL;
  2014. H245TRACE(0,10,"API:del_cap_link <-");
  2015. ASSERT (pTermCapSet);
  2016. ASSERT (pCapLink);
  2017. /************************************************/
  2018. /* BEGIN : Non Standard Capability Special Case */
  2019. /************************************************/
  2020. switch (pCapLink->value.capability.choice)
  2021. {
  2022. case Capability_nonStandard_chosen:
  2023. /* free nonstandard data value */
  2024. p_char_to_free = pCapLink->value.capability.u.Capability_nonStandard.data.value;
  2025. /* free the object id */
  2026. if (pCapLink->value.capability.u.Capability_nonStandard.nonStandardIdentifier.choice == object_chosen)
  2027. p_objid_to_free = pCapLink->value.capability.u.Capability_nonStandard.nonStandardIdentifier.u.object;
  2028. break;
  2029. case receiveVideoCapability_chosen:
  2030. case transmitVideoCapability_chosen:
  2031. case rcvAndTrnsmtVdCpblty_chosen:
  2032. /* free nonstandard data value */
  2033. if (pCapLink->value.capability.u.receiveVideoCapability.choice == VdCpblty_nonStandard_chosen)
  2034. {
  2035. /* nonstd value */
  2036. p_char_to_free = pCapLink->value.capability.u.receiveVideoCapability.u.VdCpblty_nonStandard.data.value;
  2037. /* free the object id */
  2038. if (pCapLink->value.capability.u.receiveVideoCapability.u.VdCpblty_nonStandard.nonStandardIdentifier.choice == object_chosen)
  2039. p_objid_to_free = pCapLink->value.capability.u.receiveVideoCapability.u.VdCpblty_nonStandard.nonStandardIdentifier.u.object;
  2040. }
  2041. break;
  2042. case receiveAudioCapability_chosen:
  2043. case transmitAudioCapability_chosen:
  2044. case rcvAndTrnsmtAdCpblty_chosen:
  2045. /* free nonstandard data value */
  2046. if (pCapLink->value.capability.u.receiveAudioCapability.choice == AdCpblty_nonStandard_chosen)
  2047. {
  2048. /* nonstd value */
  2049. p_char_to_free = pCapLink->value.capability.u.receiveAudioCapability.u.AdCpblty_nonStandard.data.value;
  2050. /* free the object id */
  2051. if (pCapLink->value.capability.u.receiveAudioCapability.u.AdCpblty_nonStandard.nonStandardIdentifier.choice == object_chosen)
  2052. p_objid_to_free = pCapLink->value.capability.u.receiveAudioCapability.u.AdCpblty_nonStandard.nonStandardIdentifier.u.object;
  2053. }
  2054. break;
  2055. case rcvDtApplctnCpblty_chosen:
  2056. case trnsmtDtApplctnCpblty_chosen:
  2057. case rATDACy_chosen :
  2058. if (pCapLink->value.capability.u.rcvDtApplctnCpblty.application.choice == DACy_applctn_nnStndrd_chosen)
  2059. {
  2060. /* free nonstandard data value */
  2061. p_char_to_free = pCapLink->value.capability.u.rcvDtApplctnCpblty.application.u.DACy_applctn_nnStndrd.data.value;
  2062. /* free the object id */
  2063. if (pCapLink->value.capability.u.rcvDtApplctnCpblty.application.u.DACy_applctn_nnStndrd.nonStandardIdentifier.choice == object_chosen)
  2064. p_objid_to_free = pCapLink->value.capability.u.rcvDtApplctnCpblty.application.u.DACy_applctn_nnStndrd.nonStandardIdentifier.u.object;
  2065. }
  2066. break;
  2067. case h233EncryptnTrnsmtCpblty_chosen:
  2068. case h233EncryptnRcvCpblty_chosen:
  2069. default:
  2070. break;
  2071. }
  2072. /* free the value if there is one */
  2073. if (p_char_to_free)
  2074. {
  2075. H245TRACE(0,0,"TMPMSG: Free NonStandard Value");
  2076. MemFree(p_char_to_free);
  2077. }
  2078. /* free the objectid */
  2079. if (p_objid_to_free)
  2080. {
  2081. H245TRACE(0,0,"TMPMSG: Free NonStandard ID");
  2082. free_object_id (p_objid_to_free);
  2083. }
  2084. /************************************************/
  2085. /* END : Non Standard Capability Special Case */
  2086. /************************************************/
  2087. H245TRACE(0,10,"API:del_cap_link -> OK");
  2088. return del_link(&((H245_LINK_T *) pTermCapSet->capabilityTable),
  2089. (H245_LINK_T *) pCapLink);
  2090. }
  2091. /*****************************************************************************
  2092. *
  2093. * TYPE:
  2094. *
  2095. * PROCEDURE: dealloc_link_cap_list
  2096. *
  2097. * DESCRIPTION: deallocs the entire list of capabilities from a capabiltiy
  2098. * set
  2099. *
  2100. * ASSUMES: Capability Table is locked before call
  2101. * del_cap_link updates pTermCapSet->capabilityTable
  2102. * correctly.
  2103. *
  2104. *****************************************************************************/
  2105. void
  2106. dealloc_link_cap_list ( struct TerminalCapabilitySet *pTermCapSet)
  2107. {
  2108. while (pTermCapSet->capabilityTable)
  2109. del_cap_link (pTermCapSet, pTermCapSet->capabilityTable);
  2110. }
  2111. /*****************************************************************************
  2112. *
  2113. * TYPE:
  2114. *
  2115. * PROCEDURE: clean_cap_table - clean out all unused cap entries
  2116. *
  2117. * DESCRIPTION:
  2118. *
  2119. * RETURN:
  2120. *
  2121. * ASSUMES: on entry.. table locked
  2122. *
  2123. *****************************************************************************/
  2124. void
  2125. clean_cap_table( struct TerminalCapabilitySet *pTermCapSet )
  2126. {
  2127. CapabilityTableLink pCapLink;
  2128. CapabilityTableLink pCap_nxt;
  2129. H245TRACE(0,10,"API:clean_cap_table <-");
  2130. /* traverse through the list.. delete all where capabilities are not set */
  2131. for (pCapLink = pTermCapSet->capabilityTable;
  2132. pCapLink;)
  2133. {
  2134. pCap_nxt = pCapLink->next;
  2135. if (!(pCapLink->value.bit_mask & capability_present))
  2136. {
  2137. H245TRACE(0,20,"API:clean_cap_table - deleting CapId = %d",
  2138. pCapLink->value.capabilityTableEntryNumber);
  2139. del_cap_link ( pTermCapSet, pCapLink );
  2140. }
  2141. pCapLink = pCap_nxt;
  2142. }
  2143. /* if no tercaps present unset flag */
  2144. if (!pTermCapSet->capabilityTable)
  2145. pTermCapSet->bit_mask &= ~capabilityTable_present;
  2146. H245TRACE(0,10,"API:clean_cap_table -> OK");
  2147. }
  2148. /*****************************************************************************
  2149. *
  2150. * TYPE: Global
  2151. *
  2152. * PROCEDURE: alloc_link_tracker
  2153. *
  2154. * DESCRIPTION:
  2155. *
  2156. * RETURN:
  2157. *
  2158. * ASSUME: List is Locked
  2159. *
  2160. *****************************************************************************/
  2161. Tracker_T *
  2162. alloc_link_tracker (struct InstanceStruct * pInstance,
  2163. API_TRACKER_T TrackerType,
  2164. DWORD_PTR dwTransId,
  2165. API_TRACKER_STATE_T State,
  2166. API_TRACKER_CH_ALLOC_T ChannelAlloc,
  2167. API_TRACKER_CH_T ChannelType,
  2168. H245_DATA_T DataType,
  2169. H245_CHANNEL_T wTxChannel,
  2170. H245_CHANNEL_T wRxChannel,
  2171. DWORD MuxEntryCount
  2172. )
  2173. {
  2174. Tracker_T *p_tracker;
  2175. H245TRACE(pInstance->dwInst,10,"API:alloc_link_tracker <-");
  2176. /* allocate tracker object */
  2177. if (!(p_tracker = (Tracker_T *)MemAlloc(sizeof(Tracker_T))))
  2178. {
  2179. H245TRACE(pInstance->dwInst,1,"API:alloc_link_trakcer -> No memory");
  2180. return NULL;
  2181. }
  2182. p_tracker->TrackerType = TrackerType;
  2183. p_tracker->TransId = dwTransId;
  2184. p_tracker->State = State;
  2185. switch (TrackerType)
  2186. {
  2187. case API_OPEN_CHANNEL_T:
  2188. case API_CLOSE_CHANNEL_T:
  2189. p_tracker->u.Channel.ChannelAlloc = ChannelAlloc;
  2190. p_tracker->u.Channel.ChannelType = ChannelType;
  2191. p_tracker->u.Channel.DataType = DataType;
  2192. p_tracker->u.Channel.TxChannel = wTxChannel;
  2193. p_tracker->u.Channel.RxChannel = wRxChannel;
  2194. break;
  2195. case API_SEND_MUX_T:
  2196. case API_RECV_MUX_T:
  2197. p_tracker->u.MuxEntryCount = MuxEntryCount;
  2198. break;
  2199. default:
  2200. break;
  2201. } // switch
  2202. p_tracker->p_next = pInstance->API.pTracker;
  2203. if (p_tracker->p_next)
  2204. {
  2205. p_tracker->p_prev = p_tracker->p_next->p_prev;
  2206. p_tracker->p_next->p_prev = p_tracker;
  2207. }
  2208. else
  2209. {
  2210. p_tracker->p_prev = NULL;
  2211. }
  2212. pInstance->API.pTracker = p_tracker;
  2213. H245TRACE(pInstance->dwInst,10,"API:alloc_link_tracker -> %x", p_tracker);
  2214. return p_tracker;
  2215. }
  2216. /*****************************************************************************
  2217. *
  2218. * TYPE: Global
  2219. *
  2220. * PROCEDURE:
  2221. *
  2222. * DESCRIPTION:
  2223. *
  2224. * RETURN:
  2225. *
  2226. * ASSUME: List is Locked
  2227. *
  2228. *****************************************************************************/
  2229. void
  2230. unlink_dealloc_tracker (struct InstanceStruct *pInstance, Tracker_T *p_tracker)
  2231. {
  2232. H245TRACE(pInstance->dwInst,4,"API:unlink_dealloc_tracker - type = %s",map_tracker_type (p_tracker->TrackerType));
  2233. if (p_tracker->p_next)
  2234. p_tracker->p_next->p_prev = p_tracker->p_prev;
  2235. /* if not first on the list */
  2236. if (p_tracker->p_prev)
  2237. p_tracker->p_prev->p_next = p_tracker->p_next;
  2238. else
  2239. pInstance->API.pTracker = p_tracker->p_next;
  2240. MemFree (p_tracker);
  2241. }
  2242. /*****************************************************************************
  2243. *
  2244. * TYPE: Global
  2245. *
  2246. * PROCEDURE: find_tracker_by_txchannel
  2247. *
  2248. * DESCRIPTION:
  2249. *
  2250. * RETURN:
  2251. *
  2252. * ASSUME: List is Locked
  2253. *
  2254. *****************************************************************************/
  2255. Tracker_T *
  2256. find_tracker_by_txchannel (struct InstanceStruct *pInstance, DWORD dwChannel, API_TRACKER_CH_ALLOC_T ChannelAlloc)
  2257. {
  2258. register Tracker_T *p_tracker;
  2259. ASSERT (pInstance != NULL);
  2260. for (p_tracker = pInstance->API.pTracker;p_tracker;p_tracker = p_tracker->p_next)
  2261. {
  2262. if (p_tracker->u.Channel.TxChannel == dwChannel &&
  2263. p_tracker->u.Channel.ChannelAlloc == ChannelAlloc)
  2264. {
  2265. return p_tracker;
  2266. }
  2267. }
  2268. return NULL;
  2269. }
  2270. /*****************************************************************************
  2271. *
  2272. * TYPE: Global
  2273. *
  2274. * PROCEDURE: find_tracker_by_rxchannel
  2275. *
  2276. * DESCRIPTION:
  2277. *
  2278. * RETURN:
  2279. *
  2280. * ASSUME: List is Locked
  2281. *
  2282. *****************************************************************************/
  2283. Tracker_T *
  2284. find_tracker_by_rxchannel (struct InstanceStruct *pInstance, DWORD dwChannel, API_TRACKER_CH_ALLOC_T ChannelAlloc)
  2285. {
  2286. register Tracker_T *p_tracker;
  2287. ASSERT (pInstance != NULL);
  2288. for (p_tracker = pInstance->API.pTracker;p_tracker;p_tracker = p_tracker->p_next)
  2289. {
  2290. if (p_tracker->u.Channel.RxChannel == dwChannel &&
  2291. p_tracker->u.Channel.ChannelAlloc == ChannelAlloc)
  2292. {
  2293. return p_tracker;
  2294. }
  2295. }
  2296. return NULL;
  2297. }
  2298. /*****************************************************************************
  2299. *
  2300. * TYPE: Global
  2301. *
  2302. * PROCEDURE: find_tracker_by_pointer
  2303. *
  2304. * DESCRIPTION:
  2305. *
  2306. * RETURN:
  2307. *
  2308. * ASSUME: List is Locked
  2309. *
  2310. *****************************************************************************/
  2311. Tracker_T *
  2312. find_tracker_by_pointer (struct InstanceStruct *pInstance, Tracker_T *p_tracker_look)
  2313. {
  2314. Tracker_T *p_tracker;
  2315. ASSERT (pInstance != NULL);
  2316. for (p_tracker = pInstance->API.pTracker;
  2317. ((p_tracker) && (p_tracker != p_tracker_look));
  2318. p_tracker = p_tracker->p_next);
  2319. return p_tracker;
  2320. }
  2321. /*****************************************************************************
  2322. *
  2323. * TYPE: Global
  2324. *
  2325. * PROCEDURE: find_tracker_by_type
  2326. *
  2327. * DESCRIPTION:
  2328. *
  2329. * RETURN:
  2330. *
  2331. * ASSUMES: table MUST be locked before this call on this call ..
  2332. *
  2333. *****************************************************************************/
  2334. Tracker_T *
  2335. find_tracker_by_type (struct InstanceStruct *pInstance,
  2336. API_TRACKER_T tracker_type,
  2337. Tracker_T *p_tracker_start)
  2338. {
  2339. Tracker_T *p_tracker;
  2340. ASSERT (pInstance != NULL);
  2341. if (p_tracker_start)
  2342. p_tracker = p_tracker_start;
  2343. else
  2344. p_tracker = pInstance->API.pTracker;
  2345. for (;
  2346. ((p_tracker) && (p_tracker->TrackerType != tracker_type));
  2347. p_tracker = p_tracker->p_next);
  2348. return p_tracker;
  2349. }
  2350. /*****************************************************************************
  2351. *
  2352. * TYPE: Global
  2353. *
  2354. * PROCEDURE: set_capability -
  2355. *
  2356. * DESCRIPTION:
  2357. * NOTE: capid in the TotCap structure is
  2358. * ignored.
  2359. *
  2360. * RETURN:
  2361. * NewCapId if no error
  2362. * H245_INVALID_CAPID if error
  2363. *
  2364. * ASSUMES:
  2365. * Assumes the H245_INST_T is valid and has been checked
  2366. *
  2367. *****************************************************************************/
  2368. void del_mux_cap(struct TerminalCapabilitySet *pTermCapSet)
  2369. {
  2370. if (pTermCapSet->bit_mask & multiplexCapability_present)
  2371. {
  2372. switch (pTermCapSet->multiplexCapability.choice)
  2373. {
  2374. case MltplxCpblty_nonStandard_chosen:
  2375. FreeNonStandardParameter(&pTermCapSet->multiplexCapability.u.MltplxCpblty_nonStandard);
  2376. break;
  2377. case h222Capability_chosen:
  2378. FreeH222Cap(&pTermCapSet->multiplexCapability.u.h222Capability);
  2379. break;
  2380. case h2250Capability_chosen:
  2381. FreeH2250Cap(&pTermCapSet->multiplexCapability.u.h2250Capability);
  2382. break;
  2383. } // switch
  2384. pTermCapSet->bit_mask &= ~multiplexCapability_present;
  2385. }
  2386. } // del_mux_cap()
  2387. HRESULT set_mux_cap(struct InstanceStruct *pInstance,
  2388. struct TerminalCapabilitySet *pTermCapSet,
  2389. H245_TOTCAP_T *pTotCap)
  2390. {
  2391. HRESULT lError;
  2392. switch (pTotCap->ClientType)
  2393. {
  2394. case H245_CLIENT_MUX_NONSTD:
  2395. H245TRACE(pInstance->dwInst,4,"API:set_mux_cap - NONSTD");
  2396. lError = CopyNonStandardParameter(&pTermCapSet->multiplexCapability.u.MltplxCpblty_nonStandard,
  2397. &pTotCap->Cap.H245Mux_NONSTD);
  2398. if (lError != H245_ERROR_OK)
  2399. return lError;
  2400. pTermCapSet->multiplexCapability.choice = MltplxCpblty_nonStandard_chosen;
  2401. break;
  2402. case H245_CLIENT_MUX_H222:
  2403. H245TRACE(pInstance->dwInst,4,"API:set_mux_cap - H222");
  2404. lError = CopyH222Cap(&pTermCapSet->multiplexCapability.u.h222Capability,
  2405. &pTotCap->Cap.H245Mux_H222);
  2406. if (lError != H245_ERROR_OK)
  2407. return lError;
  2408. pTermCapSet->multiplexCapability.choice = h222Capability_chosen;
  2409. break;
  2410. case H245_CLIENT_MUX_H223:
  2411. H245TRACE(pInstance->dwInst,4,"API:set_mux_cap - H223");
  2412. pTermCapSet->multiplexCapability.u.h223Capability = pTotCap->Cap.H245Mux_H223;
  2413. pTermCapSet->multiplexCapability.choice = h223Capability_chosen;
  2414. break;
  2415. case H245_CLIENT_MUX_VGMUX:
  2416. H245TRACE(pInstance->dwInst,4,"API:set_mux_cap - VGMUX");
  2417. pTermCapSet->multiplexCapability.u.v76Capability = pTotCap->Cap.H245Mux_VGMUX;
  2418. pTermCapSet->multiplexCapability.choice = v76Capability_chosen;
  2419. break;
  2420. case H245_CLIENT_MUX_H2250:
  2421. H245TRACE(pInstance->dwInst,4,"API:set_mux_cap - H2250");
  2422. lError = CopyH2250Cap(&pTermCapSet->multiplexCapability.u.h2250Capability,
  2423. &pTotCap->Cap.H245Mux_H2250);
  2424. if (lError != H245_ERROR_OK)
  2425. return lError;
  2426. pTermCapSet->multiplexCapability.choice = h2250Capability_chosen;
  2427. break;
  2428. default:
  2429. H245TRACE(pInstance->dwInst,1,"API:set_mux_cap - Unrecognized Client Type %d", pTotCap->ClientType);
  2430. return H245_ERROR_NOSUP;
  2431. }
  2432. pTermCapSet->bit_mask |= multiplexCapability_present;
  2433. return H245_ERROR_OK;
  2434. } // set_mux_cap()
  2435. HRESULT
  2436. set_capability (
  2437. struct InstanceStruct *pInstance,
  2438. struct TerminalCapabilitySet *pTermCapSet,
  2439. H245_TOTCAP_T *pTotCap /* tot capability for update*/
  2440. )
  2441. {
  2442. CapabilityTableEntry *pCapEntry;
  2443. Capability *pCapability;
  2444. CapabilityTableLink pCapLink;
  2445. HRESULT lError;
  2446. ASSERT(pInstance != NULL);
  2447. ASSERT(pTermCapSet != NULL);
  2448. ASSERT(pTotCap != NULL);
  2449. /* if the table entry is currently in the table, */
  2450. /* then delete it and add a new entry with the same entry number */
  2451. pCapLink = find_capid_by_entrynumber (pTermCapSet, pTotCap->CapId);
  2452. if (pCapLink)
  2453. {
  2454. del_cap_link (pTermCapSet, pCapLink);
  2455. } /* if pCapLink */
  2456. /* allocate an entry for the new terminal capbaility */
  2457. pCapLink = alloc_link_cap_entry (pTermCapSet);
  2458. if (pCapLink == NULL)
  2459. {
  2460. return H245_ERROR_NOMEM;
  2461. }
  2462. /* make it easier to deal with the Asn1 structures */
  2463. pCapEntry = &pCapLink->value;
  2464. pCapability = &pCapEntry->capability;
  2465. pCapability->choice = 0;
  2466. switch (pTotCap->DataType)
  2467. {
  2468. case H245_DATA_NONSTD:
  2469. pCapability->choice = Capability_nonStandard_chosen;
  2470. break;
  2471. case H245_DATA_VIDEO:
  2472. switch (pTotCap->Dir)
  2473. {
  2474. case H245_CAPDIR_RMTTX:
  2475. case H245_CAPDIR_LCLTX:
  2476. pCapability->choice = transmitVideoCapability_chosen;
  2477. break;
  2478. case H245_CAPDIR_RMTRX:
  2479. case H245_CAPDIR_LCLRX:
  2480. pCapability->choice = receiveVideoCapability_chosen;
  2481. break;
  2482. case H245_CAPDIR_RMTRXTX:
  2483. case H245_CAPDIR_LCLRXTX:
  2484. pCapability->choice = rcvAndTrnsmtVdCpblty_chosen;
  2485. break;
  2486. } // switch (Dir)
  2487. break;
  2488. case H245_DATA_AUDIO:
  2489. switch (pTotCap->Dir)
  2490. {
  2491. case H245_CAPDIR_RMTTX:
  2492. case H245_CAPDIR_LCLTX:
  2493. pCapability->choice = transmitAudioCapability_chosen;
  2494. break;
  2495. case H245_CAPDIR_RMTRX:
  2496. case H245_CAPDIR_LCLRX:
  2497. pCapability->choice = receiveAudioCapability_chosen;
  2498. break;
  2499. case H245_CAPDIR_RMTRXTX:
  2500. case H245_CAPDIR_LCLRXTX:
  2501. pCapability->choice = rcvAndTrnsmtAdCpblty_chosen;
  2502. break;
  2503. } // switch (Dir)
  2504. break;
  2505. case H245_DATA_DATA:
  2506. switch (pTotCap->Dir)
  2507. {
  2508. case H245_CAPDIR_RMTTX:
  2509. case H245_CAPDIR_LCLTX:
  2510. pCapability->choice = trnsmtDtApplctnCpblty_chosen;
  2511. break;
  2512. case H245_CAPDIR_RMTRX:
  2513. case H245_CAPDIR_LCLRX:
  2514. pCapability->choice = rcvDtApplctnCpblty_chosen;
  2515. break;
  2516. case H245_CAPDIR_RMTRXTX:
  2517. case H245_CAPDIR_LCLRXTX:
  2518. pCapability->choice = rATDACy_chosen;
  2519. break;
  2520. } // switch (Dir)
  2521. break;
  2522. case H245_DATA_ENCRYPT_D:
  2523. switch (pTotCap->Dir)
  2524. {
  2525. case H245_CAPDIR_RMTTX:
  2526. case H245_CAPDIR_LCLTX:
  2527. pCapability->choice = h233EncryptnTrnsmtCpblty_chosen;
  2528. break;
  2529. case H245_CAPDIR_RMTRX:
  2530. case H245_CAPDIR_LCLRX:
  2531. pCapability->choice = h233EncryptnRcvCpblty_chosen;
  2532. break;
  2533. } // switch (Dir)
  2534. break;
  2535. case H245_DATA_CONFERENCE:
  2536. pCapability->choice = conferenceCapability_chosen;
  2537. break;
  2538. } // switch (DataType)
  2539. /* if error occured, free cap, unlock, and return */
  2540. if (pCapability->choice == 0)
  2541. {
  2542. H245TRACE(pInstance->dwInst,1,"API:set_capability -> Invalid capability");
  2543. del_cap_link (pTermCapSet, pCapLink);
  2544. return H245_ERROR_PARAM;
  2545. }
  2546. /* load total cap into Capability Set */
  2547. /* if load cap returns error, free cap, unlock, and return */
  2548. lError = load_cap(pCapability, pTotCap);
  2549. if (lError != H245_ERROR_OK)
  2550. {
  2551. del_cap_link (pTermCapSet, pCapLink);
  2552. return lError;
  2553. }
  2554. /* mark the entry as in use */
  2555. pCapEntry->bit_mask = capability_present;
  2556. pCapEntry->capabilityTableEntryNumber = pTotCap->CapId;
  2557. /* set termcapTable present */
  2558. pTermCapSet->bit_mask |= capabilityTable_present;
  2559. return H245_ERROR_OK;
  2560. }
  2561. /*****************************************************************************
  2562. *
  2563. * TYPE: Local
  2564. *
  2565. * PROCEDURE: build_object_id
  2566. *
  2567. * DESCRIPTION
  2568. *
  2569. * RETURN: linked list of Object ID structures
  2570. *
  2571. * ASSUMES: Input string is a valid "<n>.<n>.<n>..."
  2572. *
  2573. *****************************************************************************/
  2574. static POBJECTID
  2575. build_object_id (const char *p_str)
  2576. {
  2577. POBJECTID p_obj_id = NULL;
  2578. POBJECTID p_obj_id_first = NULL;
  2579. POBJECTID p_obj_id_lst = NULL;
  2580. int value = 0;
  2581. int fset = FALSE;
  2582. /* if no sting.. forget it */
  2583. if (!p_str)
  2584. return NULL;
  2585. H245TRACE(0,20,"API:Object Id %s",p_str);
  2586. /* while there is a string left.. */
  2587. while (*p_str != '\0')
  2588. {
  2589. /* while there is a string left, and it's not a '.' */
  2590. value = 0;
  2591. fset = FALSE;
  2592. while ((*p_str != '\0') && (*p_str != '.'))
  2593. {
  2594. fset = TRUE;
  2595. value = value*10+(*p_str-'0');
  2596. p_str++;
  2597. }
  2598. /* must ahve been a "." or an end string */
  2599. if (fset)
  2600. {
  2601. if (*p_str != '\0')
  2602. p_str++;
  2603. /* allocate the first object */
  2604. if (!(p_obj_id = (POBJECTID) MemAlloc (sizeof(*p_obj_id))))
  2605. {
  2606. free_object_id (p_obj_id_first);
  2607. return NULL;
  2608. } /* if alloc failes */
  2609. /* if first objected allocated */
  2610. if (!p_obj_id_first)
  2611. p_obj_id_first = p_obj_id;
  2612. else
  2613. p_obj_id_lst->next = p_obj_id;
  2614. p_obj_id->value = (unsigned short) value;
  2615. p_obj_id->next = NULL;
  2616. p_obj_id_lst = p_obj_id;
  2617. }
  2618. } /* while */
  2619. return p_obj_id_first;
  2620. }
  2621. /*****************************************************************************
  2622. *
  2623. * TYPE: Global
  2624. *
  2625. * PROCEDURE: free_mux_table_list - recursively free mux table list
  2626. *
  2627. * DESCRIPTION:
  2628. *
  2629. * RETURN:
  2630. *
  2631. * ASSUME: List is Locked
  2632. *
  2633. *****************************************************************************/
  2634. void free_mux_table_list (H245_MUX_TABLE_T *p_mux_tbl)
  2635. {
  2636. if (!p_mux_tbl)
  2637. return;
  2638. free_mux_table_list (p_mux_tbl->pNext);
  2639. free_mux_el_list (p_mux_tbl->pMuxTblEntryElem);
  2640. MemFree (p_mux_tbl);
  2641. }
  2642. /*****************************************************************************
  2643. *
  2644. * TYPE: Global
  2645. *
  2646. * PROCEDURE: free_mux_el_list - recursively free mux element list
  2647. *
  2648. * DESCRIPTION:
  2649. *
  2650. * RETURN:
  2651. *
  2652. * ASSUME: List is Locked
  2653. *
  2654. *****************************************************************************/
  2655. void free_mux_el_list (H245_MUX_ENTRY_ELEMENT_T *p_mux_el)
  2656. {
  2657. if (!p_mux_el)
  2658. return;
  2659. if (p_mux_el->Kind == H245_MUX_ENTRY_ELEMENT)
  2660. free_mux_el_list (p_mux_el->u.pMuxTblEntryElem);
  2661. free_mux_el_list (p_mux_el->pNext);
  2662. MemFree (p_mux_el);
  2663. }
  2664. /*****************************************************************************
  2665. *
  2666. * TYPE: Global
  2667. *
  2668. * PROCEDURE: api_init ()
  2669. *
  2670. * DESCRIPTION:
  2671. *
  2672. * RETURN:
  2673. *
  2674. * ASSUMES:
  2675. *
  2676. *****************************************************************************/
  2677. HRESULT
  2678. api_init (struct InstanceStruct *pInstance)
  2679. {
  2680. ASSERT (pInstance != NULL);
  2681. H245TRACE(pInstance->dwInst,10,"API:api_init <-");
  2682. /**************************/
  2683. /* Terminal Cap TABLE */
  2684. /**************************/
  2685. pInstance->API.PDU_LocalTermCap.choice = MltmdSystmCntrlMssg_rqst_chosen;
  2686. pInstance->API.PDU_LocalTermCap.u.MltmdSystmCntrlMssg_rqst.choice =
  2687. terminalCapabilitySet_chosen;
  2688. pInstance->API.PDU_RemoteTermCap.choice = MltmdSystmCntrlMssg_rqst_chosen;
  2689. pInstance->API.PDU_RemoteTermCap.u.MltmdSystmCntrlMssg_rqst.choice =
  2690. terminalCapabilitySet_chosen;
  2691. /**************************/
  2692. /* MULTIPLEX TABLE CAP's */
  2693. /**************************/
  2694. switch (pInstance->Configuration)
  2695. {
  2696. case H245_CONF_H324:
  2697. {
  2698. H223Capability *p_H223;
  2699. /* set h223 capabilities */
  2700. pInstance->API.PDU_LocalTermCap.
  2701. u.MltmdSystmCntrlMssg_rqst.
  2702. u.terminalCapabilitySet.multiplexCapability.choice =
  2703. h223Capability_chosen;
  2704. p_H223 = &(pInstance->API.PDU_LocalTermCap.
  2705. u.MltmdSystmCntrlMssg_rqst.
  2706. u.terminalCapabilitySet.multiplexCapability.
  2707. u.h223Capability);
  2708. /* (TBC) how do we communicate this to the API */
  2709. /* booleans.. */
  2710. p_H223->transportWithI_frames;
  2711. p_H223-> videoWithAL1 = FALSE;
  2712. p_H223-> videoWithAL2 = FALSE;
  2713. p_H223-> videoWithAL3 = TRUE;
  2714. p_H223-> audioWithAL1 = FALSE;
  2715. p_H223-> audioWithAL2 = TRUE;
  2716. p_H223-> audioWithAL3 = FALSE;
  2717. p_H223-> dataWithAL1 = FALSE;
  2718. p_H223-> dataWithAL2 = FALSE;
  2719. p_H223-> dataWithAL3 = FALSE;
  2720. /* ushort's */
  2721. p_H223-> maximumAl2SDUSize = 2048;
  2722. p_H223-> maximumAl3SDUSize = 2048;
  2723. p_H223-> maximumDelayJitter = 0;
  2724. /* enhanced/Basic */
  2725. p_H223->h223MultiplexTableCapability.choice = h223MltplxTblCpblty_bsc_chosen;
  2726. }
  2727. break;
  2728. case H245_CONF_H323:
  2729. break;
  2730. case H245_CONF_H310:
  2731. case H245_CONF_GVD:
  2732. default:
  2733. return H245_ERROR_NOSUP;
  2734. break;
  2735. } /* switch */
  2736. /* setup Object Id for Terminal Cap Set */
  2737. /* (TBC) where do we get/set the protocolIdentifier */
  2738. pInstance->API.PDU_LocalTermCap.
  2739. u.MltmdSystmCntrlMssg_rqst.
  2740. u.terminalCapabilitySet.protocolIdentifier = build_object_id (H245_PROTOID);
  2741. pInstance->API.MasterSlave = APIMS_Undef;
  2742. pInstance->API.SystemState = APIST_Inited;
  2743. pInstance->API.LocalCapIdNum = H245_MAX_CAPID + 1;
  2744. pInstance->API.LocalCapDescIdNum = 0;
  2745. H245TRACE(pInstance->dwInst,10,"API:api_init -> OK");
  2746. return H245_ERROR_OK;
  2747. }
  2748. /*****************************************************************************
  2749. *
  2750. * TYPE: Global
  2751. *
  2752. * PROCEDURE: api_deinit ()
  2753. *
  2754. * DESCRIPTION:
  2755. *
  2756. * RETURN:
  2757. *
  2758. * ASSUMES:
  2759. *
  2760. *****************************************************************************/
  2761. HRESULT
  2762. api_deinit (struct InstanceStruct *pInstance)
  2763. {
  2764. Tracker_T *pTracker;
  2765. int nCount;
  2766. H245TRACE(pInstance->dwInst,10,"API:api_deinit <-");
  2767. /* free structures and act on outstanding links in structure */
  2768. #ifndef NDEBUG
  2769. dump_tracker(pInstance);
  2770. #endif
  2771. free_object_id (pInstance->API.PDU_LocalTermCap.
  2772. u.MltmdSystmCntrlMssg_rqst.
  2773. u.terminalCapabilitySet.protocolIdentifier);
  2774. /* free simultaneous capabilities */
  2775. for (nCount = 0; nCount < 256; ++nCount)
  2776. {
  2777. if (pInstance->API.PDU_LocalTermCap.TERMCAPSET.capabilityDescriptors.value[nCount].smltnsCpblts)
  2778. dealloc_simultaneous_cap (&pInstance->API.PDU_LocalTermCap.TERMCAPSET.capabilityDescriptors.value[nCount]);
  2779. if (pInstance->API.PDU_RemoteTermCap.TERMCAPSET.capabilityDescriptors.value[nCount].smltnsCpblts)
  2780. dealloc_simultaneous_cap (&pInstance->API.PDU_RemoteTermCap.TERMCAPSET.capabilityDescriptors.value[nCount]);
  2781. }
  2782. /* free capabilities */
  2783. del_mux_cap(&pInstance->API.PDU_LocalTermCap.u.MltmdSystmCntrlMssg_rqst.u.terminalCapabilitySet);
  2784. del_mux_cap(&pInstance->API.PDU_RemoteTermCap.u.MltmdSystmCntrlMssg_rqst.u.terminalCapabilitySet);
  2785. dealloc_link_cap_list ( &pInstance->API.PDU_LocalTermCap.TERMCAPSET);
  2786. dealloc_link_cap_list ( &pInstance->API.PDU_RemoteTermCap.TERMCAPSET);
  2787. while ((pTracker = pInstance->API.pTracker) != NULL)
  2788. {
  2789. H245TRACE(pInstance->dwInst,1,"API:api_deinit -> %s Tracker Still Pending",
  2790. map_tracker_type(pTracker->TrackerType));
  2791. unlink_dealloc_tracker (pInstance, pTracker);
  2792. }
  2793. H245TRACE(pInstance->dwInst,10,"API:api_deinit -> OK");
  2794. return H245_ERROR_OK;
  2795. }
  2796. #if defined(_DEBUG)
  2797. /*****************************************************************************
  2798. *
  2799. * TYPE: Global
  2800. *
  2801. * PROCEDURE: map_api_error ()
  2802. *
  2803. * DESCRIPTION:
  2804. *
  2805. * RETURN:
  2806. *
  2807. * ASSUMES:
  2808. *
  2809. *****************************************************************************/
  2810. LPSTR map_api_error (HRESULT lError)
  2811. {
  2812. static TCHAR szBuf[128];
  2813. switch (lError)
  2814. {
  2815. case H245_ERROR_OK: return "H245_ERROR_OK";
  2816. case H245_ERROR_INVALID_DATA_FORMAT: return "H245_ERROR_INVALID_DATA_FORMAT";
  2817. case H245_ERROR_NOMEM: return "H245_ERROR_NOMEM";
  2818. case H245_ERROR_NOSUP: return "H245_ERROR_NOSUP";
  2819. case H245_ERROR_PARAM: return "H245_ERROR_PARAM";
  2820. case H245_ERROR_ALREADY_INIT: return "H245_ERROR_ALREADY_INIT";
  2821. case H245_ERROR_NOT_CONNECTED: return "H245_ERROR_NOT_CONNECTED";
  2822. case H245_ERROR_NORESOURCE: return "H245_ERROR_NORESOURCE";
  2823. case H245_ERROR_NOTIMP: return "H245_ERROR_NOTIMP";
  2824. case H245_ERROR_SUBSYS: return "H245_ERROR_SUBSYS";
  2825. case H245_ERROR_FATAL: return "H245_ERROR_FATAL";
  2826. case H245_ERROR_MAXTBL: return "H245_ERROR_MAXTBL";
  2827. case H245_ERROR_CHANNEL_INUSE: return "H245_ERROR_CHANNEL_INUSE";
  2828. case H245_ERROR_INVALID_CAPID: return "H245_ERROR_INVALID_CAPID";
  2829. case H245_ERROR_INVALID_OP: return "H245_ERROR_INVALID_OP";
  2830. case H245_ERROR_UNKNOWN: return "H245_ERROR_UNKNOWN";
  2831. case H245_ERROR_NOBANDWIDTH: return "H245_ERROR_NOBANDWIDTH";
  2832. case H245_ERROR_LOSTCON: return "H245_ERROR_LOSTCON";
  2833. case H245_ERROR_INVALID_MUXTBLENTRY: return "H245_ERROR_INVALID_MUXTBLENTRY";
  2834. case H245_ERROR_INVALID_INST: return "H245_ERROR_INVALID_INST";
  2835. case H245_ERROR_INPROCESS: return "H245_ERROR_INPROCESS";
  2836. case H245_ERROR_INVALID_STATE: return "H245_ERROR_INVALID_STATE";
  2837. case H245_ERROR_TIMEOUT: return "H245_ERROR_TIMEOUT";
  2838. case H245_ERROR_INVALID_CHANNEL: return "H245_ERROR_INVALID_CHANNEL";
  2839. case H245_ERROR_INVALID_CAPDESCID: return "H245_ERROR_INVALID_CAPDESCID";
  2840. case H245_ERROR_CANCELED: return "H245_ERROR_CANCELED";
  2841. case H245_ERROR_MUXELEMENT_DEPTH: return "H245_ERROR_MUXELEMENT_DEPTH";
  2842. case H245_ERROR_MUXELEMENT_WIDTH: return "H245_ERROR_MUXELEMENT_WIDTH";
  2843. case H245_ERROR_ASN1: return "H245_ERROR_ASN1";
  2844. case H245_ERROR_NO_MUX_CAPS: return "H245_ERROR_NO_MUX_CAPS";
  2845. case H245_ERROR_NO_CAPDESC: return "H245_ERROR_NO_CAPDESC";
  2846. default:
  2847. wsprintf (szBuf,"**** UNKNOWN ERROR *** %d (0x%x)",lError,lError);
  2848. return szBuf;
  2849. }
  2850. }
  2851. /*****************************************************************************
  2852. *
  2853. * TYPE: Global
  2854. *
  2855. * PROCEDURE: map_fsm_event -
  2856. *
  2857. * DESpCRIPTION:
  2858. *
  2859. * RETURN:
  2860. *
  2861. * ASSUMES:
  2862. *
  2863. *****************************************************************************/
  2864. LPSTR map_fsm_event (DWORD event)
  2865. {
  2866. static TCHAR szBuf[128];
  2867. switch (event)
  2868. {
  2869. case H245_IND_MSTSLV: return "H245_IND_MSTSLV";
  2870. case H245_IND_CAP: return "H245_IND_CAP";
  2871. case H245_IND_OPEN: return "H245_IND_OPEN";
  2872. case H245_IND_OPEN_CONF: return "H245_IND_OPEN_CONF";
  2873. case H245_IND_CLOSE: return "H245_IND_CLOSE";
  2874. case H245_IND_REQ_CLOSE: return "H245_IND_REQ_CLOSE";
  2875. case H245_IND_MUX_TBL: return "H245_IND_MUX_TBL";
  2876. case H245_IND_MTSE_RELEASE: return "H245_IND_MTSE_RELEASE";
  2877. case H245_IND_RMESE: return "H245_IND_RMESE";
  2878. case H245_IND_RMESE_RELEASE: return "H245_IND_RMESE_RELEASE";
  2879. case H245_IND_MRSE: return "H245_IND_MRSE";
  2880. case H245_IND_MRSE_RELEASE: return "H245_IND_MRSE_RELEASE";
  2881. case H245_IND_MLSE: return "H245_IND_MLSE";
  2882. case H245_IND_MLSE_RELEASE: return "H245_IND_MLSE_RELEASE";
  2883. case H245_IND_NONSTANDARD_REQUEST: return "H245_IND_NONSTANDARD_REQUEST";
  2884. case H245_IND_NONSTANDARD_RESPONSE: return "H245_IND_NONSTANDARD_RESPONSE";
  2885. case H245_IND_NONSTANDARD_COMMAND: return "H245_IND_NONSTANDARD_COMMAND";
  2886. case H245_IND_NONSTANDARD: return "H245_IND_NONSTANDARD";
  2887. case H245_IND_MISC_COMMAND: return "H245_IND_MISC_COMMAND";
  2888. case H245_IND_MISC: return "H245_IND_MISC";
  2889. case H245_IND_COMM_MODE_REQUEST: return "H245_IND_COMM_MODE_REQUEST";
  2890. case H245_IND_COMM_MODE_RESPONSE: return "H245_IND_COMM_MODE_RESPONSE";
  2891. case H245_IND_COMM_MODE_COMMAND: return "H245_IND_COMM_MODE_COMMAND";
  2892. case H245_IND_CONFERENCE_REQUEST: return "H245_IND_CONFERENCE_REQUEST";
  2893. case H245_IND_CONFERENCE_RESPONSE: return "H245_IND_CONFERENCE_RESPONSE";
  2894. case H245_IND_CONFERENCE_COMMAND: return "H245_IND_CONFERENCE_COMMAND";
  2895. case H245_IND_CONFERENCE: return "H245_IND_CONFERENCE";
  2896. case H245_IND_SEND_TERMCAP: return "H245_IND_SEND_TERMCAP";
  2897. case H245_IND_ENCRYPTION: return "H245_IND_ENCRYPTION";
  2898. case H245_IND_FLOW_CONTROL: return "H245_IND_FLOW_CONTROL";
  2899. case H245_IND_ENDSESSION: return "H245_IND_ENDSESSION";
  2900. case H245_IND_FUNCTION_NOT_UNDERSTOOD:return "H245_IND_FUNCTION_NOT_UNDERSTOOD:";
  2901. case H245_IND_JITTER: return "H245_IND_JITTER";
  2902. case H245_IND_H223_SKEW: return "H245_IND_H223_SKEW";
  2903. case H245_IND_NEW_ATM_VC: return "H245_IND_NEW_ATM_VC";
  2904. case H245_IND_USERINPUT: return "H245_IND_USERINPUT";
  2905. case H245_IND_H2250_MAX_SKEW: return "H245_IND_H2250_MAX_SKEW";
  2906. case H245_IND_MC_LOCATION: return "H245_IND_MC_LOCATION";
  2907. case H245_IND_VENDOR_ID: return "H245_IND_VENDOR_ID";
  2908. case H245_IND_FUNCTION_NOT_SUPPORTED: return "H245_IND_FUNCTION_NOT_SUPPORTED";
  2909. case H245_IND_H223_RECONFIG: return "H245_IND_H223_RECONFIG";
  2910. case H245_IND_H223_RECONFIG_ACK: return "H245_IND_H223_RECONFIG_ACK";
  2911. case H245_IND_H223_RECONFIG_REJECT: return "H245_IND_H223_RECONFIG_REJECT";
  2912. case H245_CONF_INIT_MSTSLV: return "H245_CONF_INIT_MSTSLV";
  2913. case H245_CONF_SEND_TERMCAP: return "H245_CONF_SEND_TERMCAP";
  2914. case H245_CONF_OPEN: return "H245_CONF_OPEN";
  2915. case H245_CONF_NEEDRSP_OPEN: return "H245_CONF_NEEDRSP_OPEN";
  2916. case H245_CONF_CLOSE: return "H245_CONF_CLOSE";
  2917. case H245_CONF_REQ_CLOSE: return "H245_CONF_REQ_CLOSE";
  2918. case H245_CONF_MUXTBL_SND: return "H245_CONF_MUXTBL_SND";
  2919. case H245_CONF_RMESE: return "H245_CONF_RMESE";
  2920. case H245_CONF_RMESE_REJECT: return "H245_CONF_RMESE_REJECT";
  2921. case H245_CONF_RMESE_EXPIRED: return "H245_CONF_RMESE_EXPIRED";
  2922. case H245_CONF_MRSE: return "H245_CONF_MRSE";
  2923. case H245_CONF_MRSE_REJECT: return "H245_CONF_MRSE_REJECT";
  2924. case H245_CONF_MRSE_EXPIRED: return "H245_CONF_MRSE_EXPIRED";
  2925. case H245_CONF_MLSE: return "H245_CONF_MLSE";
  2926. case H245_CONF_MLSE_REJECT: return "H245_CONF_MLSE_REJECT";
  2927. case H245_CONF_MLSE_EXPIRED: return "H245_CONF_MLSE_EXPIRED";
  2928. case H245_CONF_RTDSE: return "H245_CONF_RTDSE";
  2929. case H245_CONF_RTDSE_EXPIRED: return "H245_CONF_RTDSE_EXPIRED";
  2930. default:
  2931. wsprintf (szBuf,"**** UNKNOWN EVENT *** %d (0x%x)",event,event);
  2932. return szBuf;
  2933. }
  2934. }
  2935. LPSTR map_tracker_type (API_TRACKER_T tracker_type)
  2936. {
  2937. static TCHAR szBuf[128];
  2938. switch (tracker_type)
  2939. {
  2940. case API_TERMCAP_T: return "API_TERMCAP_T";
  2941. case API_OPEN_CHANNEL_T: return "API_OPEN_CHANNEL_T";
  2942. case API_CLOSE_CHANNEL_T: return "API_CLOSE_CHANNEL_T";
  2943. case API_MSTSLV_T: return "API_MSTSLV_T";
  2944. case API_SEND_MUX_T: return "API_SEND_MUX_T";
  2945. case API_RECV_MUX_T: return "API_RECV_MUX_T";
  2946. default:
  2947. wsprintf (szBuf,"**** UNKNOWN TRACKER TYPE *** %d (0x%x)",tracker_type,tracker_type);
  2948. return szBuf;
  2949. }
  2950. }
  2951. #endif // (_DEBUG)
  2952.