• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ------------------------------------------------------------------
2  * Copyright (C) 1998-2009 PacketVideo
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13  * express or implied.
14  * See the License for the specific language governing permissions
15  * and limitations under the License.
16  * -------------------------------------------------------------------
17  */
18 // ----------------------------------------------------------------------
19 //
20 // This Software is an original work of authorship of PacketVideo Corporation.
21 // Portions of the Software were developed in collaboration with NTT  DoCoMo,
22 // Inc. or were derived from the public domain or materials licensed from
23 // third parties.  Title and ownership, including all intellectual property
24 // rights in and to the Software shall remain with PacketVideo Corporation
25 // and NTT DoCoMo, Inc.
26 //
27 // -----------------------------------------------------------------------
28 
29 #include "tsc_blc.h"         // Bi-directional Logical Channel Information Header
30 #include "tsc_sub.h"         // Sub Routine Information Header
31 #include "oscl_mem.h"
32 #include "h245def.h"
33 #include "h245_copier.h"
34 #include "h223types.h"
35 #include "tsc_constants.h"
36 #include "tsc_statemanager.h"
37 
38 
39 
40 /*****************************************************************************/
41 /*  function name        : Tsc_BlcEtbReq                                     */
42 /*  function outline     : Tsc_BlcEtbReq procedure                           */
43 /*  function discription : Tsc_BlcEtbReq( LcnIndex )                          */
44 /*  input data           : uint32                 Open Lcn                     */
45 /*  output data          : None                                              */
46 /*  draw time            : '96.10.09                                         */
47 /*---------------------------------------------------------------------------*/
48 /*  amendent career (x)      :                                                   */
49 /*                                                                           */
50 /*              Copyright (C) 1996 NTT DoCoMo                                */
51 /*****************************************************************************/
BlcEtbReq(TPVChannelId Lcn,PS_DataType pDataTypeForward,PS_H223LogicalChannelParameters pH223ParamsForward,PS_DataType pDataTypeReverse,PS_H223LogicalChannelParameters pH223ParamsReverse)52 void TSC_blc::BlcEtbReq(TPVChannelId Lcn,
53                         PS_DataType pDataTypeForward,
54                         PS_H223LogicalChannelParameters pH223ParamsForward,
55                         PS_DataType pDataTypeReverse,
56                         PS_H223LogicalChannelParameters pH223ParamsReverse)
57 {
58     S_ControlMsgHeader         infHeader;
59     S_ForwardReverseParam      parameter;
60     S_DataType  dataTypeNull;
61     dataTypeNull.index = 1;
62 
63     PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
64                     (0, "TSC_blc::BlcEtbReq lcn(%d), %x, %x, %x, %x", Lcn, pDataTypeForward, pH223ParamsForward, pDataTypeReverse, pH223ParamsReverse));
65 
66     if (pDataTypeReverse == NULL)
67     {
68         PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
69                         (0,
70                          "TSC_blc::BlcEtbReq Reverse DataType == null"));
71         pDataTypeReverse = &dataTypeNull;
72     }
73 
74     if (pH223ParamsReverse == NULL)
75     {
76         PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
77                         (0,
78                          "TSC_blc::BlcEtbReq Reverse H223Params == null"));
79         pH223ParamsReverse = pH223ParamsForward;
80     }
81 
82     PS_DataType dt = Copy_DataType(pDataTypeForward);
83     oscl_memcpy(&parameter.forwardLogicalChannelParameters.dataType,
84                 dt,
85                 sizeof(S_DataType));
86     OSCL_DEFAULT_FREE(dt);
87 
88     // Buffer Allocate
89     parameter.forwardLogicalChannelParameters.option_of_portNumber = false;
90 
91     // MultiplexParameters
92     parameter.forwardLogicalChannelParameters.multiplexParameters.index = 1;  // h223
93     parameter.forwardLogicalChannelParameters.multiplexParameters.h223LogicalChannelParameters =
94         Copy_H223LogicalChannelParameters(pH223ParamsForward);
95 
96     // ForwardLogicalChannelParameters
97     parameter.forwardLogicalChannelParameters.option_of_forwardLogicalChannelDependency = false;
98     parameter.forwardLogicalChannelParameters.option_of_replacementFor = false;
99 
100     // ===========================================================
101     // =========== reverseLogicalChannelParameters ===============
102     // ===========================================================
103 
104     parameter.option_of_reverseLogicalChannelParameters = true;
105 
106     dt = Copy_DataType(pDataTypeReverse);
107     oscl_memcpy(&parameter.reverseLogicalChannelParameters.dataType,
108                 dt,
109                 sizeof(S_DataType));
110     OSCL_DEFAULT_FREE(dt);
111 
112     parameter.reverseLogicalChannelParameters.option_of_rlcMultiplexParameters = true;
113     // MultiplexParameters
114     parameter.reverseLogicalChannelParameters.rlcMultiplexParameters.index = 0;  // h223
115     parameter.reverseLogicalChannelParameters.rlcMultiplexParameters.h223LogicalChannelParameters =
116         Copy_H223LogicalChannelParameters(pH223ParamsReverse);
117 
118     // rEVERSELogicalChannelParameters
119     parameter.reverseLogicalChannelParameters.option_of_reverseLogicalChannelDependency = false;
120     parameter.reverseLogicalChannelParameters.option_of_replacementFor = false;
121 
122     Tsc_SendDataSet(&infHeader,
123                     H245_PRIMITIVE,
124                     E_PtvId_Blc_Etb_Req,
125                     Lcn,
126                     0,
127                     (uint8*)&parameter,
128                     sizeof(S_ForwardReverseParam));
129 
130     // Primitive Send
131     iH245->DispatchControlMessage(&infHeader);
132 
133     iTSCstatemanager.WriteState(TSC_LC_VIDEO_SEND, STARTED);
134 
135     Delete_DataType(&parameter.forwardLogicalChannelParameters.dataType);
136     Delete_DataType(&parameter.reverseLogicalChannelParameters.dataType);
137     Delete_H223LogicalChannelParameters(
138         parameter.forwardLogicalChannelParameters.multiplexParameters.h223LogicalChannelParameters);
139     OSCL_DEFAULT_FREE(
140         parameter.forwardLogicalChannelParameters.multiplexParameters.h223LogicalChannelParameters);
141     Delete_H223LogicalChannelParameters(
142         parameter.reverseLogicalChannelParameters.rlcMultiplexParameters.h223LogicalChannelParameters);
143     OSCL_DEFAULT_FREE(
144         parameter.reverseLogicalChannelParameters.rlcMultiplexParameters.h223LogicalChannelParameters);
145 }
146 
147 /*****************************************************************************/
148 /*  function name        : Tsc_BlcEtbRps                                     */
149 /*  function outline     : Tsc_BlcEtbRps procedure                           */
150 /*  function discription : Tsc_BlcEtbRps( OpenPendingLcn )                   */
151 /*  input data           : uint32                                              */
152 /*  output data          : None                                              */
153 /*  draw time            : '96.10.09                                         */
154 /*---------------------------------------------------------------------------*/
155 /*  amendent career (x)      :                                                   */
156 /*                                                                           */
157 /*              Copyright (C) 1996 NTT DoCoMo                                */
158 /*****************************************************************************/
BlcEtbRps(TPVChannelId incoming_lcn,TPVChannelId outgoing_lcn)159 void TSC_blc::BlcEtbRps(TPVChannelId incoming_lcn, TPVChannelId outgoing_lcn)
160 {
161     S_ControlMsgHeader  infHeader;
162     S_ReverseData       parameter;
163     PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
164                     (0,
165                      "TSC_blc::BlcEtbRps incoming(%d), outgoing(%d)\n", incoming_lcn, outgoing_lcn));
166 
167     // Buffer Allocate
168     oscl_memset(&parameter, 0, sizeof(S_ReverseData));
169 
170     // ESTABLISH.response primitive - Parameter(REVERSE_DATA)
171     parameter.option_of_reverseLogicalChannelParameters = true;
172     parameter.reverseLogicalChannelParameters.reverseLogicalChannelNumber =
173         (uint16)incoming_lcn; // WWU_BLC: change 0->3
174     parameter.reverseLogicalChannelParameters.option_of_portNumber = false;
175     parameter.reverseLogicalChannelParameters.option_of_ackMultiplexParameters = false;
176     parameter.reverseLogicalChannelParameters.option_of_replacementFor = false;
177 
178     Tsc_SendDataSet(&infHeader,
179                     H245_PRIMITIVE,
180                     E_PtvId_Blc_Etb_Rps,
181                     incoming_lcn,
182                     outgoing_lcn,
183                     (uint8*)&parameter,
184                     sizeof(S_ReverseData));
185 
186     // Primitive Send
187     iH245->DispatchControlMessage(&infHeader);
188 }
189 
190 
191 /*****************************************************************************/
192 /*  function name        : Tsc_BlcRlsReq                                     */
193 /*  function outline     : Tsc_BlcRlsReq                                     */
194 /*  function discription : Tsc_BlcRlsReq( ReleaseType, CloseLcn )            */
195 /*  input data           : int32                                               */
196 /*                       : uint32                                              */
197 /*  output data          : None                                              */
198 /*  draw time            : '96.10.09                                         */
199 /*---------------------------------------------------------------------------*/
200 /*  amendent career (x)      :                                                   */
201 /*                                                                           */
202 /*              Copyright (C) 1996 NTT DoCoMo                                */
203 /*****************************************************************************/
BlcRlsReq(int32 ReleaseType,uint32 CloseLcn,uint32 Cause)204 TPVDirection TSC_blc::BlcRlsReq(int32 ReleaseType,
205                                 uint32 CloseLcn,
206                                 uint32 Cause)   // WWU_VOAL2: add Cause
207 {
208     S_ControlMsgHeader  infHeader;
209     S_OlcRejectCause    parameter;
210     TPVDirection dir = OUTGOING;
211     PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
212                     (0,
213                      "TSC_blc::BlcRlsReq lcn(%d), Release type(%d), Cause(%d)\n",
214                      CloseLcn, ReleaseType, Cause));
215 
216     if (ReleaseType == RELEASE_CLOSE)
217     {
218         // Close outgoing
219         dir = OUTGOING;
220         Tsc_SendDataSet(&infHeader,
221                         H245_PRIMITIVE,
222                         E_PtvId_Blc_Rls_Req,
223                         CloseLcn,
224                         0,
225                         NULL,
226                         0);
227     }
228     else
229     {
230         // Reject incoming
231         dir = INCOMING;
232         // Buffer Allocate
233         parameter.index = (uint16)Cause;
234         Tsc_SendDataSet(&infHeader,
235                         H245_PRIMITIVE,
236                         E_PtvId_Blc_Rls_Req,
237                         CloseLcn,
238                         0,
239                         (uint8*)&parameter,
240                         sizeof(S_OlcRejectCause));
241     }
242 
243     // Primitive Send
244     iH245->DispatchControlMessage(&infHeader);
245     return dir;
246 }
247 
248