]>
Commit | Line | Data |
---|---|---|
bac41a7b A |
1 | #if TTBL |
2 | /* | |
3 | * tbl.c | |
4 | * | |
5 | * "TBL" ASN.1 module encode/decode/print/free C src. | |
6 | * | |
29654253 | 7 | * This file was generated by snacc on Tue Mar 19 07:24:47 2002 |
bac41a7b A |
8 | * |
9 | * UBC snacc written by Mike Sample | |
10 | * | |
11 | * NOTE: This is a machine generated file - editing not recommended | |
12 | */ | |
13 | ||
14 | ||
15 | ||
16 | #include "asn-incl.h" | |
17 | #include "tbl.h" | |
18 | ||
19 | ||
20 | AsnLen | |
21 | BEncTBLRangeContent PARAMS ((b, v), | |
22 | BUF_TYPE b _AND_ | |
23 | TBLRange *v) | |
24 | { | |
25 | AsnLen totalLen = 0; | |
26 | AsnLen itemLen; | |
27 | AsnLen listLen; | |
28 | void *component; | |
29 | ||
30 | itemLen = BEncAsnIntContent (b, (&v->to)); | |
31 | BEncDefLenTo127 (b, itemLen); | |
32 | itemLen++; | |
33 | itemLen += BEncTag1 (b, CNTX, PRIM, 1); | |
34 | ||
35 | totalLen += itemLen; | |
36 | ||
37 | itemLen = BEncAsnIntContent (b, (&v->from)); | |
38 | BEncDefLenTo127 (b, itemLen); | |
39 | itemLen++; | |
40 | itemLen += BEncTag1 (b, CNTX, PRIM, 0); | |
41 | ||
42 | totalLen += itemLen; | |
43 | ||
44 | return totalLen; | |
45 | ||
46 | } /* BEncTBLRangeContent */ | |
47 | ||
48 | void | |
49 | BDecTBLRangeContent PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, env), | |
50 | BUF_TYPE b _AND_ | |
51 | AsnTag tagId0 _AND_ | |
52 | AsnLen elmtLen0 _AND_ | |
53 | TBLRange *v _AND_ | |
54 | AsnLen *bytesDecoded _AND_ | |
55 | ENV_TYPE env) | |
56 | { | |
57 | int seqDone = FALSE; | |
58 | AsnLen totalElmtsLen1 = 0; | |
59 | AsnLen elmtLen1; | |
60 | AsnTag tagId1; | |
61 | int mandatoryElmtCount1 = 0; | |
62 | ||
63 | ||
64 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
65 | ||
66 | if (((tagId1 == MAKE_TAG_ID (CNTX, PRIM, 0)))) | |
67 | { | |
68 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
69 | BDecAsnIntContent (b, tagId1, elmtLen1, (&v->from), &totalElmtsLen1, env); | |
70 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
71 | } | |
72 | else | |
73 | longjmp (env, -100); | |
74 | ||
75 | ||
76 | if (((tagId1 == MAKE_TAG_ID (CNTX, PRIM, 1)))) | |
77 | { | |
78 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
79 | BDecAsnIntContent (b, tagId1, elmtLen1, (&v->to), &totalElmtsLen1, env); | |
80 | seqDone = TRUE; | |
81 | if (elmtLen0 == INDEFINITE_LEN) | |
82 | BDecEoc (b, &totalElmtsLen1, env); | |
83 | else if (totalElmtsLen1 != elmtLen0) | |
84 | longjmp (env, -101); | |
85 | } | |
86 | else | |
87 | longjmp (env, -102); | |
88 | ||
89 | ||
90 | if (!seqDone) | |
91 | longjmp (env, -103); | |
92 | ||
93 | (*bytesDecoded) += totalElmtsLen1; | |
94 | } /* BDecTBLRangeContent */ | |
95 | ||
96 | void | |
97 | PrintTBLRange PARAMS ((f, v, indent), | |
98 | FILE* f _AND_ | |
99 | TBLRange *v _AND_ | |
100 | unsigned short int indent) | |
101 | { | |
102 | if (v == NULL) | |
103 | return; | |
104 | ||
105 | fprintf (f,"{ -- SEQUENCE --\n"); | |
106 | ||
107 | Indent (f, indent + stdIndentG); | |
108 | fprintf (f,"from "); | |
109 | PrintAsnInt (f, (&v->from), indent + stdIndentG); | |
110 | fprintf (f, ",\n"); | |
111 | Indent (f, indent + stdIndentG); | |
112 | fprintf (f,"to "); | |
113 | PrintAsnInt (f, (&v->to), indent + stdIndentG); | |
114 | fprintf (f,"\n"); | |
115 | Indent (f, indent); | |
116 | fprintf (f,"}"); | |
117 | } /* PrintTBLRange */ | |
118 | ||
119 | void | |
120 | FreeTBLRange PARAMS ((v), | |
121 | TBLRange *v) | |
122 | { | |
123 | ||
124 | if (v == NULL) | |
125 | return; | |
126 | FreeAsnInt ((&v->from)); | |
127 | ||
128 | FreeAsnInt ((&v->to)); | |
129 | ||
130 | } /* FreeTBLRange */ | |
131 | ||
132 | ||
133 | ||
134 | ||
135 | AsnLen | |
136 | BEncTBLNamedNumberContent PARAMS ((b, v), | |
137 | BUF_TYPE b _AND_ | |
138 | TBLNamedNumber *v) | |
139 | { | |
140 | AsnLen totalLen = 0; | |
141 | AsnLen itemLen; | |
142 | AsnLen listLen; | |
143 | void *component; | |
144 | ||
145 | itemLen = BEncAsnIntContent (b, (&v->value)); | |
146 | BEncDefLenTo127 (b, itemLen); | |
147 | itemLen++; | |
148 | itemLen += BEncTag1 (b, CNTX, PRIM, 1); | |
149 | ||
150 | totalLen += itemLen; | |
151 | ||
152 | itemLen = BEncPrintableStringContent (b, (&v->name)); | |
153 | itemLen += BEncDefLen (b, itemLen); | |
154 | itemLen += BEncTag1 (b, CNTX, PRIM, 0); | |
155 | ||
156 | totalLen += itemLen; | |
157 | ||
158 | return totalLen; | |
159 | ||
160 | } /* BEncTBLNamedNumberContent */ | |
161 | ||
162 | void | |
163 | BDecTBLNamedNumberContent PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, env), | |
164 | BUF_TYPE b _AND_ | |
165 | AsnTag tagId0 _AND_ | |
166 | AsnLen elmtLen0 _AND_ | |
167 | TBLNamedNumber *v _AND_ | |
168 | AsnLen *bytesDecoded _AND_ | |
169 | ENV_TYPE env) | |
170 | { | |
171 | int seqDone = FALSE; | |
172 | AsnLen totalElmtsLen1 = 0; | |
173 | AsnLen elmtLen1; | |
174 | AsnTag tagId1; | |
175 | int mandatoryElmtCount1 = 0; | |
176 | ||
177 | ||
178 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
179 | ||
180 | if (((tagId1 == MAKE_TAG_ID (CNTX, PRIM, 0)) || | |
181 | (tagId1 == MAKE_TAG_ID (CNTX, CONS, 0)))) | |
182 | { | |
183 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
184 | BDecPrintableStringContent (b, tagId1, elmtLen1, (&v->name), &totalElmtsLen1, env); | |
185 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
186 | } | |
187 | else | |
188 | longjmp (env, -104); | |
189 | ||
190 | ||
191 | if (((tagId1 == MAKE_TAG_ID (CNTX, PRIM, 1)))) | |
192 | { | |
193 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
194 | BDecAsnIntContent (b, tagId1, elmtLen1, (&v->value), &totalElmtsLen1, env); | |
195 | seqDone = TRUE; | |
196 | if (elmtLen0 == INDEFINITE_LEN) | |
197 | BDecEoc (b, &totalElmtsLen1, env); | |
198 | else if (totalElmtsLen1 != elmtLen0) | |
199 | longjmp (env, -105); | |
200 | } | |
201 | else | |
202 | longjmp (env, -106); | |
203 | ||
204 | ||
205 | if (!seqDone) | |
206 | longjmp (env, -107); | |
207 | ||
208 | (*bytesDecoded) += totalElmtsLen1; | |
209 | } /* BDecTBLNamedNumberContent */ | |
210 | ||
211 | void | |
212 | PrintTBLNamedNumber PARAMS ((f, v, indent), | |
213 | FILE* f _AND_ | |
214 | TBLNamedNumber *v _AND_ | |
215 | unsigned short int indent) | |
216 | { | |
217 | if (v == NULL) | |
218 | return; | |
219 | ||
220 | fprintf (f,"{ -- SEQUENCE --\n"); | |
221 | ||
222 | Indent (f, indent + stdIndentG); | |
223 | fprintf (f,"name "); | |
224 | PrintPrintableString (f, (&v->name), indent + stdIndentG); | |
225 | fprintf (f, ",\n"); | |
226 | Indent (f, indent + stdIndentG); | |
227 | fprintf (f,"value "); | |
228 | PrintAsnInt (f, (&v->value), indent + stdIndentG); | |
229 | fprintf (f,"\n"); | |
230 | Indent (f, indent); | |
231 | fprintf (f,"}"); | |
232 | } /* PrintTBLNamedNumber */ | |
233 | ||
234 | void | |
235 | FreeTBLNamedNumber PARAMS ((v), | |
236 | TBLNamedNumber *v) | |
237 | { | |
238 | ||
239 | if (v == NULL) | |
240 | return; | |
241 | FreePrintableString ((&v->name)); | |
242 | ||
243 | FreeAsnInt ((&v->value)); | |
244 | ||
245 | } /* FreeTBLNamedNumber */ | |
246 | ||
247 | ||
248 | ||
249 | ||
250 | AsnLen | |
251 | BEncTBLNamedNumberListContent PARAMS ((b, v), | |
252 | BUF_TYPE b _AND_ | |
253 | TBLNamedNumberList *v) | |
254 | { | |
255 | AsnLen totalLen = 0; | |
256 | AsnLen itemLen; | |
257 | AsnLen listLen; | |
258 | void *component; | |
259 | ||
260 | listLen = 0; | |
261 | FOR_EACH_LIST_ELMT_RVS (component, v) | |
262 | { | |
263 | BEncEocIfNec (b); | |
264 | itemLen = BEncTBLNamedNumberContent (b, component); | |
265 | itemLen += BEncConsLen (b, itemLen); | |
266 | itemLen += BEncTag1 (b, UNIV, CONS, 16); | |
267 | ||
268 | listLen += itemLen; | |
269 | } | |
270 | return listLen; | |
271 | ||
272 | } /* BEncTBLNamedNumberListContent */ | |
273 | ||
274 | void | |
275 | BDecTBLNamedNumberListContent PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, env), | |
276 | BUF_TYPE b _AND_ | |
277 | AsnTag tagId0 _AND_ | |
278 | AsnLen elmtLen0 _AND_ | |
279 | TBLNamedNumberList *v _AND_ | |
280 | AsnLen *bytesDecoded _AND_ | |
281 | ENV_TYPE env) | |
282 | { | |
283 | int seqDone = FALSE; | |
284 | AsnLen totalElmtsLen1 = 0; | |
285 | AsnLen elmtLen1; | |
286 | AsnTag tagId1; | |
287 | int mandatoryElmtCount1 = 0; | |
288 | ||
289 | ||
290 | for (totalElmtsLen1 = 0; (totalElmtsLen1 < elmtLen0) || (elmtLen0 == INDEFINITE_LEN);) | |
291 | { | |
292 | TBLNamedNumber **tmpVar; | |
293 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
294 | ||
295 | if ((tagId1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN)) | |
296 | { | |
297 | BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1, env) | |
298 | break; /* got EOC so can exit this SET OF/SEQ OF's for loop*/ | |
299 | } | |
300 | if ((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))) | |
301 | { | |
302 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
303 | tmpVar = (TBLNamedNumber**) AsnListAppend (v); | |
304 | (*tmpVar) = (TBLNamedNumber*) Asn1Alloc (sizeof (TBLNamedNumber)); | |
305 | CheckAsn1Alloc ((*tmpVar), env); | |
306 | BDecTBLNamedNumberContent (b, tagId1, elmtLen1, (*tmpVar), &totalElmtsLen1, env); | |
307 | } /* end of tag check if */ | |
308 | else /* wrong tag */ | |
309 | { | |
310 | Asn1Error ("Unexpected Tag\n"); | |
311 | longjmp (env, -108); | |
312 | } | |
313 | } /* end of for */ | |
314 | ||
315 | (*bytesDecoded) += totalElmtsLen1; | |
316 | } /* BDecTBLNamedNumberListContent */ | |
317 | ||
318 | void | |
319 | PrintTBLNamedNumberList PARAMS ((f, v, indent), | |
320 | FILE* f _AND_ | |
321 | TBLNamedNumberList *v _AND_ | |
322 | unsigned short int indent) | |
323 | { | |
324 | TBLNamedNumber *tmp; | |
325 | if (v == NULL) | |
326 | return; | |
327 | fprintf (f,"{ -- SEQUENCE OF -- \n"); | |
328 | FOR_EACH_LIST_ELMT (tmp, v) | |
329 | { | |
330 | Indent (f, indent+ stdIndentG); | |
331 | PrintTBLNamedNumber (f, tmp, indent + stdIndentG); | |
332 | if (tmp != (TBLNamedNumber*)LAST_LIST_ELMT (v)) | |
333 | fprintf (f,",\n"); | |
334 | } | |
335 | fprintf (f,"\n"); | |
336 | Indent (f, indent); | |
337 | fprintf (f,"}"); | |
338 | } /* PrintTBLNamedNumberList */ | |
339 | ||
340 | void | |
341 | FreeTBLNamedNumberList PARAMS ((v), | |
342 | TBLNamedNumberList *v) | |
343 | { | |
344 | ||
345 | AsnListNode *l; | |
346 | AsnListNode *tmp; | |
347 | if (v == NULL) | |
348 | return; | |
349 | for (l = FIRST_LIST_NODE (v); l != NULL; ) | |
350 | { | |
351 | FreeTBLNamedNumber ((l->data)); | |
352 | tmp = l->next; | |
353 | Asn1Free (l->data); | |
354 | Asn1Free (l); | |
355 | l = tmp; | |
356 | } | |
357 | } /* FreeTBLNamedNumberList */ | |
358 | ||
359 | ||
360 | ||
361 | ||
362 | AsnLen | |
363 | BEncTBLTypeRefContent PARAMS ((b, v), | |
364 | BUF_TYPE b _AND_ | |
365 | TBLTypeRef *v) | |
366 | { | |
367 | AsnLen totalLen = 0; | |
368 | AsnLen itemLen; | |
369 | AsnLen listLen; | |
370 | void *component; | |
371 | ||
372 | itemLen = BEncAsnBoolContent (b, (&v->implicit)); | |
373 | BEncDefLenTo127 (b, itemLen); | |
374 | itemLen++; | |
375 | itemLen += BEncTag1 (b, UNIV, PRIM, 1); | |
376 | ||
377 | totalLen += itemLen; | |
378 | ||
379 | itemLen = BEncTBLTypeDefIdContent (b, (&v->typeDef)); | |
380 | BEncDefLenTo127 (b, itemLen); | |
381 | itemLen++; | |
382 | itemLen += BEncTag1 (b, UNIV, PRIM, 2); | |
383 | ||
384 | totalLen += itemLen; | |
385 | ||
386 | return totalLen; | |
387 | ||
388 | } /* BEncTBLTypeRefContent */ | |
389 | ||
390 | void | |
391 | BDecTBLTypeRefContent PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, env), | |
392 | BUF_TYPE b _AND_ | |
393 | AsnTag tagId0 _AND_ | |
394 | AsnLen elmtLen0 _AND_ | |
395 | TBLTypeRef *v _AND_ | |
396 | AsnLen *bytesDecoded _AND_ | |
397 | ENV_TYPE env) | |
398 | { | |
399 | int seqDone = FALSE; | |
400 | AsnLen totalElmtsLen1 = 0; | |
401 | AsnLen elmtLen1; | |
402 | AsnTag tagId1; | |
403 | int mandatoryElmtCount1 = 0; | |
404 | ||
405 | ||
406 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
407 | ||
408 | if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))) | |
409 | { | |
410 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
411 | BDecTBLTypeDefIdContent (b, tagId1, elmtLen1, (&v->typeDef), &totalElmtsLen1, env); | |
412 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
413 | } | |
414 | else | |
415 | longjmp (env, -109); | |
416 | ||
417 | ||
418 | if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, BOOLEAN_TAG_CODE)))) | |
419 | { | |
420 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
421 | BDecAsnBoolContent (b, tagId1, elmtLen1, (&v->implicit), &totalElmtsLen1, env); | |
422 | seqDone = TRUE; | |
423 | if (elmtLen0 == INDEFINITE_LEN) | |
424 | BDecEoc (b, &totalElmtsLen1, env); | |
425 | else if (totalElmtsLen1 != elmtLen0) | |
426 | longjmp (env, -110); | |
427 | } | |
428 | else | |
429 | longjmp (env, -111); | |
430 | ||
431 | ||
432 | if (!seqDone) | |
433 | longjmp (env, -112); | |
434 | ||
435 | (*bytesDecoded) += totalElmtsLen1; | |
436 | } /* BDecTBLTypeRefContent */ | |
437 | ||
438 | void | |
439 | PrintTBLTypeRef PARAMS ((f, v, indent), | |
440 | FILE* f _AND_ | |
441 | TBLTypeRef *v _AND_ | |
442 | unsigned short int indent) | |
443 | { | |
444 | if (v == NULL) | |
445 | return; | |
446 | ||
447 | fprintf (f,"{ -- SEQUENCE --\n"); | |
448 | ||
449 | Indent (f, indent + stdIndentG); | |
450 | fprintf (f,"typeDef "); | |
451 | PrintTBLTypeDefId (f, (&v->typeDef), indent + stdIndentG); | |
452 | fprintf (f, ",\n"); | |
453 | Indent (f, indent + stdIndentG); | |
454 | fprintf (f,"implicit "); | |
455 | PrintAsnBool (f, (&v->implicit), indent + stdIndentG); | |
456 | fprintf (f,"\n"); | |
457 | Indent (f, indent); | |
458 | fprintf (f,"}"); | |
459 | } /* PrintTBLTypeRef */ | |
460 | ||
461 | void | |
462 | FreeTBLTypeRef PARAMS ((v), | |
463 | TBLTypeRef *v) | |
464 | { | |
465 | ||
466 | if (v == NULL) | |
467 | return; | |
468 | FreeTBLTypeDefId ((&v->typeDef)); | |
469 | ||
470 | FreeAsnBool ((&v->implicit)); | |
471 | ||
472 | } /* FreeTBLTypeRef */ | |
473 | ||
474 | ||
475 | ||
476 | ||
477 | AsnLen | |
478 | BEncTBLTagContent PARAMS ((b, v), | |
479 | BUF_TYPE b _AND_ | |
480 | TBLTag *v) | |
481 | { | |
482 | AsnLen totalLen = 0; | |
483 | AsnLen itemLen; | |
484 | AsnLen listLen; | |
485 | void *component; | |
486 | ||
487 | itemLen = BEncAsnIntContent (b, (&v->code)); | |
488 | BEncDefLenTo127 (b, itemLen); | |
489 | itemLen++; | |
490 | itemLen += BEncTag1 (b, UNIV, PRIM, 2); | |
491 | ||
492 | totalLen += itemLen; | |
493 | ||
494 | itemLen = BEncTBLTagClassContent (b, (&v->tclass)); | |
495 | BEncDefLenTo127 (b, itemLen); | |
496 | itemLen++; | |
497 | itemLen += BEncTag1 (b, UNIV, PRIM, 10); | |
498 | ||
499 | totalLen += itemLen; | |
500 | ||
501 | return totalLen; | |
502 | ||
503 | } /* BEncTBLTagContent */ | |
504 | ||
505 | void | |
506 | BDecTBLTagContent PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, env), | |
507 | BUF_TYPE b _AND_ | |
508 | AsnTag tagId0 _AND_ | |
509 | AsnLen elmtLen0 _AND_ | |
510 | TBLTag *v _AND_ | |
511 | AsnLen *bytesDecoded _AND_ | |
512 | ENV_TYPE env) | |
513 | { | |
514 | int seqDone = FALSE; | |
515 | AsnLen totalElmtsLen1 = 0; | |
516 | AsnLen elmtLen1; | |
517 | AsnTag tagId1; | |
518 | int mandatoryElmtCount1 = 0; | |
519 | ||
520 | ||
521 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
522 | ||
523 | if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, ENUM_TAG_CODE)))) | |
524 | { | |
525 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
526 | BDecTBLTagClassContent (b, tagId1, elmtLen1, (&v->tclass), &totalElmtsLen1, env); | |
527 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
528 | } | |
529 | else | |
530 | longjmp (env, -113); | |
531 | ||
532 | ||
533 | if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))) | |
534 | { | |
535 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
536 | BDecAsnIntContent (b, tagId1, elmtLen1, (&v->code), &totalElmtsLen1, env); | |
537 | seqDone = TRUE; | |
538 | if (elmtLen0 == INDEFINITE_LEN) | |
539 | BDecEoc (b, &totalElmtsLen1, env); | |
540 | else if (totalElmtsLen1 != elmtLen0) | |
541 | longjmp (env, -114); | |
542 | } | |
543 | else | |
544 | longjmp (env, -115); | |
545 | ||
546 | ||
547 | if (!seqDone) | |
548 | longjmp (env, -116); | |
549 | ||
550 | (*bytesDecoded) += totalElmtsLen1; | |
551 | } /* BDecTBLTagContent */ | |
552 | ||
553 | void | |
554 | PrintTBLTag PARAMS ((f, v, indent), | |
555 | FILE* f _AND_ | |
556 | TBLTag *v _AND_ | |
557 | unsigned short int indent) | |
558 | { | |
559 | if (v == NULL) | |
560 | return; | |
561 | ||
562 | fprintf (f,"{ -- SEQUENCE --\n"); | |
563 | ||
564 | Indent (f, indent + stdIndentG); | |
565 | fprintf (f,"tclass "); | |
566 | PrintTBLTagClass (f, (&v->tclass), indent + stdIndentG); | |
567 | fprintf (f, ",\n"); | |
568 | Indent (f, indent + stdIndentG); | |
569 | fprintf (f,"code "); | |
570 | PrintAsnInt (f, (&v->code), indent + stdIndentG); | |
571 | fprintf (f,"\n"); | |
572 | Indent (f, indent); | |
573 | fprintf (f,"}"); | |
574 | } /* PrintTBLTag */ | |
575 | ||
576 | void | |
577 | FreeTBLTag PARAMS ((v), | |
578 | TBLTag *v) | |
579 | { | |
580 | ||
581 | if (v == NULL) | |
582 | return; | |
583 | FreeTBLTagClass ((&v->tclass)); | |
584 | ||
585 | FreeAsnInt ((&v->code)); | |
586 | ||
587 | } /* FreeTBLTag */ | |
588 | ||
589 | ||
590 | ||
591 | ||
592 | AsnLen | |
593 | BEncTBLTypeSeqOfContent PARAMS ((b, v), | |
594 | BUF_TYPE b _AND_ | |
595 | TBLTypeSeqOf *v) | |
596 | { | |
597 | AsnLen totalLen = 0; | |
598 | AsnLen itemLen; | |
599 | AsnLen listLen; | |
600 | void *component; | |
601 | ||
602 | listLen = 0; | |
603 | FOR_EACH_LIST_ELMT_RVS (component, v) | |
604 | { | |
605 | BEncEocIfNec (b); | |
606 | itemLen = BEncTBLTagContent (b, component); | |
607 | itemLen += BEncConsLen (b, itemLen); | |
608 | itemLen += BEncTag1 (b, UNIV, CONS, 16); | |
609 | ||
610 | listLen += itemLen; | |
611 | } | |
612 | return listLen; | |
613 | ||
614 | } /* BEncTBLTypeSeqOfContent */ | |
615 | ||
616 | void | |
617 | BDecTBLTypeSeqOfContent PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, env), | |
618 | BUF_TYPE b _AND_ | |
619 | AsnTag tagId0 _AND_ | |
620 | AsnLen elmtLen0 _AND_ | |
621 | TBLTypeSeqOf *v _AND_ | |
622 | AsnLen *bytesDecoded _AND_ | |
623 | ENV_TYPE env) | |
624 | { | |
625 | int seqDone = FALSE; | |
626 | AsnLen totalElmtsLen1 = 0; | |
627 | AsnLen elmtLen1; | |
628 | AsnTag tagId1; | |
629 | int mandatoryElmtCount1 = 0; | |
630 | ||
631 | ||
632 | for (totalElmtsLen1 = 0; (totalElmtsLen1 < elmtLen0) || (elmtLen0 == INDEFINITE_LEN);) | |
633 | { | |
634 | TBLTag **tmpVar; | |
635 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
636 | ||
637 | if ((tagId1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN)) | |
638 | { | |
639 | BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1, env) | |
640 | break; /* got EOC so can exit this SET OF/SEQ OF's for loop*/ | |
641 | } | |
642 | if ((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))) | |
643 | { | |
644 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
645 | tmpVar = (TBLTag**) AsnListAppend (v); | |
646 | (*tmpVar) = (TBLTag*) Asn1Alloc (sizeof (TBLTag)); | |
647 | CheckAsn1Alloc ((*tmpVar), env); | |
648 | BDecTBLTagContent (b, tagId1, elmtLen1, (*tmpVar), &totalElmtsLen1, env); | |
649 | } /* end of tag check if */ | |
650 | else /* wrong tag */ | |
651 | { | |
652 | Asn1Error ("Unexpected Tag\n"); | |
653 | longjmp (env, -117); | |
654 | } | |
655 | } /* end of for */ | |
656 | ||
657 | (*bytesDecoded) += totalElmtsLen1; | |
658 | } /* BDecTBLTypeSeqOfContent */ | |
659 | ||
660 | void | |
661 | PrintTBLTypeSeqOf PARAMS ((f, v, indent), | |
662 | FILE* f _AND_ | |
663 | TBLTypeSeqOf *v _AND_ | |
664 | unsigned short int indent) | |
665 | { | |
666 | TBLTag *tmp; | |
667 | if (v == NULL) | |
668 | return; | |
669 | fprintf (f,"{ -- SEQUENCE OF -- \n"); | |
670 | FOR_EACH_LIST_ELMT (tmp, v) | |
671 | { | |
672 | Indent (f, indent+ stdIndentG); | |
673 | PrintTBLTag (f, tmp, indent + stdIndentG); | |
674 | if (tmp != (TBLTag*)LAST_LIST_ELMT (v)) | |
675 | fprintf (f,",\n"); | |
676 | } | |
677 | fprintf (f,"\n"); | |
678 | Indent (f, indent); | |
679 | fprintf (f,"}"); | |
680 | } /* PrintTBLTypeSeqOf */ | |
681 | ||
682 | void | |
683 | FreeTBLTypeSeqOf PARAMS ((v), | |
684 | TBLTypeSeqOf *v) | |
685 | { | |
686 | ||
687 | AsnListNode *l; | |
688 | AsnListNode *tmp; | |
689 | if (v == NULL) | |
690 | return; | |
691 | for (l = FIRST_LIST_NODE (v); l != NULL; ) | |
692 | { | |
693 | FreeTBLTag ((l->data)); | |
694 | tmp = l->next; | |
695 | Asn1Free (l->data); | |
696 | Asn1Free (l); | |
697 | l = tmp; | |
698 | } | |
699 | } /* FreeTBLTypeSeqOf */ | |
700 | ||
701 | ||
702 | ||
703 | ||
704 | AsnLen | |
705 | BEncTBLTypeContentSeqOfContent PARAMS ((b, v), | |
706 | BUF_TYPE b _AND_ | |
707 | TBLTypeContentSeqOf *v) | |
708 | { | |
709 | AsnLen totalLen = 0; | |
710 | AsnLen itemLen; | |
711 | AsnLen listLen; | |
712 | void *component; | |
713 | ||
714 | listLen = 0; | |
715 | FOR_EACH_LIST_ELMT_RVS (component, v) | |
716 | { | |
717 | BEncEocIfNec (b); | |
718 | itemLen = BEncTBLTypeContent (b, component); | |
719 | itemLen += BEncConsLen (b, itemLen); | |
720 | itemLen += BEncTag1 (b, UNIV, CONS, 16); | |
721 | ||
722 | listLen += itemLen; | |
723 | } | |
724 | return listLen; | |
725 | ||
726 | } /* BEncTBLTypeContentSeqOfContent */ | |
727 | ||
728 | void | |
729 | BDecTBLTypeContentSeqOfContent PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, env), | |
730 | BUF_TYPE b _AND_ | |
731 | AsnTag tagId0 _AND_ | |
732 | AsnLen elmtLen0 _AND_ | |
733 | TBLTypeContentSeqOf *v _AND_ | |
734 | AsnLen *bytesDecoded _AND_ | |
735 | ENV_TYPE env) | |
736 | { | |
737 | int seqDone = FALSE; | |
738 | AsnLen totalElmtsLen1 = 0; | |
739 | AsnLen elmtLen1; | |
740 | AsnTag tagId1; | |
741 | int mandatoryElmtCount1 = 0; | |
742 | ||
743 | ||
744 | for (totalElmtsLen1 = 0; (totalElmtsLen1 < elmtLen0) || (elmtLen0 == INDEFINITE_LEN);) | |
745 | { | |
746 | TBLType **tmpVar; | |
747 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
748 | ||
749 | if ((tagId1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN)) | |
750 | { | |
751 | BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1, env) | |
752 | break; /* got EOC so can exit this SET OF/SEQ OF's for loop*/ | |
753 | } | |
754 | if ((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))) | |
755 | { | |
756 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
757 | tmpVar = (TBLType**) AsnListAppend (v); | |
758 | (*tmpVar) = (TBLType*) Asn1Alloc (sizeof (TBLType)); | |
759 | CheckAsn1Alloc ((*tmpVar), env); | |
760 | BDecTBLTypeContent (b, tagId1, elmtLen1, (*tmpVar), &totalElmtsLen1, env); | |
761 | } /* end of tag check if */ | |
762 | else /* wrong tag */ | |
763 | { | |
764 | Asn1Error ("Unexpected Tag\n"); | |
765 | longjmp (env, -118); | |
766 | } | |
767 | } /* end of for */ | |
768 | ||
769 | (*bytesDecoded) += totalElmtsLen1; | |
770 | } /* BDecTBLTypeContentSeqOfContent */ | |
771 | ||
772 | void | |
773 | PrintTBLTypeContentSeqOf PARAMS ((f, v, indent), | |
774 | FILE* f _AND_ | |
775 | TBLTypeContentSeqOf *v _AND_ | |
776 | unsigned short int indent) | |
777 | { | |
778 | TBLType *tmp; | |
779 | if (v == NULL) | |
780 | return; | |
781 | fprintf (f,"{ -- SEQUENCE OF -- \n"); | |
782 | FOR_EACH_LIST_ELMT (tmp, v) | |
783 | { | |
784 | Indent (f, indent+ stdIndentG); | |
785 | PrintTBLType (f, tmp, indent + stdIndentG); | |
786 | if (tmp != (TBLType*)LAST_LIST_ELMT (v)) | |
787 | fprintf (f,",\n"); | |
788 | } | |
789 | fprintf (f,"\n"); | |
790 | Indent (f, indent); | |
791 | fprintf (f,"}"); | |
792 | } /* PrintTBLTypeContentSeqOf */ | |
793 | ||
794 | void | |
795 | FreeTBLTypeContentSeqOf PARAMS ((v), | |
796 | TBLTypeContentSeqOf *v) | |
797 | { | |
798 | ||
799 | AsnListNode *l; | |
800 | AsnListNode *tmp; | |
801 | if (v == NULL) | |
802 | return; | |
803 | for (l = FIRST_LIST_NODE (v); l != NULL; ) | |
804 | { | |
805 | FreeTBLType ((l->data)); | |
806 | tmp = l->next; | |
807 | Asn1Free (l->data); | |
808 | Asn1Free (l); | |
809 | l = tmp; | |
810 | } | |
811 | } /* FreeTBLTypeContentSeqOf */ | |
812 | ||
813 | ||
814 | ||
815 | ||
816 | AsnLen | |
817 | BEncTBLTypeContent PARAMS ((b, v), | |
818 | BUF_TYPE b _AND_ | |
819 | TBLType *v) | |
820 | { | |
821 | AsnLen totalLen = 0; | |
822 | AsnLen itemLen; | |
823 | AsnLen listLen; | |
824 | void *component; | |
825 | ||
826 | if (NOT_NULL ((v->values))) | |
827 | { | |
828 | BEncEocIfNec (b); | |
829 | itemLen = BEncTBLNamedNumberListContent (b, (v->values)); | |
830 | itemLen += BEncConsLen (b, itemLen); | |
831 | itemLen += BEncTag1 (b, CNTX, CONS, 6); | |
832 | ||
833 | totalLen += itemLen; | |
834 | } | |
835 | ||
836 | if (NOT_NULL ((v->constraint))) | |
837 | { | |
838 | BEncEocIfNec (b); | |
839 | itemLen = BEncTBLRangeContent (b, (v->constraint)); | |
840 | itemLen += BEncConsLen (b, itemLen); | |
841 | itemLen += BEncTag1 (b, CNTX, CONS, 5); | |
842 | ||
843 | totalLen += itemLen; | |
844 | } | |
845 | ||
846 | if (ASNOCTS_PRESENT ((&v->fieldName))) | |
847 | { | |
848 | itemLen = BEncPrintableStringContent (b, (&v->fieldName)); | |
849 | itemLen += BEncDefLen (b, itemLen); | |
850 | itemLen += BEncTag1 (b, CNTX, PRIM, 4); | |
851 | ||
852 | totalLen += itemLen; | |
853 | } | |
854 | ||
855 | BEncEocIfNec (b); | |
856 | itemLen = BEncTBLTypeContentContent (b, (v->content)); | |
857 | itemLen += BEncConsLen (b, itemLen); | |
858 | itemLen += BEncTag1 (b, CNTX, CONS, 3); | |
859 | ||
860 | totalLen += itemLen; | |
861 | ||
862 | if (NOT_NULL ((v->tagList))) | |
863 | { | |
864 | BEncEocIfNec (b); | |
865 | itemLen = BEncTBLTypeSeqOfContent (b, (v->tagList)); | |
866 | itemLen += BEncConsLen (b, itemLen); | |
867 | itemLen += BEncTag1 (b, CNTX, CONS, 2); | |
868 | ||
869 | totalLen += itemLen; | |
870 | } | |
871 | ||
872 | itemLen = BEncAsnBoolContent (b, (&v->optional)); | |
873 | BEncDefLenTo127 (b, itemLen); | |
874 | itemLen++; | |
875 | itemLen += BEncTag1 (b, CNTX, PRIM, 1); | |
876 | ||
877 | totalLen += itemLen; | |
878 | ||
879 | itemLen = BEncTBLTypeIdContent (b, (&v->typeId)); | |
880 | BEncDefLenTo127 (b, itemLen); | |
881 | itemLen++; | |
882 | itemLen += BEncTag1 (b, CNTX, PRIM, 0); | |
883 | ||
884 | totalLen += itemLen; | |
885 | ||
886 | return totalLen; | |
887 | ||
888 | } /* BEncTBLTypeContent */ | |
889 | ||
890 | void | |
891 | BDecTBLTypeContent PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, env), | |
892 | BUF_TYPE b _AND_ | |
893 | AsnTag tagId0 _AND_ | |
894 | AsnLen elmtLen0 _AND_ | |
895 | TBLType *v _AND_ | |
896 | AsnLen *bytesDecoded _AND_ | |
897 | ENV_TYPE env) | |
898 | { | |
899 | int seqDone = FALSE; | |
900 | AsnLen totalElmtsLen1 = 0; | |
901 | AsnLen elmtLen1; | |
902 | AsnTag tagId1; | |
903 | int mandatoryElmtCount1 = 0; | |
904 | AsnLen totalElmtsLen2 = 0; | |
905 | AsnLen elmtLen2; | |
906 | AsnTag tagId2; | |
907 | AsnLen totalElmtsLen3 = 0; | |
908 | AsnLen elmtLen3; | |
909 | AsnTag tagId3; | |
910 | ||
911 | ||
912 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
913 | ||
914 | if (((tagId1 == MAKE_TAG_ID (CNTX, PRIM, 0)))) | |
915 | { | |
916 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
917 | BDecTBLTypeIdContent (b, tagId1, elmtLen1, (&v->typeId), &totalElmtsLen1, env); | |
918 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
919 | } | |
920 | else | |
921 | longjmp (env, -119); | |
922 | ||
923 | ||
924 | if (((tagId1 == MAKE_TAG_ID (CNTX, PRIM, 1)))) | |
925 | { | |
926 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
927 | BDecAsnBoolContent (b, tagId1, elmtLen1, (&v->optional), &totalElmtsLen1, env); | |
928 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
929 | } | |
930 | else | |
931 | longjmp (env, -120); | |
932 | ||
933 | ||
934 | if (((tagId1 == MAKE_TAG_ID (CNTX, CONS, 2)))) | |
935 | { | |
936 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
937 | (v->tagList) = AsnListNew (sizeof (char*)); | |
938 | CheckAsn1Alloc ((v->tagList), env); | |
939 | BDecTBLTypeSeqOfContent (b, tagId1, elmtLen1, (v->tagList), &totalElmtsLen1, env); | |
940 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
941 | } | |
942 | ||
943 | ||
944 | if (((tagId1 == MAKE_TAG_ID (CNTX, CONS, 3)))) | |
945 | { | |
946 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
947 | (v->content) = (TBLTypeContent*) Asn1Alloc (sizeof (TBLTypeContent)); | |
948 | CheckAsn1Alloc ((v->content), env); | |
949 | tagId2 = BDecTag (b, &totalElmtsLen1, env); | |
950 | elmtLen2 = BDecLen (b, &totalElmtsLen1, env); | |
951 | BDecTBLTypeContentContent (b, tagId2, elmtLen2, (v->content), &totalElmtsLen1, env); | |
952 | if (elmtLen1 == INDEFINITE_LEN) | |
953 | BDecEoc(b, &totalElmtsLen1, env); | |
954 | if (elmtLen1 == INDEFINITE_LEN) | |
955 | BDecEoc (b, &totalElmtsLen1, env); | |
956 | if ((elmtLen0 != INDEFINITE_LEN) && (totalElmtsLen1 == elmtLen0)) | |
957 | seqDone = TRUE; | |
958 | else | |
959 | { | |
960 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
961 | ||
962 | if ((elmtLen0 == INDEFINITE_LEN) && (tagId1 == EOC_TAG_ID)) | |
963 | { | |
964 | BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1, env) | |
965 | seqDone = TRUE; | |
966 | } | |
967 | } | |
968 | } | |
969 | else | |
970 | longjmp (env, -121); | |
971 | ||
972 | ||
973 | if ((!seqDone) && ((tagId1 == MAKE_TAG_ID (CNTX, PRIM, 4)) || | |
974 | (tagId1 == MAKE_TAG_ID (CNTX, CONS, 4)))) | |
975 | { | |
976 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
977 | BDecPrintableStringContent (b, tagId1, elmtLen1, (&v->fieldName), &totalElmtsLen1, env); | |
978 | if ((elmtLen0 != INDEFINITE_LEN) && (totalElmtsLen1 == elmtLen0)) | |
979 | seqDone = TRUE; | |
980 | else | |
981 | { | |
982 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
983 | ||
984 | if ((elmtLen0 == INDEFINITE_LEN) && (tagId1 == EOC_TAG_ID)) | |
985 | { | |
986 | BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1, env) | |
987 | seqDone = TRUE; | |
988 | } | |
989 | } | |
990 | } | |
991 | ||
992 | ||
993 | if ((!seqDone) && ((tagId1 == MAKE_TAG_ID (CNTX, CONS, 5)))) | |
994 | { | |
995 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
996 | (v->constraint) = (TBLRange*) Asn1Alloc (sizeof (TBLRange)); | |
997 | CheckAsn1Alloc ((v->constraint), env); | |
998 | BDecTBLRangeContent (b, tagId1, elmtLen1, (v->constraint), &totalElmtsLen1, env); | |
999 | if ((elmtLen0 != INDEFINITE_LEN) && (totalElmtsLen1 == elmtLen0)) | |
1000 | seqDone = TRUE; | |
1001 | else | |
1002 | { | |
1003 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
1004 | ||
1005 | if ((elmtLen0 == INDEFINITE_LEN) && (tagId1 == EOC_TAG_ID)) | |
1006 | { | |
1007 | BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1, env) | |
1008 | seqDone = TRUE; | |
1009 | } | |
1010 | } | |
1011 | } | |
1012 | ||
1013 | ||
1014 | if ((!seqDone) && ((tagId1 == MAKE_TAG_ID (CNTX, CONS, 6)))) | |
1015 | { | |
1016 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
1017 | (v->values) = AsnListNew (sizeof (char*)); | |
1018 | CheckAsn1Alloc ((v->values), env); | |
1019 | BDecTBLNamedNumberListContent (b, tagId1, elmtLen1, (v->values), &totalElmtsLen1, env); | |
1020 | seqDone = TRUE; | |
1021 | if (elmtLen0 == INDEFINITE_LEN) | |
1022 | BDecEoc (b, &totalElmtsLen1, env); | |
1023 | else if (totalElmtsLen1 != elmtLen0) | |
1024 | longjmp (env, -122); | |
1025 | } | |
1026 | ||
1027 | ||
1028 | if (!seqDone) | |
1029 | longjmp (env, -123); | |
1030 | ||
1031 | (*bytesDecoded) += totalElmtsLen1; | |
1032 | } /* BDecTBLTypeContent */ | |
1033 | ||
1034 | void | |
1035 | PrintTBLType PARAMS ((f, v, indent), | |
1036 | FILE* f _AND_ | |
1037 | TBLType *v _AND_ | |
1038 | unsigned short int indent) | |
1039 | { | |
1040 | if (v == NULL) | |
1041 | return; | |
1042 | ||
1043 | fprintf (f,"{ -- SEQUENCE --\n"); | |
1044 | ||
1045 | Indent (f, indent + stdIndentG); | |
1046 | fprintf (f,"typeId "); | |
1047 | PrintTBLTypeId (f, (&v->typeId), indent + stdIndentG); | |
1048 | fprintf (f, ",\n"); | |
1049 | Indent (f, indent + stdIndentG); | |
1050 | fprintf (f,"optional "); | |
1051 | PrintAsnBool (f, (&v->optional), indent + stdIndentG); | |
1052 | fprintf (f, ",\n"); | |
1053 | if (NOT_NULL ((v->tagList))) | |
1054 | { | |
1055 | Indent (f, indent + stdIndentG); | |
1056 | fprintf (f,"tagList "); | |
1057 | PrintTBLTypeSeqOf (f, (v->tagList), indent + stdIndentG); | |
1058 | fprintf (f, ",\n"); | |
1059 | } | |
1060 | Indent (f, indent + stdIndentG); | |
1061 | fprintf (f,"content "); | |
1062 | PrintTBLTypeContent (f, (v->content), indent + stdIndentG); | |
1063 | if (ASNOCTS_PRESENT ((&v->fieldName))) | |
1064 | { | |
1065 | fprintf (f,",\n"); | |
1066 | Indent (f, indent + stdIndentG); | |
1067 | fprintf (f,"fieldName "); | |
1068 | PrintPrintableString (f, (&v->fieldName), indent + stdIndentG); | |
1069 | } | |
1070 | if (NOT_NULL ((v->constraint))) | |
1071 | { | |
1072 | fprintf (f,",\n"); | |
1073 | Indent (f, indent + stdIndentG); | |
1074 | fprintf (f,"constraint "); | |
1075 | PrintTBLRange (f, (v->constraint), indent + stdIndentG); | |
1076 | } | |
1077 | if (NOT_NULL ((v->values))) | |
1078 | { | |
1079 | fprintf (f,",\n"); | |
1080 | Indent (f, indent + stdIndentG); | |
1081 | fprintf (f,"values "); | |
1082 | PrintTBLNamedNumberList (f, (v->values), indent + stdIndentG); | |
1083 | } | |
1084 | fprintf (f,"\n"); | |
1085 | Indent (f, indent); | |
1086 | fprintf (f,"}"); | |
1087 | } /* PrintTBLType */ | |
1088 | ||
1089 | void | |
1090 | FreeTBLType PARAMS ((v), | |
1091 | TBLType *v) | |
1092 | { | |
1093 | ||
1094 | if (v == NULL) | |
1095 | return; | |
1096 | FreeTBLTypeId ((&v->typeId)); | |
1097 | ||
1098 | FreeAsnBool ((&v->optional)); | |
1099 | ||
1100 | if (NOT_NULL ((v->tagList))) | |
1101 | { | |
1102 | FreeTBLTypeSeqOf ((v->tagList)); | |
1103 | Asn1Free ((v->tagList)); | |
1104 | } | |
1105 | ||
1106 | FreeTBLTypeContent ((v->content)); | |
1107 | Asn1Free ((v->content)); | |
1108 | ||
1109 | if (ASNOCTS_PRESENT ((&v->fieldName))) | |
1110 | { | |
1111 | FreePrintableString ((&v->fieldName)); | |
1112 | } | |
1113 | ||
1114 | if (NOT_NULL ((v->constraint))) | |
1115 | { | |
1116 | FreeTBLRange ((v->constraint)); | |
1117 | Asn1Free ((v->constraint)); | |
1118 | } | |
1119 | ||
1120 | if (NOT_NULL ((v->values))) | |
1121 | { | |
1122 | FreeTBLNamedNumberList ((v->values)); | |
1123 | Asn1Free ((v->values)); | |
1124 | } | |
1125 | ||
1126 | } /* FreeTBLType */ | |
1127 | ||
1128 | ||
1129 | ||
1130 | ||
1131 | AsnLen | |
1132 | BEncTBLTypeContentContent PARAMS ((b, v), | |
1133 | BUF_TYPE b _AND_ | |
1134 | TBLTypeContent *v) | |
1135 | { | |
1136 | AsnLen totalLen = 0; | |
1137 | AsnLen itemLen; | |
1138 | AsnLen listLen; | |
1139 | void *component; | |
1140 | ||
1141 | switch (v->choiceId) | |
1142 | { | |
1143 | case TBLTYPECONTENT_PRIMTYPE: | |
1144 | itemLen = BEncAsnNullContent (b, (&v->a.primType)); | |
1145 | BEncDefLenTo127 (b, itemLen); | |
1146 | itemLen++; | |
1147 | itemLen += BEncTag1 (b, CNTX, PRIM, 0); | |
1148 | ||
1149 | totalLen += itemLen; | |
1150 | ||
1151 | break; | |
1152 | ||
1153 | case TBLTYPECONTENT_ELMTS: | |
1154 | BEncEocIfNec (b); | |
1155 | itemLen = BEncTBLTypeContentSeqOfContent (b, (v->a.elmts)); | |
1156 | itemLen += BEncConsLen (b, itemLen); | |
1157 | itemLen += BEncTag1 (b, CNTX, CONS, 1); | |
1158 | ||
1159 | totalLen += itemLen; | |
1160 | ||
1161 | break; | |
1162 | ||
1163 | case TBLTYPECONTENT_TYPEREF: | |
1164 | BEncEocIfNec (b); | |
1165 | itemLen = BEncTBLTypeRefContent (b, (v->a.typeRef)); | |
1166 | itemLen += BEncConsLen (b, itemLen); | |
1167 | itemLen += BEncTag1 (b, CNTX, CONS, 2); | |
1168 | ||
1169 | totalLen += itemLen; | |
1170 | ||
1171 | break; | |
1172 | ||
1173 | } | |
1174 | return totalLen; | |
1175 | ||
1176 | } /* BEncTBLTypeContentContent */ | |
1177 | ||
1178 | void | |
1179 | BDecTBLTypeContentContent PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, env), | |
1180 | BUF_TYPE b _AND_ | |
1181 | AsnTag tagId0 _AND_ | |
1182 | AsnLen elmtLen0 _AND_ | |
1183 | TBLTypeContent *v _AND_ | |
1184 | AsnLen *bytesDecoded _AND_ | |
1185 | ENV_TYPE env) | |
1186 | { | |
1187 | int seqDone = FALSE; | |
1188 | AsnLen totalElmtsLen1 = 0; | |
1189 | AsnLen elmtLen1; | |
1190 | AsnTag tagId1; | |
1191 | int mandatoryElmtCount1 = 0; | |
1192 | ||
1193 | ||
1194 | switch (tagId0) | |
1195 | { | |
1196 | case MAKE_TAG_ID (CNTX, PRIM, 0): | |
1197 | (v->choiceId) = TBLTYPECONTENT_PRIMTYPE; | |
1198 | BDecAsnNullContent (b, tagId0, elmtLen0, (&v->a.primType), &totalElmtsLen1, env); | |
1199 | break; | |
1200 | ||
1201 | case MAKE_TAG_ID (CNTX, CONS, 1): | |
1202 | (v->choiceId) = TBLTYPECONTENT_ELMTS; | |
1203 | (v->a.elmts) = AsnListNew (sizeof (char*)); | |
1204 | CheckAsn1Alloc ((v->a.elmts), env); | |
1205 | BDecTBLTypeContentSeqOfContent (b, tagId0, elmtLen0, (v->a.elmts), &totalElmtsLen1, env); | |
1206 | break; | |
1207 | ||
1208 | case MAKE_TAG_ID (CNTX, CONS, 2): | |
1209 | (v->choiceId) = TBLTYPECONTENT_TYPEREF; | |
1210 | (v->a.typeRef) = (TBLTypeRef*) Asn1Alloc (sizeof (TBLTypeRef)); | |
1211 | CheckAsn1Alloc ((v->a.typeRef), env); | |
1212 | BDecTBLTypeRefContent (b, tagId0, elmtLen0, (v->a.typeRef), &totalElmtsLen1, env); | |
1213 | break; | |
1214 | ||
1215 | default: | |
1216 | Asn1Error ("ERROR - unexpected tag in CHOICE\n"); | |
1217 | longjmp (env, -124); | |
1218 | break; | |
1219 | } /* end switch */ | |
1220 | (*bytesDecoded) += totalElmtsLen1; | |
1221 | } /* BDecTBLTypeContentContent */ | |
1222 | ||
1223 | void | |
1224 | PrintTBLTypeContent PARAMS ((f, v, indent), | |
1225 | FILE* f _AND_ | |
1226 | TBLTypeContent *v _AND_ | |
1227 | unsigned short int indent) | |
1228 | { | |
1229 | switch (v->choiceId) | |
1230 | { | |
1231 | case TBLTYPECONTENT_PRIMTYPE: | |
1232 | fprintf (f,"primType "); | |
1233 | PrintAsnNull (f, (&v->a.primType), indent + stdIndentG); | |
1234 | break; | |
1235 | ||
1236 | case TBLTYPECONTENT_ELMTS: | |
1237 | fprintf (f,"elmts "); | |
1238 | PrintTBLTypeContentSeqOf (f, (v->a.elmts), indent + stdIndentG); | |
1239 | break; | |
1240 | ||
1241 | case TBLTYPECONTENT_TYPEREF: | |
1242 | fprintf (f,"typeRef "); | |
1243 | PrintTBLTypeRef (f, (v->a.typeRef), indent + stdIndentG); | |
1244 | break; | |
1245 | ||
1246 | } | |
1247 | } /* PrintTBLTypeContent */ | |
1248 | ||
1249 | void | |
1250 | FreeTBLTypeContent PARAMS ((v), | |
1251 | TBLTypeContent *v) | |
1252 | { | |
1253 | ||
1254 | if (v == NULL) | |
1255 | return; | |
1256 | switch (v->choiceId) | |
1257 | { | |
1258 | case TBLTYPECONTENT_ELMTS: | |
1259 | FreeTBLTypeContentSeqOf ((v->a.elmts)); | |
1260 | Asn1Free ((v->a.elmts)); | |
1261 | ||
1262 | break; | |
1263 | ||
1264 | case TBLTYPECONTENT_TYPEREF: | |
1265 | FreeTBLTypeRef ((v->a.typeRef)); | |
1266 | Asn1Free ((v->a.typeRef)); | |
1267 | ||
1268 | break; | |
1269 | ||
1270 | } | |
1271 | } /* FreeTBLTypeContent */ | |
1272 | ||
1273 | ||
1274 | ||
1275 | ||
1276 | AsnLen | |
1277 | BEncTBLTypeDefContent PARAMS ((b, v), | |
1278 | BUF_TYPE b _AND_ | |
1279 | TBLTypeDef *v) | |
1280 | { | |
1281 | AsnLen totalLen = 0; | |
1282 | AsnLen itemLen; | |
1283 | AsnLen listLen; | |
1284 | void *component; | |
1285 | ||
1286 | if (NOT_NULL ((v->isPdu))) | |
1287 | { | |
1288 | itemLen = BEncAsnNullContent (b, (v->isPdu)); | |
1289 | BEncDefLenTo127 (b, itemLen); | |
1290 | itemLen++; | |
1291 | itemLen += BEncTag1 (b, UNIV, PRIM, 5); | |
1292 | ||
1293 | totalLen += itemLen; | |
1294 | } | |
1295 | ||
1296 | BEncEocIfNec (b); | |
1297 | itemLen = BEncTBLTypeContent (b, (v->type)); | |
1298 | itemLen += BEncConsLen (b, itemLen); | |
1299 | itemLen += BEncTag1 (b, UNIV, CONS, 16); | |
1300 | ||
1301 | totalLen += itemLen; | |
1302 | ||
1303 | itemLen = BEncPrintableStringContent (b, (&v->typeName)); | |
1304 | itemLen += BEncDefLen (b, itemLen); | |
1305 | itemLen += BEncTag1 (b, UNIV, PRIM, 19); | |
1306 | ||
1307 | totalLen += itemLen; | |
1308 | ||
1309 | itemLen = BEncTBLTypeDefIdContent (b, (&v->typeDefId)); | |
1310 | BEncDefLenTo127 (b, itemLen); | |
1311 | itemLen++; | |
1312 | itemLen += BEncTag1 (b, UNIV, PRIM, 2); | |
1313 | ||
1314 | totalLen += itemLen; | |
1315 | ||
1316 | return totalLen; | |
1317 | ||
1318 | } /* BEncTBLTypeDefContent */ | |
1319 | ||
1320 | void | |
1321 | BDecTBLTypeDefContent PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, env), | |
1322 | BUF_TYPE b _AND_ | |
1323 | AsnTag tagId0 _AND_ | |
1324 | AsnLen elmtLen0 _AND_ | |
1325 | TBLTypeDef *v _AND_ | |
1326 | AsnLen *bytesDecoded _AND_ | |
1327 | ENV_TYPE env) | |
1328 | { | |
1329 | int seqDone = FALSE; | |
1330 | AsnLen totalElmtsLen1 = 0; | |
1331 | AsnLen elmtLen1; | |
1332 | AsnTag tagId1; | |
1333 | int mandatoryElmtCount1 = 0; | |
1334 | ||
1335 | ||
1336 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
1337 | ||
1338 | if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))) | |
1339 | { | |
1340 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
1341 | BDecTBLTypeDefIdContent (b, tagId1, elmtLen1, (&v->typeDefId), &totalElmtsLen1, env); | |
1342 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
1343 | } | |
1344 | else | |
1345 | longjmp (env, -125); | |
1346 | ||
1347 | ||
1348 | if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, PRINTABLESTRING_TAG_CODE)) || | |
1349 | (tagId1 == MAKE_TAG_ID (UNIV, CONS, PRINTABLESTRING_TAG_CODE)))) | |
1350 | { | |
1351 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
1352 | BDecPrintableStringContent (b, tagId1, elmtLen1, (&v->typeName), &totalElmtsLen1, env); | |
1353 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
1354 | } | |
1355 | else | |
1356 | longjmp (env, -126); | |
1357 | ||
1358 | ||
1359 | if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))) | |
1360 | { | |
1361 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
1362 | (v->type) = (TBLType*) Asn1Alloc (sizeof (TBLType)); | |
1363 | CheckAsn1Alloc ((v->type), env); | |
1364 | BDecTBLTypeContent (b, tagId1, elmtLen1, (v->type), &totalElmtsLen1, env); | |
1365 | if ((elmtLen0 != INDEFINITE_LEN) && (totalElmtsLen1 == elmtLen0)) | |
1366 | seqDone = TRUE; | |
1367 | else | |
1368 | { | |
1369 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
1370 | ||
1371 | if ((elmtLen0 == INDEFINITE_LEN) && (tagId1 == EOC_TAG_ID)) | |
1372 | { | |
1373 | BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1, env) | |
1374 | seqDone = TRUE; | |
1375 | } | |
1376 | } | |
1377 | } | |
1378 | else | |
1379 | longjmp (env, -127); | |
1380 | ||
1381 | ||
1382 | if ((!seqDone) && ((tagId1 == MAKE_TAG_ID (UNIV, PRIM, NULLTYPE_TAG_CODE)))) | |
1383 | { | |
1384 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
1385 | (v->isPdu) = (AsnNull*) Asn1Alloc (sizeof (AsnNull)); | |
1386 | CheckAsn1Alloc ((v->isPdu), env); | |
1387 | BDecAsnNullContent (b, tagId1, elmtLen1, (v->isPdu), &totalElmtsLen1, env); | |
1388 | seqDone = TRUE; | |
1389 | if (elmtLen0 == INDEFINITE_LEN) | |
1390 | BDecEoc (b, &totalElmtsLen1, env); | |
1391 | else if (totalElmtsLen1 != elmtLen0) | |
1392 | longjmp (env, -128); | |
1393 | } | |
1394 | ||
1395 | ||
1396 | if (!seqDone) | |
1397 | longjmp (env, -129); | |
1398 | ||
1399 | (*bytesDecoded) += totalElmtsLen1; | |
1400 | } /* BDecTBLTypeDefContent */ | |
1401 | ||
1402 | void | |
1403 | PrintTBLTypeDef PARAMS ((f, v, indent), | |
1404 | FILE* f _AND_ | |
1405 | TBLTypeDef *v _AND_ | |
1406 | unsigned short int indent) | |
1407 | { | |
1408 | if (v == NULL) | |
1409 | return; | |
1410 | ||
1411 | fprintf (f,"{ -- SEQUENCE --\n"); | |
1412 | ||
1413 | Indent (f, indent + stdIndentG); | |
1414 | fprintf (f,"typeDefId "); | |
1415 | PrintTBLTypeDefId (f, (&v->typeDefId), indent + stdIndentG); | |
1416 | fprintf (f, ",\n"); | |
1417 | Indent (f, indent + stdIndentG); | |
1418 | fprintf (f,"typeName "); | |
1419 | PrintPrintableString (f, (&v->typeName), indent + stdIndentG); | |
1420 | fprintf (f, ",\n"); | |
1421 | Indent (f, indent + stdIndentG); | |
1422 | fprintf (f,"type "); | |
1423 | PrintTBLType (f, (v->type), indent + stdIndentG); | |
1424 | if (NOT_NULL ((v->isPdu))) | |
1425 | { | |
1426 | fprintf (f,",\n"); | |
1427 | Indent (f, indent + stdIndentG); | |
1428 | fprintf (f,"isPdu "); | |
1429 | PrintAsnNull (f, (v->isPdu), indent + stdIndentG); | |
1430 | } | |
1431 | fprintf (f,"\n"); | |
1432 | Indent (f, indent); | |
1433 | fprintf (f,"}"); | |
1434 | } /* PrintTBLTypeDef */ | |
1435 | ||
1436 | void | |
1437 | FreeTBLTypeDef PARAMS ((v), | |
1438 | TBLTypeDef *v) | |
1439 | { | |
1440 | ||
1441 | if (v == NULL) | |
1442 | return; | |
1443 | FreeTBLTypeDefId ((&v->typeDefId)); | |
1444 | ||
1445 | FreePrintableString ((&v->typeName)); | |
1446 | ||
1447 | FreeTBLType ((v->type)); | |
1448 | Asn1Free ((v->type)); | |
1449 | ||
1450 | if (NOT_NULL ((v->isPdu))) | |
1451 | { | |
1452 | FreeAsnNull ((v->isPdu)); | |
1453 | Asn1Free ((v->isPdu)); | |
1454 | } | |
1455 | ||
1456 | } /* FreeTBLTypeDef */ | |
1457 | ||
1458 | ||
1459 | ||
1460 | ||
1461 | AsnLen | |
1462 | BEncTBLModuleSeqOfContent PARAMS ((b, v), | |
1463 | BUF_TYPE b _AND_ | |
1464 | TBLModuleSeqOf *v) | |
1465 | { | |
1466 | AsnLen totalLen = 0; | |
1467 | AsnLen itemLen; | |
1468 | AsnLen listLen; | |
1469 | void *component; | |
1470 | ||
1471 | listLen = 0; | |
1472 | FOR_EACH_LIST_ELMT_RVS (component, v) | |
1473 | { | |
1474 | BEncEocIfNec (b); | |
1475 | itemLen = BEncTBLTypeDefContent (b, component); | |
1476 | itemLen += BEncConsLen (b, itemLen); | |
1477 | itemLen += BEncTag1 (b, UNIV, CONS, 16); | |
1478 | ||
1479 | listLen += itemLen; | |
1480 | } | |
1481 | return listLen; | |
1482 | ||
1483 | } /* BEncTBLModuleSeqOfContent */ | |
1484 | ||
1485 | void | |
1486 | BDecTBLModuleSeqOfContent PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, env), | |
1487 | BUF_TYPE b _AND_ | |
1488 | AsnTag tagId0 _AND_ | |
1489 | AsnLen elmtLen0 _AND_ | |
1490 | TBLModuleSeqOf *v _AND_ | |
1491 | AsnLen *bytesDecoded _AND_ | |
1492 | ENV_TYPE env) | |
1493 | { | |
1494 | int seqDone = FALSE; | |
1495 | AsnLen totalElmtsLen1 = 0; | |
1496 | AsnLen elmtLen1; | |
1497 | AsnTag tagId1; | |
1498 | int mandatoryElmtCount1 = 0; | |
1499 | ||
1500 | ||
1501 | for (totalElmtsLen1 = 0; (totalElmtsLen1 < elmtLen0) || (elmtLen0 == INDEFINITE_LEN);) | |
1502 | { | |
1503 | TBLTypeDef **tmpVar; | |
1504 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
1505 | ||
1506 | if ((tagId1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN)) | |
1507 | { | |
1508 | BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1, env) | |
1509 | break; /* got EOC so can exit this SET OF/SEQ OF's for loop*/ | |
1510 | } | |
1511 | if ((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))) | |
1512 | { | |
1513 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
1514 | tmpVar = (TBLTypeDef**) AsnListAppend (v); | |
1515 | (*tmpVar) = (TBLTypeDef*) Asn1Alloc (sizeof (TBLTypeDef)); | |
1516 | CheckAsn1Alloc ((*tmpVar), env); | |
1517 | BDecTBLTypeDefContent (b, tagId1, elmtLen1, (*tmpVar), &totalElmtsLen1, env); | |
1518 | } /* end of tag check if */ | |
1519 | else /* wrong tag */ | |
1520 | { | |
1521 | Asn1Error ("Unexpected Tag\n"); | |
1522 | longjmp (env, -130); | |
1523 | } | |
1524 | } /* end of for */ | |
1525 | ||
1526 | (*bytesDecoded) += totalElmtsLen1; | |
1527 | } /* BDecTBLModuleSeqOfContent */ | |
1528 | ||
1529 | void | |
1530 | PrintTBLModuleSeqOf PARAMS ((f, v, indent), | |
1531 | FILE* f _AND_ | |
1532 | TBLModuleSeqOf *v _AND_ | |
1533 | unsigned short int indent) | |
1534 | { | |
1535 | TBLTypeDef *tmp; | |
1536 | if (v == NULL) | |
1537 | return; | |
1538 | fprintf (f,"{ -- SEQUENCE OF -- \n"); | |
1539 | FOR_EACH_LIST_ELMT (tmp, v) | |
1540 | { | |
1541 | Indent (f, indent+ stdIndentG); | |
1542 | PrintTBLTypeDef (f, tmp, indent + stdIndentG); | |
1543 | if (tmp != (TBLTypeDef*)LAST_LIST_ELMT (v)) | |
1544 | fprintf (f,",\n"); | |
1545 | } | |
1546 | fprintf (f,"\n"); | |
1547 | Indent (f, indent); | |
1548 | fprintf (f,"}"); | |
1549 | } /* PrintTBLModuleSeqOf */ | |
1550 | ||
1551 | void | |
1552 | FreeTBLModuleSeqOf PARAMS ((v), | |
1553 | TBLModuleSeqOf *v) | |
1554 | { | |
1555 | ||
1556 | AsnListNode *l; | |
1557 | AsnListNode *tmp; | |
1558 | if (v == NULL) | |
1559 | return; | |
1560 | for (l = FIRST_LIST_NODE (v); l != NULL; ) | |
1561 | { | |
1562 | FreeTBLTypeDef ((l->data)); | |
1563 | tmp = l->next; | |
1564 | Asn1Free (l->data); | |
1565 | Asn1Free (l); | |
1566 | l = tmp; | |
1567 | } | |
1568 | } /* FreeTBLModuleSeqOf */ | |
1569 | ||
1570 | ||
1571 | ||
1572 | ||
1573 | AsnLen | |
1574 | BEncTBLModuleContent PARAMS ((b, v), | |
1575 | BUF_TYPE b _AND_ | |
1576 | TBLModule *v) | |
1577 | { | |
1578 | AsnLen totalLen = 0; | |
1579 | AsnLen itemLen; | |
1580 | AsnLen listLen; | |
1581 | void *component; | |
1582 | ||
1583 | BEncEocIfNec (b); | |
1584 | itemLen = BEncTBLModuleSeqOfContent (b, (v->typeDefs)); | |
1585 | itemLen += BEncConsLen (b, itemLen); | |
1586 | itemLen += BEncTag1 (b, CNTX, CONS, 3); | |
1587 | ||
1588 | totalLen += itemLen; | |
1589 | ||
1590 | itemLen = BEncAsnBoolContent (b, (&v->isUseful)); | |
1591 | BEncDefLenTo127 (b, itemLen); | |
1592 | itemLen++; | |
1593 | itemLen += BEncTag1 (b, CNTX, PRIM, 2); | |
1594 | ||
1595 | totalLen += itemLen; | |
1596 | ||
1597 | if (ASNOID_PRESENT ((&v->id))) | |
1598 | { | |
1599 | itemLen = BEncAsnOidContent (b, (&v->id)); | |
1600 | itemLen += BEncDefLen (b, itemLen); | |
1601 | itemLen += BEncTag1 (b, CNTX, PRIM, 1); | |
1602 | ||
1603 | totalLen += itemLen; | |
1604 | } | |
1605 | ||
1606 | itemLen = BEncPrintableStringContent (b, (&v->name)); | |
1607 | itemLen += BEncDefLen (b, itemLen); | |
1608 | itemLen += BEncTag1 (b, CNTX, PRIM, 0); | |
1609 | ||
1610 | totalLen += itemLen; | |
1611 | ||
1612 | return totalLen; | |
1613 | ||
1614 | } /* BEncTBLModuleContent */ | |
1615 | ||
1616 | void | |
1617 | BDecTBLModuleContent PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, env), | |
1618 | BUF_TYPE b _AND_ | |
1619 | AsnTag tagId0 _AND_ | |
1620 | AsnLen elmtLen0 _AND_ | |
1621 | TBLModule *v _AND_ | |
1622 | AsnLen *bytesDecoded _AND_ | |
1623 | ENV_TYPE env) | |
1624 | { | |
1625 | int seqDone = FALSE; | |
1626 | AsnLen totalElmtsLen1 = 0; | |
1627 | AsnLen elmtLen1; | |
1628 | AsnTag tagId1; | |
1629 | int mandatoryElmtCount1 = 0; | |
1630 | ||
1631 | ||
1632 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
1633 | ||
1634 | if (((tagId1 == MAKE_TAG_ID (CNTX, PRIM, 0)) || | |
1635 | (tagId1 == MAKE_TAG_ID (CNTX, CONS, 0)))) | |
1636 | { | |
1637 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
1638 | BDecPrintableStringContent (b, tagId1, elmtLen1, (&v->name), &totalElmtsLen1, env); | |
1639 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
1640 | } | |
1641 | else | |
1642 | longjmp (env, -131); | |
1643 | ||
1644 | ||
1645 | if (((tagId1 == MAKE_TAG_ID (CNTX, PRIM, 1)))) | |
1646 | { | |
1647 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
1648 | BDecAsnOidContent (b, tagId1, elmtLen1, (&v->id), &totalElmtsLen1, env); | |
1649 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
1650 | } | |
1651 | ||
1652 | ||
1653 | if (((tagId1 == MAKE_TAG_ID (CNTX, PRIM, 2)))) | |
1654 | { | |
1655 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
1656 | BDecAsnBoolContent (b, tagId1, elmtLen1, (&v->isUseful), &totalElmtsLen1, env); | |
1657 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
1658 | } | |
1659 | else | |
1660 | longjmp (env, -132); | |
1661 | ||
1662 | ||
1663 | if (((tagId1 == MAKE_TAG_ID (CNTX, CONS, 3)))) | |
1664 | { | |
1665 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
1666 | (v->typeDefs) = AsnListNew (sizeof (char*)); | |
1667 | CheckAsn1Alloc ((v->typeDefs), env); | |
1668 | BDecTBLModuleSeqOfContent (b, tagId1, elmtLen1, (v->typeDefs), &totalElmtsLen1, env); | |
1669 | seqDone = TRUE; | |
1670 | if (elmtLen0 == INDEFINITE_LEN) | |
1671 | BDecEoc (b, &totalElmtsLen1, env); | |
1672 | else if (totalElmtsLen1 != elmtLen0) | |
1673 | longjmp (env, -133); | |
1674 | } | |
1675 | else | |
1676 | longjmp (env, -134); | |
1677 | ||
1678 | ||
1679 | if (!seqDone) | |
1680 | longjmp (env, -135); | |
1681 | ||
1682 | (*bytesDecoded) += totalElmtsLen1; | |
1683 | } /* BDecTBLModuleContent */ | |
1684 | ||
1685 | void | |
1686 | PrintTBLModule PARAMS ((f, v, indent), | |
1687 | FILE* f _AND_ | |
1688 | TBLModule *v _AND_ | |
1689 | unsigned short int indent) | |
1690 | { | |
1691 | if (v == NULL) | |
1692 | return; | |
1693 | ||
1694 | fprintf (f,"{ -- SEQUENCE --\n"); | |
1695 | ||
1696 | Indent (f, indent + stdIndentG); | |
1697 | fprintf (f,"name "); | |
1698 | PrintPrintableString (f, (&v->name), indent + stdIndentG); | |
1699 | fprintf (f, ",\n"); | |
1700 | if (ASNOID_PRESENT ((&v->id))) | |
1701 | { | |
1702 | Indent (f, indent + stdIndentG); | |
1703 | fprintf (f,"id "); | |
1704 | PrintAsnOid (f, (&v->id), indent + stdIndentG); | |
1705 | fprintf (f, ",\n"); | |
1706 | } | |
1707 | Indent (f, indent + stdIndentG); | |
1708 | fprintf (f,"isUseful "); | |
1709 | PrintAsnBool (f, (&v->isUseful), indent + stdIndentG); | |
1710 | fprintf (f, ",\n"); | |
1711 | Indent (f, indent + stdIndentG); | |
1712 | fprintf (f,"typeDefs "); | |
1713 | PrintTBLModuleSeqOf (f, (v->typeDefs), indent + stdIndentG); | |
1714 | fprintf (f,"\n"); | |
1715 | Indent (f, indent); | |
1716 | fprintf (f,"}"); | |
1717 | } /* PrintTBLModule */ | |
1718 | ||
1719 | void | |
1720 | FreeTBLModule PARAMS ((v), | |
1721 | TBLModule *v) | |
1722 | { | |
1723 | ||
1724 | if (v == NULL) | |
1725 | return; | |
1726 | FreePrintableString ((&v->name)); | |
1727 | ||
1728 | if (ASNOID_PRESENT ((&v->id))) | |
1729 | { | |
1730 | FreeAsnOid ((&v->id)); | |
1731 | } | |
1732 | ||
1733 | FreeAsnBool ((&v->isUseful)); | |
1734 | ||
1735 | FreeTBLModuleSeqOf ((v->typeDefs)); | |
1736 | Asn1Free ((v->typeDefs)); | |
1737 | ||
1738 | } /* FreeTBLModule */ | |
1739 | ||
1740 | ||
1741 | ||
1742 | ||
1743 | AsnLen | |
1744 | BEncTBLSeqOfContent PARAMS ((b, v), | |
1745 | BUF_TYPE b _AND_ | |
1746 | TBLSeqOf *v) | |
1747 | { | |
1748 | AsnLen totalLen = 0; | |
1749 | AsnLen itemLen; | |
1750 | AsnLen listLen; | |
1751 | void *component; | |
1752 | ||
1753 | listLen = 0; | |
1754 | FOR_EACH_LIST_ELMT_RVS (component, v) | |
1755 | { | |
1756 | BEncEocIfNec (b); | |
1757 | itemLen = BEncTBLModuleContent (b, component); | |
1758 | itemLen += BEncConsLen (b, itemLen); | |
1759 | itemLen += BEncTag1 (b, UNIV, CONS, 16); | |
1760 | ||
1761 | listLen += itemLen; | |
1762 | } | |
1763 | return listLen; | |
1764 | ||
1765 | } /* BEncTBLSeqOfContent */ | |
1766 | ||
1767 | void | |
1768 | BDecTBLSeqOfContent PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, env), | |
1769 | BUF_TYPE b _AND_ | |
1770 | AsnTag tagId0 _AND_ | |
1771 | AsnLen elmtLen0 _AND_ | |
1772 | TBLSeqOf *v _AND_ | |
1773 | AsnLen *bytesDecoded _AND_ | |
1774 | ENV_TYPE env) | |
1775 | { | |
1776 | int seqDone = FALSE; | |
1777 | AsnLen totalElmtsLen1 = 0; | |
1778 | AsnLen elmtLen1; | |
1779 | AsnTag tagId1; | |
1780 | int mandatoryElmtCount1 = 0; | |
1781 | ||
1782 | ||
1783 | for (totalElmtsLen1 = 0; (totalElmtsLen1 < elmtLen0) || (elmtLen0 == INDEFINITE_LEN);) | |
1784 | { | |
1785 | TBLModule **tmpVar; | |
1786 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
1787 | ||
1788 | if ((tagId1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN)) | |
1789 | { | |
1790 | BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1, env) | |
1791 | break; /* got EOC so can exit this SET OF/SEQ OF's for loop*/ | |
1792 | } | |
1793 | if ((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))) | |
1794 | { | |
1795 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
1796 | tmpVar = (TBLModule**) AsnListAppend (v); | |
1797 | (*tmpVar) = (TBLModule*) Asn1Alloc (sizeof (TBLModule)); | |
1798 | CheckAsn1Alloc ((*tmpVar), env); | |
1799 | BDecTBLModuleContent (b, tagId1, elmtLen1, (*tmpVar), &totalElmtsLen1, env); | |
1800 | } /* end of tag check if */ | |
1801 | else /* wrong tag */ | |
1802 | { | |
1803 | Asn1Error ("Unexpected Tag\n"); | |
1804 | longjmp (env, -136); | |
1805 | } | |
1806 | } /* end of for */ | |
1807 | ||
1808 | (*bytesDecoded) += totalElmtsLen1; | |
1809 | } /* BDecTBLSeqOfContent */ | |
1810 | ||
1811 | void | |
1812 | PrintTBLSeqOf PARAMS ((f, v, indent), | |
1813 | FILE* f _AND_ | |
1814 | TBLSeqOf *v _AND_ | |
1815 | unsigned short int indent) | |
1816 | { | |
1817 | TBLModule *tmp; | |
1818 | if (v == NULL) | |
1819 | return; | |
1820 | fprintf (f,"{ -- SEQUENCE OF -- \n"); | |
1821 | FOR_EACH_LIST_ELMT (tmp, v) | |
1822 | { | |
1823 | Indent (f, indent+ stdIndentG); | |
1824 | PrintTBLModule (f, tmp, indent + stdIndentG); | |
1825 | if (tmp != (TBLModule*)LAST_LIST_ELMT (v)) | |
1826 | fprintf (f,",\n"); | |
1827 | } | |
1828 | fprintf (f,"\n"); | |
1829 | Indent (f, indent); | |
1830 | fprintf (f,"}"); | |
1831 | } /* PrintTBLSeqOf */ | |
1832 | ||
1833 | void | |
1834 | FreeTBLSeqOf PARAMS ((v), | |
1835 | TBLSeqOf *v) | |
1836 | { | |
1837 | ||
1838 | AsnListNode *l; | |
1839 | AsnListNode *tmp; | |
1840 | if (v == NULL) | |
1841 | return; | |
1842 | for (l = FIRST_LIST_NODE (v); l != NULL; ) | |
1843 | { | |
1844 | FreeTBLModule ((l->data)); | |
1845 | tmp = l->next; | |
1846 | Asn1Free (l->data); | |
1847 | Asn1Free (l); | |
1848 | l = tmp; | |
1849 | } | |
1850 | } /* FreeTBLSeqOf */ | |
1851 | ||
1852 | ||
1853 | ||
1854 | ||
1855 | AsnLen BEncTBL PARAMS ((b, v), | |
1856 | BUF_TYPE b _AND_ | |
1857 | TBL *v) | |
1858 | { | |
1859 | AsnLen l; | |
1860 | BEncEocIfNec (b); | |
1861 | l = BEncTBLContent (b, v); | |
1862 | l += BEncConsLen (b, l); | |
1863 | l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); | |
1864 | return l; | |
1865 | } /* BEncTBL */ | |
1866 | ||
1867 | void BDecTBL PARAMS ((b, result, bytesDecoded, env), | |
1868 | BUF_TYPE b _AND_ | |
1869 | TBL *result _AND_ | |
1870 | AsnLen *bytesDecoded _AND_ | |
1871 | ENV_TYPE env) | |
1872 | { | |
1873 | AsnTag tag; | |
1874 | AsnLen elmtLen1; | |
1875 | ||
1876 | if (((tag = BDecTag (b, bytesDecoded, env)) != | |
1877 | MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))) | |
1878 | { | |
1879 | Asn1Error ("BDecTBL: ERROR - wrong tag\n"); | |
1880 | longjmp (env, -137); | |
1881 | } | |
1882 | elmtLen1 = BDecLen (b, bytesDecoded, env); | |
1883 | BDecTBLContent (b, tag, elmtLen1, result, bytesDecoded, env); | |
1884 | } /* BDecTBL */ | |
1885 | ||
1886 | AsnLen | |
1887 | BEncTBLContent PARAMS ((b, v), | |
1888 | BUF_TYPE b _AND_ | |
1889 | TBL *v) | |
1890 | { | |
1891 | AsnLen totalLen = 0; | |
1892 | AsnLen itemLen; | |
1893 | AsnLen listLen; | |
1894 | void *component; | |
1895 | ||
1896 | BEncEocIfNec (b); | |
1897 | itemLen = BEncTBLSeqOfContent (b, (v->modules)); | |
1898 | itemLen += BEncConsLen (b, itemLen); | |
1899 | itemLen += BEncTag1 (b, UNIV, CONS, 16); | |
1900 | ||
1901 | totalLen += itemLen; | |
1902 | ||
1903 | itemLen = BEncAsnIntContent (b, (&v->totalLenStrings)); | |
1904 | BEncDefLenTo127 (b, itemLen); | |
1905 | itemLen++; | |
1906 | itemLen += BEncTag1 (b, UNIV, PRIM, 2); | |
1907 | ||
1908 | totalLen += itemLen; | |
1909 | ||
1910 | itemLen = BEncAsnIntContent (b, (&v->totalNumStrings)); | |
1911 | BEncDefLenTo127 (b, itemLen); | |
1912 | itemLen++; | |
1913 | itemLen += BEncTag1 (b, UNIV, PRIM, 2); | |
1914 | ||
1915 | totalLen += itemLen; | |
1916 | ||
1917 | itemLen = BEncAsnIntContent (b, (&v->totalNumTags)); | |
1918 | BEncDefLenTo127 (b, itemLen); | |
1919 | itemLen++; | |
1920 | itemLen += BEncTag1 (b, UNIV, PRIM, 2); | |
1921 | ||
1922 | totalLen += itemLen; | |
1923 | ||
1924 | itemLen = BEncAsnIntContent (b, (&v->totalNumTypes)); | |
1925 | BEncDefLenTo127 (b, itemLen); | |
1926 | itemLen++; | |
1927 | itemLen += BEncTag1 (b, UNIV, PRIM, 2); | |
1928 | ||
1929 | totalLen += itemLen; | |
1930 | ||
1931 | itemLen = BEncAsnIntContent (b, (&v->totalNumTypeDefs)); | |
1932 | BEncDefLenTo127 (b, itemLen); | |
1933 | itemLen++; | |
1934 | itemLen += BEncTag1 (b, UNIV, PRIM, 2); | |
1935 | ||
1936 | totalLen += itemLen; | |
1937 | ||
1938 | itemLen = BEncAsnIntContent (b, (&v->totalNumModules)); | |
1939 | BEncDefLenTo127 (b, itemLen); | |
1940 | itemLen++; | |
1941 | itemLen += BEncTag1 (b, UNIV, PRIM, 2); | |
1942 | ||
1943 | totalLen += itemLen; | |
1944 | ||
1945 | return totalLen; | |
1946 | ||
1947 | } /* BEncTBLContent */ | |
1948 | ||
1949 | void | |
1950 | BDecTBLContent PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, env), | |
1951 | BUF_TYPE b _AND_ | |
1952 | AsnTag tagId0 _AND_ | |
1953 | AsnLen elmtLen0 _AND_ | |
1954 | TBL *v _AND_ | |
1955 | AsnLen *bytesDecoded _AND_ | |
1956 | ENV_TYPE env) | |
1957 | { | |
1958 | int seqDone = FALSE; | |
1959 | AsnLen totalElmtsLen1 = 0; | |
1960 | AsnLen elmtLen1; | |
1961 | AsnTag tagId1; | |
1962 | int mandatoryElmtCount1 = 0; | |
1963 | ||
1964 | ||
1965 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
1966 | ||
1967 | if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))) | |
1968 | { | |
1969 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
1970 | BDecAsnIntContent (b, tagId1, elmtLen1, (&v->totalNumModules), &totalElmtsLen1, env); | |
1971 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
1972 | } | |
1973 | else | |
1974 | longjmp (env, -138); | |
1975 | ||
1976 | ||
1977 | if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))) | |
1978 | { | |
1979 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
1980 | BDecAsnIntContent (b, tagId1, elmtLen1, (&v->totalNumTypeDefs), &totalElmtsLen1, env); | |
1981 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
1982 | } | |
1983 | else | |
1984 | longjmp (env, -139); | |
1985 | ||
1986 | ||
1987 | if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))) | |
1988 | { | |
1989 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
1990 | BDecAsnIntContent (b, tagId1, elmtLen1, (&v->totalNumTypes), &totalElmtsLen1, env); | |
1991 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
1992 | } | |
1993 | else | |
1994 | longjmp (env, -140); | |
1995 | ||
1996 | ||
1997 | if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))) | |
1998 | { | |
1999 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
2000 | BDecAsnIntContent (b, tagId1, elmtLen1, (&v->totalNumTags), &totalElmtsLen1, env); | |
2001 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
2002 | } | |
2003 | else | |
2004 | longjmp (env, -141); | |
2005 | ||
2006 | ||
2007 | if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))) | |
2008 | { | |
2009 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
2010 | BDecAsnIntContent (b, tagId1, elmtLen1, (&v->totalNumStrings), &totalElmtsLen1, env); | |
2011 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
2012 | } | |
2013 | else | |
2014 | longjmp (env, -142); | |
2015 | ||
2016 | ||
2017 | if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))) | |
2018 | { | |
2019 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
2020 | BDecAsnIntContent (b, tagId1, elmtLen1, (&v->totalLenStrings), &totalElmtsLen1, env); | |
2021 | tagId1 = BDecTag (b, &totalElmtsLen1, env); | |
2022 | } | |
2023 | else | |
2024 | longjmp (env, -143); | |
2025 | ||
2026 | ||
2027 | if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))) | |
2028 | { | |
2029 | elmtLen1 = BDecLen (b, &totalElmtsLen1, env); | |
2030 | (v->modules) = AsnListNew (sizeof (char*)); | |
2031 | CheckAsn1Alloc ((v->modules), env); | |
2032 | BDecTBLSeqOfContent (b, tagId1, elmtLen1, (v->modules), &totalElmtsLen1, env); | |
2033 | seqDone = TRUE; | |
2034 | if (elmtLen0 == INDEFINITE_LEN) | |
2035 | BDecEoc (b, &totalElmtsLen1, env); | |
2036 | else if (totalElmtsLen1 != elmtLen0) | |
2037 | longjmp (env, -144); | |
2038 | } | |
2039 | else | |
2040 | longjmp (env, -145); | |
2041 | ||
2042 | ||
2043 | if (!seqDone) | |
2044 | longjmp (env, -146); | |
2045 | ||
2046 | (*bytesDecoded) += totalElmtsLen1; | |
2047 | } /* BDecTBLContent */ | |
2048 | ||
2049 | void | |
2050 | PrintTBL PARAMS ((f, v, indent), | |
2051 | FILE* f _AND_ | |
2052 | TBL *v _AND_ | |
2053 | unsigned short int indent) | |
2054 | { | |
2055 | if (v == NULL) | |
2056 | return; | |
2057 | ||
2058 | fprintf (f,"{ -- SEQUENCE --\n"); | |
2059 | ||
2060 | Indent (f, indent + stdIndentG); | |
2061 | fprintf (f,"totalNumModules "); | |
2062 | PrintAsnInt (f, (&v->totalNumModules), indent + stdIndentG); | |
2063 | fprintf (f, ",\n"); | |
2064 | Indent (f, indent + stdIndentG); | |
2065 | fprintf (f,"totalNumTypeDefs "); | |
2066 | PrintAsnInt (f, (&v->totalNumTypeDefs), indent + stdIndentG); | |
2067 | fprintf (f, ",\n"); | |
2068 | Indent (f, indent + stdIndentG); | |
2069 | fprintf (f,"totalNumTypes "); | |
2070 | PrintAsnInt (f, (&v->totalNumTypes), indent + stdIndentG); | |
2071 | fprintf (f, ",\n"); | |
2072 | Indent (f, indent + stdIndentG); | |
2073 | fprintf (f,"totalNumTags "); | |
2074 | PrintAsnInt (f, (&v->totalNumTags), indent + stdIndentG); | |
2075 | fprintf (f, ",\n"); | |
2076 | Indent (f, indent + stdIndentG); | |
2077 | fprintf (f,"totalNumStrings "); | |
2078 | PrintAsnInt (f, (&v->totalNumStrings), indent + stdIndentG); | |
2079 | fprintf (f, ",\n"); | |
2080 | Indent (f, indent + stdIndentG); | |
2081 | fprintf (f,"totalLenStrings "); | |
2082 | PrintAsnInt (f, (&v->totalLenStrings), indent + stdIndentG); | |
2083 | fprintf (f, ",\n"); | |
2084 | Indent (f, indent + stdIndentG); | |
2085 | fprintf (f,"modules "); | |
2086 | PrintTBLSeqOf (f, (v->modules), indent + stdIndentG); | |
2087 | fprintf (f,"\n"); | |
2088 | Indent (f, indent); | |
2089 | fprintf (f,"}"); | |
2090 | } /* PrintTBL */ | |
2091 | ||
2092 | void | |
2093 | FreeTBL PARAMS ((v), | |
2094 | TBL *v) | |
2095 | { | |
2096 | ||
2097 | if (v == NULL) | |
2098 | return; | |
2099 | FreeAsnInt ((&v->totalNumModules)); | |
2100 | ||
2101 | FreeAsnInt ((&v->totalNumTypeDefs)); | |
2102 | ||
2103 | FreeAsnInt ((&v->totalNumTypes)); | |
2104 | ||
2105 | FreeAsnInt ((&v->totalNumTags)); | |
2106 | ||
2107 | FreeAsnInt ((&v->totalNumStrings)); | |
2108 | ||
2109 | FreeAsnInt ((&v->totalLenStrings)); | |
2110 | ||
2111 | FreeTBLSeqOf ((v->modules)); | |
2112 | Asn1Free ((v->modules)); | |
2113 | ||
2114 | } /* FreeTBL */ | |
2115 | ||
2116 | ||
2117 | ||
2118 | ||
2119 | #endif /* TTBL */ |