1 // NOTE: this is a machine generated file--editing not recommended
3 // sm_x509ce.cpp - class member functions for ASN.1 module CertificateExtensions
5 // This file was generated by snacc on Wed Jun 27 16:40:55 2001
6 // UBC snacc written by Mike Sample
7 // A couple of enhancements made by IBM European Networking Center
11 #include "sm_vdatypes.h"
12 #include "sm_x501ud.h"
13 #include "sm_x411ub.h"
14 #include "sm_x411mtsas.h"
15 #include "sm_x501if.h"
16 #include "sm_x520sa.h"
17 #include "sm_x509cmn.h"
18 #include "sm_x509af.h"
19 #include "sm_x509ce.h"
20 #include "pkcs1oids.h"
21 #include "pkcs9oids.h"
26 #include "appleoids.h"
28 //------------------------------------------------------------------------------
32 //------------------------------------------------------------------------------
33 // class member definitions:
35 PolicyQualifierInfo::PolicyQualifierInfo()
40 PolicyQualifierInfo::PolicyQualifierInfo (const PolicyQualifierInfo
&)
42 Asn1Error
<< "use of incompletely defined PolicyQualifierInfo::PolicyQualifierInfo (const PolicyQualifierInfo &)" << endl
;
46 PolicyQualifierInfo::~PolicyQualifierInfo()
51 AsnType
*PolicyQualifierInfo::Clone() const
53 return new PolicyQualifierInfo
;
56 AsnType
*PolicyQualifierInfo::Copy() const
58 return new PolicyQualifierInfo (*this);
62 PolicyQualifierInfo
&PolicyQualifierInfo::operator = (const PolicyQualifierInfo
&that
)
63 #else // SNACC_DEEP_COPY
64 PolicyQualifierInfo
&PolicyQualifierInfo::operator = (const PolicyQualifierInfo
&)
65 #endif // SNACC_DEEP_COPY
70 policyQualifierId
= that
.policyQualifierId
;
74 qualifier
= new AsnAny
;
75 *qualifier
= *that
.qualifier
;
85 #else // SNACC_DEEP_COPY
86 Asn1Error
<< "use of incompletely defined PolicyQualifierInfo &PolicyQualifierInfo::operator = (const PolicyQualifierInfo &)" << endl
;
88 // if your compiler complains here, check the -novolat option
89 #endif // SNACC_DEEP_COPY
93 PolicyQualifierInfo::BEncContent (BUF_TYPE b
)
98 if (NOT_NULL (qualifier
))
100 ENC_LOAD_ANYBUF(qualifier
, b
, l
);
104 l
= policyQualifierId
.BEncContent (b
);
105 l
+= BEncDefLen (b
, l
);
107 l
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
111 } // PolicyQualifierInfo::BEncContent
114 void PolicyQualifierInfo::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
117 AsnLen seqBytesDecoded
= 0;
119 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
121 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
123 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
124 policyQualifierId
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
125 if (seqBytesDecoded
== elmtLen0
)
127 bytesDecoded
+= seqBytesDecoded
;
134 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
136 BDecEoc (b
, seqBytesDecoded
, env
);
138 bytesDecoded
+= seqBytesDecoded
;
145 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
150 qualifier
= new AsnAny
;
151 DEC_LOAD_ANYBUF(qualifier
, b
, seqBytesDecoded
, env
);
154 bytesDecoded
+= seqBytesDecoded
;
155 if (elmtLen0
== INDEFINITE_LEN
)
157 BDecEoc (b
, bytesDecoded
, env
);
160 else if (seqBytesDecoded
!= elmtLen0
)
162 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
167 } // PolicyQualifierInfo::BDecContent
169 AsnLen
PolicyQualifierInfo::BEnc (BUF_TYPE b
)
173 l
+= BEncConsLen (b
, l
);
174 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
178 void PolicyQualifierInfo::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
183 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
185 Asn1Error
<< "PolicyQualifierInfo::BDec: ERROR - wrong tag" << endl
;
188 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
189 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
192 int PolicyQualifierInfo::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
194 bytesEncoded
= BEnc (b
);
195 return !b
.WriteError();
198 int PolicyQualifierInfo::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
204 if ((val
= setjmp (env
)) == 0)
206 BDec (b
, bytesDecoded
, env
);
207 return !b
.ReadError();
213 void PolicyQualifierInfo::Print (ostream
&os
) const
216 os
<< "{ -- SEQUENCE --" << endl
;
217 indentG
+= stdIndentG
;
220 Indent (os
, indentG
);
221 os
<< "policyQualifierId ";
222 os
<< policyQualifierId
;
226 if (NOT_NULL (qualifier
))
229 Indent (os
, indentG
);
235 Indent (os
, indentG
);
242 indentG
-= stdIndentG
;
243 Indent (os
, indentG
);
246 } // PolicyQualifierInfo::Print
249 AsnType
*AttributesSyntax::Clone() const
251 return new AttributesSyntax
;
254 AsnType
*AttributesSyntax::Copy() const
256 return new AttributesSyntax (*this);
259 AsnLen
AttributesSyntax::BEnc (BUF_TYPE b
)
263 l
+= BEncConsLen (b
, l
);
264 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
268 void AttributesSyntax::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
273 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
275 Asn1Error
<< "AttributesSyntax::BDec: ERROR - wrong tag" << endl
;
278 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
279 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
282 AttributesSyntax::AttributesSyntax (const AttributesSyntax
&)
284 Asn1Error
<< "use of incompletely defined AttributesSyntax::AttributesSyntax (const AttributesSyntax &)" << endl
;
288 AttributesSyntax::~AttributesSyntax()
291 for (; Curr() != NULL
; RemoveCurrFromList())
293 } // end of destructor
296 AttributesSyntax
&AttributesSyntax::operator = (const AttributesSyntax
&that
)
297 #else // SNACC_DEEP_COPY
298 AttributesSyntax
&AttributesSyntax::operator = (const AttributesSyntax
&)
299 #endif // SNACC_DEEP_COPY
305 for (; Curr(); RemoveCurrFromList())
308 //that.SetCurrToFirst();
309 //for (; that.Curr(); that.GoNext())
310 // AppendCopy (*that.Curr());
311 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
312 AppendCopy (*run
->elmt
);
316 #else // SNACC_DEEP_COPY
317 Asn1Error
<< "use of incompletely defined AttributesSyntax &AttributesSyntax::operator = (const AttributesSyntax &)" << endl
;
319 // if your compiler complains here, check the -novolat option
320 #endif // SNACC_DEEP_COPY
323 void AttributesSyntax::Print (ostream
&os
) const
326 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
327 indentG
+= stdIndentG
;
329 //for (; Curr() != NULL; GoNext())
330 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
332 Indent (os
, indentG
);
335 //if (Curr() != Last())
340 indentG
-= stdIndentG
;
341 Indent (os
, indentG
);
349 void AttributesSyntax::SetCurrElmt (unsigned long int index
)
354 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
356 } // AttributesSyntax::SetCurrElmt
359 unsigned long int AttributesSyntax::GetCurrElmtIndex()
365 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
374 } // AttributesSyntax::GetCurrElmtIndex
377 // alloc new list elmt, put at end of list
378 // and return the component type
379 Attribute
*AttributesSyntax::Append()
381 AsnListElmt
*newElmt
;
382 newElmt
= new AsnListElmt
;
383 newElmt
->elmt
= new Attribute
;
384 newElmt
->next
= NULL
;
387 newElmt
->prev
= NULL
;
388 first
= last
= newElmt
;
392 newElmt
->prev
= last
;
393 last
->next
= newElmt
;
397 return (curr
= newElmt
)->elmt
;
398 } // AttributesSyntax::Append
401 // alloc new list elmt, put at begining of list
402 // and return the component type
403 Attribute
*AttributesSyntax::Prepend()
405 AsnListElmt
*newElmt
;
406 newElmt
= new AsnListElmt
;
407 newElmt
->elmt
= new Attribute
;
408 newElmt
->prev
= NULL
;
411 newElmt
->next
= NULL
;
412 first
= last
= newElmt
;
416 newElmt
->next
= first
;
417 first
->prev
= newElmt
;
421 return (curr
= newElmt
)->elmt
;
422 } // AttributesSyntax::Prepend
425 // alloc new list elmt, insert it before the
426 // current element and return the component type
427 // if the current element is null, the new element
428 // is placed at the beginning of the list.
429 Attribute
*AttributesSyntax::InsertBefore()
431 AsnListElmt
*newElmt
;
432 newElmt
= new AsnListElmt
;
433 newElmt
->elmt
= new Attribute
;
436 newElmt
->next
= first
;
437 newElmt
->prev
= NULL
;
444 newElmt
->next
= curr
;
445 newElmt
->prev
= curr
->prev
;
446 curr
->prev
= newElmt
;
450 newElmt
->prev
->next
= newElmt
;
453 return (curr
= newElmt
)->elmt
;
454 } // AttributesSyntax::InsertBefore
457 // alloc new list elmt, insert it after the
458 // current element and return the component type
459 // if the current element is null, the new element
460 // is placed at the end of the list.
461 Attribute
*AttributesSyntax::InsertAfter()
463 AsnListElmt
*newElmt
;
464 newElmt
= new AsnListElmt
;
465 newElmt
->elmt
= new Attribute
;
468 newElmt
->prev
= last
;
469 newElmt
->next
= NULL
;
476 newElmt
->prev
= curr
;
477 newElmt
->next
= curr
->next
;
478 curr
->next
= newElmt
;
482 newElmt
->next
->prev
= newElmt
;
485 return (curr
= newElmt
)->elmt
;
486 } // AttributesSyntax::InsertAfter
489 AttributesSyntax
&AttributesSyntax::AppendCopy (Attribute
&elmt
)
491 AsnListElmt
*newElmt
;
492 newElmt
= new AsnListElmt
;
493 newElmt
->elmt
= new Attribute
;
494 *newElmt
->elmt
= elmt
;
495 newElmt
->next
= NULL
;
498 newElmt
->prev
= NULL
;
499 first
= last
= newElmt
;
503 newElmt
->prev
= last
;
504 last
->next
= newElmt
;
512 AttributesSyntax
&AttributesSyntax::PrependCopy (Attribute
&elmt
)
514 AsnListElmt
*newElmt
;
515 newElmt
= new AsnListElmt
;
516 newElmt
->elmt
= new Attribute
;
517 *newElmt
->elmt
= elmt
;
518 newElmt
->prev
= NULL
;
521 newElmt
->next
= NULL
;
522 first
= last
= newElmt
;
526 newElmt
->next
= first
;
527 first
->prev
= newElmt
;
532 } // AttributesSyntax::PrependCopy
535 // alloc new list elmt, insert it before the
536 // current element, copy the given elmt into the new elmt
537 // and return the component type.
538 // if the current element is null, the new element
539 // is placed at the beginning of the list.
540 AttributesSyntax
&AttributesSyntax::InsertBeforeAndCopy (Attribute
&elmt
)
542 AsnListElmt
*newElmt
;
544 newElmt
= new AsnListElmt
;
545 newElmt
->elmt
= new Attribute
;
546 *newElmt
->elmt
= elmt
;
550 newElmt
->next
= first
;
551 newElmt
->prev
= NULL
;
558 newElmt
->next
= curr
;
559 newElmt
->prev
= curr
->prev
;
560 curr
->prev
= newElmt
;
564 newElmt
->prev
->next
= newElmt
;
568 } // AttributesSyntax::InsertBeforeAndCopy
571 // alloc new list elmt, insert it after the
572 // current element, copy given elmt in to new elmt
573 // and return the component type
574 // if the current element is null, the new element
575 // is placed at the end of the list.
576 AttributesSyntax
&AttributesSyntax::InsertAfterAndCopy (Attribute
&elmt
)
578 AsnListElmt
*newElmt
;
580 newElmt
= new AsnListElmt
;
581 newElmt
->elmt
= new Attribute
;
582 *newElmt
->elmt
= elmt
;
585 newElmt
->prev
= last
;
586 newElmt
->next
= NULL
;
593 newElmt
->prev
= curr
;
594 newElmt
->next
= curr
->next
;
595 curr
->next
= newElmt
;
599 newElmt
->next
->prev
= newElmt
;
603 } // AttributesSyntax::InsertAfterAndCopy
606 // remove current element from list if current element is not NULL
607 // The new current element will be the next element.
608 // If the current element is the last element in the list
609 // the second but last element will become the new current element.
610 void AttributesSyntax::RemoveCurrFromList()
612 AsnListElmt
*del_elmt
;
620 first
= last
= curr
= NULL
;
621 else if (curr
== first
)
623 curr
= first
= first
->next
;
626 else if (curr
== last
)
628 curr
= last
= last
->prev
;
633 curr
->prev
->next
= curr
->next
;
634 curr
->next
->prev
= curr
->prev
;
637 delete del_elmt
->elmt
;
643 AsnLen
AttributesSyntax::BEncContent (BUF_TYPE b
)
645 AsnListElmt
*currElmt
;
648 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
651 elmtLen
= currElmt
->elmt
->BEncContent (b
);
652 elmtLen
+= BEncConsLen (b
, elmtLen
);
654 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
658 } // AttributesSyntax::BEncContent
661 void AttributesSyntax::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
662 AsnLen
&bytesDecoded
, ENV_TYPE env
)
666 AsnLen listBytesDecoded
= 0;
669 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
671 tag1
= BDecTag (b
, listBytesDecoded
, env
);
672 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
674 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
677 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
679 Asn1Error
<< "Unexpected Tag" << endl
;
683 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
685 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
688 bytesDecoded
+= listBytesDecoded
;
689 } // AttributesSyntax::BDecContent
692 DistributionPointName::DistributionPointName()
694 choiceId
= fullNameCid
;
696 fullName
= new GeneralNames
;
698 fullName
= NULL
; // incomplete initialization of mandatory element!
702 DistributionPointName::DistributionPointName (const DistributionPointName
&)
704 Asn1Error
<< "use of incompletely defined DistributionPointName::DistributionPointName (const DistributionPointName &)" << endl
;
708 DistributionPointName::~DistributionPointName()
715 case nameRelativeToCRLIssuerCid
:
716 delete nameRelativeToCRLIssuer
;
719 } // end of destructor
721 AsnType
*DistributionPointName::Clone() const
723 return new DistributionPointName
;
726 AsnType
*DistributionPointName::Copy() const
728 return new DistributionPointName (*this);
732 DistributionPointName
&DistributionPointName::operator = (const DistributionPointName
&that
)
733 #else // SNACC_DEEP_COPY
734 DistributionPointName
&DistributionPointName::operator = (const DistributionPointName
&)
735 #endif // SNACC_DEEP_COPY
745 case nameRelativeToCRLIssuerCid
:
746 delete nameRelativeToCRLIssuer
;
749 switch (choiceId
= that
.choiceId
)
752 fullName
= new GeneralNames
;
753 *fullName
= *that
.fullName
;
755 case nameRelativeToCRLIssuerCid
:
756 nameRelativeToCRLIssuer
= new RelativeDistinguishedName
;
757 *nameRelativeToCRLIssuer
= *that
.nameRelativeToCRLIssuer
;
763 #else // SNACC_DEEP_COPY
764 Asn1Error
<< "use of incompletely defined DistributionPointName &DistributionPointName::operator = (const DistributionPointName &)" << endl
;
766 // if your compiler complains here, check the -novolat option
767 #endif // SNACC_DEEP_COPY
771 DistributionPointName::BEncContent (BUF_TYPE b
)
778 l
= fullName
->BEncContent (b
);
779 l
+= BEncConsLen (b
, l
);
781 l
+= BEncTag1 (b
, CNTX
, CONS
, 0);
784 case nameRelativeToCRLIssuerCid
:
786 l
= nameRelativeToCRLIssuer
->BEncContent (b
);
787 l
+= BEncConsLen (b
, l
);
789 l
+= BEncTag1 (b
, CNTX
, CONS
, 1);
794 } // DistributionPointName::BEncContent
797 void DistributionPointName::BDecContent (BUF_TYPE b
, AsnTag tag
, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
801 case MAKE_TAG_ID (CNTX
, CONS
, 0):
802 choiceId
= fullNameCid
;
803 fullName
= new GeneralNames
;
804 fullName
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
807 case MAKE_TAG_ID (CNTX
, CONS
, 1):
808 choiceId
= nameRelativeToCRLIssuerCid
;
809 nameRelativeToCRLIssuer
= new RelativeDistinguishedName
;
810 nameRelativeToCRLIssuer
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
814 Asn1Error
<< "ERROR - unexpected tag in CHOICE" << endl
;
818 } // DistributionPointName::BDecContent
821 AsnLen
DistributionPointName::BEnc (BUF_TYPE b
)
828 void DistributionPointName::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
833 /* CHOICEs are a special case - grab identifying tag */
834 /* this allows easier handling of nested CHOICEs */
835 tag
= BDecTag (b
, bytesDecoded
, env
);
836 elmtLen
= BDecLen (b
, bytesDecoded
, env
);
837 BDecContent (b
, tag
, elmtLen
, bytesDecoded
, env
);
840 int DistributionPointName::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
842 bytesEncoded
= BEnc (b
);
843 return !b
.WriteError();
846 int DistributionPointName::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
852 if ((val
= setjmp (env
)) == 0)
854 BDec (b
, bytesDecoded
, env
);
855 return !b
.ReadError();
861 void DistributionPointName::Print (ostream
&os
) const
871 os
<< "-- void3 --\n";
874 case nameRelativeToCRLIssuerCid
:
875 os
<< "nameRelativeToCRLIssuer ";
876 if (nameRelativeToCRLIssuer
)
877 os
<< *nameRelativeToCRLIssuer
;
879 os
<< "-- void3 --\n";
884 } // DistributionPointName::Print
886 PolicyMappingsSyntaxSeq::PolicyMappingsSyntaxSeq()
890 PolicyMappingsSyntaxSeq::PolicyMappingsSyntaxSeq (const PolicyMappingsSyntaxSeq
&)
892 Asn1Error
<< "use of incompletely defined PolicyMappingsSyntaxSeq::PolicyMappingsSyntaxSeq (const PolicyMappingsSyntaxSeq &)" << endl
;
896 PolicyMappingsSyntaxSeq::~PolicyMappingsSyntaxSeq()
900 AsnType
*PolicyMappingsSyntaxSeq::Clone() const
902 return new PolicyMappingsSyntaxSeq
;
905 AsnType
*PolicyMappingsSyntaxSeq::Copy() const
907 return new PolicyMappingsSyntaxSeq (*this);
911 PolicyMappingsSyntaxSeq
&PolicyMappingsSyntaxSeq::operator = (const PolicyMappingsSyntaxSeq
&that
)
912 #else // SNACC_DEEP_COPY
913 PolicyMappingsSyntaxSeq
&PolicyMappingsSyntaxSeq::operator = (const PolicyMappingsSyntaxSeq
&)
914 #endif // SNACC_DEEP_COPY
919 issuerDomainPolicy
= that
.issuerDomainPolicy
;
920 subjectDomainPolicy
= that
.subjectDomainPolicy
;
924 #else // SNACC_DEEP_COPY
925 Asn1Error
<< "use of incompletely defined PolicyMappingsSyntaxSeq &PolicyMappingsSyntaxSeq::operator = (const PolicyMappingsSyntaxSeq &)" << endl
;
927 // if your compiler complains here, check the -novolat option
928 #endif // SNACC_DEEP_COPY
932 PolicyMappingsSyntaxSeq::BEncContent (BUF_TYPE b
)
937 l
= subjectDomainPolicy
.BEncContent (b
);
938 l
+= BEncDefLen (b
, l
);
940 l
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
943 l
= issuerDomainPolicy
.BEncContent (b
);
944 l
+= BEncDefLen (b
, l
);
946 l
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
950 } // PolicyMappingsSyntaxSeq::BEncContent
953 void PolicyMappingsSyntaxSeq::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
956 AsnLen seqBytesDecoded
= 0;
958 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
960 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
962 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
963 issuerDomainPolicy
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
964 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
968 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
972 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
974 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
975 subjectDomainPolicy
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
979 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
983 bytesDecoded
+= seqBytesDecoded
;
984 if (elmtLen0
== INDEFINITE_LEN
)
986 BDecEoc (b
, bytesDecoded
, env
);
989 else if (seqBytesDecoded
!= elmtLen0
)
991 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
996 } // PolicyMappingsSyntaxSeq::BDecContent
998 AsnLen
PolicyMappingsSyntaxSeq::BEnc (BUF_TYPE b
)
1001 l
= BEncContent (b
);
1002 l
+= BEncConsLen (b
, l
);
1003 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1007 void PolicyMappingsSyntaxSeq::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1012 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1014 Asn1Error
<< "PolicyMappingsSyntaxSeq::BDec: ERROR - wrong tag" << endl
;
1015 longjmp (env
, -109);
1017 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1018 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1021 int PolicyMappingsSyntaxSeq::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
1023 bytesEncoded
= BEnc (b
);
1024 return !b
.WriteError();
1027 int PolicyMappingsSyntaxSeq::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
1033 if ((val
= setjmp (env
)) == 0)
1035 BDec (b
, bytesDecoded
, env
);
1036 return !b
.ReadError();
1042 void PolicyMappingsSyntaxSeq::Print (ostream
&os
) const
1045 os
<< "{ -- SEQUENCE --" << endl
;
1046 indentG
+= stdIndentG
;
1049 Indent (os
, indentG
);
1050 os
<< "issuerDomainPolicy ";
1051 os
<< issuerDomainPolicy
;
1056 Indent (os
, indentG
);
1057 os
<< "subjectDomainPolicy ";
1058 os
<< subjectDomainPolicy
;
1062 indentG
-= stdIndentG
;
1063 Indent (os
, indentG
);
1066 } // PolicyMappingsSyntaxSeq::Print
1069 AsnType
*PolicyInformationSeqOf::Clone() const
1071 return new PolicyInformationSeqOf
;
1074 AsnType
*PolicyInformationSeqOf::Copy() const
1076 return new PolicyInformationSeqOf (*this);
1079 AsnLen
PolicyInformationSeqOf::BEnc (BUF_TYPE b
)
1082 l
= BEncContent (b
);
1083 l
+= BEncConsLen (b
, l
);
1084 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1088 void PolicyInformationSeqOf::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1093 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1095 Asn1Error
<< "PolicyInformationSeqOf::BDec: ERROR - wrong tag" << endl
;
1096 longjmp (env
, -110);
1098 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1099 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1102 PolicyInformationSeqOf::PolicyInformationSeqOf (const PolicyInformationSeqOf
&)
1104 Asn1Error
<< "use of incompletely defined PolicyInformationSeqOf::PolicyInformationSeqOf (const PolicyInformationSeqOf &)" << endl
;
1108 PolicyInformationSeqOf::~PolicyInformationSeqOf()
1111 for (; Curr() != NULL
; RemoveCurrFromList())
1113 } // end of destructor
1116 PolicyInformationSeqOf
&PolicyInformationSeqOf::operator = (const PolicyInformationSeqOf
&that
)
1117 #else // SNACC_DEEP_COPY
1118 PolicyInformationSeqOf
&PolicyInformationSeqOf::operator = (const PolicyInformationSeqOf
&)
1119 #endif // SNACC_DEEP_COPY
1125 for (; Curr(); RemoveCurrFromList())
1128 //that.SetCurrToFirst();
1129 //for (; that.Curr(); that.GoNext())
1130 // AppendCopy (*that.Curr());
1131 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
1132 AppendCopy (*run
->elmt
);
1136 #else // SNACC_DEEP_COPY
1137 Asn1Error
<< "use of incompletely defined PolicyInformationSeqOf &PolicyInformationSeqOf::operator = (const PolicyInformationSeqOf &)" << endl
;
1139 // if your compiler complains here, check the -novolat option
1140 #endif // SNACC_DEEP_COPY
1143 void PolicyInformationSeqOf::Print (ostream
&os
) const
1146 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
1147 indentG
+= stdIndentG
;
1149 //for (; Curr() != NULL; GoNext())
1150 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
1152 Indent (os
, indentG
);
1155 //if (Curr() != Last())
1160 indentG
-= stdIndentG
;
1161 Indent (os
, indentG
);
1169 void PolicyInformationSeqOf::SetCurrElmt (unsigned long int index
)
1171 unsigned long int i
;
1174 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
1176 } // PolicyInformationSeqOf::SetCurrElmt
1179 unsigned long int PolicyInformationSeqOf::GetCurrElmtIndex()
1181 unsigned long int i
;
1185 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
1194 } // PolicyInformationSeqOf::GetCurrElmtIndex
1197 // alloc new list elmt, put at end of list
1198 // and return the component type
1199 PolicyQualifierInfo
*PolicyInformationSeqOf::Append()
1201 AsnListElmt
*newElmt
;
1202 newElmt
= new AsnListElmt
;
1203 newElmt
->elmt
= new PolicyQualifierInfo
;
1204 newElmt
->next
= NULL
;
1207 newElmt
->prev
= NULL
;
1208 first
= last
= newElmt
;
1212 newElmt
->prev
= last
;
1213 last
->next
= newElmt
;
1217 return (curr
= newElmt
)->elmt
;
1218 } // PolicyInformationSeqOf::Append
1221 // alloc new list elmt, put at begining of list
1222 // and return the component type
1223 PolicyQualifierInfo
*PolicyInformationSeqOf::Prepend()
1225 AsnListElmt
*newElmt
;
1226 newElmt
= new AsnListElmt
;
1227 newElmt
->elmt
= new PolicyQualifierInfo
;
1228 newElmt
->prev
= NULL
;
1231 newElmt
->next
= NULL
;
1232 first
= last
= newElmt
;
1236 newElmt
->next
= first
;
1237 first
->prev
= newElmt
;
1241 return (curr
= newElmt
)->elmt
;
1242 } // PolicyInformationSeqOf::Prepend
1245 // alloc new list elmt, insert it before the
1246 // current element and return the component type
1247 // if the current element is null, the new element
1248 // is placed at the beginning of the list.
1249 PolicyQualifierInfo
*PolicyInformationSeqOf::InsertBefore()
1251 AsnListElmt
*newElmt
;
1252 newElmt
= new AsnListElmt
;
1253 newElmt
->elmt
= new PolicyQualifierInfo
;
1256 newElmt
->next
= first
;
1257 newElmt
->prev
= NULL
;
1264 newElmt
->next
= curr
;
1265 newElmt
->prev
= curr
->prev
;
1266 curr
->prev
= newElmt
;
1270 newElmt
->prev
->next
= newElmt
;
1273 return (curr
= newElmt
)->elmt
;
1274 } // PolicyInformationSeqOf::InsertBefore
1277 // alloc new list elmt, insert it after the
1278 // current element and return the component type
1279 // if the current element is null, the new element
1280 // is placed at the end of the list.
1281 PolicyQualifierInfo
*PolicyInformationSeqOf::InsertAfter()
1283 AsnListElmt
*newElmt
;
1284 newElmt
= new AsnListElmt
;
1285 newElmt
->elmt
= new PolicyQualifierInfo
;
1288 newElmt
->prev
= last
;
1289 newElmt
->next
= NULL
;
1296 newElmt
->prev
= curr
;
1297 newElmt
->next
= curr
->next
;
1298 curr
->next
= newElmt
;
1302 newElmt
->next
->prev
= newElmt
;
1305 return (curr
= newElmt
)->elmt
;
1306 } // PolicyInformationSeqOf::InsertAfter
1309 PolicyInformationSeqOf
&PolicyInformationSeqOf::AppendCopy (PolicyQualifierInfo
&elmt
)
1311 AsnListElmt
*newElmt
;
1312 newElmt
= new AsnListElmt
;
1313 newElmt
->elmt
= new PolicyQualifierInfo
;
1314 *newElmt
->elmt
= elmt
;
1315 newElmt
->next
= NULL
;
1318 newElmt
->prev
= NULL
;
1319 first
= last
= newElmt
;
1323 newElmt
->prev
= last
;
1324 last
->next
= newElmt
;
1332 PolicyInformationSeqOf
&PolicyInformationSeqOf::PrependCopy (PolicyQualifierInfo
&elmt
)
1334 AsnListElmt
*newElmt
;
1335 newElmt
= new AsnListElmt
;
1336 newElmt
->elmt
= new PolicyQualifierInfo
;
1337 *newElmt
->elmt
= elmt
;
1338 newElmt
->prev
= NULL
;
1341 newElmt
->next
= NULL
;
1342 first
= last
= newElmt
;
1346 newElmt
->next
= first
;
1347 first
->prev
= newElmt
;
1352 } // PolicyInformationSeqOf::PrependCopy
1355 // alloc new list elmt, insert it before the
1356 // current element, copy the given elmt into the new elmt
1357 // and return the component type.
1358 // if the current element is null, the new element
1359 // is placed at the beginning of the list.
1360 PolicyInformationSeqOf
&PolicyInformationSeqOf::InsertBeforeAndCopy (PolicyQualifierInfo
&elmt
)
1362 AsnListElmt
*newElmt
;
1364 newElmt
= new AsnListElmt
;
1365 newElmt
->elmt
= new PolicyQualifierInfo
;
1366 *newElmt
->elmt
= elmt
;
1370 newElmt
->next
= first
;
1371 newElmt
->prev
= NULL
;
1378 newElmt
->next
= curr
;
1379 newElmt
->prev
= curr
->prev
;
1380 curr
->prev
= newElmt
;
1384 newElmt
->prev
->next
= newElmt
;
1388 } // PolicyInformationSeqOf::InsertBeforeAndCopy
1391 // alloc new list elmt, insert it after the
1392 // current element, copy given elmt in to new elmt
1393 // and return the component type
1394 // if the current element is null, the new element
1395 // is placed at the end of the list.
1396 PolicyInformationSeqOf
&PolicyInformationSeqOf::InsertAfterAndCopy (PolicyQualifierInfo
&elmt
)
1398 AsnListElmt
*newElmt
;
1400 newElmt
= new AsnListElmt
;
1401 newElmt
->elmt
= new PolicyQualifierInfo
;
1402 *newElmt
->elmt
= elmt
;
1405 newElmt
->prev
= last
;
1406 newElmt
->next
= NULL
;
1413 newElmt
->prev
= curr
;
1414 newElmt
->next
= curr
->next
;
1415 curr
->next
= newElmt
;
1419 newElmt
->next
->prev
= newElmt
;
1423 } // PolicyInformationSeqOf::InsertAfterAndCopy
1426 // remove current element from list if current element is not NULL
1427 // The new current element will be the next element.
1428 // If the current element is the last element in the list
1429 // the second but last element will become the new current element.
1430 void PolicyInformationSeqOf::RemoveCurrFromList()
1432 AsnListElmt
*del_elmt
;
1440 first
= last
= curr
= NULL
;
1441 else if (curr
== first
)
1443 curr
= first
= first
->next
;
1446 else if (curr
== last
)
1448 curr
= last
= last
->prev
;
1453 curr
->prev
->next
= curr
->next
;
1454 curr
->next
->prev
= curr
->prev
;
1457 delete del_elmt
->elmt
;
1463 AsnLen
PolicyInformationSeqOf::BEncContent (BUF_TYPE b
)
1465 AsnListElmt
*currElmt
;
1467 AsnLen totalLen
= 0;
1468 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
1471 elmtLen
= currElmt
->elmt
->BEncContent (b
);
1472 elmtLen
+= BEncConsLen (b
, elmtLen
);
1474 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1475 totalLen
+= elmtLen
;
1478 } // PolicyInformationSeqOf::BEncContent
1481 void PolicyInformationSeqOf::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
1482 AsnLen
&bytesDecoded
, ENV_TYPE env
)
1484 PolicyQualifierInfo
*listElmt
;
1486 AsnLen listBytesDecoded
= 0;
1489 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
1491 tag1
= BDecTag (b
, listBytesDecoded
, env
);
1492 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
1494 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
1497 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
1499 Asn1Error
<< "Unexpected Tag" << endl
;
1500 longjmp (env
, -111);
1503 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
1504 listElmt
= Append();
1505 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
1508 bytesDecoded
+= listBytesDecoded
;
1509 } // PolicyInformationSeqOf::BDecContent
1512 PolicyInformation::PolicyInformation()
1514 policyQualifiers
= NULL
;
1517 PolicyInformation::PolicyInformation (const PolicyInformation
&)
1519 Asn1Error
<< "use of incompletely defined PolicyInformation::PolicyInformation (const PolicyInformation &)" << endl
;
1523 PolicyInformation::~PolicyInformation()
1525 delete policyQualifiers
;
1528 AsnType
*PolicyInformation::Clone() const
1530 return new PolicyInformation
;
1533 AsnType
*PolicyInformation::Copy() const
1535 return new PolicyInformation (*this);
1539 PolicyInformation
&PolicyInformation::operator = (const PolicyInformation
&that
)
1540 #else // SNACC_DEEP_COPY
1541 PolicyInformation
&PolicyInformation::operator = (const PolicyInformation
&)
1542 #endif // SNACC_DEEP_COPY
1547 policyIdentifier
= that
.policyIdentifier
;
1548 if (that
.policyQualifiers
)
1550 if (!policyQualifiers
)
1551 policyQualifiers
= new PolicyInformationSeqOf
;
1552 *policyQualifiers
= *that
.policyQualifiers
;
1556 delete policyQualifiers
;
1557 policyQualifiers
= NULL
;
1562 #else // SNACC_DEEP_COPY
1563 Asn1Error
<< "use of incompletely defined PolicyInformation &PolicyInformation::operator = (const PolicyInformation &)" << endl
;
1565 // if your compiler complains here, check the -novolat option
1566 #endif // SNACC_DEEP_COPY
1570 PolicyInformation::BEncContent (BUF_TYPE b
)
1572 AsnLen totalLen
= 0;
1575 if (NOT_NULL (policyQualifiers
))
1578 l
= policyQualifiers
->BEncContent (b
);
1579 l
+= BEncConsLen (b
, l
);
1581 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1585 l
= policyIdentifier
.BEncContent (b
);
1586 l
+= BEncDefLen (b
, l
);
1588 l
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
1592 } // PolicyInformation::BEncContent
1595 void PolicyInformation::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1598 AsnLen seqBytesDecoded
= 0;
1600 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1602 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
1604 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1605 policyIdentifier
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1606 if (seqBytesDecoded
== elmtLen0
)
1608 bytesDecoded
+= seqBytesDecoded
;
1613 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1615 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
1617 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
1618 bytesDecoded
+= seqBytesDecoded
;
1625 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1626 longjmp (env
, -112);
1629 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
1631 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1632 policyQualifiers
= new PolicyInformationSeqOf
;
1633 policyQualifiers
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1636 bytesDecoded
+= seqBytesDecoded
;
1637 if (elmtLen0
== INDEFINITE_LEN
)
1639 BDecEoc (b
, bytesDecoded
, env
);
1642 else if (seqBytesDecoded
!= elmtLen0
)
1644 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
1645 longjmp (env
, -113);
1649 } // PolicyInformation::BDecContent
1651 AsnLen
PolicyInformation::BEnc (BUF_TYPE b
)
1654 l
= BEncContent (b
);
1655 l
+= BEncConsLen (b
, l
);
1656 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1660 void PolicyInformation::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1665 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1667 Asn1Error
<< "PolicyInformation::BDec: ERROR - wrong tag" << endl
;
1668 longjmp (env
, -114);
1670 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1671 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1674 int PolicyInformation::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
1676 bytesEncoded
= BEnc (b
);
1677 return !b
.WriteError();
1680 int PolicyInformation::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
1686 if ((val
= setjmp (env
)) == 0)
1688 BDec (b
, bytesDecoded
, env
);
1689 return !b
.ReadError();
1695 void PolicyInformation::Print (ostream
&os
) const
1698 os
<< "{ -- SEQUENCE --" << endl
;
1699 indentG
+= stdIndentG
;
1702 Indent (os
, indentG
);
1703 os
<< "policyIdentifier ";
1704 os
<< policyIdentifier
;
1708 if (NOT_NULL (policyQualifiers
))
1711 Indent (os
, indentG
);
1712 os
<< "policyQualifiers ";
1713 os
<< *policyQualifiers
;
1717 Indent (os
, indentG
);
1718 os
<< "policyQualifiers ";
1724 indentG
-= stdIndentG
;
1725 Indent (os
, indentG
);
1728 } // PolicyInformation::Print
1731 GeneralSubtree::GeneralSubtree()
1734 base
= new GeneralName
;
1736 base
= NULL
; // incomplete initialization of mandatory element!
1742 GeneralSubtree::GeneralSubtree (const GeneralSubtree
&)
1744 Asn1Error
<< "use of incompletely defined GeneralSubtree::GeneralSubtree (const GeneralSubtree &)" << endl
;
1748 GeneralSubtree::~GeneralSubtree()
1755 AsnType
*GeneralSubtree::Clone() const
1757 return new GeneralSubtree
;
1760 AsnType
*GeneralSubtree::Copy() const
1762 return new GeneralSubtree (*this);
1766 GeneralSubtree
&GeneralSubtree::operator = (const GeneralSubtree
&that
)
1767 #else // SNACC_DEEP_COPY
1768 GeneralSubtree
&GeneralSubtree::operator = (const GeneralSubtree
&)
1769 #endif // SNACC_DEEP_COPY
1777 base
= new GeneralName
;
1788 minimum
= new BaseDistance
;
1789 *minimum
= *that
.minimum
;
1799 maximum
= new BaseDistance
;
1800 *maximum
= *that
.maximum
;
1810 #else // SNACC_DEEP_COPY
1811 Asn1Error
<< "use of incompletely defined GeneralSubtree &GeneralSubtree::operator = (const GeneralSubtree &)" << endl
;
1813 // if your compiler complains here, check the -novolat option
1814 #endif // SNACC_DEEP_COPY
1818 GeneralSubtree::BEncContent (BUF_TYPE b
)
1820 AsnLen totalLen
= 0;
1823 if (NOT_NULL (maximum
))
1825 l
= maximum
->BEncContent (b
);
1826 BEncDefLenTo127 (b
, l
);
1829 l
+= BEncTag1 (b
, CNTX
, PRIM
, 1);
1833 if (NOT_NULL (minimum
))
1835 l
= minimum
->BEncContent (b
);
1836 BEncDefLenTo127 (b
, l
);
1839 l
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
1843 l
= base
->BEncContent (b
);
1847 } // GeneralSubtree::BEncContent
1850 void GeneralSubtree::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1853 AsnLen seqBytesDecoded
= 0;
1855 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1857 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 0))
1858 || (tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 1))
1859 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1))
1860 || (tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 2))
1861 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 2))
1862 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 3))
1863 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 4))
1864 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 5))
1865 || (tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 6))
1866 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 6))
1867 || (tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 7))
1868 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 7))
1869 || (tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 8)))
1871 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1872 base
= new GeneralName
;
1873 base
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1874 if (seqBytesDecoded
== elmtLen0
)
1876 bytesDecoded
+= seqBytesDecoded
;
1881 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1883 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
1885 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
1886 bytesDecoded
+= seqBytesDecoded
;
1893 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1894 longjmp (env
, -115);
1897 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 0)))
1899 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1900 minimum
= new BaseDistance
;
1901 minimum
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1902 if (seqBytesDecoded
== elmtLen0
)
1904 bytesDecoded
+= seqBytesDecoded
;
1909 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1911 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
1913 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
1914 bytesDecoded
+= seqBytesDecoded
;
1920 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 1)))
1922 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1923 maximum
= new BaseDistance
;
1924 maximum
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1927 bytesDecoded
+= seqBytesDecoded
;
1928 if (elmtLen0
== INDEFINITE_LEN
)
1930 BDecEoc (b
, bytesDecoded
, env
);
1933 else if (seqBytesDecoded
!= elmtLen0
)
1935 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
1936 longjmp (env
, -116);
1940 } // GeneralSubtree::BDecContent
1942 AsnLen
GeneralSubtree::BEnc (BUF_TYPE b
)
1945 l
= BEncContent (b
);
1946 l
+= BEncConsLen (b
, l
);
1947 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1951 void GeneralSubtree::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1956 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1958 Asn1Error
<< "GeneralSubtree::BDec: ERROR - wrong tag" << endl
;
1959 longjmp (env
, -117);
1961 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1962 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1965 int GeneralSubtree::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
1967 bytesEncoded
= BEnc (b
);
1968 return !b
.WriteError();
1971 int GeneralSubtree::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
1977 if ((val
= setjmp (env
)) == 0)
1979 BDec (b
, bytesDecoded
, env
);
1980 return !b
.ReadError();
1986 void GeneralSubtree::Print (ostream
&os
) const
1989 os
<< "{ -- SEQUENCE --" << endl
;
1990 indentG
+= stdIndentG
;
1992 if (NOT_NULL (base
))
1994 Indent (os
, indentG
);
2000 Indent (os
, indentG
);
2006 if (NOT_NULL (minimum
))
2009 Indent (os
, indentG
);
2015 Indent (os
, indentG
);
2021 if (NOT_NULL (maximum
))
2024 Indent (os
, indentG
);
2030 Indent (os
, indentG
);
2037 indentG
-= stdIndentG
;
2038 Indent (os
, indentG
);
2041 } // GeneralSubtree::Print
2044 DistributionPoint::DistributionPoint()
2046 distributionPoint
= NULL
;
2051 DistributionPoint::DistributionPoint (const DistributionPoint
&)
2053 Asn1Error
<< "use of incompletely defined DistributionPoint::DistributionPoint (const DistributionPoint &)" << endl
;
2057 DistributionPoint::~DistributionPoint()
2059 delete distributionPoint
;
2064 AsnType
*DistributionPoint::Clone() const
2066 return new DistributionPoint
;
2069 AsnType
*DistributionPoint::Copy() const
2071 return new DistributionPoint (*this);
2075 DistributionPoint
&DistributionPoint::operator = (const DistributionPoint
&that
)
2076 #else // SNACC_DEEP_COPY
2077 DistributionPoint
&DistributionPoint::operator = (const DistributionPoint
&)
2078 #endif // SNACC_DEEP_COPY
2083 if (that
.distributionPoint
)
2085 if (!distributionPoint
)
2086 distributionPoint
= new DistributionPointName
;
2087 *distributionPoint
= *that
.distributionPoint
;
2091 delete distributionPoint
;
2092 distributionPoint
= NULL
;
2097 reasons
= new ReasonFlags
;
2098 *reasons
= *that
.reasons
;
2108 cRLIssuer
= new GeneralNames
;
2109 *cRLIssuer
= *that
.cRLIssuer
;
2119 #else // SNACC_DEEP_COPY
2120 Asn1Error
<< "use of incompletely defined DistributionPoint &DistributionPoint::operator = (const DistributionPoint &)" << endl
;
2122 // if your compiler complains here, check the -novolat option
2123 #endif // SNACC_DEEP_COPY
2127 DistributionPoint::BEncContent (BUF_TYPE b
)
2129 AsnLen totalLen
= 0;
2132 if (NOT_NULL (cRLIssuer
))
2135 l
= cRLIssuer
->BEncContent (b
);
2136 l
+= BEncConsLen (b
, l
);
2138 l
+= BEncTag1 (b
, CNTX
, CONS
, 2);
2142 if (NOT_NULL (reasons
))
2144 l
= reasons
->BEncContent (b
);
2145 l
+= BEncDefLen (b
, l
);
2147 l
+= BEncTag1 (b
, CNTX
, PRIM
, 1);
2151 if (NOT_NULL (distributionPoint
))
2154 l
= distributionPoint
->BEncContent (b
);
2155 l
+= BEncConsLen (b
, l
);
2157 l
+= BEncTag1 (b
, CNTX
, CONS
, 0);
2162 } // DistributionPoint::BEncContent
2165 void DistributionPoint::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2168 AsnLen seqBytesDecoded
= 0;
2175 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
2177 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
2179 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
2180 bytesDecoded
+= seqBytesDecoded
;
2185 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0)))
2187 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
2188 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
2189 elmtLen2
= BDecLen (b
, seqBytesDecoded
, env
);
2190 distributionPoint
= new DistributionPointName
;
2191 distributionPoint
->BDecContent (b
, tag1
, elmtLen2
, seqBytesDecoded
, env
);
2192 if (elmtLen1
== INDEFINITE_LEN
)
2193 BDecEoc (b
, seqBytesDecoded
, env
);
2195 if (seqBytesDecoded
== elmtLen0
)
2197 bytesDecoded
+= seqBytesDecoded
;
2202 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
2204 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
2206 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
2207 bytesDecoded
+= seqBytesDecoded
;
2213 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 1))
2214 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
2216 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
2217 reasons
= new ReasonFlags
;
2218 reasons
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
2219 if (seqBytesDecoded
== elmtLen0
)
2221 bytesDecoded
+= seqBytesDecoded
;
2226 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
2228 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
2230 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
2231 bytesDecoded
+= seqBytesDecoded
;
2237 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 2)))
2239 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
2240 cRLIssuer
= new GeneralNames
;
2241 cRLIssuer
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
2244 bytesDecoded
+= seqBytesDecoded
;
2245 if (elmtLen0
== INDEFINITE_LEN
)
2247 BDecEoc (b
, bytesDecoded
, env
);
2250 else if (seqBytesDecoded
!= elmtLen0
)
2252 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
2253 longjmp (env
, -118);
2257 } // DistributionPoint::BDecContent
2259 AsnLen
DistributionPoint::BEnc (BUF_TYPE b
)
2262 l
= BEncContent (b
);
2263 l
+= BEncConsLen (b
, l
);
2264 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2268 void DistributionPoint::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2273 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
2275 Asn1Error
<< "DistributionPoint::BDec: ERROR - wrong tag" << endl
;
2276 longjmp (env
, -119);
2278 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
2279 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
2282 int DistributionPoint::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
2284 bytesEncoded
= BEnc (b
);
2285 return !b
.WriteError();
2288 int DistributionPoint::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
2294 if ((val
= setjmp (env
)) == 0)
2296 BDec (b
, bytesDecoded
, env
);
2297 return !b
.ReadError();
2303 void DistributionPoint::Print (ostream
&os
) const
2306 int nonePrinted
= true;
2307 os
<< "{ -- SEQUENCE --" << endl
;
2308 indentG
+= stdIndentG
;
2310 if (NOT_NULL (distributionPoint
))
2312 nonePrinted
= false;
2313 Indent (os
, indentG
);
2314 os
<< "distributionPoint ";
2315 os
<< *distributionPoint
;
2319 Indent (os
, indentG
);
2320 os
<< "distributionPoint ";
2325 if (NOT_NULL (reasons
))
2329 nonePrinted
= false;
2330 Indent (os
, indentG
);
2336 Indent (os
, indentG
);
2342 if (NOT_NULL (cRLIssuer
))
2346 nonePrinted
= false;
2347 Indent (os
, indentG
);
2353 Indent (os
, indentG
);
2360 indentG
-= stdIndentG
;
2361 Indent (os
, indentG
);
2364 } // DistributionPoint::Print
2367 AsnType
*CertificatePoliciesSyntax::Clone() const
2369 return new CertificatePoliciesSyntax
;
2372 AsnType
*CertificatePoliciesSyntax::Copy() const
2374 return new CertificatePoliciesSyntax (*this);
2377 AsnLen
CertificatePoliciesSyntax::BEnc (BUF_TYPE b
)
2380 l
= BEncContent (b
);
2381 l
+= BEncConsLen (b
, l
);
2382 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2386 void CertificatePoliciesSyntax::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2391 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
2393 Asn1Error
<< "CertificatePoliciesSyntax::BDec: ERROR - wrong tag" << endl
;
2394 longjmp (env
, -120);
2396 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
2397 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
2400 CertificatePoliciesSyntax::CertificatePoliciesSyntax (const CertificatePoliciesSyntax
&)
2402 Asn1Error
<< "use of incompletely defined CertificatePoliciesSyntax::CertificatePoliciesSyntax (const CertificatePoliciesSyntax &)" << endl
;
2406 CertificatePoliciesSyntax::~CertificatePoliciesSyntax()
2409 for (; Curr() != NULL
; RemoveCurrFromList())
2411 } // end of destructor
2414 CertificatePoliciesSyntax
&CertificatePoliciesSyntax::operator = (const CertificatePoliciesSyntax
&that
)
2415 #else // SNACC_DEEP_COPY
2416 CertificatePoliciesSyntax
&CertificatePoliciesSyntax::operator = (const CertificatePoliciesSyntax
&)
2417 #endif // SNACC_DEEP_COPY
2423 for (; Curr(); RemoveCurrFromList())
2426 //that.SetCurrToFirst();
2427 //for (; that.Curr(); that.GoNext())
2428 // AppendCopy (*that.Curr());
2429 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
2430 AppendCopy (*run
->elmt
);
2434 #else // SNACC_DEEP_COPY
2435 Asn1Error
<< "use of incompletely defined CertificatePoliciesSyntax &CertificatePoliciesSyntax::operator = (const CertificatePoliciesSyntax &)" << endl
;
2437 // if your compiler complains here, check the -novolat option
2438 #endif // SNACC_DEEP_COPY
2441 void CertificatePoliciesSyntax::Print (ostream
&os
) const
2444 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
2445 indentG
+= stdIndentG
;
2447 //for (; Curr() != NULL; GoNext())
2448 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
2450 Indent (os
, indentG
);
2453 //if (Curr() != Last())
2458 indentG
-= stdIndentG
;
2459 Indent (os
, indentG
);
2467 void CertificatePoliciesSyntax::SetCurrElmt (unsigned long int index
)
2469 unsigned long int i
;
2472 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
2474 } // CertificatePoliciesSyntax::SetCurrElmt
2477 unsigned long int CertificatePoliciesSyntax::GetCurrElmtIndex()
2479 unsigned long int i
;
2483 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
2492 } // CertificatePoliciesSyntax::GetCurrElmtIndex
2495 // alloc new list elmt, put at end of list
2496 // and return the component type
2497 PolicyInformation
*CertificatePoliciesSyntax::Append()
2499 AsnListElmt
*newElmt
;
2500 newElmt
= new AsnListElmt
;
2501 newElmt
->elmt
= new PolicyInformation
;
2502 newElmt
->next
= NULL
;
2505 newElmt
->prev
= NULL
;
2506 first
= last
= newElmt
;
2510 newElmt
->prev
= last
;
2511 last
->next
= newElmt
;
2515 return (curr
= newElmt
)->elmt
;
2516 } // CertificatePoliciesSyntax::Append
2519 // alloc new list elmt, put at begining of list
2520 // and return the component type
2521 PolicyInformation
*CertificatePoliciesSyntax::Prepend()
2523 AsnListElmt
*newElmt
;
2524 newElmt
= new AsnListElmt
;
2525 newElmt
->elmt
= new PolicyInformation
;
2526 newElmt
->prev
= NULL
;
2529 newElmt
->next
= NULL
;
2530 first
= last
= newElmt
;
2534 newElmt
->next
= first
;
2535 first
->prev
= newElmt
;
2539 return (curr
= newElmt
)->elmt
;
2540 } // CertificatePoliciesSyntax::Prepend
2543 // alloc new list elmt, insert it before the
2544 // current element and return the component type
2545 // if the current element is null, the new element
2546 // is placed at the beginning of the list.
2547 PolicyInformation
*CertificatePoliciesSyntax::InsertBefore()
2549 AsnListElmt
*newElmt
;
2550 newElmt
= new AsnListElmt
;
2551 newElmt
->elmt
= new PolicyInformation
;
2554 newElmt
->next
= first
;
2555 newElmt
->prev
= NULL
;
2562 newElmt
->next
= curr
;
2563 newElmt
->prev
= curr
->prev
;
2564 curr
->prev
= newElmt
;
2568 newElmt
->prev
->next
= newElmt
;
2571 return (curr
= newElmt
)->elmt
;
2572 } // CertificatePoliciesSyntax::InsertBefore
2575 // alloc new list elmt, insert it after the
2576 // current element and return the component type
2577 // if the current element is null, the new element
2578 // is placed at the end of the list.
2579 PolicyInformation
*CertificatePoliciesSyntax::InsertAfter()
2581 AsnListElmt
*newElmt
;
2582 newElmt
= new AsnListElmt
;
2583 newElmt
->elmt
= new PolicyInformation
;
2586 newElmt
->prev
= last
;
2587 newElmt
->next
= NULL
;
2594 newElmt
->prev
= curr
;
2595 newElmt
->next
= curr
->next
;
2596 curr
->next
= newElmt
;
2600 newElmt
->next
->prev
= newElmt
;
2603 return (curr
= newElmt
)->elmt
;
2604 } // CertificatePoliciesSyntax::InsertAfter
2607 CertificatePoliciesSyntax
&CertificatePoliciesSyntax::AppendCopy (PolicyInformation
&elmt
)
2609 AsnListElmt
*newElmt
;
2610 newElmt
= new AsnListElmt
;
2611 newElmt
->elmt
= new PolicyInformation
;
2612 *newElmt
->elmt
= elmt
;
2613 newElmt
->next
= NULL
;
2616 newElmt
->prev
= NULL
;
2617 first
= last
= newElmt
;
2621 newElmt
->prev
= last
;
2622 last
->next
= newElmt
;
2630 CertificatePoliciesSyntax
&CertificatePoliciesSyntax::PrependCopy (PolicyInformation
&elmt
)
2632 AsnListElmt
*newElmt
;
2633 newElmt
= new AsnListElmt
;
2634 newElmt
->elmt
= new PolicyInformation
;
2635 *newElmt
->elmt
= elmt
;
2636 newElmt
->prev
= NULL
;
2639 newElmt
->next
= NULL
;
2640 first
= last
= newElmt
;
2644 newElmt
->next
= first
;
2645 first
->prev
= newElmt
;
2650 } // CertificatePoliciesSyntax::PrependCopy
2653 // alloc new list elmt, insert it before the
2654 // current element, copy the given elmt into the new elmt
2655 // and return the component type.
2656 // if the current element is null, the new element
2657 // is placed at the beginning of the list.
2658 CertificatePoliciesSyntax
&CertificatePoliciesSyntax::InsertBeforeAndCopy (PolicyInformation
&elmt
)
2660 AsnListElmt
*newElmt
;
2662 newElmt
= new AsnListElmt
;
2663 newElmt
->elmt
= new PolicyInformation
;
2664 *newElmt
->elmt
= elmt
;
2668 newElmt
->next
= first
;
2669 newElmt
->prev
= NULL
;
2676 newElmt
->next
= curr
;
2677 newElmt
->prev
= curr
->prev
;
2678 curr
->prev
= newElmt
;
2682 newElmt
->prev
->next
= newElmt
;
2686 } // CertificatePoliciesSyntax::InsertBeforeAndCopy
2689 // alloc new list elmt, insert it after the
2690 // current element, copy given elmt in to new elmt
2691 // and return the component type
2692 // if the current element is null, the new element
2693 // is placed at the end of the list.
2694 CertificatePoliciesSyntax
&CertificatePoliciesSyntax::InsertAfterAndCopy (PolicyInformation
&elmt
)
2696 AsnListElmt
*newElmt
;
2698 newElmt
= new AsnListElmt
;
2699 newElmt
->elmt
= new PolicyInformation
;
2700 *newElmt
->elmt
= elmt
;
2703 newElmt
->prev
= last
;
2704 newElmt
->next
= NULL
;
2711 newElmt
->prev
= curr
;
2712 newElmt
->next
= curr
->next
;
2713 curr
->next
= newElmt
;
2717 newElmt
->next
->prev
= newElmt
;
2721 } // CertificatePoliciesSyntax::InsertAfterAndCopy
2724 // remove current element from list if current element is not NULL
2725 // The new current element will be the next element.
2726 // If the current element is the last element in the list
2727 // the second but last element will become the new current element.
2728 void CertificatePoliciesSyntax::RemoveCurrFromList()
2730 AsnListElmt
*del_elmt
;
2738 first
= last
= curr
= NULL
;
2739 else if (curr
== first
)
2741 curr
= first
= first
->next
;
2744 else if (curr
== last
)
2746 curr
= last
= last
->prev
;
2751 curr
->prev
->next
= curr
->next
;
2752 curr
->next
->prev
= curr
->prev
;
2755 delete del_elmt
->elmt
;
2761 AsnLen
CertificatePoliciesSyntax::BEncContent (BUF_TYPE b
)
2763 AsnListElmt
*currElmt
;
2765 AsnLen totalLen
= 0;
2766 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
2769 elmtLen
= currElmt
->elmt
->BEncContent (b
);
2770 elmtLen
+= BEncConsLen (b
, elmtLen
);
2772 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2773 totalLen
+= elmtLen
;
2776 } // CertificatePoliciesSyntax::BEncContent
2779 void CertificatePoliciesSyntax::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
2780 AsnLen
&bytesDecoded
, ENV_TYPE env
)
2782 PolicyInformation
*listElmt
;
2784 AsnLen listBytesDecoded
= 0;
2787 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
2789 tag1
= BDecTag (b
, listBytesDecoded
, env
);
2790 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
2792 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
2795 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
2797 Asn1Error
<< "Unexpected Tag" << endl
;
2798 longjmp (env
, -121);
2801 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
2802 listElmt
= Append();
2803 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
2806 bytesDecoded
+= listBytesDecoded
;
2807 } // CertificatePoliciesSyntax::BDecContent
2810 AsnType
*GeneralSubtrees::Clone() const
2812 return new GeneralSubtrees
;
2815 AsnType
*GeneralSubtrees::Copy() const
2817 return new GeneralSubtrees (*this);
2820 AsnLen
GeneralSubtrees::BEnc (BUF_TYPE b
)
2823 l
= BEncContent (b
);
2824 l
+= BEncConsLen (b
, l
);
2825 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2829 void GeneralSubtrees::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2834 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
2836 Asn1Error
<< "GeneralSubtrees::BDec: ERROR - wrong tag" << endl
;
2837 longjmp (env
, -122);
2839 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
2840 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
2843 GeneralSubtrees::GeneralSubtrees (const GeneralSubtrees
&)
2845 Asn1Error
<< "use of incompletely defined GeneralSubtrees::GeneralSubtrees (const GeneralSubtrees &)" << endl
;
2849 GeneralSubtrees::~GeneralSubtrees()
2852 for (; Curr() != NULL
; RemoveCurrFromList())
2854 } // end of destructor
2857 GeneralSubtrees
&GeneralSubtrees::operator = (const GeneralSubtrees
&that
)
2858 #else // SNACC_DEEP_COPY
2859 GeneralSubtrees
&GeneralSubtrees::operator = (const GeneralSubtrees
&)
2860 #endif // SNACC_DEEP_COPY
2866 for (; Curr(); RemoveCurrFromList())
2869 //that.SetCurrToFirst();
2870 //for (; that.Curr(); that.GoNext())
2871 // AppendCopy (*that.Curr());
2872 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
2873 AppendCopy (*run
->elmt
);
2877 #else // SNACC_DEEP_COPY
2878 Asn1Error
<< "use of incompletely defined GeneralSubtrees &GeneralSubtrees::operator = (const GeneralSubtrees &)" << endl
;
2880 // if your compiler complains here, check the -novolat option
2881 #endif // SNACC_DEEP_COPY
2884 void GeneralSubtrees::Print (ostream
&os
) const
2887 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
2888 indentG
+= stdIndentG
;
2890 //for (; Curr() != NULL; GoNext())
2891 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
2893 Indent (os
, indentG
);
2896 //if (Curr() != Last())
2901 indentG
-= stdIndentG
;
2902 Indent (os
, indentG
);
2910 void GeneralSubtrees::SetCurrElmt (unsigned long int index
)
2912 unsigned long int i
;
2915 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
2917 } // GeneralSubtrees::SetCurrElmt
2920 unsigned long int GeneralSubtrees::GetCurrElmtIndex()
2922 unsigned long int i
;
2926 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
2935 } // GeneralSubtrees::GetCurrElmtIndex
2938 // alloc new list elmt, put at end of list
2939 // and return the component type
2940 GeneralSubtree
*GeneralSubtrees::Append()
2942 AsnListElmt
*newElmt
;
2943 newElmt
= new AsnListElmt
;
2944 newElmt
->elmt
= new GeneralSubtree
;
2945 newElmt
->next
= NULL
;
2948 newElmt
->prev
= NULL
;
2949 first
= last
= newElmt
;
2953 newElmt
->prev
= last
;
2954 last
->next
= newElmt
;
2958 return (curr
= newElmt
)->elmt
;
2959 } // GeneralSubtrees::Append
2962 // alloc new list elmt, put at begining of list
2963 // and return the component type
2964 GeneralSubtree
*GeneralSubtrees::Prepend()
2966 AsnListElmt
*newElmt
;
2967 newElmt
= new AsnListElmt
;
2968 newElmt
->elmt
= new GeneralSubtree
;
2969 newElmt
->prev
= NULL
;
2972 newElmt
->next
= NULL
;
2973 first
= last
= newElmt
;
2977 newElmt
->next
= first
;
2978 first
->prev
= newElmt
;
2982 return (curr
= newElmt
)->elmt
;
2983 } // GeneralSubtrees::Prepend
2986 // alloc new list elmt, insert it before the
2987 // current element and return the component type
2988 // if the current element is null, the new element
2989 // is placed at the beginning of the list.
2990 GeneralSubtree
*GeneralSubtrees::InsertBefore()
2992 AsnListElmt
*newElmt
;
2993 newElmt
= new AsnListElmt
;
2994 newElmt
->elmt
= new GeneralSubtree
;
2997 newElmt
->next
= first
;
2998 newElmt
->prev
= NULL
;
3005 newElmt
->next
= curr
;
3006 newElmt
->prev
= curr
->prev
;
3007 curr
->prev
= newElmt
;
3011 newElmt
->prev
->next
= newElmt
;
3014 return (curr
= newElmt
)->elmt
;
3015 } // GeneralSubtrees::InsertBefore
3018 // alloc new list elmt, insert it after the
3019 // current element and return the component type
3020 // if the current element is null, the new element
3021 // is placed at the end of the list.
3022 GeneralSubtree
*GeneralSubtrees::InsertAfter()
3024 AsnListElmt
*newElmt
;
3025 newElmt
= new AsnListElmt
;
3026 newElmt
->elmt
= new GeneralSubtree
;
3029 newElmt
->prev
= last
;
3030 newElmt
->next
= NULL
;
3037 newElmt
->prev
= curr
;
3038 newElmt
->next
= curr
->next
;
3039 curr
->next
= newElmt
;
3043 newElmt
->next
->prev
= newElmt
;
3046 return (curr
= newElmt
)->elmt
;
3047 } // GeneralSubtrees::InsertAfter
3050 GeneralSubtrees
&GeneralSubtrees::AppendCopy (GeneralSubtree
&elmt
)
3052 AsnListElmt
*newElmt
;
3053 newElmt
= new AsnListElmt
;
3054 newElmt
->elmt
= new GeneralSubtree
;
3055 *newElmt
->elmt
= elmt
;
3056 newElmt
->next
= NULL
;
3059 newElmt
->prev
= NULL
;
3060 first
= last
= newElmt
;
3064 newElmt
->prev
= last
;
3065 last
->next
= newElmt
;
3073 GeneralSubtrees
&GeneralSubtrees::PrependCopy (GeneralSubtree
&elmt
)
3075 AsnListElmt
*newElmt
;
3076 newElmt
= new AsnListElmt
;
3077 newElmt
->elmt
= new GeneralSubtree
;
3078 *newElmt
->elmt
= elmt
;
3079 newElmt
->prev
= NULL
;
3082 newElmt
->next
= NULL
;
3083 first
= last
= newElmt
;
3087 newElmt
->next
= first
;
3088 first
->prev
= newElmt
;
3093 } // GeneralSubtrees::PrependCopy
3096 // alloc new list elmt, insert it before the
3097 // current element, copy the given elmt into the new elmt
3098 // and return the component type.
3099 // if the current element is null, the new element
3100 // is placed at the beginning of the list.
3101 GeneralSubtrees
&GeneralSubtrees::InsertBeforeAndCopy (GeneralSubtree
&elmt
)
3103 AsnListElmt
*newElmt
;
3105 newElmt
= new AsnListElmt
;
3106 newElmt
->elmt
= new GeneralSubtree
;
3107 *newElmt
->elmt
= elmt
;
3111 newElmt
->next
= first
;
3112 newElmt
->prev
= NULL
;
3119 newElmt
->next
= curr
;
3120 newElmt
->prev
= curr
->prev
;
3121 curr
->prev
= newElmt
;
3125 newElmt
->prev
->next
= newElmt
;
3129 } // GeneralSubtrees::InsertBeforeAndCopy
3132 // alloc new list elmt, insert it after the
3133 // current element, copy given elmt in to new elmt
3134 // and return the component type
3135 // if the current element is null, the new element
3136 // is placed at the end of the list.
3137 GeneralSubtrees
&GeneralSubtrees::InsertAfterAndCopy (GeneralSubtree
&elmt
)
3139 AsnListElmt
*newElmt
;
3141 newElmt
= new AsnListElmt
;
3142 newElmt
->elmt
= new GeneralSubtree
;
3143 *newElmt
->elmt
= elmt
;
3146 newElmt
->prev
= last
;
3147 newElmt
->next
= NULL
;
3154 newElmt
->prev
= curr
;
3155 newElmt
->next
= curr
->next
;
3156 curr
->next
= newElmt
;
3160 newElmt
->next
->prev
= newElmt
;
3164 } // GeneralSubtrees::InsertAfterAndCopy
3167 // remove current element from list if current element is not NULL
3168 // The new current element will be the next element.
3169 // If the current element is the last element in the list
3170 // the second but last element will become the new current element.
3171 void GeneralSubtrees::RemoveCurrFromList()
3173 AsnListElmt
*del_elmt
;
3181 first
= last
= curr
= NULL
;
3182 else if (curr
== first
)
3184 curr
= first
= first
->next
;
3187 else if (curr
== last
)
3189 curr
= last
= last
->prev
;
3194 curr
->prev
->next
= curr
->next
;
3195 curr
->next
->prev
= curr
->prev
;
3198 delete del_elmt
->elmt
;
3204 AsnLen
GeneralSubtrees::BEncContent (BUF_TYPE b
)
3206 AsnListElmt
*currElmt
;
3208 AsnLen totalLen
= 0;
3209 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
3212 elmtLen
= currElmt
->elmt
->BEncContent (b
);
3213 elmtLen
+= BEncConsLen (b
, elmtLen
);
3215 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3216 totalLen
+= elmtLen
;
3219 } // GeneralSubtrees::BEncContent
3222 void GeneralSubtrees::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
3223 AsnLen
&bytesDecoded
, ENV_TYPE env
)
3225 GeneralSubtree
*listElmt
;
3227 AsnLen listBytesDecoded
= 0;
3230 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
3232 tag1
= BDecTag (b
, listBytesDecoded
, env
);
3233 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
3235 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
3238 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
3240 Asn1Error
<< "Unexpected Tag" << endl
;
3241 longjmp (env
, -123);
3244 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
3245 listElmt
= Append();
3246 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
3249 bytesDecoded
+= listBytesDecoded
;
3250 } // GeneralSubtrees::BDecContent
3253 AuthorityKeyIdentifier::AuthorityKeyIdentifier()
3255 keyIdentifier
= NULL
;
3256 authorityCertIssuer
= NULL
;
3257 authorityCertSerialNumber
= NULL
;
3260 AuthorityKeyIdentifier::AuthorityKeyIdentifier (const AuthorityKeyIdentifier
&)
3262 Asn1Error
<< "use of incompletely defined AuthorityKeyIdentifier::AuthorityKeyIdentifier (const AuthorityKeyIdentifier &)" << endl
;
3266 AuthorityKeyIdentifier::~AuthorityKeyIdentifier()
3268 delete keyIdentifier
;
3269 delete authorityCertIssuer
;
3270 delete authorityCertSerialNumber
;
3273 AsnType
*AuthorityKeyIdentifier::Clone() const
3275 return new AuthorityKeyIdentifier
;
3278 AsnType
*AuthorityKeyIdentifier::Copy() const
3280 return new AuthorityKeyIdentifier (*this);
3284 AuthorityKeyIdentifier
&AuthorityKeyIdentifier::operator = (const AuthorityKeyIdentifier
&that
)
3285 #else // SNACC_DEEP_COPY
3286 AuthorityKeyIdentifier
&AuthorityKeyIdentifier::operator = (const AuthorityKeyIdentifier
&)
3287 #endif // SNACC_DEEP_COPY
3292 if (that
.keyIdentifier
)
3295 keyIdentifier
= new KeyIdentifier
;
3296 *keyIdentifier
= *that
.keyIdentifier
;
3300 delete keyIdentifier
;
3301 keyIdentifier
= NULL
;
3303 if (that
.authorityCertIssuer
)
3305 if (!authorityCertIssuer
)
3306 authorityCertIssuer
= new GeneralNames
;
3307 *authorityCertIssuer
= *that
.authorityCertIssuer
;
3311 delete authorityCertIssuer
;
3312 authorityCertIssuer
= NULL
;
3314 if (that
.authorityCertSerialNumber
)
3316 if (!authorityCertSerialNumber
)
3317 authorityCertSerialNumber
= new CertificateSerialNumber
;
3318 *authorityCertSerialNumber
= *that
.authorityCertSerialNumber
;
3322 delete authorityCertSerialNumber
;
3323 authorityCertSerialNumber
= NULL
;
3328 #else // SNACC_DEEP_COPY
3329 Asn1Error
<< "use of incompletely defined AuthorityKeyIdentifier &AuthorityKeyIdentifier::operator = (const AuthorityKeyIdentifier &)" << endl
;
3331 // if your compiler complains here, check the -novolat option
3332 #endif // SNACC_DEEP_COPY
3336 AuthorityKeyIdentifier::BEncContent (BUF_TYPE b
)
3338 AsnLen totalLen
= 0;
3341 if (NOT_NULL (authorityCertSerialNumber
))
3343 l
= authorityCertSerialNumber
->BEncContent (b
);
3344 l
+= BEncDefLen (b
, l
);
3346 l
+= BEncTag1 (b
, CNTX
, PRIM
, 2);
3350 if (NOT_NULL (authorityCertIssuer
))
3353 l
= authorityCertIssuer
->BEncContent (b
);
3354 l
+= BEncConsLen (b
, l
);
3356 l
+= BEncTag1 (b
, CNTX
, CONS
, 1);
3360 if (NOT_NULL (keyIdentifier
))
3362 l
= keyIdentifier
->BEncContent (b
);
3363 l
+= BEncDefLen (b
, l
);
3365 l
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
3370 } // AuthorityKeyIdentifier::BEncContent
3373 void AuthorityKeyIdentifier::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3376 AsnLen seqBytesDecoded
= 0;
3382 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3384 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3386 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3387 bytesDecoded
+= seqBytesDecoded
;
3392 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 0))
3393 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0)))
3395 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3396 keyIdentifier
= new KeyIdentifier
;
3397 keyIdentifier
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3398 if (seqBytesDecoded
== elmtLen0
)
3400 bytesDecoded
+= seqBytesDecoded
;
3405 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3407 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3409 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3410 bytesDecoded
+= seqBytesDecoded
;
3416 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
3418 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3419 authorityCertIssuer
= new GeneralNames
;
3420 authorityCertIssuer
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3421 if (seqBytesDecoded
== elmtLen0
)
3423 bytesDecoded
+= seqBytesDecoded
;
3428 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3430 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3432 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3433 bytesDecoded
+= seqBytesDecoded
;
3439 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 2))
3440 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 2)))
3442 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3443 authorityCertSerialNumber
= new CertificateSerialNumber
;
3444 authorityCertSerialNumber
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3447 bytesDecoded
+= seqBytesDecoded
;
3448 if (elmtLen0
== INDEFINITE_LEN
)
3450 BDecEoc (b
, bytesDecoded
, env
);
3453 else if (seqBytesDecoded
!= elmtLen0
)
3455 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
3456 longjmp (env
, -124);
3460 } // AuthorityKeyIdentifier::BDecContent
3462 AsnLen
AuthorityKeyIdentifier::BEnc (BUF_TYPE b
)
3465 l
= BEncContent (b
);
3466 l
+= BEncConsLen (b
, l
);
3467 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3471 void AuthorityKeyIdentifier::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3476 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
3478 Asn1Error
<< "AuthorityKeyIdentifier::BDec: ERROR - wrong tag" << endl
;
3479 longjmp (env
, -125);
3481 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
3482 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
3485 int AuthorityKeyIdentifier::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
3487 bytesEncoded
= BEnc (b
);
3488 return !b
.WriteError();
3491 int AuthorityKeyIdentifier::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
3497 if ((val
= setjmp (env
)) == 0)
3499 BDec (b
, bytesDecoded
, env
);
3500 return !b
.ReadError();
3506 void AuthorityKeyIdentifier::Print (ostream
&os
) const
3509 int nonePrinted
= true;
3510 os
<< "{ -- SEQUENCE --" << endl
;
3511 indentG
+= stdIndentG
;
3513 if (NOT_NULL (keyIdentifier
))
3515 nonePrinted
= false;
3516 Indent (os
, indentG
);
3517 os
<< "keyIdentifier ";
3518 os
<< *keyIdentifier
;
3522 Indent (os
, indentG
);
3523 os
<< "keyIdentifier ";
3528 if (NOT_NULL (authorityCertIssuer
))
3532 nonePrinted
= false;
3533 Indent (os
, indentG
);
3534 os
<< "authorityCertIssuer ";
3535 os
<< *authorityCertIssuer
;
3539 Indent (os
, indentG
);
3540 os
<< "authorityCertIssuer ";
3545 if (NOT_NULL (authorityCertSerialNumber
))
3549 nonePrinted
= false;
3550 Indent (os
, indentG
);
3551 os
<< "authorityCertSerialNumber ";
3552 os
<< *authorityCertSerialNumber
;
3556 Indent (os
, indentG
);
3557 os
<< "authorityCertSerialNumber ";
3563 indentG
-= stdIndentG
;
3564 Indent (os
, indentG
);
3567 } // AuthorityKeyIdentifier::Print
3570 AsnType
*ExtKeyUsageSyntax::Clone() const
3572 return new ExtKeyUsageSyntax
;
3575 AsnType
*ExtKeyUsageSyntax::Copy() const
3577 return new ExtKeyUsageSyntax (*this);
3580 AsnLen
ExtKeyUsageSyntax::BEnc (BUF_TYPE b
)
3583 l
= BEncContent (b
);
3584 l
+= BEncConsLen (b
, l
);
3585 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3589 void ExtKeyUsageSyntax::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3594 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
3596 Asn1Error
<< "ExtKeyUsageSyntax::BDec: ERROR - wrong tag" << endl
;
3597 longjmp (env
, -126);
3599 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
3600 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
3603 ExtKeyUsageSyntax::ExtKeyUsageSyntax (const ExtKeyUsageSyntax
&)
3605 Asn1Error
<< "use of incompletely defined ExtKeyUsageSyntax::ExtKeyUsageSyntax (const ExtKeyUsageSyntax &)" << endl
;
3609 ExtKeyUsageSyntax::~ExtKeyUsageSyntax()
3612 for (; Curr() != NULL
; RemoveCurrFromList())
3614 } // end of destructor
3617 ExtKeyUsageSyntax
&ExtKeyUsageSyntax::operator = (const ExtKeyUsageSyntax
&that
)
3618 #else // SNACC_DEEP_COPY
3619 ExtKeyUsageSyntax
&ExtKeyUsageSyntax::operator = (const ExtKeyUsageSyntax
&)
3620 #endif // SNACC_DEEP_COPY
3626 for (; Curr(); RemoveCurrFromList())
3629 //that.SetCurrToFirst();
3630 //for (; that.Curr(); that.GoNext())
3631 // AppendCopy (*that.Curr());
3632 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
3633 AppendCopy (*run
->elmt
);
3637 #else // SNACC_DEEP_COPY
3638 Asn1Error
<< "use of incompletely defined ExtKeyUsageSyntax &ExtKeyUsageSyntax::operator = (const ExtKeyUsageSyntax &)" << endl
;
3640 // if your compiler complains here, check the -novolat option
3641 #endif // SNACC_DEEP_COPY
3644 void ExtKeyUsageSyntax::Print (ostream
&os
) const
3647 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
3648 indentG
+= stdIndentG
;
3650 //for (; Curr() != NULL; GoNext())
3651 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
3653 Indent (os
, indentG
);
3656 //if (Curr() != Last())
3661 indentG
-= stdIndentG
;
3662 Indent (os
, indentG
);
3670 void ExtKeyUsageSyntax::SetCurrElmt (unsigned long int index
)
3672 unsigned long int i
;
3675 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
3677 } // ExtKeyUsageSyntax::SetCurrElmt
3680 unsigned long int ExtKeyUsageSyntax::GetCurrElmtIndex()
3682 unsigned long int i
;
3686 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
3695 } // ExtKeyUsageSyntax::GetCurrElmtIndex
3698 // alloc new list elmt, put at end of list
3699 // and return the component type
3700 KeyPurposeId
*ExtKeyUsageSyntax::Append()
3702 AsnListElmt
*newElmt
;
3703 newElmt
= new AsnListElmt
;
3704 newElmt
->elmt
= new KeyPurposeId
;
3705 newElmt
->next
= NULL
;
3708 newElmt
->prev
= NULL
;
3709 first
= last
= newElmt
;
3713 newElmt
->prev
= last
;
3714 last
->next
= newElmt
;
3718 return (curr
= newElmt
)->elmt
;
3719 } // ExtKeyUsageSyntax::Append
3722 // alloc new list elmt, put at begining of list
3723 // and return the component type
3724 KeyPurposeId
*ExtKeyUsageSyntax::Prepend()
3726 AsnListElmt
*newElmt
;
3727 newElmt
= new AsnListElmt
;
3728 newElmt
->elmt
= new KeyPurposeId
;
3729 newElmt
->prev
= NULL
;
3732 newElmt
->next
= NULL
;
3733 first
= last
= newElmt
;
3737 newElmt
->next
= first
;
3738 first
->prev
= newElmt
;
3742 return (curr
= newElmt
)->elmt
;
3743 } // ExtKeyUsageSyntax::Prepend
3746 // alloc new list elmt, insert it before the
3747 // current element and return the component type
3748 // if the current element is null, the new element
3749 // is placed at the beginning of the list.
3750 KeyPurposeId
*ExtKeyUsageSyntax::InsertBefore()
3752 AsnListElmt
*newElmt
;
3753 newElmt
= new AsnListElmt
;
3754 newElmt
->elmt
= new KeyPurposeId
;
3757 newElmt
->next
= first
;
3758 newElmt
->prev
= NULL
;
3765 newElmt
->next
= curr
;
3766 newElmt
->prev
= curr
->prev
;
3767 curr
->prev
= newElmt
;
3771 newElmt
->prev
->next
= newElmt
;
3774 return (curr
= newElmt
)->elmt
;
3775 } // ExtKeyUsageSyntax::InsertBefore
3778 // alloc new list elmt, insert it after the
3779 // current element and return the component type
3780 // if the current element is null, the new element
3781 // is placed at the end of the list.
3782 KeyPurposeId
*ExtKeyUsageSyntax::InsertAfter()
3784 AsnListElmt
*newElmt
;
3785 newElmt
= new AsnListElmt
;
3786 newElmt
->elmt
= new KeyPurposeId
;
3789 newElmt
->prev
= last
;
3790 newElmt
->next
= NULL
;
3797 newElmt
->prev
= curr
;
3798 newElmt
->next
= curr
->next
;
3799 curr
->next
= newElmt
;
3803 newElmt
->next
->prev
= newElmt
;
3806 return (curr
= newElmt
)->elmt
;
3807 } // ExtKeyUsageSyntax::InsertAfter
3810 ExtKeyUsageSyntax
&ExtKeyUsageSyntax::AppendCopy (KeyPurposeId
&elmt
)
3812 AsnListElmt
*newElmt
;
3813 newElmt
= new AsnListElmt
;
3814 newElmt
->elmt
= new KeyPurposeId
;
3815 *newElmt
->elmt
= elmt
;
3816 newElmt
->next
= NULL
;
3819 newElmt
->prev
= NULL
;
3820 first
= last
= newElmt
;
3824 newElmt
->prev
= last
;
3825 last
->next
= newElmt
;
3833 ExtKeyUsageSyntax
&ExtKeyUsageSyntax::PrependCopy (KeyPurposeId
&elmt
)
3835 AsnListElmt
*newElmt
;
3836 newElmt
= new AsnListElmt
;
3837 newElmt
->elmt
= new KeyPurposeId
;
3838 *newElmt
->elmt
= elmt
;
3839 newElmt
->prev
= NULL
;
3842 newElmt
->next
= NULL
;
3843 first
= last
= newElmt
;
3847 newElmt
->next
= first
;
3848 first
->prev
= newElmt
;
3853 } // ExtKeyUsageSyntax::PrependCopy
3856 // alloc new list elmt, insert it before the
3857 // current element, copy the given elmt into the new elmt
3858 // and return the component type.
3859 // if the current element is null, the new element
3860 // is placed at the beginning of the list.
3861 ExtKeyUsageSyntax
&ExtKeyUsageSyntax::InsertBeforeAndCopy (KeyPurposeId
&elmt
)
3863 AsnListElmt
*newElmt
;
3865 newElmt
= new AsnListElmt
;
3866 newElmt
->elmt
= new KeyPurposeId
;
3867 *newElmt
->elmt
= elmt
;
3871 newElmt
->next
= first
;
3872 newElmt
->prev
= NULL
;
3879 newElmt
->next
= curr
;
3880 newElmt
->prev
= curr
->prev
;
3881 curr
->prev
= newElmt
;
3885 newElmt
->prev
->next
= newElmt
;
3889 } // ExtKeyUsageSyntax::InsertBeforeAndCopy
3892 // alloc new list elmt, insert it after the
3893 // current element, copy given elmt in to new elmt
3894 // and return the component type
3895 // if the current element is null, the new element
3896 // is placed at the end of the list.
3897 ExtKeyUsageSyntax
&ExtKeyUsageSyntax::InsertAfterAndCopy (KeyPurposeId
&elmt
)
3899 AsnListElmt
*newElmt
;
3901 newElmt
= new AsnListElmt
;
3902 newElmt
->elmt
= new KeyPurposeId
;
3903 *newElmt
->elmt
= elmt
;
3906 newElmt
->prev
= last
;
3907 newElmt
->next
= NULL
;
3914 newElmt
->prev
= curr
;
3915 newElmt
->next
= curr
->next
;
3916 curr
->next
= newElmt
;
3920 newElmt
->next
->prev
= newElmt
;
3924 } // ExtKeyUsageSyntax::InsertAfterAndCopy
3927 // remove current element from list if current element is not NULL
3928 // The new current element will be the next element.
3929 // If the current element is the last element in the list
3930 // the second but last element will become the new current element.
3931 void ExtKeyUsageSyntax::RemoveCurrFromList()
3933 AsnListElmt
*del_elmt
;
3941 first
= last
= curr
= NULL
;
3942 else if (curr
== first
)
3944 curr
= first
= first
->next
;
3947 else if (curr
== last
)
3949 curr
= last
= last
->prev
;
3954 curr
->prev
->next
= curr
->next
;
3955 curr
->next
->prev
= curr
->prev
;
3958 delete del_elmt
->elmt
;
3964 AsnLen
ExtKeyUsageSyntax::BEncContent (BUF_TYPE b
)
3966 AsnListElmt
*currElmt
;
3968 AsnLen totalLen
= 0;
3969 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
3971 elmtLen
= currElmt
->elmt
->BEncContent (b
);
3972 elmtLen
+= BEncDefLen (b
, elmtLen
);
3974 elmtLen
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
3975 totalLen
+= elmtLen
;
3978 } // ExtKeyUsageSyntax::BEncContent
3981 void ExtKeyUsageSyntax::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
3982 AsnLen
&bytesDecoded
, ENV_TYPE env
)
3984 KeyPurposeId
*listElmt
;
3986 AsnLen listBytesDecoded
= 0;
3989 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
3991 tag1
= BDecTag (b
, listBytesDecoded
, env
);
3992 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
3994 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
3997 if ((tag1
!= MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
3999 Asn1Error
<< "Unexpected Tag" << endl
;
4000 longjmp (env
, -127);
4003 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
4004 listElmt
= Append();
4005 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
4008 bytesDecoded
+= listBytesDecoded
;
4009 } // ExtKeyUsageSyntax::BDecContent
4012 PrivateKeyUsagePeriod::PrivateKeyUsagePeriod()
4018 PrivateKeyUsagePeriod::PrivateKeyUsagePeriod (const PrivateKeyUsagePeriod
&)
4020 Asn1Error
<< "use of incompletely defined PrivateKeyUsagePeriod::PrivateKeyUsagePeriod (const PrivateKeyUsagePeriod &)" << endl
;
4024 PrivateKeyUsagePeriod::~PrivateKeyUsagePeriod()
4030 AsnType
*PrivateKeyUsagePeriod::Clone() const
4032 return new PrivateKeyUsagePeriod
;
4035 AsnType
*PrivateKeyUsagePeriod::Copy() const
4037 return new PrivateKeyUsagePeriod (*this);
4041 PrivateKeyUsagePeriod
&PrivateKeyUsagePeriod::operator = (const PrivateKeyUsagePeriod
&that
)
4042 #else // SNACC_DEEP_COPY
4043 PrivateKeyUsagePeriod
&PrivateKeyUsagePeriod::operator = (const PrivateKeyUsagePeriod
&)
4044 #endif // SNACC_DEEP_COPY
4052 notBefore
= new GeneralizedTime
;
4053 *notBefore
= *that
.notBefore
;
4063 notAfter
= new GeneralizedTime
;
4064 *notAfter
= *that
.notAfter
;
4074 #else // SNACC_DEEP_COPY
4075 Asn1Error
<< "use of incompletely defined PrivateKeyUsagePeriod &PrivateKeyUsagePeriod::operator = (const PrivateKeyUsagePeriod &)" << endl
;
4077 // if your compiler complains here, check the -novolat option
4078 #endif // SNACC_DEEP_COPY
4082 PrivateKeyUsagePeriod::BEncContent (BUF_TYPE b
)
4084 AsnLen totalLen
= 0;
4087 if (NOT_NULL (notAfter
))
4089 l
= notAfter
->BEncContent (b
);
4090 l
+= BEncDefLen (b
, l
);
4092 l
+= BEncTag1 (b
, CNTX
, PRIM
, 1);
4096 if (NOT_NULL (notBefore
))
4098 l
= notBefore
->BEncContent (b
);
4099 l
+= BEncDefLen (b
, l
);
4101 l
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
4106 } // PrivateKeyUsagePeriod::BEncContent
4109 void PrivateKeyUsagePeriod::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4112 AsnLen seqBytesDecoded
= 0;
4118 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4120 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
4122 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
4123 bytesDecoded
+= seqBytesDecoded
;
4128 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 0))
4129 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0)))
4131 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4132 notBefore
= new GeneralizedTime
;
4133 notBefore
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4134 if (seqBytesDecoded
== elmtLen0
)
4136 bytesDecoded
+= seqBytesDecoded
;
4141 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4143 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
4145 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
4146 bytesDecoded
+= seqBytesDecoded
;
4152 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 1))
4153 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
4155 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4156 notAfter
= new GeneralizedTime
;
4157 notAfter
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4160 bytesDecoded
+= seqBytesDecoded
;
4161 if (elmtLen0
== INDEFINITE_LEN
)
4163 BDecEoc (b
, bytesDecoded
, env
);
4166 else if (seqBytesDecoded
!= elmtLen0
)
4168 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
4169 longjmp (env
, -128);
4173 } // PrivateKeyUsagePeriod::BDecContent
4175 AsnLen
PrivateKeyUsagePeriod::BEnc (BUF_TYPE b
)
4178 l
= BEncContent (b
);
4179 l
+= BEncConsLen (b
, l
);
4180 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4184 void PrivateKeyUsagePeriod::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4189 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
4191 Asn1Error
<< "PrivateKeyUsagePeriod::BDec: ERROR - wrong tag" << endl
;
4192 longjmp (env
, -129);
4194 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
4195 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
4198 int PrivateKeyUsagePeriod::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
4200 bytesEncoded
= BEnc (b
);
4201 return !b
.WriteError();
4204 int PrivateKeyUsagePeriod::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
4210 if ((val
= setjmp (env
)) == 0)
4212 BDec (b
, bytesDecoded
, env
);
4213 return !b
.ReadError();
4219 void PrivateKeyUsagePeriod::Print (ostream
&os
) const
4222 int nonePrinted
= true;
4223 os
<< "{ -- SEQUENCE --" << endl
;
4224 indentG
+= stdIndentG
;
4226 if (NOT_NULL (notBefore
))
4228 nonePrinted
= false;
4229 Indent (os
, indentG
);
4235 Indent (os
, indentG
);
4241 if (NOT_NULL (notAfter
))
4245 nonePrinted
= false;
4246 Indent (os
, indentG
);
4252 Indent (os
, indentG
);
4259 indentG
-= stdIndentG
;
4260 Indent (os
, indentG
);
4263 } // PrivateKeyUsagePeriod::Print
4266 AsnType
*PolicyMappingsSyntax::Clone() const
4268 return new PolicyMappingsSyntax
;
4271 AsnType
*PolicyMappingsSyntax::Copy() const
4273 return new PolicyMappingsSyntax (*this);
4276 AsnLen
PolicyMappingsSyntax::BEnc (BUF_TYPE b
)
4279 l
= BEncContent (b
);
4280 l
+= BEncConsLen (b
, l
);
4281 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4285 void PolicyMappingsSyntax::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4290 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
4292 Asn1Error
<< "PolicyMappingsSyntax::BDec: ERROR - wrong tag" << endl
;
4293 longjmp (env
, -130);
4295 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
4296 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
4299 PolicyMappingsSyntax::PolicyMappingsSyntax (const PolicyMappingsSyntax
&)
4301 Asn1Error
<< "use of incompletely defined PolicyMappingsSyntax::PolicyMappingsSyntax (const PolicyMappingsSyntax &)" << endl
;
4305 PolicyMappingsSyntax::~PolicyMappingsSyntax()
4308 for (; Curr() != NULL
; RemoveCurrFromList())
4310 } // end of destructor
4313 PolicyMappingsSyntax
&PolicyMappingsSyntax::operator = (const PolicyMappingsSyntax
&that
)
4314 #else // SNACC_DEEP_COPY
4315 PolicyMappingsSyntax
&PolicyMappingsSyntax::operator = (const PolicyMappingsSyntax
&)
4316 #endif // SNACC_DEEP_COPY
4322 for (; Curr(); RemoveCurrFromList())
4325 //that.SetCurrToFirst();
4326 //for (; that.Curr(); that.GoNext())
4327 // AppendCopy (*that.Curr());
4328 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
4329 AppendCopy (*run
->elmt
);
4333 #else // SNACC_DEEP_COPY
4334 Asn1Error
<< "use of incompletely defined PolicyMappingsSyntax &PolicyMappingsSyntax::operator = (const PolicyMappingsSyntax &)" << endl
;
4336 // if your compiler complains here, check the -novolat option
4337 #endif // SNACC_DEEP_COPY
4340 void PolicyMappingsSyntax::Print (ostream
&os
) const
4343 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
4344 indentG
+= stdIndentG
;
4346 //for (; Curr() != NULL; GoNext())
4347 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
4349 Indent (os
, indentG
);
4352 //if (Curr() != Last())
4357 indentG
-= stdIndentG
;
4358 Indent (os
, indentG
);
4366 void PolicyMappingsSyntax::SetCurrElmt (unsigned long int index
)
4368 unsigned long int i
;
4371 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
4373 } // PolicyMappingsSyntax::SetCurrElmt
4376 unsigned long int PolicyMappingsSyntax::GetCurrElmtIndex()
4378 unsigned long int i
;
4382 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
4391 } // PolicyMappingsSyntax::GetCurrElmtIndex
4394 // alloc new list elmt, put at end of list
4395 // and return the component type
4396 PolicyMappingsSyntaxSeq
*PolicyMappingsSyntax::Append()
4398 AsnListElmt
*newElmt
;
4399 newElmt
= new AsnListElmt
;
4400 newElmt
->elmt
= new PolicyMappingsSyntaxSeq
;
4401 newElmt
->next
= NULL
;
4404 newElmt
->prev
= NULL
;
4405 first
= last
= newElmt
;
4409 newElmt
->prev
= last
;
4410 last
->next
= newElmt
;
4414 return (curr
= newElmt
)->elmt
;
4415 } // PolicyMappingsSyntax::Append
4418 // alloc new list elmt, put at begining of list
4419 // and return the component type
4420 PolicyMappingsSyntaxSeq
*PolicyMappingsSyntax::Prepend()
4422 AsnListElmt
*newElmt
;
4423 newElmt
= new AsnListElmt
;
4424 newElmt
->elmt
= new PolicyMappingsSyntaxSeq
;
4425 newElmt
->prev
= NULL
;
4428 newElmt
->next
= NULL
;
4429 first
= last
= newElmt
;
4433 newElmt
->next
= first
;
4434 first
->prev
= newElmt
;
4438 return (curr
= newElmt
)->elmt
;
4439 } // PolicyMappingsSyntax::Prepend
4442 // alloc new list elmt, insert it before the
4443 // current element and return the component type
4444 // if the current element is null, the new element
4445 // is placed at the beginning of the list.
4446 PolicyMappingsSyntaxSeq
*PolicyMappingsSyntax::InsertBefore()
4448 AsnListElmt
*newElmt
;
4449 newElmt
= new AsnListElmt
;
4450 newElmt
->elmt
= new PolicyMappingsSyntaxSeq
;
4453 newElmt
->next
= first
;
4454 newElmt
->prev
= NULL
;
4461 newElmt
->next
= curr
;
4462 newElmt
->prev
= curr
->prev
;
4463 curr
->prev
= newElmt
;
4467 newElmt
->prev
->next
= newElmt
;
4470 return (curr
= newElmt
)->elmt
;
4471 } // PolicyMappingsSyntax::InsertBefore
4474 // alloc new list elmt, insert it after the
4475 // current element and return the component type
4476 // if the current element is null, the new element
4477 // is placed at the end of the list.
4478 PolicyMappingsSyntaxSeq
*PolicyMappingsSyntax::InsertAfter()
4480 AsnListElmt
*newElmt
;
4481 newElmt
= new AsnListElmt
;
4482 newElmt
->elmt
= new PolicyMappingsSyntaxSeq
;
4485 newElmt
->prev
= last
;
4486 newElmt
->next
= NULL
;
4493 newElmt
->prev
= curr
;
4494 newElmt
->next
= curr
->next
;
4495 curr
->next
= newElmt
;
4499 newElmt
->next
->prev
= newElmt
;
4502 return (curr
= newElmt
)->elmt
;
4503 } // PolicyMappingsSyntax::InsertAfter
4506 PolicyMappingsSyntax
&PolicyMappingsSyntax::AppendCopy (PolicyMappingsSyntaxSeq
&elmt
)
4508 AsnListElmt
*newElmt
;
4509 newElmt
= new AsnListElmt
;
4510 newElmt
->elmt
= new PolicyMappingsSyntaxSeq
;
4511 *newElmt
->elmt
= elmt
;
4512 newElmt
->next
= NULL
;
4515 newElmt
->prev
= NULL
;
4516 first
= last
= newElmt
;
4520 newElmt
->prev
= last
;
4521 last
->next
= newElmt
;
4529 PolicyMappingsSyntax
&PolicyMappingsSyntax::PrependCopy (PolicyMappingsSyntaxSeq
&elmt
)
4531 AsnListElmt
*newElmt
;
4532 newElmt
= new AsnListElmt
;
4533 newElmt
->elmt
= new PolicyMappingsSyntaxSeq
;
4534 *newElmt
->elmt
= elmt
;
4535 newElmt
->prev
= NULL
;
4538 newElmt
->next
= NULL
;
4539 first
= last
= newElmt
;
4543 newElmt
->next
= first
;
4544 first
->prev
= newElmt
;
4549 } // PolicyMappingsSyntax::PrependCopy
4552 // alloc new list elmt, insert it before the
4553 // current element, copy the given elmt into the new elmt
4554 // and return the component type.
4555 // if the current element is null, the new element
4556 // is placed at the beginning of the list.
4557 PolicyMappingsSyntax
&PolicyMappingsSyntax::InsertBeforeAndCopy (PolicyMappingsSyntaxSeq
&elmt
)
4559 AsnListElmt
*newElmt
;
4561 newElmt
= new AsnListElmt
;
4562 newElmt
->elmt
= new PolicyMappingsSyntaxSeq
;
4563 *newElmt
->elmt
= elmt
;
4567 newElmt
->next
= first
;
4568 newElmt
->prev
= NULL
;
4575 newElmt
->next
= curr
;
4576 newElmt
->prev
= curr
->prev
;
4577 curr
->prev
= newElmt
;
4581 newElmt
->prev
->next
= newElmt
;
4585 } // PolicyMappingsSyntax::InsertBeforeAndCopy
4588 // alloc new list elmt, insert it after the
4589 // current element, copy given elmt in to new elmt
4590 // and return the component type
4591 // if the current element is null, the new element
4592 // is placed at the end of the list.
4593 PolicyMappingsSyntax
&PolicyMappingsSyntax::InsertAfterAndCopy (PolicyMappingsSyntaxSeq
&elmt
)
4595 AsnListElmt
*newElmt
;
4597 newElmt
= new AsnListElmt
;
4598 newElmt
->elmt
= new PolicyMappingsSyntaxSeq
;
4599 *newElmt
->elmt
= elmt
;
4602 newElmt
->prev
= last
;
4603 newElmt
->next
= NULL
;
4610 newElmt
->prev
= curr
;
4611 newElmt
->next
= curr
->next
;
4612 curr
->next
= newElmt
;
4616 newElmt
->next
->prev
= newElmt
;
4620 } // PolicyMappingsSyntax::InsertAfterAndCopy
4623 // remove current element from list if current element is not NULL
4624 // The new current element will be the next element.
4625 // If the current element is the last element in the list
4626 // the second but last element will become the new current element.
4627 void PolicyMappingsSyntax::RemoveCurrFromList()
4629 AsnListElmt
*del_elmt
;
4637 first
= last
= curr
= NULL
;
4638 else if (curr
== first
)
4640 curr
= first
= first
->next
;
4643 else if (curr
== last
)
4645 curr
= last
= last
->prev
;
4650 curr
->prev
->next
= curr
->next
;
4651 curr
->next
->prev
= curr
->prev
;
4654 delete del_elmt
->elmt
;
4660 AsnLen
PolicyMappingsSyntax::BEncContent (BUF_TYPE b
)
4662 AsnListElmt
*currElmt
;
4664 AsnLen totalLen
= 0;
4665 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
4668 elmtLen
= currElmt
->elmt
->BEncContent (b
);
4669 elmtLen
+= BEncConsLen (b
, elmtLen
);
4671 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4672 totalLen
+= elmtLen
;
4675 } // PolicyMappingsSyntax::BEncContent
4678 void PolicyMappingsSyntax::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
4679 AsnLen
&bytesDecoded
, ENV_TYPE env
)
4681 PolicyMappingsSyntaxSeq
*listElmt
;
4683 AsnLen listBytesDecoded
= 0;
4686 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
4688 tag1
= BDecTag (b
, listBytesDecoded
, env
);
4689 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
4691 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
4694 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
4696 Asn1Error
<< "Unexpected Tag" << endl
;
4697 longjmp (env
, -131);
4700 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
4701 listElmt
= Append();
4702 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
4705 bytesDecoded
+= listBytesDecoded
;
4706 } // PolicyMappingsSyntax::BDecContent
4709 SupportedAlgorithm::SupportedAlgorithm()
4712 algorithmIdentifier
= new AlgorithmIdentifier
;
4714 algorithmIdentifier
= NULL
; // incomplete initialization of mandatory element!
4716 intendedUsage
= NULL
;
4717 intendedCertificatePolicies
= NULL
;
4720 SupportedAlgorithm::SupportedAlgorithm (const SupportedAlgorithm
&)
4722 Asn1Error
<< "use of incompletely defined SupportedAlgorithm::SupportedAlgorithm (const SupportedAlgorithm &)" << endl
;
4726 SupportedAlgorithm::~SupportedAlgorithm()
4728 delete algorithmIdentifier
;
4729 delete intendedUsage
;
4730 delete intendedCertificatePolicies
;
4733 AsnType
*SupportedAlgorithm::Clone() const
4735 return new SupportedAlgorithm
;
4738 AsnType
*SupportedAlgorithm::Copy() const
4740 return new SupportedAlgorithm (*this);
4744 SupportedAlgorithm
&SupportedAlgorithm::operator = (const SupportedAlgorithm
&that
)
4745 #else // SNACC_DEEP_COPY
4746 SupportedAlgorithm
&SupportedAlgorithm::operator = (const SupportedAlgorithm
&)
4747 #endif // SNACC_DEEP_COPY
4752 if (that
.algorithmIdentifier
)
4754 if (!algorithmIdentifier
)
4755 algorithmIdentifier
= new AlgorithmIdentifier
;
4756 *algorithmIdentifier
= *that
.algorithmIdentifier
;
4760 delete algorithmIdentifier
;
4761 algorithmIdentifier
= NULL
;
4763 if (that
.intendedUsage
)
4766 intendedUsage
= new KeyUsage
;
4767 *intendedUsage
= *that
.intendedUsage
;
4771 delete intendedUsage
;
4772 intendedUsage
= NULL
;
4774 if (that
.intendedCertificatePolicies
)
4776 if (!intendedCertificatePolicies
)
4777 intendedCertificatePolicies
= new CertificatePoliciesSyntax
;
4778 *intendedCertificatePolicies
= *that
.intendedCertificatePolicies
;
4782 delete intendedCertificatePolicies
;
4783 intendedCertificatePolicies
= NULL
;
4788 #else // SNACC_DEEP_COPY
4789 Asn1Error
<< "use of incompletely defined SupportedAlgorithm &SupportedAlgorithm::operator = (const SupportedAlgorithm &)" << endl
;
4791 // if your compiler complains here, check the -novolat option
4792 #endif // SNACC_DEEP_COPY
4796 SupportedAlgorithm::BEncContent (BUF_TYPE b
)
4798 AsnLen totalLen
= 0;
4801 if (NOT_NULL (intendedCertificatePolicies
))
4804 l
= intendedCertificatePolicies
->BEncContent (b
);
4805 l
+= BEncConsLen (b
, l
);
4807 l
+= BEncTag1 (b
, CNTX
, CONS
, 1);
4811 if (NOT_NULL (intendedUsage
))
4813 l
= intendedUsage
->BEncContent (b
);
4814 l
+= BEncDefLen (b
, l
);
4816 l
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
4821 l
= algorithmIdentifier
->BEncContent (b
);
4822 l
+= BEncConsLen (b
, l
);
4824 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4828 } // SupportedAlgorithm::BEncContent
4831 void SupportedAlgorithm::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4834 AsnLen seqBytesDecoded
= 0;
4836 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4838 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
4840 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4841 algorithmIdentifier
= new AlgorithmIdentifier
;
4842 algorithmIdentifier
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4843 if (seqBytesDecoded
== elmtLen0
)
4845 bytesDecoded
+= seqBytesDecoded
;
4850 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4852 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
4854 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
4855 bytesDecoded
+= seqBytesDecoded
;
4862 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
4863 longjmp (env
, -132);
4866 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 0))
4867 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0)))
4869 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4870 intendedUsage
= new KeyUsage
;
4871 intendedUsage
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4872 if (seqBytesDecoded
== elmtLen0
)
4874 bytesDecoded
+= seqBytesDecoded
;
4879 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4881 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
4883 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
4884 bytesDecoded
+= seqBytesDecoded
;
4890 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
4892 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4893 intendedCertificatePolicies
= new CertificatePoliciesSyntax
;
4894 intendedCertificatePolicies
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4897 bytesDecoded
+= seqBytesDecoded
;
4898 if (elmtLen0
== INDEFINITE_LEN
)
4900 BDecEoc (b
, bytesDecoded
, env
);
4903 else if (seqBytesDecoded
!= elmtLen0
)
4905 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
4906 longjmp (env
, -133);
4910 } // SupportedAlgorithm::BDecContent
4912 AsnLen
SupportedAlgorithm::BEnc (BUF_TYPE b
)
4915 l
= BEncContent (b
);
4916 l
+= BEncConsLen (b
, l
);
4917 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4921 void SupportedAlgorithm::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4926 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
4928 Asn1Error
<< "SupportedAlgorithm::BDec: ERROR - wrong tag" << endl
;
4929 longjmp (env
, -134);
4931 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
4932 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
4935 int SupportedAlgorithm::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
4937 bytesEncoded
= BEnc (b
);
4938 return !b
.WriteError();
4941 int SupportedAlgorithm::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
4947 if ((val
= setjmp (env
)) == 0)
4949 BDec (b
, bytesDecoded
, env
);
4950 return !b
.ReadError();
4956 void SupportedAlgorithm::Print (ostream
&os
) const
4959 os
<< "{ -- SEQUENCE --" << endl
;
4960 indentG
+= stdIndentG
;
4962 if (NOT_NULL (algorithmIdentifier
))
4964 Indent (os
, indentG
);
4965 os
<< "algorithmIdentifier ";
4966 os
<< *algorithmIdentifier
;
4970 Indent (os
, indentG
);
4971 os
<< "algorithmIdentifier ";
4976 if (NOT_NULL (intendedUsage
))
4979 Indent (os
, indentG
);
4980 os
<< "intendedUsage ";
4981 os
<< *intendedUsage
;
4985 Indent (os
, indentG
);
4986 os
<< "intendedUsage ";
4991 if (NOT_NULL (intendedCertificatePolicies
))
4994 Indent (os
, indentG
);
4995 os
<< "intendedCertificatePolicies ";
4996 os
<< *intendedCertificatePolicies
;
5000 Indent (os
, indentG
);
5001 os
<< "intendedCertificatePolicies ";
5007 indentG
-= stdIndentG
;
5008 Indent (os
, indentG
);
5011 } // SupportedAlgorithm::Print
5014 BasicConstraintsSyntax::BasicConstraintsSyntax()
5017 pathLenConstraint
= NULL
;
5020 BasicConstraintsSyntax::BasicConstraintsSyntax (const BasicConstraintsSyntax
&)
5022 Asn1Error
<< "use of incompletely defined BasicConstraintsSyntax::BasicConstraintsSyntax (const BasicConstraintsSyntax &)" << endl
;
5026 BasicConstraintsSyntax::~BasicConstraintsSyntax()
5029 delete pathLenConstraint
;
5032 AsnType
*BasicConstraintsSyntax::Clone() const
5034 return new BasicConstraintsSyntax
;
5037 AsnType
*BasicConstraintsSyntax::Copy() const
5039 return new BasicConstraintsSyntax (*this);
5043 BasicConstraintsSyntax
&BasicConstraintsSyntax::operator = (const BasicConstraintsSyntax
&that
)
5044 #else // SNACC_DEEP_COPY
5045 BasicConstraintsSyntax
&BasicConstraintsSyntax::operator = (const BasicConstraintsSyntax
&)
5046 #endif // SNACC_DEEP_COPY
5062 if (that
.pathLenConstraint
)
5064 if (!pathLenConstraint
)
5065 pathLenConstraint
= new AsnInt
;
5066 *pathLenConstraint
= *that
.pathLenConstraint
;
5070 delete pathLenConstraint
;
5071 pathLenConstraint
= NULL
;
5076 #else // SNACC_DEEP_COPY
5077 Asn1Error
<< "use of incompletely defined BasicConstraintsSyntax &BasicConstraintsSyntax::operator = (const BasicConstraintsSyntax &)" << endl
;
5079 // if your compiler complains here, check the -novolat option
5080 #endif // SNACC_DEEP_COPY
5084 BasicConstraintsSyntax::BEncContent (BUF_TYPE b
)
5086 AsnLen totalLen
= 0;
5089 if (NOT_NULL (pathLenConstraint
))
5091 l
= pathLenConstraint
->BEncContent (b
);
5092 BEncDefLenTo127 (b
, l
);
5095 l
+= BEncTag1 (b
, UNIV
, PRIM
, INTEGER_TAG_CODE
);
5101 l
= cA
->BEncContent (b
);
5102 BEncDefLenTo127 (b
, l
);
5105 l
+= BEncTag1 (b
, UNIV
, PRIM
, BOOLEAN_TAG_CODE
);
5110 } // BasicConstraintsSyntax::BEncContent
5113 void BasicConstraintsSyntax::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5116 AsnLen seqBytesDecoded
= 0;
5122 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5124 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
5126 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
5127 bytesDecoded
+= seqBytesDecoded
;
5132 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, BOOLEAN_TAG_CODE
)))
5134 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5136 cA
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5137 if (seqBytesDecoded
== elmtLen0
)
5139 bytesDecoded
+= seqBytesDecoded
;
5144 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5146 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
5148 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
5149 bytesDecoded
+= seqBytesDecoded
;
5155 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
)))
5157 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5158 pathLenConstraint
= new AsnInt
;
5159 pathLenConstraint
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5162 bytesDecoded
+= seqBytesDecoded
;
5163 if (elmtLen0
== INDEFINITE_LEN
)
5165 BDecEoc (b
, bytesDecoded
, env
);
5168 else if (seqBytesDecoded
!= elmtLen0
)
5170 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
5171 longjmp (env
, -135);
5175 } // BasicConstraintsSyntax::BDecContent
5177 AsnLen
BasicConstraintsSyntax::BEnc (BUF_TYPE b
)
5180 l
= BEncContent (b
);
5181 l
+= BEncConsLen (b
, l
);
5182 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5186 void BasicConstraintsSyntax::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5191 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
5193 Asn1Error
<< "BasicConstraintsSyntax::BDec: ERROR - wrong tag" << endl
;
5194 longjmp (env
, -136);
5196 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
5197 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
5200 int BasicConstraintsSyntax::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
5202 bytesEncoded
= BEnc (b
);
5203 return !b
.WriteError();
5206 int BasicConstraintsSyntax::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
5212 if ((val
= setjmp (env
)) == 0)
5214 BDec (b
, bytesDecoded
, env
);
5215 return !b
.ReadError();
5221 void BasicConstraintsSyntax::Print (ostream
&os
) const
5224 int nonePrinted
= true;
5225 os
<< "{ -- SEQUENCE --" << endl
;
5226 indentG
+= stdIndentG
;
5230 nonePrinted
= false;
5231 Indent (os
, indentG
);
5237 Indent (os
, indentG
);
5243 if (NOT_NULL (pathLenConstraint
))
5247 nonePrinted
= false;
5248 Indent (os
, indentG
);
5249 os
<< "pathLenConstraint ";
5250 os
<< *pathLenConstraint
;
5254 Indent (os
, indentG
);
5255 os
<< "pathLenConstraint ";
5261 indentG
-= stdIndentG
;
5262 Indent (os
, indentG
);
5265 } // BasicConstraintsSyntax::Print
5268 NameConstraintsSyntax::NameConstraintsSyntax()
5270 permittedSubtrees
= NULL
;
5271 excludedSubtrees
= NULL
;
5274 NameConstraintsSyntax::NameConstraintsSyntax (const NameConstraintsSyntax
&)
5276 Asn1Error
<< "use of incompletely defined NameConstraintsSyntax::NameConstraintsSyntax (const NameConstraintsSyntax &)" << endl
;
5280 NameConstraintsSyntax::~NameConstraintsSyntax()
5282 delete permittedSubtrees
;
5283 delete excludedSubtrees
;
5286 AsnType
*NameConstraintsSyntax::Clone() const
5288 return new NameConstraintsSyntax
;
5291 AsnType
*NameConstraintsSyntax::Copy() const
5293 return new NameConstraintsSyntax (*this);
5297 NameConstraintsSyntax
&NameConstraintsSyntax::operator = (const NameConstraintsSyntax
&that
)
5298 #else // SNACC_DEEP_COPY
5299 NameConstraintsSyntax
&NameConstraintsSyntax::operator = (const NameConstraintsSyntax
&)
5300 #endif // SNACC_DEEP_COPY
5305 if (that
.permittedSubtrees
)
5307 if (!permittedSubtrees
)
5308 permittedSubtrees
= new GeneralSubtrees
;
5309 *permittedSubtrees
= *that
.permittedSubtrees
;
5313 delete permittedSubtrees
;
5314 permittedSubtrees
= NULL
;
5316 if (that
.excludedSubtrees
)
5318 if (!excludedSubtrees
)
5319 excludedSubtrees
= new GeneralSubtrees
;
5320 *excludedSubtrees
= *that
.excludedSubtrees
;
5324 delete excludedSubtrees
;
5325 excludedSubtrees
= NULL
;
5330 #else // SNACC_DEEP_COPY
5331 Asn1Error
<< "use of incompletely defined NameConstraintsSyntax &NameConstraintsSyntax::operator = (const NameConstraintsSyntax &)" << endl
;
5333 // if your compiler complains here, check the -novolat option
5334 #endif // SNACC_DEEP_COPY
5338 NameConstraintsSyntax::BEncContent (BUF_TYPE b
)
5340 AsnLen totalLen
= 0;
5343 if (NOT_NULL (excludedSubtrees
))
5346 l
= excludedSubtrees
->BEncContent (b
);
5347 l
+= BEncConsLen (b
, l
);
5349 l
+= BEncTag1 (b
, CNTX
, CONS
, 1);
5353 if (NOT_NULL (permittedSubtrees
))
5356 l
= permittedSubtrees
->BEncContent (b
);
5357 l
+= BEncConsLen (b
, l
);
5359 l
+= BEncTag1 (b
, CNTX
, CONS
, 0);
5364 } // NameConstraintsSyntax::BEncContent
5367 void NameConstraintsSyntax::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5370 AsnLen seqBytesDecoded
= 0;
5376 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5378 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
5380 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
5381 bytesDecoded
+= seqBytesDecoded
;
5386 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0)))
5388 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5389 permittedSubtrees
= new GeneralSubtrees
;
5390 permittedSubtrees
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5391 if (seqBytesDecoded
== elmtLen0
)
5393 bytesDecoded
+= seqBytesDecoded
;
5398 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5400 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
5402 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
5403 bytesDecoded
+= seqBytesDecoded
;
5409 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
5411 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5412 excludedSubtrees
= new GeneralSubtrees
;
5413 excludedSubtrees
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5416 bytesDecoded
+= seqBytesDecoded
;
5417 if (elmtLen0
== INDEFINITE_LEN
)
5419 BDecEoc (b
, bytesDecoded
, env
);
5422 else if (seqBytesDecoded
!= elmtLen0
)
5424 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
5425 longjmp (env
, -137);
5429 } // NameConstraintsSyntax::BDecContent
5431 AsnLen
NameConstraintsSyntax::BEnc (BUF_TYPE b
)
5434 l
= BEncContent (b
);
5435 l
+= BEncConsLen (b
, l
);
5436 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5440 void NameConstraintsSyntax::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5445 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
5447 Asn1Error
<< "NameConstraintsSyntax::BDec: ERROR - wrong tag" << endl
;
5448 longjmp (env
, -138);
5450 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
5451 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
5454 int NameConstraintsSyntax::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
5456 bytesEncoded
= BEnc (b
);
5457 return !b
.WriteError();
5460 int NameConstraintsSyntax::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
5466 if ((val
= setjmp (env
)) == 0)
5468 BDec (b
, bytesDecoded
, env
);
5469 return !b
.ReadError();
5475 void NameConstraintsSyntax::Print (ostream
&os
) const
5478 int nonePrinted
= true;
5479 os
<< "{ -- SEQUENCE --" << endl
;
5480 indentG
+= stdIndentG
;
5482 if (NOT_NULL (permittedSubtrees
))
5484 nonePrinted
= false;
5485 Indent (os
, indentG
);
5486 os
<< "permittedSubtrees ";
5487 os
<< *permittedSubtrees
;
5491 Indent (os
, indentG
);
5492 os
<< "permittedSubtrees ";
5497 if (NOT_NULL (excludedSubtrees
))
5501 nonePrinted
= false;
5502 Indent (os
, indentG
);
5503 os
<< "excludedSubtrees ";
5504 os
<< *excludedSubtrees
;
5508 Indent (os
, indentG
);
5509 os
<< "excludedSubtrees ";
5515 indentG
-= stdIndentG
;
5516 Indent (os
, indentG
);
5519 } // NameConstraintsSyntax::Print
5522 PolicyConstraintsSyntax::PolicyConstraintsSyntax()
5524 requireExplicitPolicy
= NULL
;
5525 inhibitPolicyMapping
= NULL
;
5528 PolicyConstraintsSyntax::PolicyConstraintsSyntax (const PolicyConstraintsSyntax
&)
5530 Asn1Error
<< "use of incompletely defined PolicyConstraintsSyntax::PolicyConstraintsSyntax (const PolicyConstraintsSyntax &)" << endl
;
5534 PolicyConstraintsSyntax::~PolicyConstraintsSyntax()
5536 delete requireExplicitPolicy
;
5537 delete inhibitPolicyMapping
;
5540 AsnType
*PolicyConstraintsSyntax::Clone() const
5542 return new PolicyConstraintsSyntax
;
5545 AsnType
*PolicyConstraintsSyntax::Copy() const
5547 return new PolicyConstraintsSyntax (*this);
5551 PolicyConstraintsSyntax
&PolicyConstraintsSyntax::operator = (const PolicyConstraintsSyntax
&that
)
5552 #else // SNACC_DEEP_COPY
5553 PolicyConstraintsSyntax
&PolicyConstraintsSyntax::operator = (const PolicyConstraintsSyntax
&)
5554 #endif // SNACC_DEEP_COPY
5559 if (that
.requireExplicitPolicy
)
5561 if (!requireExplicitPolicy
)
5562 requireExplicitPolicy
= new SkipCerts
;
5563 *requireExplicitPolicy
= *that
.requireExplicitPolicy
;
5567 delete requireExplicitPolicy
;
5568 requireExplicitPolicy
= NULL
;
5570 if (that
.inhibitPolicyMapping
)
5572 if (!inhibitPolicyMapping
)
5573 inhibitPolicyMapping
= new SkipCerts
;
5574 *inhibitPolicyMapping
= *that
.inhibitPolicyMapping
;
5578 delete inhibitPolicyMapping
;
5579 inhibitPolicyMapping
= NULL
;
5584 #else // SNACC_DEEP_COPY
5585 Asn1Error
<< "use of incompletely defined PolicyConstraintsSyntax &PolicyConstraintsSyntax::operator = (const PolicyConstraintsSyntax &)" << endl
;
5587 // if your compiler complains here, check the -novolat option
5588 #endif // SNACC_DEEP_COPY
5592 PolicyConstraintsSyntax::BEncContent (BUF_TYPE b
)
5594 AsnLen totalLen
= 0;
5597 if (NOT_NULL (inhibitPolicyMapping
))
5599 l
= inhibitPolicyMapping
->BEncContent (b
);
5600 BEncDefLenTo127 (b
, l
);
5603 l
+= BEncTag1 (b
, CNTX
, PRIM
, 1);
5607 if (NOT_NULL (requireExplicitPolicy
))
5609 l
= requireExplicitPolicy
->BEncContent (b
);
5610 BEncDefLenTo127 (b
, l
);
5613 l
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
5618 } // PolicyConstraintsSyntax::BEncContent
5621 void PolicyConstraintsSyntax::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5624 AsnLen seqBytesDecoded
= 0;
5630 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5632 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
5634 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
5635 bytesDecoded
+= seqBytesDecoded
;
5640 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 0)))
5642 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5643 requireExplicitPolicy
= new SkipCerts
;
5644 requireExplicitPolicy
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5645 if (seqBytesDecoded
== elmtLen0
)
5647 bytesDecoded
+= seqBytesDecoded
;
5652 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5654 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
5656 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
5657 bytesDecoded
+= seqBytesDecoded
;
5663 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 1)))
5665 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5666 inhibitPolicyMapping
= new SkipCerts
;
5667 inhibitPolicyMapping
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5670 bytesDecoded
+= seqBytesDecoded
;
5671 if (elmtLen0
== INDEFINITE_LEN
)
5673 BDecEoc (b
, bytesDecoded
, env
);
5676 else if (seqBytesDecoded
!= elmtLen0
)
5678 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
5679 longjmp (env
, -139);
5683 } // PolicyConstraintsSyntax::BDecContent
5685 AsnLen
PolicyConstraintsSyntax::BEnc (BUF_TYPE b
)
5688 l
= BEncContent (b
);
5689 l
+= BEncConsLen (b
, l
);
5690 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5694 void PolicyConstraintsSyntax::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5699 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
5701 Asn1Error
<< "PolicyConstraintsSyntax::BDec: ERROR - wrong tag" << endl
;
5702 longjmp (env
, -140);
5704 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
5705 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
5708 int PolicyConstraintsSyntax::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
5710 bytesEncoded
= BEnc (b
);
5711 return !b
.WriteError();
5714 int PolicyConstraintsSyntax::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
5720 if ((val
= setjmp (env
)) == 0)
5722 BDec (b
, bytesDecoded
, env
);
5723 return !b
.ReadError();
5729 void PolicyConstraintsSyntax::Print (ostream
&os
) const
5732 int nonePrinted
= true;
5733 os
<< "{ -- SEQUENCE --" << endl
;
5734 indentG
+= stdIndentG
;
5736 if (NOT_NULL (requireExplicitPolicy
))
5738 nonePrinted
= false;
5739 Indent (os
, indentG
);
5740 os
<< "requireExplicitPolicy ";
5741 os
<< *requireExplicitPolicy
;
5745 Indent (os
, indentG
);
5746 os
<< "requireExplicitPolicy ";
5751 if (NOT_NULL (inhibitPolicyMapping
))
5755 nonePrinted
= false;
5756 Indent (os
, indentG
);
5757 os
<< "inhibitPolicyMapping ";
5758 os
<< *inhibitPolicyMapping
;
5762 Indent (os
, indentG
);
5763 os
<< "inhibitPolicyMapping ";
5769 indentG
-= stdIndentG
;
5770 Indent (os
, indentG
);
5773 } // PolicyConstraintsSyntax::Print
5776 AsnType
*CertPolicySet::Clone() const
5778 return new CertPolicySet
;
5781 AsnType
*CertPolicySet::Copy() const
5783 return new CertPolicySet (*this);
5786 AsnLen
CertPolicySet::BEnc (BUF_TYPE b
)
5789 l
= BEncContent (b
);
5790 l
+= BEncConsLen (b
, l
);
5791 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5795 void CertPolicySet::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5800 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
5802 Asn1Error
<< "CertPolicySet::BDec: ERROR - wrong tag" << endl
;
5803 longjmp (env
, -141);
5805 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
5806 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
5809 CertPolicySet::CertPolicySet (const CertPolicySet
&)
5811 Asn1Error
<< "use of incompletely defined CertPolicySet::CertPolicySet (const CertPolicySet &)" << endl
;
5815 CertPolicySet::~CertPolicySet()
5818 for (; Curr() != NULL
; RemoveCurrFromList())
5820 } // end of destructor
5823 CertPolicySet
&CertPolicySet::operator = (const CertPolicySet
&that
)
5824 #else // SNACC_DEEP_COPY
5825 CertPolicySet
&CertPolicySet::operator = (const CertPolicySet
&)
5826 #endif // SNACC_DEEP_COPY
5832 for (; Curr(); RemoveCurrFromList())
5835 //that.SetCurrToFirst();
5836 //for (; that.Curr(); that.GoNext())
5837 // AppendCopy (*that.Curr());
5838 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
5839 AppendCopy (*run
->elmt
);
5843 #else // SNACC_DEEP_COPY
5844 Asn1Error
<< "use of incompletely defined CertPolicySet &CertPolicySet::operator = (const CertPolicySet &)" << endl
;
5846 // if your compiler complains here, check the -novolat option
5847 #endif // SNACC_DEEP_COPY
5850 void CertPolicySet::Print (ostream
&os
) const
5853 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
5854 indentG
+= stdIndentG
;
5856 //for (; Curr() != NULL; GoNext())
5857 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
5859 Indent (os
, indentG
);
5862 //if (Curr() != Last())
5867 indentG
-= stdIndentG
;
5868 Indent (os
, indentG
);
5876 void CertPolicySet::SetCurrElmt (unsigned long int index
)
5878 unsigned long int i
;
5881 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
5883 } // CertPolicySet::SetCurrElmt
5886 unsigned long int CertPolicySet::GetCurrElmtIndex()
5888 unsigned long int i
;
5892 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
5901 } // CertPolicySet::GetCurrElmtIndex
5904 // alloc new list elmt, put at end of list
5905 // and return the component type
5906 CertPolicyId
*CertPolicySet::Append()
5908 AsnListElmt
*newElmt
;
5909 newElmt
= new AsnListElmt
;
5910 newElmt
->elmt
= new CertPolicyId
;
5911 newElmt
->next
= NULL
;
5914 newElmt
->prev
= NULL
;
5915 first
= last
= newElmt
;
5919 newElmt
->prev
= last
;
5920 last
->next
= newElmt
;
5924 return (curr
= newElmt
)->elmt
;
5925 } // CertPolicySet::Append
5928 // alloc new list elmt, put at begining of list
5929 // and return the component type
5930 CertPolicyId
*CertPolicySet::Prepend()
5932 AsnListElmt
*newElmt
;
5933 newElmt
= new AsnListElmt
;
5934 newElmt
->elmt
= new CertPolicyId
;
5935 newElmt
->prev
= NULL
;
5938 newElmt
->next
= NULL
;
5939 first
= last
= newElmt
;
5943 newElmt
->next
= first
;
5944 first
->prev
= newElmt
;
5948 return (curr
= newElmt
)->elmt
;
5949 } // CertPolicySet::Prepend
5952 // alloc new list elmt, insert it before the
5953 // current element and return the component type
5954 // if the current element is null, the new element
5955 // is placed at the beginning of the list.
5956 CertPolicyId
*CertPolicySet::InsertBefore()
5958 AsnListElmt
*newElmt
;
5959 newElmt
= new AsnListElmt
;
5960 newElmt
->elmt
= new CertPolicyId
;
5963 newElmt
->next
= first
;
5964 newElmt
->prev
= NULL
;
5971 newElmt
->next
= curr
;
5972 newElmt
->prev
= curr
->prev
;
5973 curr
->prev
= newElmt
;
5977 newElmt
->prev
->next
= newElmt
;
5980 return (curr
= newElmt
)->elmt
;
5981 } // CertPolicySet::InsertBefore
5984 // alloc new list elmt, insert it after the
5985 // current element and return the component type
5986 // if the current element is null, the new element
5987 // is placed at the end of the list.
5988 CertPolicyId
*CertPolicySet::InsertAfter()
5990 AsnListElmt
*newElmt
;
5991 newElmt
= new AsnListElmt
;
5992 newElmt
->elmt
= new CertPolicyId
;
5995 newElmt
->prev
= last
;
5996 newElmt
->next
= NULL
;
6003 newElmt
->prev
= curr
;
6004 newElmt
->next
= curr
->next
;
6005 curr
->next
= newElmt
;
6009 newElmt
->next
->prev
= newElmt
;
6012 return (curr
= newElmt
)->elmt
;
6013 } // CertPolicySet::InsertAfter
6016 CertPolicySet
&CertPolicySet::AppendCopy (CertPolicyId
&elmt
)
6018 AsnListElmt
*newElmt
;
6019 newElmt
= new AsnListElmt
;
6020 newElmt
->elmt
= new CertPolicyId
;
6021 *newElmt
->elmt
= elmt
;
6022 newElmt
->next
= NULL
;
6025 newElmt
->prev
= NULL
;
6026 first
= last
= newElmt
;
6030 newElmt
->prev
= last
;
6031 last
->next
= newElmt
;
6039 CertPolicySet
&CertPolicySet::PrependCopy (CertPolicyId
&elmt
)
6041 AsnListElmt
*newElmt
;
6042 newElmt
= new AsnListElmt
;
6043 newElmt
->elmt
= new CertPolicyId
;
6044 *newElmt
->elmt
= elmt
;
6045 newElmt
->prev
= NULL
;
6048 newElmt
->next
= NULL
;
6049 first
= last
= newElmt
;
6053 newElmt
->next
= first
;
6054 first
->prev
= newElmt
;
6059 } // CertPolicySet::PrependCopy
6062 // alloc new list elmt, insert it before the
6063 // current element, copy the given elmt into the new elmt
6064 // and return the component type.
6065 // if the current element is null, the new element
6066 // is placed at the beginning of the list.
6067 CertPolicySet
&CertPolicySet::InsertBeforeAndCopy (CertPolicyId
&elmt
)
6069 AsnListElmt
*newElmt
;
6071 newElmt
= new AsnListElmt
;
6072 newElmt
->elmt
= new CertPolicyId
;
6073 *newElmt
->elmt
= elmt
;
6077 newElmt
->next
= first
;
6078 newElmt
->prev
= NULL
;
6085 newElmt
->next
= curr
;
6086 newElmt
->prev
= curr
->prev
;
6087 curr
->prev
= newElmt
;
6091 newElmt
->prev
->next
= newElmt
;
6095 } // CertPolicySet::InsertBeforeAndCopy
6098 // alloc new list elmt, insert it after the
6099 // current element, copy given elmt in to new elmt
6100 // and return the component type
6101 // if the current element is null, the new element
6102 // is placed at the end of the list.
6103 CertPolicySet
&CertPolicySet::InsertAfterAndCopy (CertPolicyId
&elmt
)
6105 AsnListElmt
*newElmt
;
6107 newElmt
= new AsnListElmt
;
6108 newElmt
->elmt
= new CertPolicyId
;
6109 *newElmt
->elmt
= elmt
;
6112 newElmt
->prev
= last
;
6113 newElmt
->next
= NULL
;
6120 newElmt
->prev
= curr
;
6121 newElmt
->next
= curr
->next
;
6122 curr
->next
= newElmt
;
6126 newElmt
->next
->prev
= newElmt
;
6130 } // CertPolicySet::InsertAfterAndCopy
6133 // remove current element from list if current element is not NULL
6134 // The new current element will be the next element.
6135 // If the current element is the last element in the list
6136 // the second but last element will become the new current element.
6137 void CertPolicySet::RemoveCurrFromList()
6139 AsnListElmt
*del_elmt
;
6147 first
= last
= curr
= NULL
;
6148 else if (curr
== first
)
6150 curr
= first
= first
->next
;
6153 else if (curr
== last
)
6155 curr
= last
= last
->prev
;
6160 curr
->prev
->next
= curr
->next
;
6161 curr
->next
->prev
= curr
->prev
;
6164 delete del_elmt
->elmt
;
6170 AsnLen
CertPolicySet::BEncContent (BUF_TYPE b
)
6172 AsnListElmt
*currElmt
;
6174 AsnLen totalLen
= 0;
6175 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
6177 elmtLen
= currElmt
->elmt
->BEncContent (b
);
6178 elmtLen
+= BEncDefLen (b
, elmtLen
);
6180 elmtLen
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
6181 totalLen
+= elmtLen
;
6184 } // CertPolicySet::BEncContent
6187 void CertPolicySet::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
6188 AsnLen
&bytesDecoded
, ENV_TYPE env
)
6190 CertPolicyId
*listElmt
;
6192 AsnLen listBytesDecoded
= 0;
6195 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
6197 tag1
= BDecTag (b
, listBytesDecoded
, env
);
6198 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
6200 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
6203 if ((tag1
!= MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
6205 Asn1Error
<< "Unexpected Tag" << endl
;
6206 longjmp (env
, -142);
6209 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
6210 listElmt
= Append();
6211 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
6214 bytesDecoded
+= listBytesDecoded
;
6215 } // CertPolicySet::BDecContent
6218 AsnType
*CRLDistPointsSyntax::Clone() const
6220 return new CRLDistPointsSyntax
;
6223 AsnType
*CRLDistPointsSyntax::Copy() const
6225 return new CRLDistPointsSyntax (*this);
6228 AsnLen
CRLDistPointsSyntax::BEnc (BUF_TYPE b
)
6231 l
= BEncContent (b
);
6232 l
+= BEncConsLen (b
, l
);
6233 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6237 void CRLDistPointsSyntax::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
6242 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
6244 Asn1Error
<< "CRLDistPointsSyntax::BDec: ERROR - wrong tag" << endl
;
6245 longjmp (env
, -143);
6247 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
6248 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
6251 CRLDistPointsSyntax::CRLDistPointsSyntax (const CRLDistPointsSyntax
&)
6253 Asn1Error
<< "use of incompletely defined CRLDistPointsSyntax::CRLDistPointsSyntax (const CRLDistPointsSyntax &)" << endl
;
6257 CRLDistPointsSyntax::~CRLDistPointsSyntax()
6260 for (; Curr() != NULL
; RemoveCurrFromList())
6262 } // end of destructor
6265 CRLDistPointsSyntax
&CRLDistPointsSyntax::operator = (const CRLDistPointsSyntax
&that
)
6266 #else // SNACC_DEEP_COPY
6267 CRLDistPointsSyntax
&CRLDistPointsSyntax::operator = (const CRLDistPointsSyntax
&)
6268 #endif // SNACC_DEEP_COPY
6274 for (; Curr(); RemoveCurrFromList())
6277 //that.SetCurrToFirst();
6278 //for (; that.Curr(); that.GoNext())
6279 // AppendCopy (*that.Curr());
6280 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
6281 AppendCopy (*run
->elmt
);
6285 #else // SNACC_DEEP_COPY
6286 Asn1Error
<< "use of incompletely defined CRLDistPointsSyntax &CRLDistPointsSyntax::operator = (const CRLDistPointsSyntax &)" << endl
;
6288 // if your compiler complains here, check the -novolat option
6289 #endif // SNACC_DEEP_COPY
6292 void CRLDistPointsSyntax::Print (ostream
&os
) const
6295 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
6296 indentG
+= stdIndentG
;
6298 //for (; Curr() != NULL; GoNext())
6299 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
6301 Indent (os
, indentG
);
6304 //if (Curr() != Last())
6309 indentG
-= stdIndentG
;
6310 Indent (os
, indentG
);
6318 void CRLDistPointsSyntax::SetCurrElmt (unsigned long int index
)
6320 unsigned long int i
;
6323 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
6325 } // CRLDistPointsSyntax::SetCurrElmt
6328 unsigned long int CRLDistPointsSyntax::GetCurrElmtIndex()
6330 unsigned long int i
;
6334 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
6343 } // CRLDistPointsSyntax::GetCurrElmtIndex
6346 // alloc new list elmt, put at end of list
6347 // and return the component type
6348 DistributionPoint
*CRLDistPointsSyntax::Append()
6350 AsnListElmt
*newElmt
;
6351 newElmt
= new AsnListElmt
;
6352 newElmt
->elmt
= new DistributionPoint
;
6353 newElmt
->next
= NULL
;
6356 newElmt
->prev
= NULL
;
6357 first
= last
= newElmt
;
6361 newElmt
->prev
= last
;
6362 last
->next
= newElmt
;
6366 return (curr
= newElmt
)->elmt
;
6367 } // CRLDistPointsSyntax::Append
6370 // alloc new list elmt, put at begining of list
6371 // and return the component type
6372 DistributionPoint
*CRLDistPointsSyntax::Prepend()
6374 AsnListElmt
*newElmt
;
6375 newElmt
= new AsnListElmt
;
6376 newElmt
->elmt
= new DistributionPoint
;
6377 newElmt
->prev
= NULL
;
6380 newElmt
->next
= NULL
;
6381 first
= last
= newElmt
;
6385 newElmt
->next
= first
;
6386 first
->prev
= newElmt
;
6390 return (curr
= newElmt
)->elmt
;
6391 } // CRLDistPointsSyntax::Prepend
6394 // alloc new list elmt, insert it before the
6395 // current element and return the component type
6396 // if the current element is null, the new element
6397 // is placed at the beginning of the list.
6398 DistributionPoint
*CRLDistPointsSyntax::InsertBefore()
6400 AsnListElmt
*newElmt
;
6401 newElmt
= new AsnListElmt
;
6402 newElmt
->elmt
= new DistributionPoint
;
6405 newElmt
->next
= first
;
6406 newElmt
->prev
= NULL
;
6413 newElmt
->next
= curr
;
6414 newElmt
->prev
= curr
->prev
;
6415 curr
->prev
= newElmt
;
6419 newElmt
->prev
->next
= newElmt
;
6422 return (curr
= newElmt
)->elmt
;
6423 } // CRLDistPointsSyntax::InsertBefore
6426 // alloc new list elmt, insert it after the
6427 // current element and return the component type
6428 // if the current element is null, the new element
6429 // is placed at the end of the list.
6430 DistributionPoint
*CRLDistPointsSyntax::InsertAfter()
6432 AsnListElmt
*newElmt
;
6433 newElmt
= new AsnListElmt
;
6434 newElmt
->elmt
= new DistributionPoint
;
6437 newElmt
->prev
= last
;
6438 newElmt
->next
= NULL
;
6445 newElmt
->prev
= curr
;
6446 newElmt
->next
= curr
->next
;
6447 curr
->next
= newElmt
;
6451 newElmt
->next
->prev
= newElmt
;
6454 return (curr
= newElmt
)->elmt
;
6455 } // CRLDistPointsSyntax::InsertAfter
6458 CRLDistPointsSyntax
&CRLDistPointsSyntax::AppendCopy (DistributionPoint
&elmt
)
6460 AsnListElmt
*newElmt
;
6461 newElmt
= new AsnListElmt
;
6462 newElmt
->elmt
= new DistributionPoint
;
6463 *newElmt
->elmt
= elmt
;
6464 newElmt
->next
= NULL
;
6467 newElmt
->prev
= NULL
;
6468 first
= last
= newElmt
;
6472 newElmt
->prev
= last
;
6473 last
->next
= newElmt
;
6481 CRLDistPointsSyntax
&CRLDistPointsSyntax::PrependCopy (DistributionPoint
&elmt
)
6483 AsnListElmt
*newElmt
;
6484 newElmt
= new AsnListElmt
;
6485 newElmt
->elmt
= new DistributionPoint
;
6486 *newElmt
->elmt
= elmt
;
6487 newElmt
->prev
= NULL
;
6490 newElmt
->next
= NULL
;
6491 first
= last
= newElmt
;
6495 newElmt
->next
= first
;
6496 first
->prev
= newElmt
;
6501 } // CRLDistPointsSyntax::PrependCopy
6504 // alloc new list elmt, insert it before the
6505 // current element, copy the given elmt into the new elmt
6506 // and return the component type.
6507 // if the current element is null, the new element
6508 // is placed at the beginning of the list.
6509 CRLDistPointsSyntax
&CRLDistPointsSyntax::InsertBeforeAndCopy (DistributionPoint
&elmt
)
6511 AsnListElmt
*newElmt
;
6513 newElmt
= new AsnListElmt
;
6514 newElmt
->elmt
= new DistributionPoint
;
6515 *newElmt
->elmt
= elmt
;
6519 newElmt
->next
= first
;
6520 newElmt
->prev
= NULL
;
6527 newElmt
->next
= curr
;
6528 newElmt
->prev
= curr
->prev
;
6529 curr
->prev
= newElmt
;
6533 newElmt
->prev
->next
= newElmt
;
6537 } // CRLDistPointsSyntax::InsertBeforeAndCopy
6540 // alloc new list elmt, insert it after the
6541 // current element, copy given elmt in to new elmt
6542 // and return the component type
6543 // if the current element is null, the new element
6544 // is placed at the end of the list.
6545 CRLDistPointsSyntax
&CRLDistPointsSyntax::InsertAfterAndCopy (DistributionPoint
&elmt
)
6547 AsnListElmt
*newElmt
;
6549 newElmt
= new AsnListElmt
;
6550 newElmt
->elmt
= new DistributionPoint
;
6551 *newElmt
->elmt
= elmt
;
6554 newElmt
->prev
= last
;
6555 newElmt
->next
= NULL
;
6562 newElmt
->prev
= curr
;
6563 newElmt
->next
= curr
->next
;
6564 curr
->next
= newElmt
;
6568 newElmt
->next
->prev
= newElmt
;
6572 } // CRLDistPointsSyntax::InsertAfterAndCopy
6575 // remove current element from list if current element is not NULL
6576 // The new current element will be the next element.
6577 // If the current element is the last element in the list
6578 // the second but last element will become the new current element.
6579 void CRLDistPointsSyntax::RemoveCurrFromList()
6581 AsnListElmt
*del_elmt
;
6589 first
= last
= curr
= NULL
;
6590 else if (curr
== first
)
6592 curr
= first
= first
->next
;
6595 else if (curr
== last
)
6597 curr
= last
= last
->prev
;
6602 curr
->prev
->next
= curr
->next
;
6603 curr
->next
->prev
= curr
->prev
;
6606 delete del_elmt
->elmt
;
6612 AsnLen
CRLDistPointsSyntax::BEncContent (BUF_TYPE b
)
6614 AsnListElmt
*currElmt
;
6616 AsnLen totalLen
= 0;
6617 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
6620 elmtLen
= currElmt
->elmt
->BEncContent (b
);
6621 elmtLen
+= BEncConsLen (b
, elmtLen
);
6623 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6624 totalLen
+= elmtLen
;
6627 } // CRLDistPointsSyntax::BEncContent
6630 void CRLDistPointsSyntax::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
6631 AsnLen
&bytesDecoded
, ENV_TYPE env
)
6633 DistributionPoint
*listElmt
;
6635 AsnLen listBytesDecoded
= 0;
6638 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
6640 tag1
= BDecTag (b
, listBytesDecoded
, env
);
6641 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
6643 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
6646 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
6648 Asn1Error
<< "Unexpected Tag" << endl
;
6649 longjmp (env
, -144);
6652 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
6653 listElmt
= Append();
6654 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
6657 bytesDecoded
+= listBytesDecoded
;
6658 } // CRLDistPointsSyntax::BDecContent
6661 IssuingDistPointSyntax::IssuingDistPointSyntax()
6663 distributionPoint
= NULL
;
6664 onlyContainsUserCerts
= NULL
;
6665 onlyContainsCACerts
= NULL
;
6666 onlySomeReasons
= NULL
;
6670 IssuingDistPointSyntax::IssuingDistPointSyntax (const IssuingDistPointSyntax
&)
6672 Asn1Error
<< "use of incompletely defined IssuingDistPointSyntax::IssuingDistPointSyntax (const IssuingDistPointSyntax &)" << endl
;
6676 IssuingDistPointSyntax::~IssuingDistPointSyntax()
6678 delete distributionPoint
;
6679 delete onlyContainsUserCerts
;
6680 delete onlyContainsCACerts
;
6681 delete onlySomeReasons
;
6685 AsnType
*IssuingDistPointSyntax::Clone() const
6687 return new IssuingDistPointSyntax
;
6690 AsnType
*IssuingDistPointSyntax::Copy() const
6692 return new IssuingDistPointSyntax (*this);
6696 IssuingDistPointSyntax
&IssuingDistPointSyntax::operator = (const IssuingDistPointSyntax
&that
)
6697 #else // SNACC_DEEP_COPY
6698 IssuingDistPointSyntax
&IssuingDistPointSyntax::operator = (const IssuingDistPointSyntax
&)
6699 #endif // SNACC_DEEP_COPY
6704 if (that
.distributionPoint
)
6706 if (!distributionPoint
)
6707 distributionPoint
= new DistributionPointName
;
6708 *distributionPoint
= *that
.distributionPoint
;
6712 delete distributionPoint
;
6713 distributionPoint
= NULL
;
6715 if (that
.onlyContainsUserCerts
)
6717 if (!onlyContainsUserCerts
)
6718 onlyContainsUserCerts
= new AsnBool
;
6719 *onlyContainsUserCerts
= *that
.onlyContainsUserCerts
;
6723 delete onlyContainsUserCerts
;
6724 onlyContainsUserCerts
= NULL
;
6726 if (that
.onlyContainsCACerts
)
6728 if (!onlyContainsCACerts
)
6729 onlyContainsCACerts
= new AsnBool
;
6730 *onlyContainsCACerts
= *that
.onlyContainsCACerts
;
6734 delete onlyContainsCACerts
;
6735 onlyContainsCACerts
= NULL
;
6737 if (that
.onlySomeReasons
)
6739 if (!onlySomeReasons
)
6740 onlySomeReasons
= new ReasonFlags
;
6741 *onlySomeReasons
= *that
.onlySomeReasons
;
6745 delete onlySomeReasons
;
6746 onlySomeReasons
= NULL
;
6748 if (that
.indirectCRL
)
6751 indirectCRL
= new AsnBool
;
6752 *indirectCRL
= *that
.indirectCRL
;
6762 #else // SNACC_DEEP_COPY
6763 Asn1Error
<< "use of incompletely defined IssuingDistPointSyntax &IssuingDistPointSyntax::operator = (const IssuingDistPointSyntax &)" << endl
;
6765 // if your compiler complains here, check the -novolat option
6766 #endif // SNACC_DEEP_COPY
6770 IssuingDistPointSyntax::BEncContent (BUF_TYPE b
)
6772 AsnLen totalLen
= 0;
6775 if (NOT_NULL (indirectCRL
))
6777 l
= indirectCRL
->BEncContent (b
);
6778 BEncDefLenTo127 (b
, l
);
6781 l
+= BEncTag1 (b
, CNTX
, PRIM
, 4);
6785 if (NOT_NULL (onlySomeReasons
))
6787 l
= onlySomeReasons
->BEncContent (b
);
6788 l
+= BEncDefLen (b
, l
);
6790 l
+= BEncTag1 (b
, CNTX
, PRIM
, 3);
6794 if (NOT_NULL (onlyContainsCACerts
))
6796 l
= onlyContainsCACerts
->BEncContent (b
);
6797 BEncDefLenTo127 (b
, l
);
6800 l
+= BEncTag1 (b
, CNTX
, PRIM
, 2);
6804 if (NOT_NULL (onlyContainsUserCerts
))
6806 l
= onlyContainsUserCerts
->BEncContent (b
);
6807 BEncDefLenTo127 (b
, l
);
6810 l
+= BEncTag1 (b
, CNTX
, PRIM
, 1);
6814 if (NOT_NULL (distributionPoint
))
6817 l
= distributionPoint
->BEncContent (b
);
6818 l
+= BEncConsLen (b
, l
);
6820 l
+= BEncTag1 (b
, CNTX
, CONS
, 0);
6825 } // IssuingDistPointSyntax::BEncContent
6828 void IssuingDistPointSyntax::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
6831 AsnLen seqBytesDecoded
= 0;
6838 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6840 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
6842 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
6843 bytesDecoded
+= seqBytesDecoded
;
6848 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0)))
6850 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6851 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6852 elmtLen2
= BDecLen (b
, seqBytesDecoded
, env
);
6853 distributionPoint
= new DistributionPointName
;
6854 distributionPoint
->BDecContent (b
, tag1
, elmtLen2
, seqBytesDecoded
, env
);
6855 if (elmtLen1
== INDEFINITE_LEN
)
6856 BDecEoc (b
, seqBytesDecoded
, env
);
6858 if (seqBytesDecoded
== elmtLen0
)
6860 bytesDecoded
+= seqBytesDecoded
;
6865 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6867 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
6869 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
6870 bytesDecoded
+= seqBytesDecoded
;
6876 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 1)))
6878 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6879 onlyContainsUserCerts
= new AsnBool
;
6880 onlyContainsUserCerts
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
6881 if (seqBytesDecoded
== elmtLen0
)
6883 bytesDecoded
+= seqBytesDecoded
;
6888 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6890 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
6892 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
6893 bytesDecoded
+= seqBytesDecoded
;
6899 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 2)))
6901 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6902 onlyContainsCACerts
= new AsnBool
;
6903 onlyContainsCACerts
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
6904 if (seqBytesDecoded
== elmtLen0
)
6906 bytesDecoded
+= seqBytesDecoded
;
6911 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6913 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
6915 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
6916 bytesDecoded
+= seqBytesDecoded
;
6922 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 3))
6923 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 3)))
6925 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6926 onlySomeReasons
= new ReasonFlags
;
6927 onlySomeReasons
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
6928 if (seqBytesDecoded
== elmtLen0
)
6930 bytesDecoded
+= seqBytesDecoded
;
6935 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6937 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
6939 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
6940 bytesDecoded
+= seqBytesDecoded
;
6946 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 4)))
6948 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6949 indirectCRL
= new AsnBool
;
6950 indirectCRL
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
6953 bytesDecoded
+= seqBytesDecoded
;
6954 if (elmtLen0
== INDEFINITE_LEN
)
6956 BDecEoc (b
, bytesDecoded
, env
);
6959 else if (seqBytesDecoded
!= elmtLen0
)
6961 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
6962 longjmp (env
, -145);
6966 } // IssuingDistPointSyntax::BDecContent
6968 AsnLen
IssuingDistPointSyntax::BEnc (BUF_TYPE b
)
6971 l
= BEncContent (b
);
6972 l
+= BEncConsLen (b
, l
);
6973 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6977 void IssuingDistPointSyntax::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
6982 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
6984 Asn1Error
<< "IssuingDistPointSyntax::BDec: ERROR - wrong tag" << endl
;
6985 longjmp (env
, -146);
6987 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
6988 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
6991 int IssuingDistPointSyntax::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
6993 bytesEncoded
= BEnc (b
);
6994 return !b
.WriteError();
6997 int IssuingDistPointSyntax::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
7003 if ((val
= setjmp (env
)) == 0)
7005 BDec (b
, bytesDecoded
, env
);
7006 return !b
.ReadError();
7012 void IssuingDistPointSyntax::Print (ostream
&os
) const
7015 int nonePrinted
= true;
7016 os
<< "{ -- SEQUENCE --" << endl
;
7017 indentG
+= stdIndentG
;
7019 if (NOT_NULL (distributionPoint
))
7021 nonePrinted
= false;
7022 Indent (os
, indentG
);
7023 os
<< "distributionPoint ";
7024 os
<< *distributionPoint
;
7028 Indent (os
, indentG
);
7029 os
<< "distributionPoint ";
7034 if (NOT_NULL (onlyContainsUserCerts
))
7038 nonePrinted
= false;
7039 Indent (os
, indentG
);
7040 os
<< "onlyContainsUserCerts ";
7041 os
<< *onlyContainsUserCerts
;
7045 Indent (os
, indentG
);
7046 os
<< "onlyContainsUserCerts ";
7051 if (NOT_NULL (onlyContainsCACerts
))
7055 nonePrinted
= false;
7056 Indent (os
, indentG
);
7057 os
<< "onlyContainsCACerts ";
7058 os
<< *onlyContainsCACerts
;
7062 Indent (os
, indentG
);
7063 os
<< "onlyContainsCACerts ";
7068 if (NOT_NULL (onlySomeReasons
))
7072 nonePrinted
= false;
7073 Indent (os
, indentG
);
7074 os
<< "onlySomeReasons ";
7075 os
<< *onlySomeReasons
;
7079 Indent (os
, indentG
);
7080 os
<< "onlySomeReasons ";
7085 if (NOT_NULL (indirectCRL
))
7089 nonePrinted
= false;
7090 Indent (os
, indentG
);
7091 os
<< "indirectCRL ";
7096 Indent (os
, indentG
);
7097 os
<< "indirectCRL ";
7103 indentG
-= stdIndentG
;
7104 Indent (os
, indentG
);
7107 } // IssuingDistPointSyntax::Print