FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/ccd/critical_ext.c @ 648:970d6199f2c5
gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Thu, 04 Sep 2014 05:48:57 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
647:a60b375014e3 | 648:970d6199f2c5 |
---|---|
1 | |
2 /* | |
3 +------------------------------------------------------------------------------ | |
4 | File: critical_ext.c | |
5 +------------------------------------------------------------------------------ | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG. | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +------------------------------------------------------------------------------ | |
17 | Purpose: Encoding and decoding functions for criticalExtensions | |
18 | | |
19 | $Identity:$ | |
20 +------------------------------------------------------------------------------ | |
21 */ | |
22 | |
23 /* | |
24 * Standard definitions like UCHAR, ERROR etc. | |
25 */ | |
26 #include "typedefs.h" | |
27 #include "header.h" | |
28 | |
29 /* | |
30 * Prototypes of ccd (USE_DRIVER EQ undef) for prototypes only | |
31 * look at ccdapi.h | |
32 */ | |
33 #undef USE_DRIVER | |
34 #include "ccdapi.h" | |
35 | |
36 /* | |
37 * Types and functions for bit access and manipulation | |
38 */ | |
39 #include "ccd_globs.h" | |
40 #include "bitfun.h" | |
41 | |
42 /* | |
43 * Prototypes and constants in the common part of ccd | |
44 */ | |
45 #include "ccd.h" | |
46 | |
47 /* | |
48 * Declaration of coder/decoder tables | |
49 */ | |
50 #include "ccdtable.h" | |
51 #include "ccddata.h" | |
52 | |
53 #ifndef RUN_INT_RAM | |
54 /* | |
55 +------------------------------------------------------------------------+ | |
56 | PROJECT : CCD (6144) MODULE : critical_ext | | |
57 | STATE : code ROUTINE : cdc_critical_ext_decode | | |
58 +------------------------------------------------------------------------+ | |
59 | |
60 PURPOSE : Decode elements of type criticalExtensions | |
61 | |
62 An element of this type should never be encoded or decoded. | |
63 If the coder faces an IE of this type, it should report an | |
64 error report and abort. | |
65 Whenever a criticalExtensions-IE is extended from NULL or | |
66 SEQUENCE {} to another type, its CCD coding type will change | |
67 and the functions in this file will not be called for that IE | |
68 any more. | |
69 | |
70 According to 3GPP TS25.331 V3.6.0, 10.1.1.2.2: | |
71 Since messages including critical extensions are rejected by | |
72 receivers not comprehending them, these messages can be | |
73 modified completely, e.g. IEs may be inserted at any place | |
74 and IEs may be removed or redefined. | |
75 See also 3GPP TS25.921 V4.3.0, 10.4. | |
76 */ | |
77 SHORT cdc_critical_ext_decode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs) | |
78 { | |
79 #ifdef DEBUG_CCD | |
80 #ifndef CCD_SYMBOLS | |
81 TRACE_CCD (globs, "cdc_critical_ext_decode()"); | |
82 #else | |
83 TRACE_CCD (globs, "cdc_critical_ext_decode() %s", mcomp[melem[e_ref].elemRef].name); | |
84 #endif | |
85 #endif | |
86 | |
87 globs->pstructOffs = melem[e_ref].structOffs; | |
88 | |
89 /* For optional elements we have already set the valid flag in the | |
90 * C-structure. We have done it while processing ASN1_SEQ. | |
91 */ | |
92 if ( ! cdc_isPresent(e_ref, globs) ) { | |
93 return 1; | |
94 } | |
95 | |
96 if (melem[e_ref].elemType EQ 'V' AND mvar[melem[e_ref].elemRef].bSize EQ 0) | |
97 { | |
98 ccd_recordFault (globs, | |
99 ERR_CRITICAL_EXT, | |
100 BREAK, | |
101 (USHORT) e_ref, | |
102 globs->pstruct + melem[e_ref].structOffs | |
103 ); | |
104 return 0; | |
105 } | |
106 /* | |
107 * Currently CCD tool chain does not support extensions of this type. | |
108 * This else-implementation is just an outlook. | |
109 * | |
110 else | |
111 { | |
112 U16 compRef = melem[e_ref].elemRef; | |
113 U16 elemRef = mcomp[compRef].componentRef; | |
114 (void) codec[melem[Elem].codingType][DECODE_FUN] | |
115 (compRef, elemRef, globs); | |
116 }*/ | |
117 return 1; | |
118 } | |
119 #endif /* !RUN_INT_RAM */ | |
120 | |
121 #ifndef RUN_INT_RAM | |
122 /* | |
123 +------------------------------------------------------------------------+ | |
124 | PROJECT : CCD (6144) MODULE : critical_ext | | |
125 | STATE : code ROUTINE : cdc_critical_ext_encode | | |
126 +------------------------------------------------------------------------+ | |
127 | |
128 PURPOSE : Encode elements of type criticalExtensions | |
129 | |
130 An element of this type should never be encoded or decoded. | |
131 If the coder faces an IE of this type, it should report an | |
132 error report and abort. | |
133 */ | |
134 SHORT cdc_critical_ext_encode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs) | |
135 { | |
136 | |
137 #ifdef DEBUG_CCD | |
138 #ifndef CCD_SYMBOLS | |
139 TRACE_CCD (globs, "cdc_critical_ext_encode()"); | |
140 #else | |
141 TRACE_CCD (globs, "cdc_critical_ext_encode() %s", mcomp[melem[e_ref].elemRef].name); | |
142 #endif | |
143 #endif | |
144 | |
145 globs->pstructOffs = melem[e_ref].structOffs; | |
146 | |
147 /* For optional elements we have already set the valid flag in the | |
148 * C-structure. We have done it while processing ASN1_SEQ. | |
149 */ | |
150 if ( ! cdc_isPresent(e_ref, globs) ) { | |
151 return 1; | |
152 } | |
153 | |
154 if (melem[e_ref].elemType EQ 'V' AND mvar[melem[e_ref].elemRef].bSize EQ 0) | |
155 { | |
156 ccd_recordFault (globs, | |
157 ERR_CRITICAL_EXT, | |
158 BREAK, | |
159 (USHORT) e_ref, | |
160 globs->pstruct + melem[e_ref].structOffs | |
161 ); | |
162 return 0; | |
163 } | |
164 /* | |
165 * Currently CCD tool chain does not support extensions of this type. | |
166 * This else-implementation is just an outlook. | |
167 * | |
168 else | |
169 { | |
170 U16 compRef = melem[e_ref].elemRef; | |
171 U16 elemRef = mcomp[compRef].componentRef; | |
172 (void) codec[melem[Elem].codingType][ENCODE_FUN] | |
173 (compRef, elemRef, globs); | |
174 }*/ | |
175 return 1; | |
176 } | |
177 #endif /* !RUN_INT_RAM */ |