2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
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
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.
23 * "TBL" ASN.1 module encode/decode/print/free C src.
25 * This file was generated by snacc on Mon Jun 2 11:23:56 1997
27 * UBC snacc written by Mike Sample
29 * NOTE: This is a machine generated file - editing not recommended
39 BEncTBLRangeContent
PARAMS ((b
, v
),
48 itemLen
= BEncAsnIntContent (b
, (&v
->to
));
49 BEncDefLenTo127 (b
, itemLen
);
51 itemLen
+= BEncTag1 (b
, CNTX
, PRIM
, 1);
55 itemLen
= BEncAsnIntContent (b
, (&v
->from
));
56 BEncDefLenTo127 (b
, itemLen
);
58 itemLen
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
64 } /* BEncTBLRangeContent */
67 BDecTBLRangeContent
PARAMS ((b
, tagId0
, elmtLen0
, v
, bytesDecoded
, env
),
72 AsnLen
*bytesDecoded _AND_
76 AsnLen totalElmtsLen1
= 0;
79 int mandatoryElmtCount1
= 0;
82 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
84 if (((tagId1
== MAKE_TAG_ID (CNTX
, PRIM
, 0))))
86 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
87 BDecAsnIntContent (b
, tagId1
, elmtLen1
, (&v
->from
), &totalElmtsLen1
, env
);
88 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
94 if (((tagId1
== MAKE_TAG_ID (CNTX
, PRIM
, 1))))
96 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
97 BDecAsnIntContent (b
, tagId1
, elmtLen1
, (&v
->to
), &totalElmtsLen1
, env
);
99 if (elmtLen0
== INDEFINITE_LEN
)
100 BDecEoc (b
, &totalElmtsLen1
, env
);
101 else if (totalElmtsLen1
!= elmtLen0
)
111 (*bytesDecoded
) += totalElmtsLen1
;
112 } /* BDecTBLRangeContent */
115 PrintTBLRange
PARAMS ((f
, v
, indent
),
118 unsigned short int indent
)
123 fprintf (f
,"{ -- SEQUENCE --\n");
125 Indent (f
, indent
+ stdIndentG
);
127 PrintAsnInt (f
, (&v
->from
), indent
+ stdIndentG
);
129 Indent (f
, indent
+ stdIndentG
);
131 PrintAsnInt (f
, (&v
->to
), indent
+ stdIndentG
);
135 } /* PrintTBLRange */
138 FreeTBLRange
PARAMS ((v
),
144 FreeAsnInt ((&v
->from
));
146 FreeAsnInt ((&v
->to
));
154 BEncTBLNamedNumberContent
PARAMS ((b
, v
),
163 itemLen
= BEncAsnIntContent (b
, (&v
->value
));
164 BEncDefLenTo127 (b
, itemLen
);
166 itemLen
+= BEncTag1 (b
, CNTX
, PRIM
, 1);
170 itemLen
= BEncPrintableStringContent (b
, (&v
->name
));
171 itemLen
+= BEncDefLen (b
, itemLen
);
172 itemLen
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
178 } /* BEncTBLNamedNumberContent */
181 BDecTBLNamedNumberContent
PARAMS ((b
, tagId0
, elmtLen0
, v
, bytesDecoded
, env
),
184 AsnLen elmtLen0 _AND_
185 TBLNamedNumber
*v _AND_
186 AsnLen
*bytesDecoded _AND_
190 AsnLen totalElmtsLen1
= 0;
193 int mandatoryElmtCount1
= 0;
196 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
198 if (((tagId1
== MAKE_TAG_ID (CNTX
, PRIM
, 0)) ||
199 (tagId1
== MAKE_TAG_ID (CNTX
, CONS
, 0))))
201 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
202 BDecPrintableStringContent (b
, tagId1
, elmtLen1
, (&v
->name
), &totalElmtsLen1
, env
);
203 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
209 if (((tagId1
== MAKE_TAG_ID (CNTX
, PRIM
, 1))))
211 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
212 BDecAsnIntContent (b
, tagId1
, elmtLen1
, (&v
->value
), &totalElmtsLen1
, env
);
214 if (elmtLen0
== INDEFINITE_LEN
)
215 BDecEoc (b
, &totalElmtsLen1
, env
);
216 else if (totalElmtsLen1
!= elmtLen0
)
226 (*bytesDecoded
) += totalElmtsLen1
;
227 } /* BDecTBLNamedNumberContent */
230 PrintTBLNamedNumber
PARAMS ((f
, v
, indent
),
232 TBLNamedNumber
*v _AND_
233 unsigned short int indent
)
238 fprintf (f
,"{ -- SEQUENCE --\n");
240 Indent (f
, indent
+ stdIndentG
);
242 PrintPrintableString (f
, (&v
->name
), indent
+ stdIndentG
);
244 Indent (f
, indent
+ stdIndentG
);
245 fprintf (f
,"value ");
246 PrintAsnInt (f
, (&v
->value
), indent
+ stdIndentG
);
250 } /* PrintTBLNamedNumber */
253 FreeTBLNamedNumber
PARAMS ((v
),
259 FreePrintableString ((&v
->name
));
261 FreeAsnInt ((&v
->value
));
263 } /* FreeTBLNamedNumber */
269 BEncTBLNamedNumberListContent
PARAMS ((b
, v
),
271 TBLNamedNumberList
*v
)
279 FOR_EACH_LIST_ELMT_RVS (component
, v
)
282 itemLen
= BEncTBLNamedNumberContent (b
, component
);
283 itemLen
+= BEncConsLen (b
, itemLen
);
284 itemLen
+= BEncTag1 (b
, UNIV
, CONS
, 16);
290 } /* BEncTBLNamedNumberListContent */
293 BDecTBLNamedNumberListContent
PARAMS ((b
, tagId0
, elmtLen0
, v
, bytesDecoded
, env
),
296 AsnLen elmtLen0 _AND_
297 TBLNamedNumberList
*v _AND_
298 AsnLen
*bytesDecoded _AND_
302 AsnLen totalElmtsLen1
= 0;
305 int mandatoryElmtCount1
= 0;
308 for (totalElmtsLen1
= 0; (totalElmtsLen1
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
);)
310 TBLNamedNumber
**tmpVar
;
311 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
313 if ((tagId1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
315 BDEC_2ND_EOC_OCTET (b
, &totalElmtsLen1
, env
)
316 break; /* got EOC so can exit this SET OF/SEQ OF's for loop*/
318 if ((tagId1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
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 */
328 Asn1Error ("Unexpected Tag\n");
333 (*bytesDecoded
) += totalElmtsLen1
;
334 } /* BDecTBLNamedNumberListContent */
337 PrintTBLNamedNumberList
PARAMS ((f
, v
, indent
),
339 TBLNamedNumberList
*v _AND_
340 unsigned short int indent
)
345 fprintf (f
,"{ -- SEQUENCE OF -- \n");
346 FOR_EACH_LIST_ELMT (tmp
, v
)
348 Indent (f
, indent
+ stdIndentG
);
349 PrintTBLNamedNumber (f
, tmp
, indent
+ stdIndentG
);
350 if (tmp
!= (TBLNamedNumber
*)LAST_LIST_ELMT (v
))
356 } /* PrintTBLNamedNumberList */
359 FreeTBLNamedNumberList
PARAMS ((v
),
360 TBLNamedNumberList
*v
)
367 for (l
= FIRST_LIST_NODE (v
); l
!= NULL
; )
369 FreeTBLNamedNumber ((l
->data
));
375 } /* FreeTBLNamedNumberList */
381 BEncTBLTypeRefContent
PARAMS ((b
, v
),
390 itemLen
= BEncAsnBoolContent (b
, (&v
->implicit
));
391 BEncDefLenTo127 (b
, itemLen
);
393 itemLen
+= BEncTag1 (b
, UNIV
, PRIM
, 1);
397 itemLen
= BEncTBLTypeDefIdContent (b
, (&v
->typeDef
));
398 BEncDefLenTo127 (b
, itemLen
);
400 itemLen
+= BEncTag1 (b
, UNIV
, PRIM
, 2);
406 } /* BEncTBLTypeRefContent */
409 BDecTBLTypeRefContent
PARAMS ((b
, tagId0
, elmtLen0
, v
, bytesDecoded
, env
),
412 AsnLen elmtLen0 _AND_
414 AsnLen
*bytesDecoded _AND_
418 AsnLen totalElmtsLen1
= 0;
421 int mandatoryElmtCount1
= 0;
424 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
426 if (((tagId1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
))))
428 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
429 BDecTBLTypeDefIdContent (b
, tagId1
, elmtLen1
, (&v
->typeDef
), &totalElmtsLen1
, env
);
430 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
436 if (((tagId1
== MAKE_TAG_ID (UNIV
, PRIM
, BOOLEAN_TAG_CODE
))))
438 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
439 BDecAsnBoolContent (b
, tagId1
, elmtLen1
, (&v
->implicit
), &totalElmtsLen1
, env
);
441 if (elmtLen0
== INDEFINITE_LEN
)
442 BDecEoc (b
, &totalElmtsLen1
, env
);
443 else if (totalElmtsLen1
!= elmtLen0
)
453 (*bytesDecoded
) += totalElmtsLen1
;
454 } /* BDecTBLTypeRefContent */
457 PrintTBLTypeRef
PARAMS ((f
, v
, indent
),
460 unsigned short int indent
)
465 fprintf (f
,"{ -- SEQUENCE --\n");
467 Indent (f
, indent
+ stdIndentG
);
468 fprintf (f
,"typeDef ");
469 PrintTBLTypeDefId (f
, (&v
->typeDef
), indent
+ stdIndentG
);
471 Indent (f
, indent
+ stdIndentG
);
472 fprintf (f
,"implicit ");
473 PrintAsnBool (f
, (&v
->implicit
), indent
+ stdIndentG
);
477 } /* PrintTBLTypeRef */
480 FreeTBLTypeRef
PARAMS ((v
),
486 FreeTBLTypeDefId ((&v
->typeDef
));
488 FreeAsnBool ((&v
->implicit
));
490 } /* FreeTBLTypeRef */
496 BEncTBLTagContent
PARAMS ((b
, v
),
505 itemLen
= BEncAsnIntContent (b
, (&v
->code
));
506 BEncDefLenTo127 (b
, itemLen
);
508 itemLen
+= BEncTag1 (b
, UNIV
, PRIM
, 2);
512 itemLen
= BEncTBLTagClassContent (b
, (&v
->tclass
));
513 BEncDefLenTo127 (b
, itemLen
);
515 itemLen
+= BEncTag1 (b
, UNIV
, PRIM
, 10);
521 } /* BEncTBLTagContent */
524 BDecTBLTagContent
PARAMS ((b
, tagId0
, elmtLen0
, v
, bytesDecoded
, env
),
527 AsnLen elmtLen0 _AND_
529 AsnLen
*bytesDecoded _AND_
533 AsnLen totalElmtsLen1
= 0;
536 int mandatoryElmtCount1
= 0;
539 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
541 if (((tagId1
== MAKE_TAG_ID (UNIV
, PRIM
, ENUM_TAG_CODE
))))
543 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
544 BDecTBLTagClassContent (b
, tagId1
, elmtLen1
, (&v
->tclass
), &totalElmtsLen1
, env
);
545 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
551 if (((tagId1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
))))
553 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
554 BDecAsnIntContent (b
, tagId1
, elmtLen1
, (&v
->code
), &totalElmtsLen1
, env
);
556 if (elmtLen0
== INDEFINITE_LEN
)
557 BDecEoc (b
, &totalElmtsLen1
, env
);
558 else if (totalElmtsLen1
!= elmtLen0
)
568 (*bytesDecoded
) += totalElmtsLen1
;
569 } /* BDecTBLTagContent */
572 PrintTBLTag
PARAMS ((f
, v
, indent
),
575 unsigned short int indent
)
580 fprintf (f
,"{ -- SEQUENCE --\n");
582 Indent (f
, indent
+ stdIndentG
);
583 fprintf (f
,"tclass ");
584 PrintTBLTagClass (f
, (&v
->tclass
), indent
+ stdIndentG
);
586 Indent (f
, indent
+ stdIndentG
);
588 PrintAsnInt (f
, (&v
->code
), indent
+ stdIndentG
);
595 FreeTBLTag
PARAMS ((v
),
601 FreeTBLTagClass ((&v
->tclass
));
603 FreeAsnInt ((&v
->code
));
611 BEncTBLTypeSeqOfContent
PARAMS ((b
, v
),
621 FOR_EACH_LIST_ELMT_RVS (component
, v
)
624 itemLen
= BEncTBLTagContent (b
, component
);
625 itemLen
+= BEncConsLen (b
, itemLen
);
626 itemLen
+= BEncTag1 (b
, UNIV
, CONS
, 16);
632 } /* BEncTBLTypeSeqOfContent */
635 BDecTBLTypeSeqOfContent
PARAMS ((b
, tagId0
, elmtLen0
, v
, bytesDecoded
, env
),
638 AsnLen elmtLen0 _AND_
639 TBLTypeSeqOf
*v _AND_
640 AsnLen
*bytesDecoded _AND_
644 AsnLen totalElmtsLen1
= 0;
647 int mandatoryElmtCount1
= 0;
650 for (totalElmtsLen1
= 0; (totalElmtsLen1
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
);)
653 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
655 if ((tagId1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
657 BDEC_2ND_EOC_OCTET (b
, &totalElmtsLen1
, env
)
658 break; /* got EOC so can exit this SET OF/SEQ OF's for loop*/
660 if ((tagId1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
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 */
670 Asn1Error ("Unexpected Tag\n");
675 (*bytesDecoded
) += totalElmtsLen1
;
676 } /* BDecTBLTypeSeqOfContent */
679 PrintTBLTypeSeqOf
PARAMS ((f
, v
, indent
),
681 TBLTypeSeqOf
*v _AND_
682 unsigned short int indent
)
687 fprintf (f
,"{ -- SEQUENCE OF -- \n");
688 FOR_EACH_LIST_ELMT (tmp
, v
)
690 Indent (f
, indent
+ stdIndentG
);
691 PrintTBLTag (f
, tmp
, indent
+ stdIndentG
);
692 if (tmp
!= (TBLTag
*)LAST_LIST_ELMT (v
))
698 } /* PrintTBLTypeSeqOf */
701 FreeTBLTypeSeqOf
PARAMS ((v
),
709 for (l
= FIRST_LIST_NODE (v
); l
!= NULL
; )
711 FreeTBLTag ((l
->data
));
717 } /* FreeTBLTypeSeqOf */
723 BEncTBLTypeContentSeqOfContent
PARAMS ((b
, v
),
725 TBLTypeContentSeqOf
*v
)
733 FOR_EACH_LIST_ELMT_RVS (component
, v
)
736 itemLen
= BEncTBLTypeContent (b
, component
);
737 itemLen
+= BEncConsLen (b
, itemLen
);
738 itemLen
+= BEncTag1 (b
, UNIV
, CONS
, 16);
744 } /* BEncTBLTypeContentSeqOfContent */
747 BDecTBLTypeContentSeqOfContent
PARAMS ((b
, tagId0
, elmtLen0
, v
, bytesDecoded
, env
),
750 AsnLen elmtLen0 _AND_
751 TBLTypeContentSeqOf
*v _AND_
752 AsnLen
*bytesDecoded _AND_
756 AsnLen totalElmtsLen1
= 0;
759 int mandatoryElmtCount1
= 0;
762 for (totalElmtsLen1
= 0; (totalElmtsLen1
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
);)
765 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
767 if ((tagId1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
769 BDEC_2ND_EOC_OCTET (b
, &totalElmtsLen1
, env
)
770 break; /* got EOC so can exit this SET OF/SEQ OF's for loop*/
772 if ((tagId1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
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 */
782 Asn1Error ("Unexpected Tag\n");
787 (*bytesDecoded
) += totalElmtsLen1
;
788 } /* BDecTBLTypeContentSeqOfContent */
791 PrintTBLTypeContentSeqOf
PARAMS ((f
, v
, indent
),
793 TBLTypeContentSeqOf
*v _AND_
794 unsigned short int indent
)
799 fprintf (f
,"{ -- SEQUENCE OF -- \n");
800 FOR_EACH_LIST_ELMT (tmp
, v
)
802 Indent (f
, indent
+ stdIndentG
);
803 PrintTBLType (f
, tmp
, indent
+ stdIndentG
);
804 if (tmp
!= (TBLType
*)LAST_LIST_ELMT (v
))
810 } /* PrintTBLTypeContentSeqOf */
813 FreeTBLTypeContentSeqOf
PARAMS ((v
),
814 TBLTypeContentSeqOf
*v
)
821 for (l
= FIRST_LIST_NODE (v
); l
!= NULL
; )
823 FreeTBLType ((l
->data
));
829 } /* FreeTBLTypeContentSeqOf */
835 BEncTBLTypeContent
PARAMS ((b
, v
),
844 if (NOT_NULL ((v
->values
)))
847 itemLen
= BEncTBLNamedNumberListContent (b
, (v
->values
));
848 itemLen
+= BEncConsLen (b
, itemLen
);
849 itemLen
+= BEncTag1 (b
, CNTX
, CONS
, 6);
854 if (NOT_NULL ((v
->constraint
)))
857 itemLen
= BEncTBLRangeContent (b
, (v
->constraint
));
858 itemLen
+= BEncConsLen (b
, itemLen
);
859 itemLen
+= BEncTag1 (b
, CNTX
, CONS
, 5);
864 if (ASNOCTS_PRESENT ((&v
->fieldName
)))
866 itemLen
= BEncPrintableStringContent (b
, (&v
->fieldName
));
867 itemLen
+= BEncDefLen (b
, itemLen
);
868 itemLen
+= BEncTag1 (b
, CNTX
, PRIM
, 4);
874 itemLen
= BEncTBLTypeContentContent (b
, (v
->content
));
875 itemLen
+= BEncConsLen (b
, itemLen
);
876 itemLen
+= BEncTag1 (b
, CNTX
, CONS
, 3);
880 if (NOT_NULL ((v
->tagList
)))
883 itemLen
= BEncTBLTypeSeqOfContent (b
, (v
->tagList
));
884 itemLen
+= BEncConsLen (b
, itemLen
);
885 itemLen
+= BEncTag1 (b
, CNTX
, CONS
, 2);
890 itemLen
= BEncAsnBoolContent (b
, (&v
->optional
));
891 BEncDefLenTo127 (b
, itemLen
);
893 itemLen
+= BEncTag1 (b
, CNTX
, PRIM
, 1);
897 itemLen
= BEncTBLTypeIdContent (b
, (&v
->typeId
));
898 BEncDefLenTo127 (b
, itemLen
);
900 itemLen
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
906 } /* BEncTBLTypeContent */
909 BDecTBLTypeContent
PARAMS ((b
, tagId0
, elmtLen0
, v
, bytesDecoded
, env
),
912 AsnLen elmtLen0 _AND_
914 AsnLen
*bytesDecoded _AND_
918 AsnLen totalElmtsLen1
= 0;
921 int mandatoryElmtCount1
= 0;
922 AsnLen totalElmtsLen2
= 0;
925 AsnLen totalElmtsLen3
= 0;
930 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
932 if (((tagId1
== MAKE_TAG_ID (CNTX
, PRIM
, 0))))
934 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
935 BDecTBLTypeIdContent (b
, tagId1
, elmtLen1
, (&v
->typeId
), &totalElmtsLen1
, env
);
936 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
942 if (((tagId1
== MAKE_TAG_ID (CNTX
, PRIM
, 1))))
944 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
945 BDecAsnBoolContent (b
, tagId1
, elmtLen1
, (&v
->optional
), &totalElmtsLen1
, env
);
946 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
952 if (((tagId1
== MAKE_TAG_ID (CNTX
, CONS
, 2))))
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
);
962 if (((tagId1
== MAKE_TAG_ID (CNTX
, CONS
, 3))))
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
))
978 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
980 if ((elmtLen0
== INDEFINITE_LEN
) && (tagId1
== EOC_TAG_ID
))
982 BDEC_2ND_EOC_OCTET (b
, &totalElmtsLen1
, env
)
991 if ((!seqDone
) && ((tagId1
== MAKE_TAG_ID (CNTX
, PRIM
, 4)) ||
992 (tagId1
== MAKE_TAG_ID (CNTX
, CONS
, 4))))
994 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
995 BDecPrintableStringContent (b
, tagId1
, elmtLen1
, (&v
->fieldName
), &totalElmtsLen1
, env
);
996 if ((elmtLen0
!= INDEFINITE_LEN
) && (totalElmtsLen1
== elmtLen0
))
1000 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
1002 if ((elmtLen0
== INDEFINITE_LEN
) && (tagId1
== EOC_TAG_ID
))
1004 BDEC_2ND_EOC_OCTET (b
, &totalElmtsLen1
, env
)
1011 if ((!seqDone
) && ((tagId1
== MAKE_TAG_ID (CNTX
, CONS
, 5))))
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
))
1021 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
1023 if ((elmtLen0
== INDEFINITE_LEN
) && (tagId1
== EOC_TAG_ID
))
1025 BDEC_2ND_EOC_OCTET (b
, &totalElmtsLen1
, env
)
1032 if ((!seqDone
) && ((tagId1
== MAKE_TAG_ID (CNTX
, CONS
, 6))))
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
);
1039 if (elmtLen0
== INDEFINITE_LEN
)
1040 BDecEoc (b
, &totalElmtsLen1
, env
);
1041 else if (totalElmtsLen1
!= elmtLen0
)
1042 longjmp (env
, -122);
1047 longjmp (env
, -123);
1049 (*bytesDecoded
) += totalElmtsLen1
;
1050 } /* BDecTBLTypeContent */
1053 PrintTBLType
PARAMS ((f
, v
, indent
),
1056 unsigned short int indent
)
1061 fprintf (f
,"{ -- SEQUENCE --\n");
1063 Indent (f
, indent
+ stdIndentG
);
1064 fprintf (f
,"typeId ");
1065 PrintTBLTypeId (f
, (&v
->typeId
), indent
+ stdIndentG
);
1067 Indent (f
, indent
+ stdIndentG
);
1068 fprintf (f
,"optional ");
1069 PrintAsnBool (f
, (&v
->optional
), indent
+ stdIndentG
);
1071 if (NOT_NULL ((v
->tagList
)))
1073 Indent (f
, indent
+ stdIndentG
);
1074 fprintf (f
,"tagList ");
1075 PrintTBLTypeSeqOf (f
, (v
->tagList
), indent
+ stdIndentG
);
1078 Indent (f
, indent
+ stdIndentG
);
1079 fprintf (f
,"content ");
1080 PrintTBLTypeContent (f
, (v
->content
), indent
+ stdIndentG
);
1081 if (ASNOCTS_PRESENT ((&v
->fieldName
)))
1084 Indent (f
, indent
+ stdIndentG
);
1085 fprintf (f
,"fieldName ");
1086 PrintPrintableString (f
, (&v
->fieldName
), indent
+ stdIndentG
);
1088 if (NOT_NULL ((v
->constraint
)))
1091 Indent (f
, indent
+ stdIndentG
);
1092 fprintf (f
,"constraint ");
1093 PrintTBLRange (f
, (v
->constraint
), indent
+ stdIndentG
);
1095 if (NOT_NULL ((v
->values
)))
1098 Indent (f
, indent
+ stdIndentG
);
1099 fprintf (f
,"values ");
1100 PrintTBLNamedNumberList (f
, (v
->values
), indent
+ stdIndentG
);
1105 } /* PrintTBLType */
1108 FreeTBLType
PARAMS ((v
),
1114 FreeTBLTypeId ((&v
->typeId
));
1116 FreeAsnBool ((&v
->optional
));
1118 if (NOT_NULL ((v
->tagList
)))
1120 FreeTBLTypeSeqOf ((v
->tagList
));
1121 Asn1Free ((v
->tagList
));
1124 FreeTBLTypeContent ((v
->content
));
1125 Asn1Free ((v
->content
));
1127 if (ASNOCTS_PRESENT ((&v
->fieldName
)))
1129 FreePrintableString ((&v
->fieldName
));
1132 if (NOT_NULL ((v
->constraint
)))
1134 FreeTBLRange ((v
->constraint
));
1135 Asn1Free ((v
->constraint
));
1138 if (NOT_NULL ((v
->values
)))
1140 FreeTBLNamedNumberList ((v
->values
));
1141 Asn1Free ((v
->values
));
1150 BEncTBLTypeContentContent
PARAMS ((b
, v
),
1154 AsnLen totalLen
= 0;
1159 switch (v
->choiceId
)
1161 case TBLTYPECONTENT_PRIMTYPE
:
1162 itemLen
= BEncAsnNullContent (b
, (&v
->a
.primType
));
1163 BEncDefLenTo127 (b
, itemLen
);
1165 itemLen
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
1167 totalLen
+= itemLen
;
1171 case TBLTYPECONTENT_ELMTS
:
1173 itemLen
= BEncTBLTypeContentSeqOfContent (b
, (v
->a
.elmts
));
1174 itemLen
+= BEncConsLen (b
, itemLen
);
1175 itemLen
+= BEncTag1 (b
, CNTX
, CONS
, 1);
1177 totalLen
+= itemLen
;
1181 case TBLTYPECONTENT_TYPEREF
:
1183 itemLen
= BEncTBLTypeRefContent (b
, (v
->a
.typeRef
));
1184 itemLen
+= BEncConsLen (b
, itemLen
);
1185 itemLen
+= BEncTag1 (b
, CNTX
, CONS
, 2);
1187 totalLen
+= itemLen
;
1194 } /* BEncTBLTypeContentContent */
1197 BDecTBLTypeContentContent
PARAMS ((b
, tagId0
, elmtLen0
, v
, bytesDecoded
, env
),
1200 AsnLen elmtLen0 _AND_
1201 TBLTypeContent
*v _AND_
1202 AsnLen
*bytesDecoded _AND_
1205 int seqDone
= FALSE
;
1206 AsnLen totalElmtsLen1
= 0;
1209 int mandatoryElmtCount1
= 0;
1214 case MAKE_TAG_ID (CNTX
, PRIM
, 0):
1215 (v
->choiceId
) = TBLTYPECONTENT_PRIMTYPE
;
1216 BDecAsnNullContent (b
, tagId0
, elmtLen0
, (&v
->a
.primType
), &totalElmtsLen1
, env
);
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
);
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
);
1234 Asn1Error ("ERROR - unexpected tag in CHOICE\n");
1235 longjmp (env
, -124);
1238 (*bytesDecoded
) += totalElmtsLen1
;
1239 } /* BDecTBLTypeContentContent */
1242 PrintTBLTypeContent
PARAMS ((f
, v
, indent
),
1244 TBLTypeContent
*v _AND_
1245 unsigned short int indent
)
1247 switch (v
->choiceId
)
1249 case TBLTYPECONTENT_PRIMTYPE
:
1250 fprintf (f
,"primType ");
1251 PrintAsnNull (f
, (&v
->a
.primType
), indent
+ stdIndentG
);
1254 case TBLTYPECONTENT_ELMTS
:
1255 fprintf (f
,"elmts ");
1256 PrintTBLTypeContentSeqOf (f
, (v
->a
.elmts
), indent
+ stdIndentG
);
1259 case TBLTYPECONTENT_TYPEREF
:
1260 fprintf (f
,"typeRef ");
1261 PrintTBLTypeRef (f
, (v
->a
.typeRef
), indent
+ stdIndentG
);
1265 } /* PrintTBLTypeContent */
1268 FreeTBLTypeContent
PARAMS ((v
),
1274 switch (v
->choiceId
)
1276 case TBLTYPECONTENT_ELMTS
:
1277 FreeTBLTypeContentSeqOf ((v
->a
.elmts
));
1278 Asn1Free ((v
->a
.elmts
));
1282 case TBLTYPECONTENT_TYPEREF
:
1283 FreeTBLTypeRef ((v
->a
.typeRef
));
1284 Asn1Free ((v
->a
.typeRef
));
1289 } /* FreeTBLTypeContent */
1295 BEncTBLTypeDefContent
PARAMS ((b
, v
),
1299 AsnLen totalLen
= 0;
1304 if (NOT_NULL ((v
->isPdu
)))
1306 itemLen
= BEncAsnNullContent (b
, (v
->isPdu
));
1307 BEncDefLenTo127 (b
, itemLen
);
1309 itemLen
+= BEncTag1 (b
, UNIV
, PRIM
, 5);
1311 totalLen
+= itemLen
;
1315 itemLen
= BEncTBLTypeContent (b
, (v
->type
));
1316 itemLen
+= BEncConsLen (b
, itemLen
);
1317 itemLen
+= BEncTag1 (b
, UNIV
, CONS
, 16);
1319 totalLen
+= itemLen
;
1321 itemLen
= BEncPrintableStringContent (b
, (&v
->typeName
));
1322 itemLen
+= BEncDefLen (b
, itemLen
);
1323 itemLen
+= BEncTag1 (b
, UNIV
, PRIM
, 19);
1325 totalLen
+= itemLen
;
1327 itemLen
= BEncTBLTypeDefIdContent (b
, (&v
->typeDefId
));
1328 BEncDefLenTo127 (b
, itemLen
);
1330 itemLen
+= BEncTag1 (b
, UNIV
, PRIM
, 2);
1332 totalLen
+= itemLen
;
1336 } /* BEncTBLTypeDefContent */
1339 BDecTBLTypeDefContent
PARAMS ((b
, tagId0
, elmtLen0
, v
, bytesDecoded
, env
),
1342 AsnLen elmtLen0 _AND_
1344 AsnLen
*bytesDecoded _AND_
1347 int seqDone
= FALSE
;
1348 AsnLen totalElmtsLen1
= 0;
1351 int mandatoryElmtCount1
= 0;
1354 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
1356 if (((tagId1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
))))
1358 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
1359 BDecTBLTypeDefIdContent (b
, tagId1
, elmtLen1
, (&v
->typeDefId
), &totalElmtsLen1
, env
);
1360 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
1363 longjmp (env
, -125);
1366 if (((tagId1
== MAKE_TAG_ID (UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
)) ||
1367 (tagId1
== MAKE_TAG_ID (UNIV
, CONS
, PRINTABLESTRING_TAG_CODE
))))
1369 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
1370 BDecPrintableStringContent (b
, tagId1
, elmtLen1
, (&v
->typeName
), &totalElmtsLen1
, env
);
1371 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
1374 longjmp (env
, -126);
1377 if (((tagId1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))))
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
))
1387 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
1389 if ((elmtLen0
== INDEFINITE_LEN
) && (tagId1
== EOC_TAG_ID
))
1391 BDEC_2ND_EOC_OCTET (b
, &totalElmtsLen1
, env
)
1397 longjmp (env
, -127);
1400 if ((!seqDone
) && ((tagId1
== MAKE_TAG_ID (UNIV
, PRIM
, NULLTYPE_TAG_CODE
))))
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
);
1407 if (elmtLen0
== INDEFINITE_LEN
)
1408 BDecEoc (b
, &totalElmtsLen1
, env
);
1409 else if (totalElmtsLen1
!= elmtLen0
)
1410 longjmp (env
, -128);
1415 longjmp (env
, -129);
1417 (*bytesDecoded
) += totalElmtsLen1
;
1418 } /* BDecTBLTypeDefContent */
1421 PrintTBLTypeDef
PARAMS ((f
, v
, indent
),
1424 unsigned short int indent
)
1429 fprintf (f
,"{ -- SEQUENCE --\n");
1431 Indent (f
, indent
+ stdIndentG
);
1432 fprintf (f
,"typeDefId ");
1433 PrintTBLTypeDefId (f
, (&v
->typeDefId
), indent
+ stdIndentG
);
1435 Indent (f
, indent
+ stdIndentG
);
1436 fprintf (f
,"typeName ");
1437 PrintPrintableString (f
, (&v
->typeName
), indent
+ stdIndentG
);
1439 Indent (f
, indent
+ stdIndentG
);
1440 fprintf (f
,"type ");
1441 PrintTBLType (f
, (v
->type
), indent
+ stdIndentG
);
1442 if (NOT_NULL ((v
->isPdu
)))
1445 Indent (f
, indent
+ stdIndentG
);
1446 fprintf (f
,"isPdu ");
1447 PrintAsnNull (f
, (v
->isPdu
), indent
+ stdIndentG
);
1452 } /* PrintTBLTypeDef */
1455 FreeTBLTypeDef
PARAMS ((v
),
1461 FreeTBLTypeDefId ((&v
->typeDefId
));
1463 FreePrintableString ((&v
->typeName
));
1465 FreeTBLType ((v
->type
));
1466 Asn1Free ((v
->type
));
1468 if (NOT_NULL ((v
->isPdu
)))
1470 FreeAsnNull ((v
->isPdu
));
1471 Asn1Free ((v
->isPdu
));
1474 } /* FreeTBLTypeDef */
1480 BEncTBLModuleSeqOfContent
PARAMS ((b
, v
),
1484 AsnLen totalLen
= 0;
1490 FOR_EACH_LIST_ELMT_RVS (component
, v
)
1493 itemLen
= BEncTBLTypeDefContent (b
, component
);
1494 itemLen
+= BEncConsLen (b
, itemLen
);
1495 itemLen
+= BEncTag1 (b
, UNIV
, CONS
, 16);
1501 } /* BEncTBLModuleSeqOfContent */
1504 BDecTBLModuleSeqOfContent
PARAMS ((b
, tagId0
, elmtLen0
, v
, bytesDecoded
, env
),
1507 AsnLen elmtLen0 _AND_
1508 TBLModuleSeqOf
*v _AND_
1509 AsnLen
*bytesDecoded _AND_
1512 int seqDone
= FALSE
;
1513 AsnLen totalElmtsLen1
= 0;
1516 int mandatoryElmtCount1
= 0;
1519 for (totalElmtsLen1
= 0; (totalElmtsLen1
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
);)
1521 TBLTypeDef
**tmpVar
;
1522 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
1524 if ((tagId1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
1526 BDEC_2ND_EOC_OCTET (b
, &totalElmtsLen1
, env
)
1527 break; /* got EOC so can exit this SET OF/SEQ OF's for loop*/
1529 if ((tagId1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
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 */
1539 Asn1Error ("Unexpected Tag\n");
1540 longjmp (env
, -130);
1544 (*bytesDecoded
) += totalElmtsLen1
;
1545 } /* BDecTBLModuleSeqOfContent */
1548 PrintTBLModuleSeqOf
PARAMS ((f
, v
, indent
),
1550 TBLModuleSeqOf
*v _AND_
1551 unsigned short int indent
)
1556 fprintf (f
,"{ -- SEQUENCE OF -- \n");
1557 FOR_EACH_LIST_ELMT (tmp
, v
)
1559 Indent (f
, indent
+ stdIndentG
);
1560 PrintTBLTypeDef (f
, tmp
, indent
+ stdIndentG
);
1561 if (tmp
!= (TBLTypeDef
*)LAST_LIST_ELMT (v
))
1567 } /* PrintTBLModuleSeqOf */
1570 FreeTBLModuleSeqOf
PARAMS ((v
),
1578 for (l
= FIRST_LIST_NODE (v
); l
!= NULL
; )
1580 FreeTBLTypeDef ((l
->data
));
1586 } /* FreeTBLModuleSeqOf */
1592 BEncTBLModuleContent
PARAMS ((b
, v
),
1596 AsnLen totalLen
= 0;
1602 itemLen
= BEncTBLModuleSeqOfContent (b
, (v
->typeDefs
));
1603 itemLen
+= BEncConsLen (b
, itemLen
);
1604 itemLen
+= BEncTag1 (b
, CNTX
, CONS
, 3);
1606 totalLen
+= itemLen
;
1608 itemLen
= BEncAsnBoolContent (b
, (&v
->isUseful
));
1609 BEncDefLenTo127 (b
, itemLen
);
1611 itemLen
+= BEncTag1 (b
, CNTX
, PRIM
, 2);
1613 totalLen
+= itemLen
;
1615 if (ASNOID_PRESENT ((&v
->id
)))
1617 itemLen
= BEncAsnOidContent (b
, (&v
->id
));
1618 itemLen
+= BEncDefLen (b
, itemLen
);
1619 itemLen
+= BEncTag1 (b
, CNTX
, PRIM
, 1);
1621 totalLen
+= itemLen
;
1624 itemLen
= BEncPrintableStringContent (b
, (&v
->name
));
1625 itemLen
+= BEncDefLen (b
, itemLen
);
1626 itemLen
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
1628 totalLen
+= itemLen
;
1632 } /* BEncTBLModuleContent */
1635 BDecTBLModuleContent
PARAMS ((b
, tagId0
, elmtLen0
, v
, bytesDecoded
, env
),
1638 AsnLen elmtLen0 _AND_
1640 AsnLen
*bytesDecoded _AND_
1643 int seqDone
= FALSE
;
1644 AsnLen totalElmtsLen1
= 0;
1647 int mandatoryElmtCount1
= 0;
1650 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
1652 if (((tagId1
== MAKE_TAG_ID (CNTX
, PRIM
, 0)) ||
1653 (tagId1
== MAKE_TAG_ID (CNTX
, CONS
, 0))))
1655 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
1656 BDecPrintableStringContent (b
, tagId1
, elmtLen1
, (&v
->name
), &totalElmtsLen1
, env
);
1657 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
1660 longjmp (env
, -131);
1663 if (((tagId1
== MAKE_TAG_ID (CNTX
, PRIM
, 1))))
1665 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
1666 BDecAsnOidContent (b
, tagId1
, elmtLen1
, (&v
->id
), &totalElmtsLen1
, env
);
1667 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
1671 if (((tagId1
== MAKE_TAG_ID (CNTX
, PRIM
, 2))))
1673 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
1674 BDecAsnBoolContent (b
, tagId1
, elmtLen1
, (&v
->isUseful
), &totalElmtsLen1
, env
);
1675 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
1678 longjmp (env
, -132);
1681 if (((tagId1
== MAKE_TAG_ID (CNTX
, CONS
, 3))))
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
);
1688 if (elmtLen0
== INDEFINITE_LEN
)
1689 BDecEoc (b
, &totalElmtsLen1
, env
);
1690 else if (totalElmtsLen1
!= elmtLen0
)
1691 longjmp (env
, -133);
1694 longjmp (env
, -134);
1698 longjmp (env
, -135);
1700 (*bytesDecoded
) += totalElmtsLen1
;
1701 } /* BDecTBLModuleContent */
1704 PrintTBLModule
PARAMS ((f
, v
, indent
),
1707 unsigned short int indent
)
1712 fprintf (f
,"{ -- SEQUENCE --\n");
1714 Indent (f
, indent
+ stdIndentG
);
1715 fprintf (f
,"name ");
1716 PrintPrintableString (f
, (&v
->name
), indent
+ stdIndentG
);
1718 if (ASNOID_PRESENT ((&v
->id
)))
1720 Indent (f
, indent
+ stdIndentG
);
1722 PrintAsnOid (f
, (&v
->id
), indent
+ stdIndentG
);
1725 Indent (f
, indent
+ stdIndentG
);
1726 fprintf (f
,"isUseful ");
1727 PrintAsnBool (f
, (&v
->isUseful
), indent
+ stdIndentG
);
1729 Indent (f
, indent
+ stdIndentG
);
1730 fprintf (f
,"typeDefs ");
1731 PrintTBLModuleSeqOf (f
, (v
->typeDefs
), indent
+ stdIndentG
);
1735 } /* PrintTBLModule */
1738 FreeTBLModule
PARAMS ((v
),
1744 FreePrintableString ((&v
->name
));
1746 if (ASNOID_PRESENT ((&v
->id
)))
1748 FreeAsnOid ((&v
->id
));
1751 FreeAsnBool ((&v
->isUseful
));
1753 FreeTBLModuleSeqOf ((v
->typeDefs
));
1754 Asn1Free ((v
->typeDefs
));
1756 } /* FreeTBLModule */
1762 BEncTBLSeqOfContent
PARAMS ((b
, v
),
1766 AsnLen totalLen
= 0;
1772 FOR_EACH_LIST_ELMT_RVS (component
, v
)
1775 itemLen
= BEncTBLModuleContent (b
, component
);
1776 itemLen
+= BEncConsLen (b
, itemLen
);
1777 itemLen
+= BEncTag1 (b
, UNIV
, CONS
, 16);
1783 } /* BEncTBLSeqOfContent */
1786 BDecTBLSeqOfContent
PARAMS ((b
, tagId0
, elmtLen0
, v
, bytesDecoded
, env
),
1789 AsnLen elmtLen0 _AND_
1791 AsnLen
*bytesDecoded _AND_
1794 int seqDone
= FALSE
;
1795 AsnLen totalElmtsLen1
= 0;
1798 int mandatoryElmtCount1
= 0;
1801 for (totalElmtsLen1
= 0; (totalElmtsLen1
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
);)
1804 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
1806 if ((tagId1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
1808 BDEC_2ND_EOC_OCTET (b
, &totalElmtsLen1
, env
)
1809 break; /* got EOC so can exit this SET OF/SEQ OF's for loop*/
1811 if ((tagId1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
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 */
1821 Asn1Error ("Unexpected Tag\n");
1822 longjmp (env
, -136);
1826 (*bytesDecoded
) += totalElmtsLen1
;
1827 } /* BDecTBLSeqOfContent */
1830 PrintTBLSeqOf
PARAMS ((f
, v
, indent
),
1833 unsigned short int indent
)
1838 fprintf (f
,"{ -- SEQUENCE OF -- \n");
1839 FOR_EACH_LIST_ELMT (tmp
, v
)
1841 Indent (f
, indent
+ stdIndentG
);
1842 PrintTBLModule (f
, tmp
, indent
+ stdIndentG
);
1843 if (tmp
!= (TBLModule
*)LAST_LIST_ELMT (v
))
1849 } /* PrintTBLSeqOf */
1852 FreeTBLSeqOf
PARAMS ((v
),
1860 for (l
= FIRST_LIST_NODE (v
); l
!= NULL
; )
1862 FreeTBLModule ((l
->data
));
1868 } /* FreeTBLSeqOf */
1873 AsnLen BEncTBL
PARAMS ((b
, v
),
1879 l
= BEncTBLContent (b
, v
);
1880 l
+= BEncConsLen (b
, l
);
1881 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1885 void BDecTBL
PARAMS ((b
, result
, bytesDecoded
, env
),
1888 AsnLen
*bytesDecoded _AND_
1894 if (((tag
= BDecTag (b
, bytesDecoded
, env
)) !=
1895 MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
1897 Asn1Error ("BDecTBL: ERROR - wrong tag\n");
1898 longjmp (env
, -137);
1900 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1901 BDecTBLContent (b
, tag
, elmtLen1
, result
, bytesDecoded
, env
);
1905 BEncTBLContent
PARAMS ((b
, v
),
1909 AsnLen totalLen
= 0;
1915 itemLen
= BEncTBLSeqOfContent (b
, (v
->modules
));
1916 itemLen
+= BEncConsLen (b
, itemLen
);
1917 itemLen
+= BEncTag1 (b
, UNIV
, CONS
, 16);
1919 totalLen
+= itemLen
;
1921 itemLen
= BEncAsnIntContent (b
, (&v
->totalLenStrings
));
1922 BEncDefLenTo127 (b
, itemLen
);
1924 itemLen
+= BEncTag1 (b
, UNIV
, PRIM
, 2);
1926 totalLen
+= itemLen
;
1928 itemLen
= BEncAsnIntContent (b
, (&v
->totalNumStrings
));
1929 BEncDefLenTo127 (b
, itemLen
);
1931 itemLen
+= BEncTag1 (b
, UNIV
, PRIM
, 2);
1933 totalLen
+= itemLen
;
1935 itemLen
= BEncAsnIntContent (b
, (&v
->totalNumTags
));
1936 BEncDefLenTo127 (b
, itemLen
);
1938 itemLen
+= BEncTag1 (b
, UNIV
, PRIM
, 2);
1940 totalLen
+= itemLen
;
1942 itemLen
= BEncAsnIntContent (b
, (&v
->totalNumTypes
));
1943 BEncDefLenTo127 (b
, itemLen
);
1945 itemLen
+= BEncTag1 (b
, UNIV
, PRIM
, 2);
1947 totalLen
+= itemLen
;
1949 itemLen
= BEncAsnIntContent (b
, (&v
->totalNumTypeDefs
));
1950 BEncDefLenTo127 (b
, itemLen
);
1952 itemLen
+= BEncTag1 (b
, UNIV
, PRIM
, 2);
1954 totalLen
+= itemLen
;
1956 itemLen
= BEncAsnIntContent (b
, (&v
->totalNumModules
));
1957 BEncDefLenTo127 (b
, itemLen
);
1959 itemLen
+= BEncTag1 (b
, UNIV
, PRIM
, 2);
1961 totalLen
+= itemLen
;
1965 } /* BEncTBLContent */
1968 BDecTBLContent
PARAMS ((b
, tagId0
, elmtLen0
, v
, bytesDecoded
, env
),
1971 AsnLen elmtLen0 _AND_
1973 AsnLen
*bytesDecoded _AND_
1976 int seqDone
= FALSE
;
1977 AsnLen totalElmtsLen1
= 0;
1980 int mandatoryElmtCount1
= 0;
1983 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
1985 if (((tagId1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
))))
1987 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
1988 BDecAsnIntContent (b
, tagId1
, elmtLen1
, (&v
->totalNumModules
), &totalElmtsLen1
, env
);
1989 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
1992 longjmp (env
, -138);
1995 if (((tagId1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
))))
1997 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
1998 BDecAsnIntContent (b
, tagId1
, elmtLen1
, (&v
->totalNumTypeDefs
), &totalElmtsLen1
, env
);
1999 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
2002 longjmp (env
, -139);
2005 if (((tagId1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
))))
2007 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
2008 BDecAsnIntContent (b
, tagId1
, elmtLen1
, (&v
->totalNumTypes
), &totalElmtsLen1
, env
);
2009 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
2012 longjmp (env
, -140);
2015 if (((tagId1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
))))
2017 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
2018 BDecAsnIntContent (b
, tagId1
, elmtLen1
, (&v
->totalNumTags
), &totalElmtsLen1
, env
);
2019 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
2022 longjmp (env
, -141);
2025 if (((tagId1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
))))
2027 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
2028 BDecAsnIntContent (b
, tagId1
, elmtLen1
, (&v
->totalNumStrings
), &totalElmtsLen1
, env
);
2029 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
2032 longjmp (env
, -142);
2035 if (((tagId1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
))))
2037 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
2038 BDecAsnIntContent (b
, tagId1
, elmtLen1
, (&v
->totalLenStrings
), &totalElmtsLen1
, env
);
2039 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
2042 longjmp (env
, -143);
2045 if (((tagId1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))))
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
);
2052 if (elmtLen0
== INDEFINITE_LEN
)
2053 BDecEoc (b
, &totalElmtsLen1
, env
);
2054 else if (totalElmtsLen1
!= elmtLen0
)
2055 longjmp (env
, -144);
2058 longjmp (env
, -145);
2062 longjmp (env
, -146);
2064 (*bytesDecoded
) += totalElmtsLen1
;
2065 } /* BDecTBLContent */
2068 PrintTBL
PARAMS ((f
, v
, indent
),
2071 unsigned short int indent
)
2076 fprintf (f
,"{ -- SEQUENCE --\n");
2078 Indent (f
, indent
+ stdIndentG
);
2079 fprintf (f
,"totalNumModules ");
2080 PrintAsnInt (f
, (&v
->totalNumModules
), indent
+ stdIndentG
);
2082 Indent (f
, indent
+ stdIndentG
);
2083 fprintf (f
,"totalNumTypeDefs ");
2084 PrintAsnInt (f
, (&v
->totalNumTypeDefs
), indent
+ stdIndentG
);
2086 Indent (f
, indent
+ stdIndentG
);
2087 fprintf (f
,"totalNumTypes ");
2088 PrintAsnInt (f
, (&v
->totalNumTypes
), indent
+ stdIndentG
);
2090 Indent (f
, indent
+ stdIndentG
);
2091 fprintf (f
,"totalNumTags ");
2092 PrintAsnInt (f
, (&v
->totalNumTags
), indent
+ stdIndentG
);
2094 Indent (f
, indent
+ stdIndentG
);
2095 fprintf (f
,"totalNumStrings ");
2096 PrintAsnInt (f
, (&v
->totalNumStrings
), indent
+ stdIndentG
);
2098 Indent (f
, indent
+ stdIndentG
);
2099 fprintf (f
,"totalLenStrings ");
2100 PrintAsnInt (f
, (&v
->totalLenStrings
), indent
+ stdIndentG
);
2102 Indent (f
, indent
+ stdIndentG
);
2103 fprintf (f
,"modules ");
2104 PrintTBLSeqOf (f
, (v
->modules
), indent
+ stdIndentG
);
2111 FreeTBL
PARAMS ((v
),
2117 FreeAsnInt ((&v
->totalNumModules
));
2119 FreeAsnInt ((&v
->totalNumTypeDefs
));
2121 FreeAsnInt ((&v
->totalNumTypes
));
2123 FreeAsnInt ((&v
->totalNumTags
));
2125 FreeAsnInt ((&v
->totalNumStrings
));
2127 FreeAsnInt ((&v
->totalLenStrings
));
2129 FreeTBLSeqOf ((v
->modules
));
2130 Asn1Free ((v
->modules
));