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.

1008 lines
33 KiB

  1. /***********************************************************************
  2. * *
  3. * Filename: pduparse.c *
  4. * Module: H245 Finite State Machine Subsystem *
  5. * *
  6. ***********************************************************************
  7. * INTEL Corporation Proprietary Information *
  8. * *
  9. * This listing is supplied under the terms of a license agreement *
  10. * with INTEL Corporation and may not be copied nor disclosed except *
  11. * in accordance with the terms of that agreement. *
  12. * *
  13. * Copyright (c) 1996 Intel Corporation. All rights reserved. *
  14. ***********************************************************************
  15. * *
  16. * $Workfile: PDUPARSE.C $
  17. * $Revision: 1.6 $
  18. * $Modtime: 09 Dec 1996 13:36:34 $
  19. * $Log: S:/STURGEON/SRC/H245/SRC/VCS/PDUPARSE.C_v $
  20. *
  21. * Rev 1.6 09 Dec 1996 13:36:56 EHOWARDX
  22. * Updated copyright notice.
  23. *
  24. * Rev 1.5 29 Jul 1996 16:58:08 EHOWARDX
  25. *
  26. * Missed some Geneva update PDU types.
  27. *
  28. * Rev 1.4 05 Jun 1996 17:15:02 EHOWARDX
  29. * MaintenanceLoop fix.
  30. *
  31. * Rev 1.3 04 Jun 1996 13:58:06 EHOWARDX
  32. * Fixed Release build warnings.
  33. *
  34. * Rev 1.2 29 May 1996 15:20:24 EHOWARDX
  35. * Change to use HRESULT.
  36. *
  37. * Rev 1.1 28 May 1996 14:25:26 EHOWARDX
  38. * Tel Aviv update.
  39. *
  40. * Rev 1.0 09 May 1996 21:06:40 EHOWARDX
  41. * Initial revision.
  42. *
  43. * Rev 1.8.1.4 09 May 1996 19:48:40 EHOWARDX
  44. * Change TimerExpiryF function arguements.
  45. *
  46. * Rev 1.8.1.3 25 Apr 1996 17:00:16 EHOWARDX
  47. * Minor fixes.
  48. *
  49. * Rev 1.8.1.2 15 Apr 1996 10:48:00 EHOWARDX
  50. * Update.
  51. *
  52. * Rev 1.8.1.1 10 Apr 1996 21:15:54 EHOWARDX
  53. * Check-in for safety in middle of re-design.
  54. *
  55. * Rev 1.8.1.0 05 Apr 1996 20:53:06 EHOWARDX
  56. * Branched.
  57. * *
  58. ***********************************************************************/
  59. #include "precomp.h"
  60. #include "h245api.h"
  61. #include "h245com.h"
  62. #include "h245fsm.h"
  63. /*
  64. * NAME
  65. * PduParseIncoming - parse an inbound PDU and determine Entity, Event, etc.
  66. *
  67. *
  68. * PARAMETERS
  69. * INPUT pInst Pointer to FSM Instance structure
  70. * INPUT pPdu Pointer to an incoming PDU structure
  71. * OUTPUT pEntity Pointer to variable to return PDU state entity in
  72. * OUTPUT pEvent Pointer to variable to return PDU event in
  73. * OUTPUT pKey Pointer to variable to return lookup key in
  74. * OUTPUT pbCreate Pointer to variable to return create flag in
  75. *
  76. * RETURN VALUE
  77. * SUCCESS or FAIL
  78. */
  79. HRESULT
  80. PduParseIncoming(struct InstanceStruct *pInstance, PDU_t *pPdu,
  81. Entity_t *pEntity, Event_t *pEvent, Key_t *pKey, int *pbCreate)
  82. {
  83. ASSERT(pInstance != NULL);
  84. ASSERT(pPdu != NULL);
  85. ASSERT(pEntity != NULL);
  86. ASSERT(pEvent != NULL);
  87. ASSERT(pKey != NULL);
  88. ASSERT(pbCreate != NULL);
  89. // Set default value for key
  90. *pKey = 0;
  91. switch (pPdu->choice)
  92. {
  93. ////////////////////////////////////////////////////////////////////
  94. //
  95. // REQUEST
  96. //
  97. ////////////////////////////////////////////////////////////////////
  98. case MltmdSystmCntrlMssg_rqst_chosen:
  99. *pbCreate = TRUE;
  100. switch (pPdu->u.MltmdSystmCntrlMssg_rqst.choice)
  101. {
  102. case RqstMssg_nonStandard_chosen:
  103. *pEntity = STATELESS;
  104. *pEvent = NonStandardRequestPDU;
  105. break;
  106. case masterSlaveDetermination_chosen:
  107. *pEntity = MSDSE;
  108. *pEvent = MSDetPDU;
  109. break;
  110. case terminalCapabilitySet_chosen:
  111. *pEntity = CESE_IN;
  112. *pEvent = TermCapSetPDU;
  113. break;
  114. case openLogicalChannel_chosen:
  115. if (pPdu->u.MltmdSystmCntrlMssg_rqst.u.openLogicalChannel.bit_mask & OLCl_rLCPs_present)
  116. {
  117. *pEntity = BLCSE_IN;
  118. *pEvent = OpenBChPDU;
  119. }
  120. else
  121. {
  122. *pEntity = LCSE_IN;
  123. *pEvent = OpenUChPDU;
  124. }
  125. *pKey = pPdu->u.MltmdSystmCntrlMssg_rqst.u.openLogicalChannel.forwardLogicalChannelNumber;
  126. break;
  127. case closeLogicalChannel_chosen:
  128. *pKey = pPdu->u.MltmdSystmCntrlMssg_rqst.u.closeLogicalChannel.forwardLogicalChannelNumber;
  129. if (ObjectFind(pInstance, BLCSE_IN, *pKey) != NULL)
  130. {
  131. *pEntity = BLCSE_IN;
  132. *pEvent = CloseBChPDU;
  133. }
  134. else
  135. {
  136. *pEntity = LCSE_IN;
  137. *pEvent = CloseUChPDU;
  138. }
  139. break;
  140. case requestChannelClose_chosen:
  141. *pEntity = CLCSE_IN;
  142. *pEvent = ReqChClosePDU;
  143. *pKey = pPdu->u.MltmdSystmCntrlMssg_rqst.u.requestChannelClose.forwardLogicalChannelNumber;
  144. break;
  145. case multiplexEntrySend_chosen:
  146. *pEntity = MTSE_IN;
  147. *pEvent = MultiplexEntrySendPDU;
  148. break;
  149. case requestMultiplexEntry_chosen:
  150. *pEntity = RMESE_IN;
  151. *pEvent = RequestMultiplexEntryPDU;
  152. break;
  153. case requestMode_chosen:
  154. *pEntity = MRSE_IN;
  155. *pEvent = RequestModePDU;
  156. break;
  157. case roundTripDelayRequest_chosen:
  158. *pEntity = RTDSE;
  159. *pEvent = RoundTripDelayRequestPDU;
  160. break;
  161. case maintenanceLoopRequest_chosen:
  162. *pEntity = MLSE_IN;
  163. *pEvent = MaintenanceLoopRequestPDU;
  164. switch (pPdu->u.MltmdSystmCntrlMssg_rqst.u.maintenanceLoopRequest.type.choice)
  165. {
  166. case systemLoop_chosen:
  167. break;
  168. case mediaLoop_chosen:
  169. *pKey = pPdu->u.MltmdSystmCntrlMssg_rqst.u.maintenanceLoopRequest.type.u.mediaLoop;
  170. break;
  171. case logicalChannelLoop_chosen:
  172. *pKey = pPdu->u.MltmdSystmCntrlMssg_rqst.u.maintenanceLoopRequest.type.u.logicalChannelLoop;
  173. break;
  174. default:
  175. return H245_ERROR_PARAM;
  176. } // switch
  177. break;
  178. case communicationModeRequest_chosen:
  179. *pEntity = STATELESS;
  180. *pEvent = CommunicationModeRequestPDU;
  181. break;
  182. case conferenceRequest_chosen:
  183. *pEntity = STATELESS;
  184. *pEvent = ConferenceRequestPDU;
  185. break;
  186. #if(0) // this is not part of H.245 version 3
  187. case h223AnnxARcnfgrtn_chosen:
  188. *pEntity = STATELESS;
  189. *pEvent = H223ReconfigPDU;
  190. break;
  191. #endif // if (0)
  192. default:
  193. H245TRACE(pInstance->dwInst, 1, "PduParseIncoming: Invalid Request %d",
  194. pPdu->u.MltmdSystmCntrlMssg_rqst.choice);
  195. return H245_ERROR_PARAM;
  196. }
  197. break;
  198. ////////////////////////////////////////////////////////////////////
  199. //
  200. // RESPONSE
  201. //
  202. ////////////////////////////////////////////////////////////////////
  203. case MSCMg_rspns_chosen:
  204. *pbCreate = FALSE;
  205. switch (pPdu->u.MSCMg_rspns.choice)
  206. {
  207. case RspnsMssg_nonStandard_chosen:
  208. *pEntity = STATELESS;
  209. *pEvent = NonStandardResponsePDU;
  210. break;
  211. case mstrSlvDtrmntnAck_chosen:
  212. *pEntity = MSDSE;
  213. *pEvent = MSDetAckPDU;
  214. break;
  215. case mstrSlvDtrmntnRjct_chosen:
  216. *pEntity = MSDSE;
  217. *pEvent = MSDetRejectPDU;
  218. break;
  219. case terminalCapabilitySetAck_chosen:
  220. *pEntity = CESE_OUT;
  221. *pEvent = TermCapSetAckPDU;
  222. break;
  223. case trmnlCpbltyStRjct_chosen:
  224. *pEntity = CESE_OUT;
  225. *pEvent = TermCapSetRejectPDU;
  226. break;
  227. case openLogicalChannelAck_chosen:
  228. if (pPdu->u.MSCMg_rspns.u.openLogicalChannelAck.bit_mask & OLCAk_rLCPs_present)
  229. {
  230. *pEntity = BLCSE_OUT;
  231. *pEvent = OpenBChAckPDU;
  232. }
  233. else
  234. {
  235. *pEntity = LCSE_OUT;
  236. *pEvent = OpenUChAckPDU;
  237. }
  238. *pKey = pPdu->u.MSCMg_rspns.u.openLogicalChannelAck.forwardLogicalChannelNumber;
  239. break;
  240. case openLogicalChannelReject_chosen:
  241. *pKey = pPdu->u.MSCMg_rspns.u.openLogicalChannelReject.forwardLogicalChannelNumber;
  242. if (ObjectFind(pInstance, BLCSE_OUT, *pKey) != NULL)
  243. {
  244. *pEntity = BLCSE_OUT;
  245. *pEvent = OpenBChRejectPDU;
  246. }
  247. else
  248. {
  249. *pEntity = LCSE_OUT;
  250. *pEvent = OpenUChRejectPDU;
  251. }
  252. break;
  253. case closeLogicalChannelAck_chosen:
  254. *pKey = pPdu->u.MSCMg_rspns.u.closeLogicalChannelAck.forwardLogicalChannelNumber;
  255. if (ObjectFind(pInstance, BLCSE_OUT, *pKey) != NULL)
  256. {
  257. *pEntity = BLCSE_OUT;
  258. *pEvent = CloseBChAckPDU;
  259. }
  260. else
  261. {
  262. *pEntity = LCSE_OUT;
  263. *pEvent = CloseUChAckPDU;
  264. }
  265. break;
  266. case requestChannelCloseAck_chosen:
  267. *pEntity = CLCSE_OUT;
  268. *pEvent = ReqChCloseAckPDU;
  269. *pKey = pPdu->u.MSCMg_rspns.u.requestChannelCloseAck.forwardLogicalChannelNumber;
  270. break;
  271. case rqstChnnlClsRjct_chosen:
  272. *pEntity = CLCSE_OUT;
  273. *pEvent = ReqChCloseRejectPDU;
  274. *pKey = pPdu->u.MSCMg_rspns.u.rqstChnnlClsRjct.forwardLogicalChannelNumber;
  275. break;
  276. case multiplexEntrySendAck_chosen:
  277. *pEntity = MTSE_OUT;
  278. *pEvent = MultiplexEntrySendAckPDU;
  279. break;
  280. case multiplexEntrySendReject_chosen:
  281. *pEntity = MTSE_OUT;
  282. *pEvent = MultiplexEntrySendRejectPDU;
  283. break;
  284. case requestMultiplexEntryAck_chosen:
  285. *pEntity = RMESE_OUT;
  286. *pEvent = RequestMultiplexEntryAckPDU;
  287. break;
  288. case rqstMltplxEntryRjct_chosen:
  289. *pEntity = RMESE_OUT;
  290. *pEvent = RequestMultiplexEntryRejectPDU;
  291. break;
  292. case requestModeAck_chosen:
  293. *pEntity = MRSE_OUT;
  294. *pEvent = RequestModeAckPDU;
  295. break;
  296. case requestModeReject_chosen:
  297. *pEntity = MRSE_OUT;
  298. *pEvent = RequestModeRejectPDU;
  299. break;
  300. case roundTripDelayResponse_chosen:
  301. *pEntity = RTDSE;
  302. *pEvent = RoundTripDelayResponsePDU;
  303. break;
  304. case maintenanceLoopAck_chosen:
  305. *pEntity = MLSE_OUT;
  306. *pEvent = MaintenanceLoopAckPDU;
  307. switch (pPdu->u.MSCMg_rspns.u.maintenanceLoopAck.type.choice)
  308. {
  309. case systemLoop_chosen:
  310. break;
  311. case mediaLoop_chosen:
  312. *pKey = pPdu->u.MSCMg_rspns.u.maintenanceLoopAck.type.u.mediaLoop;
  313. break;
  314. case logicalChannelLoop_chosen:
  315. *pKey = pPdu->u.MSCMg_rspns.u.maintenanceLoopAck.type.u.logicalChannelLoop;
  316. break;
  317. default:
  318. return H245_ERROR_PARAM;
  319. } // switch
  320. break;
  321. case maintenanceLoopReject_chosen:
  322. *pEntity = MLSE_OUT;
  323. *pEvent = MaintenanceLoopRejectPDU;
  324. switch (pPdu->u.MSCMg_rspns.u.maintenanceLoopReject.type.choice)
  325. {
  326. case systemLoop_chosen:
  327. break;
  328. case mediaLoop_chosen:
  329. *pKey = pPdu->u.MSCMg_rspns.u.maintenanceLoopReject.type.u.mediaLoop;
  330. break;
  331. case logicalChannelLoop_chosen:
  332. *pKey = pPdu->u.MSCMg_rspns.u.maintenanceLoopReject.type.u.logicalChannelLoop;
  333. break;
  334. default:
  335. return H245_ERROR_PARAM;
  336. } // switch
  337. break;
  338. case cmmnctnMdRspns_chosen:
  339. *pEntity = STATELESS;
  340. *pEvent = CommunicationModeResponsePDU;
  341. break;
  342. case conferenceResponse_chosen:
  343. *pEntity = STATELESS;
  344. *pEvent = ConferenceResponsePDU;
  345. break;
  346. #if(0) // this is not part of H.245 version 3
  347. case h223AnnxARcnfgrtnAck_chosen:
  348. *pEntity = STATELESS;
  349. *pEvent = H223ReconfigAckPDU;
  350. break;
  351. case h223AnnxARcnfgrtnRjct_chosen:
  352. *pEntity = STATELESS;
  353. *pEvent = H223ReconfigRejectPDU;
  354. break;
  355. #endif // if(0)
  356. default:
  357. H245TRACE(pInstance->dwInst, 1, "PduParseIncoming: Invalid Response %d",
  358. pPdu->u.MSCMg_rspns.choice);
  359. return H245_ERROR_PARAM;
  360. }
  361. break;
  362. ////////////////////////////////////////////////////////////////////
  363. //
  364. // COMMAND
  365. //
  366. ////////////////////////////////////////////////////////////////////
  367. case MSCMg_cmmnd_chosen:
  368. *pbCreate = FALSE;
  369. switch (pPdu->u.MSCMg_cmmnd.choice)
  370. {
  371. case CmmndMssg_nonStandard_chosen:
  372. *pEntity = STATELESS;
  373. *pEvent = NonStandardCommandPDU;
  374. break;
  375. case mntnncLpOffCmmnd_chosen:
  376. *pEntity = MLSE_IN;
  377. *pEvent = MaintenanceLoopOffCommandPDU;
  378. break;
  379. case sndTrmnlCpbltySt_chosen:
  380. *pEntity = STATELESS;
  381. *pEvent = SendTerminalCapabilitySetPDU;
  382. *pbCreate = TRUE;
  383. break;
  384. case encryptionCommand_chosen:
  385. *pEntity = STATELESS;
  386. *pEvent = EncryptionCommandPDU;
  387. break;
  388. case flowControlCommand_chosen:
  389. *pEntity = STATELESS;
  390. *pEvent = FlowControlCommandPDU;
  391. break;
  392. case endSessionCommand_chosen:
  393. *pEntity = STATELESS;
  394. *pEvent = EndSessionCommandPDU;
  395. break;
  396. case miscellaneousCommand_chosen:
  397. *pEntity = STATELESS;
  398. *pEvent = MiscellaneousCommandPDU;
  399. break;
  400. case communicationModeCommand_chosen:
  401. *pEntity = STATELESS;
  402. *pEvent = CommunicationModeCommandPDU;
  403. break;
  404. case conferenceCommand_chosen:
  405. *pEntity = STATELESS;
  406. *pEvent = ConferenceCommandPDU;
  407. break;
  408. default:
  409. H245TRACE(pInstance->dwInst, 1, "PduParseIncoming: Invalid Command %d",
  410. pPdu->u.MSCMg_cmmnd.choice);
  411. return H245_ERROR_PARAM;
  412. } // switch
  413. break;
  414. ////////////////////////////////////////////////////////////////////
  415. //
  416. // INDICATION
  417. //
  418. ////////////////////////////////////////////////////////////////////
  419. case indication_chosen:
  420. *pbCreate = FALSE;
  421. switch (pPdu->u.indication.choice)
  422. {
  423. case IndctnMssg_nonStandard_chosen:
  424. *pEntity = STATELESS;
  425. *pEvent = NonStandardIndicationPDU;
  426. break;
  427. case functionNotUnderstood_chosen:
  428. *pEntity = STATELESS;
  429. *pEvent = FunctionNotUnderstoodPDU;
  430. break;
  431. case mstrSlvDtrmntnRls_chosen:
  432. *pEntity = MSDSE;
  433. *pEvent = MSDetReleasePDU;
  434. break;
  435. case trmnlCpbltyStRls_chosen:
  436. *pEntity = CESE_IN;
  437. *pEvent = TermCapSetReleasePDU;
  438. break;
  439. case opnLgclChnnlCnfrm_chosen:
  440. *pEntity = BLCSE_IN;
  441. *pEvent = OpenBChConfirmPDU;
  442. *pKey = pPdu->u.indication.u.opnLgclChnnlCnfrm.forwardLogicalChannelNumber;
  443. break;
  444. case rqstChnnlClsRls_chosen:
  445. *pEntity = CLCSE_IN;
  446. *pEvent = ReqChCloseReleasePDU;
  447. *pKey = pPdu->u.indication.u.rqstChnnlClsRls.forwardLogicalChannelNumber;
  448. break;
  449. case mltplxEntrySndRls_chosen:
  450. *pEntity = MTSE_IN;
  451. *pEvent = MultiplexEntrySendReleasePDU;
  452. break;
  453. case rqstMltplxEntryRls_chosen:
  454. *pEntity = RMESE_IN;
  455. *pEvent = RequestMultiplexEntryReleasePDU;
  456. break;
  457. case requestModeRelease_chosen:
  458. *pEntity = MRSE_IN;
  459. *pEvent = RequestModeReleasePDU;
  460. break;
  461. case miscellaneousIndication_chosen:
  462. *pEntity = STATELESS;
  463. *pEvent = MiscellaneousIndicationPDU;
  464. break;
  465. case jitterIndication_chosen:
  466. *pEntity = STATELESS;
  467. *pEvent = JitterIndicationPDU;
  468. break;
  469. case h223SkewIndication_chosen:
  470. *pEntity = STATELESS;
  471. *pEvent = H223SkewIndicationPDU;
  472. break;
  473. case newATMVCIndication_chosen:
  474. *pEntity = STATELESS;
  475. *pEvent = NewATMVCIndicationPDU;
  476. break;
  477. case userInput_chosen:
  478. *pEntity = STATELESS;
  479. *pEvent = UserInputIndicationPDU;
  480. break;
  481. case h2250MxmmSkwIndctn_chosen:
  482. *pEntity = STATELESS;
  483. *pEvent = H2250MaximumSkewIndicationPDU;
  484. break;
  485. case mcLocationIndication_chosen:
  486. *pEntity = STATELESS;
  487. *pEvent = MCLocationIndicationPDU;
  488. break;
  489. case conferenceIndication_chosen:
  490. *pEntity = STATELESS;
  491. *pEvent = ConferenceIndicationPDU;
  492. break;
  493. case vendorIdentification_chosen:
  494. *pEntity = STATELESS;
  495. *pEvent = VendorIdentificationPDU;
  496. break;
  497. case IndicationMessage_functionNotSupported_chosen:
  498. *pEntity = STATELESS;
  499. *pEvent = FunctionNotSupportedPDU;
  500. break;
  501. default:
  502. H245TRACE(pInstance->dwInst, 1, "PduParseIncoming: Invalid Indication %d",
  503. pPdu->u.indication.choice);
  504. return H245_ERROR_PARAM;
  505. } // switch
  506. break;
  507. default:
  508. H245TRACE(pInstance->dwInst, 1, "PduParseIncoming: Invalid Message Type %d",
  509. pPdu->choice);
  510. return H245_ERROR_PARAM;
  511. } // switch
  512. return H245_ERROR_OK;
  513. } // PduParseIncoming()
  514. /*
  515. * NAME
  516. * PduParseOutgoing - parse an outbound PDU and determine Entity, Event, etc.
  517. *
  518. * PARAMETERS
  519. * INPUT pInst Pointer to FSM Instance structure
  520. * INPUT pPdu Pointer to an incoming PDU structure
  521. * OUTPUT pEntity Pointer to variable to return PDU state entity in
  522. * OUTPUT pEvent Pointer to variable to return PDU event in
  523. * OUTPUT pKey Pointer to variable to return lookup key in
  524. * OUTPUT pbCreate Pointer to variable to return create flag in
  525. *
  526. * RETURN VALUE
  527. * SUCCESS or FAIL
  528. */
  529. HRESULT
  530. PduParseOutgoing(struct InstanceStruct *pInstance, PDU_t *pPdu,
  531. Entity_t *pEntity, Event_t *pEvent, Key_t *pKey, int *pbCreate)
  532. {
  533. ASSERT(pInstance != NULL);
  534. ASSERT(pPdu != NULL);
  535. ASSERT(pEntity != NULL);
  536. ASSERT(pEvent != NULL);
  537. ASSERT(pKey != NULL);
  538. ASSERT(pbCreate != NULL);
  539. // Set default value for key
  540. *pKey = 0;
  541. switch (pPdu->choice)
  542. {
  543. ////////////////////////////////////////////////////////////////////
  544. //
  545. // REQUEST
  546. //
  547. ////////////////////////////////////////////////////////////////////
  548. case MltmdSystmCntrlMssg_rqst_chosen:
  549. *pbCreate = TRUE;
  550. switch (pPdu->u.MltmdSystmCntrlMssg_rqst.choice)
  551. {
  552. case RqstMssg_nonStandard_chosen:
  553. *pEntity = STATELESS;
  554. break;
  555. case masterSlaveDetermination_chosen:
  556. *pEntity = MSDSE;
  557. *pEvent = MSDetReq;
  558. break;
  559. case terminalCapabilitySet_chosen:
  560. *pEntity = CESE_OUT;
  561. *pEvent = TransferCapRequest;
  562. break;
  563. case openLogicalChannel_chosen:
  564. if (pPdu->u.MltmdSystmCntrlMssg_rqst.u.openLogicalChannel.bit_mask & OLCl_rLCPs_present)
  565. {
  566. *pEntity = BLCSE_OUT;
  567. *pEvent = ReqBEstablish;
  568. }
  569. else
  570. {
  571. *pEntity = LCSE_OUT;
  572. *pEvent = ReqUEstablish;
  573. }
  574. *pKey = pPdu->u.MltmdSystmCntrlMssg_rqst.u.openLogicalChannel.forwardLogicalChannelNumber;
  575. break;
  576. case closeLogicalChannel_chosen:
  577. *pKey = pPdu->u.MltmdSystmCntrlMssg_rqst.u.closeLogicalChannel.forwardLogicalChannelNumber;
  578. if (ObjectFind(pInstance, BLCSE_OUT, *pKey) != NULL)
  579. {
  580. *pEntity = BLCSE_OUT;
  581. *pEvent = ReqClsBLCSE;
  582. }
  583. else
  584. {
  585. *pEntity = LCSE_OUT;
  586. *pEvent = ReqURelease;
  587. }
  588. break;
  589. case requestChannelClose_chosen:
  590. *pEntity = CLCSE_OUT;
  591. *pEvent = ReqClose;
  592. *pKey = pPdu->u.MltmdSystmCntrlMssg_rqst.u.requestChannelClose.forwardLogicalChannelNumber;
  593. break;
  594. case multiplexEntrySend_chosen:
  595. *pEntity = MTSE_OUT;
  596. *pEvent = MTSE_TRANSFER_request;
  597. break;
  598. case requestMultiplexEntry_chosen:
  599. *pEntity = RMESE_OUT;
  600. *pEvent = RMESE_SEND_request;
  601. break;
  602. case requestMode_chosen:
  603. *pEntity = MRSE_OUT;
  604. *pEvent = MRSE_TRANSFER_request;
  605. break;
  606. case roundTripDelayRequest_chosen:
  607. *pEntity = RTDSE;
  608. *pEvent = RTDSE_TRANSFER_request;
  609. break;
  610. case maintenanceLoopRequest_chosen:
  611. *pEntity = MLSE_OUT;
  612. *pEvent = MLSE_LOOP_request;
  613. switch (pPdu->u.MltmdSystmCntrlMssg_rqst.u.maintenanceLoopRequest.type.choice)
  614. {
  615. case systemLoop_chosen:
  616. break;
  617. case mediaLoop_chosen:
  618. *pKey = pPdu->u.MltmdSystmCntrlMssg_rqst.u.maintenanceLoopRequest.type.u.mediaLoop;
  619. break;
  620. case logicalChannelLoop_chosen:
  621. *pKey = pPdu->u.MltmdSystmCntrlMssg_rqst.u.maintenanceLoopRequest.type.u.logicalChannelLoop;
  622. break;
  623. default:
  624. return H245_ERROR_PARAM;
  625. } // switch
  626. break;
  627. case communicationModeRequest_chosen:
  628. case conferenceRequest_chosen:
  629. // case h223AnnxARcnfgrtn_chosen:
  630. *pEntity = STATELESS;
  631. break;
  632. default:
  633. H245TRACE(pInstance->dwInst, 1, "PduParseOutgoing: Invalid Request %d",
  634. pPdu->u.MltmdSystmCntrlMssg_rqst.choice);
  635. return H245_ERROR_PARAM;
  636. }
  637. break;
  638. ////////////////////////////////////////////////////////////////////
  639. //
  640. // RESPONSE
  641. //
  642. ////////////////////////////////////////////////////////////////////
  643. case MSCMg_rspns_chosen:
  644. *pbCreate = FALSE;
  645. switch (pPdu->u.MSCMg_rspns.choice)
  646. {
  647. case RspnsMssg_nonStandard_chosen:
  648. *pEntity = STATELESS;
  649. break;
  650. #if 0
  651. // Master Slave Determination Ack is generated by State Machine only
  652. case mstrSlvDtrmntnAck_chosen:
  653. *pEntity = MSDSE;
  654. break;
  655. // Master Slave Determination Reject is generated by State Machine only
  656. case mstrSlvDtrmntnRjct_chosen:
  657. *pEntity = MSDSE;
  658. break;
  659. #endif
  660. case terminalCapabilitySetAck_chosen:
  661. *pEntity = CESE_IN;
  662. *pEvent = CESE_TRANSFER_response;
  663. break;
  664. case trmnlCpbltyStRjct_chosen:
  665. *pEntity = CESE_IN;
  666. *pEvent = CESE_REJECT_request;
  667. break;
  668. case openLogicalChannelAck_chosen:
  669. if (pPdu->u.MSCMg_rspns.u.openLogicalChannelAck.bit_mask & OLCAk_rLCPs_present)
  670. {
  671. *pEntity = BLCSE_IN;
  672. *pEvent = ResponseBEstablish;
  673. }
  674. else
  675. {
  676. *pEntity = LCSE_IN;
  677. *pEvent = ResponseUEstablish;
  678. }
  679. *pKey = pPdu->u.MSCMg_rspns.u.openLogicalChannelAck.forwardLogicalChannelNumber;
  680. break;
  681. case openLogicalChannelReject_chosen:
  682. *pKey = pPdu->u.MSCMg_rspns.u.openLogicalChannelReject.forwardLogicalChannelNumber;
  683. if (ObjectFind(pInstance, BLCSE_IN, *pKey) != NULL)
  684. {
  685. *pEntity = BLCSE_IN;
  686. *pEvent = OpenRejectBLCSE;
  687. }
  688. else
  689. {
  690. *pEntity = LCSE_IN;
  691. *pEvent = EstablishUReject;
  692. }
  693. break;
  694. #if 0
  695. // Close Logical Channel Ack is generated by State Machine only
  696. case closeLogicalChannelAck_chosen:
  697. *pKey = pPdu->u.MSCMg_rspns.u.closeLogicalChannelAck.forwardLogicalChannelNumber;
  698. if (ObjectFind(pInstance, BLCSE_IN, *pKey) != NULL)
  699. {
  700. *pEntity = BLCSE_IN;
  701. }
  702. else
  703. {
  704. *pEntity = LCSE_IN;
  705. }
  706. break;
  707. #endif
  708. case requestChannelCloseAck_chosen:
  709. *pEntity = CLCSE_IN;
  710. *pEvent = CLCSE_CLOSE_response;
  711. *pKey = pPdu->u.MSCMg_rspns.u.requestChannelCloseAck.forwardLogicalChannelNumber;
  712. break;
  713. case rqstChnnlClsRjct_chosen:
  714. *pEntity = CLCSE_IN;
  715. *pEvent = CLCSE_REJECT_request;
  716. *pKey = pPdu->u.MSCMg_rspns.u.rqstChnnlClsRjct.forwardLogicalChannelNumber;
  717. break;
  718. case multiplexEntrySendAck_chosen:
  719. *pEntity = MTSE_IN;
  720. *pEvent = MTSE_TRANSFER_response;
  721. break;
  722. case multiplexEntrySendReject_chosen:
  723. *pEntity = MTSE_IN;
  724. *pEvent = MTSE_REJECT_request;
  725. break;
  726. case requestMultiplexEntryAck_chosen:
  727. *pEntity = RMESE_IN;
  728. *pEvent = RMESE_SEND_response;
  729. break;
  730. case rqstMltplxEntryRjct_chosen:
  731. *pEntity = RMESE_IN;
  732. *pEvent = RMESE_REJECT_request;
  733. break;
  734. case requestModeAck_chosen:
  735. *pEntity = MRSE_IN;
  736. *pEvent = MRSE_TRANSFER_response;
  737. break;
  738. case requestModeReject_chosen:
  739. *pEntity = MRSE_IN;
  740. *pEvent = MRSE_REJECT_request;
  741. break;
  742. #if 0
  743. // Round Trip Delay Response sent by State Machine only
  744. case roundTripDelayResponse_chosen:
  745. *pEntity = RTDSE;
  746. *pEvent = RoundTripDelayResponse;
  747. break;
  748. #endif
  749. case maintenanceLoopAck_chosen:
  750. *pEntity = MLSE_IN;
  751. *pEvent = MLSE_LOOP_response;
  752. // Caveat: Channel number must be zero if system loop!
  753. *pKey = pPdu->u.MSCMg_rspns.u.maintenanceLoopAck.type.u.mediaLoop;
  754. break;
  755. case maintenanceLoopReject_chosen:
  756. *pEntity = MLSE_IN;
  757. *pEvent = MLSE_IN_RELEASE_request;
  758. // Caveat: Channel number must be zero if system loop!
  759. *pKey = pPdu->u.MSCMg_rspns.u.maintenanceLoopReject.type.u.mediaLoop;
  760. break;
  761. case cmmnctnMdRspns_chosen:
  762. case conferenceResponse_chosen:
  763. // case h223AnnxARcnfgrtnAck_chosen:
  764. // case h223AnnxARcnfgrtnRjct_chosen:
  765. *pEntity = STATELESS;
  766. break;
  767. default:
  768. H245TRACE(pInstance->dwInst, 1, "PduParseOutgoing: Invalid Response %d",
  769. pPdu->u.MSCMg_rspns.choice);
  770. return H245_ERROR_PARAM;
  771. }
  772. break;
  773. ////////////////////////////////////////////////////////////////////
  774. //
  775. // COMMAND
  776. //
  777. ////////////////////////////////////////////////////////////////////
  778. case MSCMg_cmmnd_chosen:
  779. *pbCreate = FALSE;
  780. switch (pPdu->u.MSCMg_cmmnd.choice)
  781. {
  782. case CmmndMssg_nonStandard_chosen:
  783. *pEntity = STATELESS;
  784. break;
  785. case mntnncLpOffCmmnd_chosen:
  786. *pEntity = MLSE_OUT;
  787. *pEvent = MLSE_OUT_RELEASE_request;
  788. break;
  789. case sndTrmnlCpbltySt_chosen:
  790. case encryptionCommand_chosen:
  791. case flowControlCommand_chosen:
  792. case endSessionCommand_chosen:
  793. case miscellaneousCommand_chosen:
  794. case communicationModeCommand_chosen:
  795. case conferenceCommand_chosen:
  796. *pEntity = STATELESS;
  797. break;
  798. default:
  799. H245TRACE(pInstance->dwInst, 1, "PduParseOutgoing: Invalid Command %d",
  800. pPdu->u.MSCMg_cmmnd.choice);
  801. return H245_ERROR_PARAM;
  802. } // switch
  803. break;
  804. ////////////////////////////////////////////////////////////////////
  805. //
  806. // INDICATION
  807. //
  808. ////////////////////////////////////////////////////////////////////
  809. case indication_chosen:
  810. *pbCreate = FALSE;
  811. switch (pPdu->u.indication.choice)
  812. {
  813. case IndctnMssg_nonStandard_chosen:
  814. *pEntity = STATELESS;
  815. break;
  816. case functionNotUnderstood_chosen:
  817. *pEntity = STATELESS;
  818. break;
  819. #if 0
  820. // Master Slave Determination Release is sent by State Machine Only
  821. case mstrSlvDtrmntnRls_chosen:
  822. *pEntity = MSDSE;
  823. break;
  824. // Terminal Capability Set Release is sent by State Machine Only
  825. case trmnlCpbltyStRls_chosen:
  826. *pEntity = CESE_OUT
  827. break;
  828. #endif
  829. case opnLgclChnnlCnfrm_chosen:
  830. *pEntity = BLCSE_OUT;
  831. *pEvent = RspConfirmBLCSE;
  832. *pKey = pPdu->u.indication.u.opnLgclChnnlCnfrm.forwardLogicalChannelNumber;
  833. break;
  834. #if 0
  835. // Request Channel Close Release is sent by State Machine Only
  836. case rqstChnnlClsRls_chosen:
  837. *pEntity = CLCSE_OUT;
  838. *pKey = pPdu->u.indication.u.rqstChnnlClsRls.forwardLogicalChannelNumber;
  839. break;
  840. // Multiplex Entry Send Release is sent by State Machine Only
  841. case mltplxEntrySndRls_chosen:
  842. *pEntity = MTSE_OUT;
  843. break;
  844. // Request Multiplex Entry Release is sent by State Machine Only
  845. case rqstMltplxEntryRls_chosen:
  846. *pEntity = RMESE_OUT;
  847. break;
  848. // Request Mode Release is sent by State Machine Only
  849. case requestModeRelease_chosen:
  850. *pEntity = MRSE_OUT;
  851. break;
  852. #endif
  853. case miscellaneousIndication_chosen:
  854. case jitterIndication_chosen:
  855. case h223SkewIndication_chosen:
  856. case newATMVCIndication_chosen:
  857. case userInput_chosen:
  858. case h2250MxmmSkwIndctn_chosen:
  859. case mcLocationIndication_chosen:
  860. case conferenceIndication_chosen:
  861. case vendorIdentification_chosen:
  862. case IndicationMessage_functionNotSupported_chosen:
  863. *pEntity = STATELESS;
  864. break;
  865. default:
  866. H245TRACE(pInstance->dwInst, 1, "PduParseOutgoing: Invalid Indication %d",
  867. pPdu->u.indication.choice);
  868. return H245_ERROR_PARAM;
  869. } // switch
  870. break;
  871. default:
  872. H245TRACE(pInstance->dwInst, 1, "PduParseOutgoing: Invalid Message Type %d",
  873. pPdu->choice);
  874. return H245_ERROR_PARAM;
  875. } // switch
  876. return H245_ERROR_OK;
  877. } // PduParseOutgoing()