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 /* file name : tsc_eventreceive.c */
30 /* file contents : Event Id Receive */
31 /* draw : '96.10.04 */
32 /*---------------------------------------------------------------------------*/
33 /* amendment */
34 /* Copyright (C) 1996 NTT DoCoMo */
35 /*****************************************************************************/
36 #include "oscl_types.h"
37 #include "oscl_mem.h"
38 #include "h245inf.h"
39 #include "tsc_eventreceive.h"
40
41 /*---------------------------------------------------------------------------*/
42 /* Variable Definition */
43 /*---------------------------------------------------------------------------*/
44 typedef struct _eventidtable
45 {
46 uint32 EventId; /* EventId */
47 uint32 EventInfType; /* EventType */
48 uint32 EventInfId; /* EventId(receive) */
49 } S_EventIdTable;
50
51 // -------------------------------------------------------------
52 // New event table for User Events (App<->Tsc). These are now
53 // handled separately from the SE<->Tsc events. (RAN)
54 // -------------------------------------------------------------
55 static const S_EventIdTable UserEventIdTable[] =
56 {
57 // { 1, H245_USER , E_User_Ce_Instruct },
58 { 2, H245_USER , E_User_Mt_Instruct },
59 { 3, H245_USER , E_User_Mr_Instruct },
60 { 4, H245_USER , E_User_Rtd_Instruct },
61 { 5, H245_USER , E_User_Ml_Instruct },
62 { 6, H245_USER , E_User_Rme_Instruct },
63 { 7, H245_USER , E_User_Stcs_Instruct },
64 { 8, H245_USER , E_User_Hmr_Instruct },
65 { 9, H245_USER , E_User_Rcc_Instruct },
66 { 10, H245_USER , E_User_Clc_Instruct },
67 { 44, H245_USER , E_User_Consent },
68 { 45, H245_USER , E_User_Reject },
69 { 50, H245_USER , E_User_Close },
70 { 51, H245_USER , E_User_NonProcedure },
71 { 0, 0 , 0 }
72 };
73
74 // -------------------------------------------------------------
75 // The original event table for SE<->Tsc events. The user
76 // events have been removed. (RAN)
77 // -------------------------------------------------------------
78 static const S_EventIdTable EventIdTable[] =
79 {
80 // { 2, H245_PRIMITIVE, E_PtvId_Msd_Dtm_Idc },
81 // { 3, H245_PRIMITIVE, E_PtvId_Msd_Dtm_Cfm },
82 // { 4, H245_PRIMITIVE, E_PtvId_Msd_Rjt_Idc },
83 // { 5, H245_PRIMITIVE, E_PtvId_Msd_Err_Idc },
84 // { 6, H245_PRIMITIVE, E_PtvId_Ce_Trf_Idc },
85 // { 7, H245_PRIMITIVE, E_PtvId_Ce_Trf_Cfm },
86 // { 8, H245_PRIMITIVE, E_PtvId_Ce_Rjt_Idc },
87 { 9, H245_PRIMITIVE, E_PtvId_Lc_Etb_Idc },
88 { 10, H245_PRIMITIVE, E_PtvId_Lc_Etb_Cfm },
89 { 11, H245_PRIMITIVE, E_PtvId_Lc_Rls_Idc },
90 { 12, H245_PRIMITIVE, E_PtvId_Lc_Rls_Cfm },
91 { 13, H245_PRIMITIVE, E_PtvId_Lc_Err_Idc },
92 { 14, H245_PRIMITIVE, E_PtvId_Blc_Etb_Idc },
93 { 15, H245_PRIMITIVE, E_PtvId_Blc_Etb_Cfm },
94 { 16, H245_PRIMITIVE, E_PtvId_Blc_Rls_Idc },
95 { 17, H245_PRIMITIVE, E_PtvId_Blc_Rls_Cfm },
96 { 18, H245_PRIMITIVE, E_PtvId_Blc_Err_Idc },
97 { 19, H245_PRIMITIVE, E_PtvId_Clc_Cls_Idc },
98 { 20, H245_PRIMITIVE, E_PtvId_Clc_Cls_Cfm },
99 { 21, H245_PRIMITIVE, E_PtvId_Clc_Rjt_Idc },
100 { 22, H245_PRIMITIVE, E_PtvId_Mt_Trf_Idc },
101 { 23, H245_PRIMITIVE, E_PtvId_Mt_Trf_Cfm },
102 { 24, H245_PRIMITIVE, E_PtvId_Mt_Rjt_Idc },
103 { 25, H245_PRIMITIVE, E_PtvId_Rme_Send_Idc },
104 { 26, H245_PRIMITIVE, E_PtvId_Rme_Send_Cfm },
105 { 27, H245_PRIMITIVE, E_PtvId_Rme_Rjt_Idc },
106 { 28, H245_PRIMITIVE, E_PtvId_Mr_Trf_Idc },
107 { 29, H245_PRIMITIVE, E_PtvId_Mr_Trf_Cfm },
108 { 30, H245_PRIMITIVE, E_PtvId_Mr_Rjt_Idc },
109 { 31, H245_PRIMITIVE, E_PtvId_Rtd_Trf_Cfm },
110 { 32, H245_PRIMITIVE, E_PtvId_Rtd_Exp_Idc },
111 { 33, H245_PRIMITIVE, E_PtvId_Ml_Loop_Idc },
112 { 34, H245_PRIMITIVE, E_PtvId_Ml_Loop_Cfm },
113 { 35, H245_PRIMITIVE, E_PtvId_Ml_Rls_Idc },
114 { 36, H245_PRIMITIVE, E_PtvId_Ml_Err_Idc },
115 { 37, H245_PRIMITIVE, E_PtvId_Cmd_Es_Cfm },
116 { 38, H245_ERROR , H245_INTERNAL_ERROR_TSC },
117 { 38, H245_ERROR , H245_INTERNAL_ERROR_SE },
118 { 38, H245_ERROR , H245_INTERNAL_ERROR_SRP },
119 // NOTE: Tsc currently has no handling for Event38.
120
121 { 49, H245_PRIMITIVE, E_PtvId_Nsd_Req_Cfm },
122 { 49, H245_PRIMITIVE, E_PtvId_Nsd_Rps_Cfm },
123 { 49, H245_PRIMITIVE, E_PtvId_Nsd_Cmd_Cfm },
124 { 49, H245_PRIMITIVE, E_PtvId_Nsd_Idc_Cfm },
125 { 49, H245_PRIMITIVE, E_PtvId_Cm_Req_Cfm },
126 { 49, H245_PRIMITIVE, E_PtvId_Cm_Rps_Cfm },
127 { 49, H245_PRIMITIVE, E_PtvId_Cm_Cmd_Cfm },
128 { 49, H245_PRIMITIVE, E_PtvId_H223aar_Cfm }, /* Not a codeword! (RAN) */
129 { 49, H245_PRIMITIVE, E_PtvId_H223aar_Ack_Cfm }, /* Not a codeword! (RAN) */
130 { 49, H245_PRIMITIVE, E_PtvId_H223aar_Rjt_Cfm }, /* Not a codeword! (RAN) */
131 { 49, H245_PRIMITIVE, E_PtvId_Cnf_Req_Cfm },
132 { 49, H245_PRIMITIVE, E_PtvId_Cnf_Rps_Cfm },
133 { 49, H245_PRIMITIVE, E_PtvId_Cmd_Ecrpt_Cfm },
134 { 49, H245_PRIMITIVE, E_PtvId_Cmd_Es_Cfm },
135 { 49, H245_PRIMITIVE, E_PtvId_Cmd_Cnf_Cfm },
136 { 49, H245_PRIMITIVE, E_PtvId_Idc_Fnu_Cfm },
137 { 49, H245_PRIMITIVE, E_PtvId_Idc_Jtr_Cfm },
138 { 49, H245_PRIMITIVE, E_PtvId_Idc_Nwatmvc_Cfm },
139 { 49, H245_PRIMITIVE, E_PtvId_Idc_Cnf_Cfm },
140 { 49, H245_PRIMITIVE, E_PtvId_Idc_H2250mxskw_Cfm },
141 { 49, H245_PRIMITIVE, E_PtvId_Idc_Mclct_Cfm },
142 { 49, H245_PRIMITIVE, E_PtvId_Idc_Fns_Cfm },
143 { 49, H245_PRIMITIVE, E_PtvId_Idc_Fc_Cfm },
144 /* WWU_BLC: added table entries */
145 { 50, H245_PRIMITIVE, E_PtvId_Blc_Etb_Cfm2 },
146 { 52, H245_PRIMITIVE, E_PtvId_Cmd_Stcs_Cfm }, /* RAN STCS */
147 { 53, H245_PRIMITIVE, E_PtvId_Cmd_Fc_Cfm }, /* RAN FC */
148 { 54, H245_PRIMITIVE, E_PtvId_Cmd_Mscl_Cfm }, /* RAN MSCL */
149 { 55, H245_PRIMITIVE, E_PtvId_Cmd_Hmr_Cfm }, /* RAN HMR */
150 { 56, H245_PRIMITIVE, E_PtvId_Idc_Vi_Cfm },
151 { 57, H245_PRIMITIVE, E_PtvId_Idc_Ui_Cfm }, /* AR: 2SD*/
152 { 58, H245_PRIMITIVE, E_PtvId_Idc_Mscl_Cfm },
153 { 59, H245_PRIMITIVE, E_PtvId_Idc_H223skw_Cfm },
154 { 60, H245_PRIMITIVE, E_PtvId_Cmd_Fc }, /* AR FC */
155 { 0, 0 , 0 }
156 };
157
158
159 /*****************************************************************************/
160 /* function name : Tsc_EventReceive */
161 /* function outline : Event Id Receive procedure */
162 /* function discription : Tsc_EventReceive(pReceiveInf) */
163 /* input data : PS_InfHeader Receive InfHeader Pointer */
164 /* output data : uint32 Event Id */
165 /* draw time : '96.10.09 */
166 /*---------------------------------------------------------------------------*/
167 /* amendent career : */
168 /* */
169 /* Copyright (C) 1996 NTT DoCoMo */
170 /*****************************************************************************/
Tsc_EventReceive(PS_ControlMsgHeader pReceiveInf)171 uint32 Tsc_EventReceive(PS_ControlMsgHeader pReceiveInf)
172 {
173
174 for (uint32 Cnt = 0; EventIdTable[Cnt].EventId != 0; ++Cnt)
175 {
176 if (((uint32)EventIdTable[Cnt].EventInfType == pReceiveInf->InfType) &&
177 ((uint32)EventIdTable[Cnt].EventInfId == pReceiveInf->InfId))
178 {
179 return(EventIdTable[Cnt].EventId);
180 }
181 }
182 return 0;
183 }
184
185 //===================================================================
186 // Tsc_UserEventLookup() (RAN) 6/26/00
187 //
188 // This one is added to process user events from App layer.
189 // It searches the UserEventIdTable to get the event ID, which
190 // it then returns to the calling routine.
191 // NOTE: This routine differs from Tsc_EventReceive() in that
192 // it doesn't pull the contents of pReceiveInf from a queue.
193 // It instead assumes the contents are already there, having
194 // been passed to Tsc by a direct call from the App layer.
195 //====================================================================
Tsc_UserEventLookup(PS_ControlMsgHeader pReceiveInf)196 uint32 Tsc_UserEventLookup(PS_ControlMsgHeader pReceiveInf)
197 {
198 if (pReceiveInf != NULL)
199 {
200 // Look up the UserEventId
201 for (uint32 Cnt = 0; UserEventIdTable[Cnt].EventId != 0; ++Cnt)
202 {
203 if (((uint32)UserEventIdTable[Cnt].EventInfType == pReceiveInf->InfType) &&
204 ((uint32)UserEventIdTable[Cnt].EventInfId == pReceiveInf->InfId))
205 {
206 return(UserEventIdTable[Cnt].EventId);
207 }
208 }
209 return 0; // None found
210 }
211 return 0;
212 }
213