4 * "ASN-USEFUL" ASN.1 module encode/decode/print/free C src.
6 * This file was generated by snacc on Tue Mar 19 07:24:46 2002
8 * UBC snacc written by Mike Sample
10 * NOTE: This is a machine generated file - editing not recommended
16 #include "asn-useful.h"
19 AsnLen BEncUTF8String
PARAMS ((b
, v
),
24 l
= BEncUTF8StringContent (b
, v
);
25 l
+= BEncDefLen (b
, l
);
26 l
+= BEncTag1 (b
, UNIV
, PRIM
, 12);
28 } /* BEncUTF8String */
30 void BDecUTF8String
PARAMS ((b
, result
, bytesDecoded
, env
),
32 UTF8String
*result _AND_
33 AsnLen
*bytesDecoded _AND_
39 if (((tag
= BDecTag (b
, bytesDecoded
, env
)) !=
40 MAKE_TAG_ID (UNIV
, PRIM
, 12))&&
41 (tag
!= MAKE_TAG_ID (UNIV
, CONS
, 12)))
43 Asn1Error ("BDecUTF8String: ERROR - wrong tag\n");
46 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
47 BDecUTF8StringContent (b
, tag
, elmtLen1
, result
, bytesDecoded
, env
);
48 } /* BDecUTF8String */
50 AsnLen BEncNumericString
PARAMS ((b
, v
),
55 l
= BEncNumericStringContent (b
, v
);
56 l
+= BEncDefLen (b
, l
);
57 l
+= BEncTag1 (b
, UNIV
, PRIM
, NUMERICSTRING_TAG_CODE
);
59 } /* BEncNumericString */
61 void BDecNumericString
PARAMS ((b
, result
, bytesDecoded
, env
),
63 NumericString
*result _AND_
64 AsnLen
*bytesDecoded _AND_
70 if (((tag
= BDecTag (b
, bytesDecoded
, env
)) !=
71 MAKE_TAG_ID (UNIV
, PRIM
, NUMERICSTRING_TAG_CODE
))&&
72 (tag
!= MAKE_TAG_ID (UNIV
, CONS
, NUMERICSTRING_TAG_CODE
)))
74 Asn1Error ("BDecNumericString: ERROR - wrong tag\n");
77 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
78 BDecNumericStringContent (b
, tag
, elmtLen1
, result
, bytesDecoded
, env
);
79 } /* BDecNumericString */
81 AsnLen BEncPrintableString
PARAMS ((b
, v
),
86 l
= BEncPrintableStringContent (b
, v
);
87 l
+= BEncDefLen (b
, l
);
88 l
+= BEncTag1 (b
, UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
);
90 } /* BEncPrintableString */
92 void BDecPrintableString
PARAMS ((b
, result
, bytesDecoded
, env
),
94 PrintableString
*result _AND_
95 AsnLen
*bytesDecoded _AND_
101 if (((tag
= BDecTag (b
, bytesDecoded
, env
)) !=
102 MAKE_TAG_ID (UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
))&&
103 (tag
!= MAKE_TAG_ID (UNIV
, CONS
, PRINTABLESTRING_TAG_CODE
)))
105 Asn1Error ("BDecPrintableString: ERROR - wrong tag\n");
108 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
109 BDecPrintableStringContent (b
, tag
, elmtLen1
, result
, bytesDecoded
, env
);
110 } /* BDecPrintableString */
112 AsnLen BEncTeletexString
PARAMS ((b
, v
),
117 l
= BEncTeletexStringContent (b
, v
);
118 l
+= BEncDefLen (b
, l
);
119 l
+= BEncTag1 (b
, UNIV
, PRIM
, TELETEXSTRING_TAG_CODE
);
121 } /* BEncTeletexString */
123 void BDecTeletexString
PARAMS ((b
, result
, bytesDecoded
, env
),
125 TeletexString
*result _AND_
126 AsnLen
*bytesDecoded _AND_
132 if (((tag
= BDecTag (b
, bytesDecoded
, env
)) !=
133 MAKE_TAG_ID (UNIV
, PRIM
, TELETEXSTRING_TAG_CODE
))&&
134 (tag
!= MAKE_TAG_ID (UNIV
, CONS
, TELETEXSTRING_TAG_CODE
)))
136 Asn1Error ("BDecTeletexString: ERROR - wrong tag\n");
139 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
140 BDecTeletexStringContent (b
, tag
, elmtLen1
, result
, bytesDecoded
, env
);
141 } /* BDecTeletexString */
143 AsnLen BEncT61String
PARAMS ((b
, v
),
148 l
= BEncT61StringContent (b
, v
);
149 l
+= BEncDefLen (b
, l
);
150 l
+= BEncTag1 (b
, UNIV
, PRIM
, TELETEXSTRING_TAG_CODE
);
152 } /* BEncT61String */
154 void BDecT61String
PARAMS ((b
, result
, bytesDecoded
, env
),
156 T61String
*result _AND_
157 AsnLen
*bytesDecoded _AND_
163 if (((tag
= BDecTag (b
, bytesDecoded
, env
)) !=
164 MAKE_TAG_ID (UNIV
, PRIM
, TELETEXSTRING_TAG_CODE
))&&
165 (tag
!= MAKE_TAG_ID (UNIV
, CONS
, TELETEXSTRING_TAG_CODE
)))
167 Asn1Error ("BDecT61String: ERROR - wrong tag\n");
170 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
171 BDecT61StringContent (b
, tag
, elmtLen1
, result
, bytesDecoded
, env
);
172 } /* BDecT61String */
174 AsnLen BEncVideotexString
PARAMS ((b
, v
),
179 l
= BEncVideotexStringContent (b
, v
);
180 l
+= BEncDefLen (b
, l
);
181 l
+= BEncTag1 (b
, UNIV
, PRIM
, VIDEOTEXSTRING_TAG_CODE
);
183 } /* BEncVideotexString */
185 void BDecVideotexString
PARAMS ((b
, result
, bytesDecoded
, env
),
187 VideotexString
*result _AND_
188 AsnLen
*bytesDecoded _AND_
194 if (((tag
= BDecTag (b
, bytesDecoded
, env
)) !=
195 MAKE_TAG_ID (UNIV
, PRIM
, VIDEOTEXSTRING_TAG_CODE
))&&
196 (tag
!= MAKE_TAG_ID (UNIV
, CONS
, VIDEOTEXSTRING_TAG_CODE
)))
198 Asn1Error ("BDecVideotexString: ERROR - wrong tag\n");
201 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
202 BDecVideotexStringContent (b
, tag
, elmtLen1
, result
, bytesDecoded
, env
);
203 } /* BDecVideotexString */
205 AsnLen BEncIA5String
PARAMS ((b
, v
),
210 l
= BEncIA5StringContent (b
, v
);
211 l
+= BEncDefLen (b
, l
);
212 l
+= BEncTag1 (b
, UNIV
, PRIM
, IA5STRING_TAG_CODE
);
214 } /* BEncIA5String */
216 void BDecIA5String
PARAMS ((b
, result
, bytesDecoded
, env
),
218 IA5String
*result _AND_
219 AsnLen
*bytesDecoded _AND_
225 if (((tag
= BDecTag (b
, bytesDecoded
, env
)) !=
226 MAKE_TAG_ID (UNIV
, PRIM
, IA5STRING_TAG_CODE
))&&
227 (tag
!= MAKE_TAG_ID (UNIV
, CONS
, IA5STRING_TAG_CODE
)))
229 Asn1Error ("BDecIA5String: ERROR - wrong tag\n");
232 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
233 BDecIA5StringContent (b
, tag
, elmtLen1
, result
, bytesDecoded
, env
);
234 } /* BDecIA5String */
236 AsnLen BEncGraphicString
PARAMS ((b
, v
),
241 l
= BEncGraphicStringContent (b
, v
);
242 l
+= BEncDefLen (b
, l
);
243 l
+= BEncTag1 (b
, UNIV
, PRIM
, GRAPHICSTRING_TAG_CODE
);
245 } /* BEncGraphicString */
247 void BDecGraphicString
PARAMS ((b
, result
, bytesDecoded
, env
),
249 GraphicString
*result _AND_
250 AsnLen
*bytesDecoded _AND_
256 if (((tag
= BDecTag (b
, bytesDecoded
, env
)) !=
257 MAKE_TAG_ID (UNIV
, PRIM
, GRAPHICSTRING_TAG_CODE
))&&
258 (tag
!= MAKE_TAG_ID (UNIV
, CONS
, GRAPHICSTRING_TAG_CODE
)))
260 Asn1Error ("BDecGraphicString: ERROR - wrong tag\n");
263 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
264 BDecGraphicStringContent (b
, tag
, elmtLen1
, result
, bytesDecoded
, env
);
265 } /* BDecGraphicString */
267 AsnLen BEncVisibleString
PARAMS ((b
, v
),
272 l
= BEncVisibleStringContent (b
, v
);
273 l
+= BEncDefLen (b
, l
);
274 l
+= BEncTag1 (b
, UNIV
, PRIM
, VISIBLESTRING_TAG_CODE
);
276 } /* BEncVisibleString */
278 void BDecVisibleString
PARAMS ((b
, result
, bytesDecoded
, env
),
280 VisibleString
*result _AND_
281 AsnLen
*bytesDecoded _AND_
287 if (((tag
= BDecTag (b
, bytesDecoded
, env
)) !=
288 MAKE_TAG_ID (UNIV
, PRIM
, VISIBLESTRING_TAG_CODE
))&&
289 (tag
!= MAKE_TAG_ID (UNIV
, CONS
, VISIBLESTRING_TAG_CODE
)))
291 Asn1Error ("BDecVisibleString: ERROR - wrong tag\n");
294 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
295 BDecVisibleStringContent (b
, tag
, elmtLen1
, result
, bytesDecoded
, env
);
296 } /* BDecVisibleString */
298 AsnLen BEncISO646String
PARAMS ((b
, v
),
303 l
= BEncISO646StringContent (b
, v
);
304 l
+= BEncDefLen (b
, l
);
305 l
+= BEncTag1 (b
, UNIV
, PRIM
, VISIBLESTRING_TAG_CODE
);
307 } /* BEncISO646String */
309 void BDecISO646String
PARAMS ((b
, result
, bytesDecoded
, env
),
311 ISO646String
*result _AND_
312 AsnLen
*bytesDecoded _AND_
318 if (((tag
= BDecTag (b
, bytesDecoded
, env
)) !=
319 MAKE_TAG_ID (UNIV
, PRIM
, VISIBLESTRING_TAG_CODE
))&&
320 (tag
!= MAKE_TAG_ID (UNIV
, CONS
, VISIBLESTRING_TAG_CODE
)))
322 Asn1Error ("BDecISO646String: ERROR - wrong tag\n");
325 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
326 BDecISO646StringContent (b
, tag
, elmtLen1
, result
, bytesDecoded
, env
);
327 } /* BDecISO646String */
329 AsnLen BEncGeneralString
PARAMS ((b
, v
),
334 l
= BEncGeneralStringContent (b
, v
);
335 l
+= BEncDefLen (b
, l
);
336 l
+= BEncTag1 (b
, UNIV
, PRIM
, GENERALSTRING_TAG_CODE
);
338 } /* BEncGeneralString */
340 void BDecGeneralString
PARAMS ((b
, result
, bytesDecoded
, env
),
342 GeneralString
*result _AND_
343 AsnLen
*bytesDecoded _AND_
349 if (((tag
= BDecTag (b
, bytesDecoded
, env
)) !=
350 MAKE_TAG_ID (UNIV
, PRIM
, GENERALSTRING_TAG_CODE
))&&
351 (tag
!= MAKE_TAG_ID (UNIV
, CONS
, GENERALSTRING_TAG_CODE
)))
353 Asn1Error ("BDecGeneralString: ERROR - wrong tag\n");
356 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
357 BDecGeneralStringContent (b
, tag
, elmtLen1
, result
, bytesDecoded
, env
);
358 } /* BDecGeneralString */
360 AsnLen BEncUTCTime
PARAMS ((b
, v
),
365 l
= BEncUTCTimeContent (b
, v
);
366 l
+= BEncDefLen (b
, l
);
367 l
+= BEncTag1 (b
, UNIV
, PRIM
, UTCTIME_TAG_CODE
);
371 void BDecUTCTime
PARAMS ((b
, result
, bytesDecoded
, env
),
373 UTCTime
*result _AND_
374 AsnLen
*bytesDecoded _AND_
380 if (((tag
= BDecTag (b
, bytesDecoded
, env
)) !=
381 MAKE_TAG_ID (UNIV
, PRIM
, UTCTIME_TAG_CODE
))&&
382 (tag
!= MAKE_TAG_ID (UNIV
, CONS
, UTCTIME_TAG_CODE
)))
384 Asn1Error ("BDecUTCTime: ERROR - wrong tag\n");
387 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
388 BDecUTCTimeContent (b
, tag
, elmtLen1
, result
, bytesDecoded
, env
);
391 AsnLen BEncGeneralizedTime
PARAMS ((b
, v
),
396 l
= BEncGeneralizedTimeContent (b
, v
);
397 l
+= BEncDefLen (b
, l
);
398 l
+= BEncTag1 (b
, UNIV
, PRIM
, GENERALIZEDTIME_TAG_CODE
);
400 } /* BEncGeneralizedTime */
402 void BDecGeneralizedTime
PARAMS ((b
, result
, bytesDecoded
, env
),
404 GeneralizedTime
*result _AND_
405 AsnLen
*bytesDecoded _AND_
411 if (((tag
= BDecTag (b
, bytesDecoded
, env
)) !=
412 MAKE_TAG_ID (UNIV
, PRIM
, GENERALIZEDTIME_TAG_CODE
))&&
413 (tag
!= MAKE_TAG_ID (UNIV
, CONS
, GENERALIZEDTIME_TAG_CODE
)))
415 Asn1Error ("BDecGeneralizedTime: ERROR - wrong tag\n");
418 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
419 BDecGeneralizedTimeContent (b
, tag
, elmtLen1
, result
, bytesDecoded
, env
);
420 } /* BDecGeneralizedTime */
422 AsnLen BEncUniversalString
PARAMS ((b
, v
),
427 l
= BEncUniversalStringContent (b
, v
);
428 l
+= BEncDefLen (b
, l
);
429 l
+= BEncTag1 (b
, UNIV
, PRIM
, UNIVERSALSTRING_TAG_CODE
);
431 } /* BEncUniversalString */
433 void BDecUniversalString
PARAMS ((b
, result
, bytesDecoded
, env
),
435 UniversalString
*result _AND_
436 AsnLen
*bytesDecoded _AND_
442 if (((tag
= BDecTag (b
, bytesDecoded
, env
)) !=
443 MAKE_TAG_ID (UNIV
, PRIM
, UNIVERSALSTRING_TAG_CODE
))&&
444 (tag
!= MAKE_TAG_ID (UNIV
, CONS
, UNIVERSALSTRING_TAG_CODE
)))
446 Asn1Error ("BDecUniversalString: ERROR - wrong tag\n");
449 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
450 BDecUniversalStringContent (b
, tag
, elmtLen1
, result
, bytesDecoded
, env
);
451 } /* BDecUniversalString */
453 AsnLen BEncBMPString
PARAMS ((b
, v
),
458 l
= BEncBMPStringContent (b
, v
);
459 l
+= BEncDefLen (b
, l
);
460 l
+= BEncTag1 (b
, UNIV
, PRIM
, BMPSTRING_TAG_CODE
);
462 } /* BEncBMPString */
464 void BDecBMPString
PARAMS ((b
, result
, bytesDecoded
, env
),
466 BMPString
*result _AND_
467 AsnLen
*bytesDecoded _AND_
473 if (((tag
= BDecTag (b
, bytesDecoded
, env
)) !=
474 MAKE_TAG_ID (UNIV
, PRIM
, BMPSTRING_TAG_CODE
))&&
475 (tag
!= MAKE_TAG_ID (UNIV
, CONS
, BMPSTRING_TAG_CODE
)))
477 Asn1Error ("BDecBMPString: ERROR - wrong tag\n");
480 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
481 BDecBMPStringContent (b
, tag
, elmtLen1
, result
, bytesDecoded
, env
);
482 } /* BDecBMPString */
485 BEncEXTERNALChoiceContent
PARAMS ((b
, v
),
496 case EXTERNALCHOICE_SINGLE_ASN1_TYPE
:
498 itemLen
= BEncAsnOctsContent (b
, (v
->a
.single_ASN1_type
));
499 itemLen
+= BEncDefLen (b
, itemLen
);
500 itemLen
+= BEncTag1 (b
, UNIV
, PRIM
, 4);
501 itemLen
+= BEncConsLen (b
, itemLen
);
502 itemLen
+= BEncTag1 (b
, CNTX
, CONS
, 0);
508 case EXTERNALCHOICE_OCTET_ALIGNED
:
509 itemLen
= BEncAsnOctsContent (b
, (v
->a
.octet_aligned
));
510 itemLen
+= BEncDefLen (b
, itemLen
);
511 itemLen
+= BEncTag1 (b
, CNTX
, PRIM
, 1);
517 case EXTERNALCHOICE_ARBITRARY
:
518 itemLen
= BEncAsnBitsContent (b
, (v
->a
.arbitrary
));
519 itemLen
+= BEncDefLen (b
, itemLen
);
520 itemLen
+= BEncTag1 (b
, CNTX
, PRIM
, 2);
529 } /* BEncEXTERNALChoiceContent */
532 BDecEXTERNALChoiceContent
PARAMS ((b
, tagId0
, elmtLen0
, v
, bytesDecoded
, env
),
535 AsnLen elmtLen0 _AND_
536 EXTERNALChoice
*v _AND_
537 AsnLen
*bytesDecoded _AND_
541 AsnLen totalElmtsLen1
= 0;
544 int mandatoryElmtCount1
= 0;
545 AsnLen totalElmtsLen2
= 0;
552 case MAKE_TAG_ID (CNTX
, CONS
, 0):
553 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
554 if ((tagId1
!= MAKE_TAG_ID (UNIV
, PRIM
, OCTETSTRING_TAG_CODE
)) &&
555 (tagId1
!= MAKE_TAG_ID (UNIV
, CONS
, OCTETSTRING_TAG_CODE
)))
557 Asn1Error ("Unexpected Tag\n");
561 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
562 (v
->choiceId
) = EXTERNALCHOICE_SINGLE_ASN1_TYPE
;
563 (v
->a
.single_ASN1_type
) = (AsnOcts
*) Asn1Alloc (sizeof (AsnOcts
));
564 CheckAsn1Alloc ((v
->a
.single_ASN1_type
), env
);
565 BDecAsnOctsContent (b
, tagId1
, elmtLen1
, (v
->a
.single_ASN1_type
), &totalElmtsLen1
, env
);
566 if (elmtLen0
== INDEFINITE_LEN
)
567 BDecEoc (b
, &totalElmtsLen1
, env
);
570 case MAKE_TAG_ID (CNTX
, PRIM
, 1):
571 case MAKE_TAG_ID (CNTX
, CONS
, 1):
572 (v
->choiceId
) = EXTERNALCHOICE_OCTET_ALIGNED
;
573 (v
->a
.octet_aligned
) = (AsnOcts
*) Asn1Alloc (sizeof (AsnOcts
));
574 CheckAsn1Alloc ((v
->a
.octet_aligned
), env
);
575 BDecAsnOctsContent (b
, tagId0
, elmtLen0
, (v
->a
.octet_aligned
), &totalElmtsLen1
, env
);
578 case MAKE_TAG_ID (CNTX
, PRIM
, 2):
579 case MAKE_TAG_ID (CNTX
, CONS
, 2):
580 (v
->choiceId
) = EXTERNALCHOICE_ARBITRARY
;
581 (v
->a
.arbitrary
) = (AsnBits
*) Asn1Alloc (sizeof (AsnBits
));
582 CheckAsn1Alloc ((v
->a
.arbitrary
), env
);
583 BDecAsnBitsContent (b
, tagId0
, elmtLen0
, (v
->a
.arbitrary
), &totalElmtsLen1
, env
);
587 Asn1Error ("ERROR - unexpected tag in CHOICE\n");
591 (*bytesDecoded
) += totalElmtsLen1
;
592 } /* BDecEXTERNALChoiceContent */
595 PrintEXTERNALChoice
PARAMS ((f
, v
, indent
),
597 EXTERNALChoice
*v _AND_
598 unsigned short int indent
)
602 case EXTERNALCHOICE_SINGLE_ASN1_TYPE
:
603 fprintf (f
,"single-ASN1-type ");
604 PrintAsnOcts (f
, (v
->a
.single_ASN1_type
), indent
+ stdIndentG
);
607 case EXTERNALCHOICE_OCTET_ALIGNED
:
608 fprintf (f
,"octet-aligned ");
609 PrintAsnOcts (f
, (v
->a
.octet_aligned
), indent
+ stdIndentG
);
612 case EXTERNALCHOICE_ARBITRARY
:
613 fprintf (f
,"arbitrary ");
614 PrintAsnBits (f
, (v
->a
.arbitrary
), indent
+ stdIndentG
);
618 } /* PrintEXTERNALChoice */
621 FreeEXTERNALChoice
PARAMS ((v
),
629 case EXTERNALCHOICE_SINGLE_ASN1_TYPE
:
630 FreeAsnOcts ((v
->a
.single_ASN1_type
));
631 Asn1Free ((v
->a
.single_ASN1_type
));
635 case EXTERNALCHOICE_OCTET_ALIGNED
:
636 FreeAsnOcts ((v
->a
.octet_aligned
));
637 Asn1Free ((v
->a
.octet_aligned
));
641 case EXTERNALCHOICE_ARBITRARY
:
642 FreeAsnBits ((v
->a
.arbitrary
));
643 Asn1Free ((v
->a
.arbitrary
));
648 } /* FreeEXTERNALChoice */
653 AsnLen BEncEXTERNAL
PARAMS ((b
, v
),
659 l
= BEncEXTERNALContent (b
, v
);
660 l
+= BEncConsLen (b
, l
);
661 l
+= BEncTag1 (b
, UNIV
, CONS
, EXTERNAL_TAG_CODE
);
665 void BDecEXTERNAL
PARAMS ((b
, result
, bytesDecoded
, env
),
667 EXTERNAL
*result _AND_
668 AsnLen
*bytesDecoded _AND_
674 if (((tag
= BDecTag (b
, bytesDecoded
, env
)) !=
675 MAKE_TAG_ID (UNIV
, CONS
, EXTERNAL_TAG_CODE
)))
677 Asn1Error ("BDecEXTERNAL: ERROR - wrong tag\n");
680 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
681 BDecEXTERNALContent (b
, tag
, elmtLen1
, result
, bytesDecoded
, env
);
685 BEncEXTERNALContent
PARAMS ((b
, v
),
694 itemLen
= BEncEXTERNALChoiceContent (b
, (v
->encoding
));
698 if (ASNOCTS_PRESENT ((&v
->data_value_descriptor
)))
700 itemLen
= BEncObjectDescriptorContent (b
, (&v
->data_value_descriptor
));
701 itemLen
+= BEncDefLen (b
, itemLen
);
702 itemLen
+= BEncTag1 (b
, UNIV
, PRIM
, 7);
707 if (NOT_NULL ((v
->indirect_reference
)))
709 itemLen
= BEncAsnIntContent (b
, (v
->indirect_reference
));
710 BEncDefLenTo127 (b
, itemLen
);
712 itemLen
+= BEncTag1 (b
, UNIV
, PRIM
, 2);
717 if (ASNOID_PRESENT ((&v
->direct_reference
)))
719 itemLen
= BEncAsnOidContent (b
, (&v
->direct_reference
));
720 itemLen
+= BEncDefLen (b
, itemLen
);
721 itemLen
+= BEncTag1 (b
, UNIV
, PRIM
, 6);
728 } /* BEncEXTERNALContent */
731 BDecEXTERNALContent
PARAMS ((b
, tagId0
, elmtLen0
, v
, bytesDecoded
, env
),
734 AsnLen elmtLen0 _AND_
736 AsnLen
*bytesDecoded _AND_
740 AsnLen totalElmtsLen1
= 0;
743 int mandatoryElmtCount1
= 0;
744 AsnLen totalElmtsLen2
= 0;
749 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
751 if (((tagId1
== MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
))))
753 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
754 BDecAsnOidContent (b
, tagId1
, elmtLen1
, (&v
->direct_reference
), &totalElmtsLen1
, env
);
755 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
759 if (((tagId1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
))))
761 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
762 (v
->indirect_reference
) = (AsnInt
*) Asn1Alloc (sizeof (AsnInt
));
763 CheckAsn1Alloc ((v
->indirect_reference
), env
);
764 BDecAsnIntContent (b
, tagId1
, elmtLen1
, (v
->indirect_reference
), &totalElmtsLen1
, env
);
765 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
769 if (((tagId1
== MAKE_TAG_ID (UNIV
, PRIM
, OD_TAG_CODE
)) ||
770 (tagId1
== MAKE_TAG_ID (UNIV
, CONS
, OD_TAG_CODE
))))
772 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
773 BDecObjectDescriptorContent (b
, tagId1
, elmtLen1
, (&v
->data_value_descriptor
), &totalElmtsLen1
, env
);
774 tagId1
= BDecTag (b
, &totalElmtsLen1
, env
);
778 if (((tagId1
== MAKE_TAG_ID (CNTX
, CONS
, 0)) ||
779 (tagId1
== MAKE_TAG_ID (CNTX
, PRIM
, 1))||
780 (tagId1
== MAKE_TAG_ID (CNTX
, CONS
, 1)) ||
781 (tagId1
== MAKE_TAG_ID (CNTX
, PRIM
, 2))||
782 (tagId1
== MAKE_TAG_ID (CNTX
, CONS
, 2))))
784 elmtLen1
= BDecLen (b
, &totalElmtsLen1
, env
);
785 (v
->encoding
) = (EXTERNALChoice
*) Asn1Alloc (sizeof (EXTERNALChoice
));
786 CheckAsn1Alloc ((v
->encoding
), env
);
787 BDecEXTERNALChoiceContent (b
, tagId1
, elmtLen1
, (v
->encoding
), &totalElmtsLen1
, env
);
789 if (elmtLen0
== INDEFINITE_LEN
)
790 BDecEoc (b
, &totalElmtsLen1
, env
);
791 else if (totalElmtsLen1
!= elmtLen0
)
801 (*bytesDecoded
) += totalElmtsLen1
;
802 } /* BDecEXTERNALContent */
805 PrintEXTERNAL
PARAMS ((f
, v
, indent
),
808 unsigned short int indent
)
813 fprintf (f
,"{ -- SEQUENCE --\n");
815 if (ASNOID_PRESENT ((&v
->direct_reference
)))
817 Indent (f
, indent
+ stdIndentG
);
818 fprintf (f
,"direct-reference ");
819 PrintAsnOid (f
, (&v
->direct_reference
), indent
+ stdIndentG
);
822 if (NOT_NULL ((v
->indirect_reference
)))
824 Indent (f
, indent
+ stdIndentG
);
825 fprintf (f
,"indirect-reference ");
826 PrintAsnInt (f
, (v
->indirect_reference
), indent
+ stdIndentG
);
829 if (ASNOCTS_PRESENT ((&v
->data_value_descriptor
)))
831 Indent (f
, indent
+ stdIndentG
);
832 fprintf (f
,"data-value-descriptor ");
833 PrintObjectDescriptor (f
, (&v
->data_value_descriptor
), indent
+ stdIndentG
);
836 Indent (f
, indent
+ stdIndentG
);
837 fprintf (f
,"encoding ");
838 PrintEXTERNALChoice (f
, (v
->encoding
), indent
+ stdIndentG
);
842 } /* PrintEXTERNAL */
845 FreeEXTERNAL
PARAMS ((v
),
851 if (ASNOID_PRESENT ((&v
->direct_reference
)))
853 FreeAsnOid ((&v
->direct_reference
));
856 if (NOT_NULL ((v
->indirect_reference
)))
858 FreeAsnInt ((v
->indirect_reference
));
859 Asn1Free ((v
->indirect_reference
));
862 if (ASNOCTS_PRESENT ((&v
->data_value_descriptor
)))
864 FreeObjectDescriptor ((&v
->data_value_descriptor
));
867 FreeEXTERNALChoice ((v
->encoding
));
868 Asn1Free ((v
->encoding
));