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