1 // NOTE: this is a machine generated file--editing not recommended
3 // sm_ess.cpp - class member functions for ASN.1 module ExtendedSecurityServices
5 // This file was generated by snacc on Mon Apr 22 22:34:19 2002
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"
29 //------------------------------------------------------------------------------
33 //------------------------------------------------------------------------------
34 // class member definitions:
36 AsnType
*SigningCertificateSeqOf1::Clone() const
38 return new SigningCertificateSeqOf1
;
41 AsnType
*SigningCertificateSeqOf1::Copy() const
43 return new SigningCertificateSeqOf1 (*this);
46 AsnLen
SigningCertificateSeqOf1::BEnc (BUF_TYPE b
)
50 l
+= BEncConsLen (b
, l
);
51 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
55 void SigningCertificateSeqOf1::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
60 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
62 Asn1Error
<< "SigningCertificateSeqOf1::BDec: ERROR - wrong tag" << endl
;
63 SnaccExcep::throwMe(-100);
65 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
66 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
69 SigningCertificateSeqOf1::SigningCertificateSeqOf1 (const SigningCertificateSeqOf1
&)
71 Asn1Error
<< "use of incompletely defined SigningCertificateSeqOf1::SigningCertificateSeqOf1 (const SigningCertificateSeqOf1 &)" << endl
;
75 SigningCertificateSeqOf1::~SigningCertificateSeqOf1()
78 for (; Curr() != NULL
; RemoveCurrFromList())
80 } // end of destructor
83 SigningCertificateSeqOf1
&SigningCertificateSeqOf1::operator = (const SigningCertificateSeqOf1
&that
)
84 #else // SNACC_DEEP_COPY
85 SigningCertificateSeqOf1
&SigningCertificateSeqOf1::operator = (const SigningCertificateSeqOf1
&)
86 #endif // SNACC_DEEP_COPY
92 for (; Curr(); RemoveCurrFromList())
95 //that.SetCurrToFirst();
96 //for (; that.Curr(); that.GoNext())
97 // AppendCopy (*that.Curr());
98 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
99 AppendCopy (*run
->elmt
);
103 #else // SNACC_DEEP_COPY
104 Asn1Error
<< "use of incompletely defined SigningCertificateSeqOf1 &SigningCertificateSeqOf1::operator = (const SigningCertificateSeqOf1 &)" << endl
;
106 // if your compiler complains here, check the -novolat option
107 #endif // SNACC_DEEP_COPY
110 void SigningCertificateSeqOf1::Print (ostream
&os
) const
113 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
114 indentG
+= stdIndentG
;
116 //for (; Curr() != NULL; GoNext())
117 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
119 Indent (os
, indentG
);
122 //if (Curr() != Last())
127 indentG
-= stdIndentG
;
128 Indent (os
, indentG
);
136 void SigningCertificateSeqOf1::SetCurrElmt (unsigned long int index
)
141 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
143 } // SigningCertificateSeqOf1::SetCurrElmt
146 unsigned long int SigningCertificateSeqOf1::GetCurrElmtIndex()
152 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
161 } // SigningCertificateSeqOf1::GetCurrElmtIndex
164 // alloc new list elmt, put at end of list
165 // and return the component type
166 PolicyInformation
*SigningCertificateSeqOf1::Append()
168 AsnListElmt
*newElmt
;
169 newElmt
= new AsnListElmt
;
170 newElmt
->elmt
= new PolicyInformation
;
171 newElmt
->next
= NULL
;
174 newElmt
->prev
= NULL
;
175 first
= last
= newElmt
;
179 newElmt
->prev
= last
;
180 last
->next
= newElmt
;
184 return (curr
= newElmt
)->elmt
;
185 } // SigningCertificateSeqOf1::Append
188 // alloc new list elmt, put at begining of list
189 // and return the component type
190 PolicyInformation
*SigningCertificateSeqOf1::Prepend()
192 AsnListElmt
*newElmt
;
193 newElmt
= new AsnListElmt
;
194 newElmt
->elmt
= new PolicyInformation
;
195 newElmt
->prev
= NULL
;
198 newElmt
->next
= NULL
;
199 first
= last
= newElmt
;
203 newElmt
->next
= first
;
204 first
->prev
= newElmt
;
208 return (curr
= newElmt
)->elmt
;
209 } // SigningCertificateSeqOf1::Prepend
212 // alloc new list elmt, insert it before the
213 // current element and return the component type
214 // if the current element is null, the new element
215 // is placed at the beginning of the list.
216 PolicyInformation
*SigningCertificateSeqOf1::InsertBefore()
218 AsnListElmt
*newElmt
;
219 newElmt
= new AsnListElmt
;
220 newElmt
->elmt
= new PolicyInformation
;
223 newElmt
->next
= first
;
224 newElmt
->prev
= NULL
;
231 newElmt
->next
= curr
;
232 newElmt
->prev
= curr
->prev
;
233 curr
->prev
= newElmt
;
237 newElmt
->prev
->next
= newElmt
;
240 return (curr
= newElmt
)->elmt
;
241 } // SigningCertificateSeqOf1::InsertBefore
244 // alloc new list elmt, insert it after the
245 // current element and return the component type
246 // if the current element is null, the new element
247 // is placed at the end of the list.
248 PolicyInformation
*SigningCertificateSeqOf1::InsertAfter()
250 AsnListElmt
*newElmt
;
251 newElmt
= new AsnListElmt
;
252 newElmt
->elmt
= new PolicyInformation
;
255 newElmt
->prev
= last
;
256 newElmt
->next
= NULL
;
263 newElmt
->prev
= curr
;
264 newElmt
->next
= curr
->next
;
265 curr
->next
= newElmt
;
269 newElmt
->next
->prev
= newElmt
;
272 return (curr
= newElmt
)->elmt
;
273 } // SigningCertificateSeqOf1::InsertAfter
276 SigningCertificateSeqOf1
&SigningCertificateSeqOf1::AppendCopy (PolicyInformation
&elmt
)
278 AsnListElmt
*newElmt
;
279 newElmt
= new AsnListElmt
;
280 newElmt
->elmt
= new PolicyInformation
;
281 *newElmt
->elmt
= elmt
;
282 newElmt
->next
= NULL
;
285 newElmt
->prev
= NULL
;
286 first
= last
= newElmt
;
290 newElmt
->prev
= last
;
291 last
->next
= newElmt
;
299 SigningCertificateSeqOf1
&SigningCertificateSeqOf1::PrependCopy (PolicyInformation
&elmt
)
301 AsnListElmt
*newElmt
;
302 newElmt
= new AsnListElmt
;
303 newElmt
->elmt
= new PolicyInformation
;
304 *newElmt
->elmt
= elmt
;
305 newElmt
->prev
= NULL
;
308 newElmt
->next
= NULL
;
309 first
= last
= newElmt
;
313 newElmt
->next
= first
;
314 first
->prev
= newElmt
;
319 } // SigningCertificateSeqOf1::PrependCopy
322 // alloc new list elmt, insert it before the
323 // current element, copy the given elmt into the new elmt
324 // and return the component type.
325 // if the current element is null, the new element
326 // is placed at the beginning of the list.
327 SigningCertificateSeqOf1
&SigningCertificateSeqOf1::InsertBeforeAndCopy (PolicyInformation
&elmt
)
329 AsnListElmt
*newElmt
;
331 newElmt
= new AsnListElmt
;
332 newElmt
->elmt
= new PolicyInformation
;
333 *newElmt
->elmt
= elmt
;
337 newElmt
->next
= first
;
338 newElmt
->prev
= NULL
;
345 newElmt
->next
= curr
;
346 newElmt
->prev
= curr
->prev
;
347 curr
->prev
= newElmt
;
351 newElmt
->prev
->next
= newElmt
;
355 } // SigningCertificateSeqOf1::InsertBeforeAndCopy
358 // alloc new list elmt, insert it after the
359 // current element, copy given elmt in to new elmt
360 // and return the component type
361 // if the current element is null, the new element
362 // is placed at the end of the list.
363 SigningCertificateSeqOf1
&SigningCertificateSeqOf1::InsertAfterAndCopy (PolicyInformation
&elmt
)
365 AsnListElmt
*newElmt
;
367 newElmt
= new AsnListElmt
;
368 newElmt
->elmt
= new PolicyInformation
;
369 *newElmt
->elmt
= elmt
;
372 newElmt
->prev
= last
;
373 newElmt
->next
= NULL
;
380 newElmt
->prev
= curr
;
381 newElmt
->next
= curr
->next
;
382 curr
->next
= newElmt
;
386 newElmt
->next
->prev
= newElmt
;
390 } // SigningCertificateSeqOf1::InsertAfterAndCopy
393 // remove current element from list if current element is not NULL
394 // The new current element will be the next element.
395 // If the current element is the last element in the list
396 // the second but last element will become the new current element.
397 void SigningCertificateSeqOf1::RemoveCurrFromList()
399 AsnListElmt
*del_elmt
;
407 first
= last
= curr
= NULL
;
408 else if (curr
== first
)
410 curr
= first
= first
->next
;
413 else if (curr
== last
)
415 curr
= last
= last
->prev
;
420 curr
->prev
->next
= curr
->next
;
421 curr
->next
->prev
= curr
->prev
;
424 delete del_elmt
->elmt
;
430 AsnLen
SigningCertificateSeqOf1::BEncContent (BUF_TYPE b
)
432 AsnListElmt
*currElmt
;
435 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
438 elmtLen
= currElmt
->elmt
->BEncContent (b
);
439 elmtLen
+= BEncConsLen (b
, elmtLen
);
441 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
445 } // SigningCertificateSeqOf1::BEncContent
448 void SigningCertificateSeqOf1::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
449 AsnLen
&bytesDecoded
, ENV_TYPE env
)
451 PolicyInformation
*listElmt
;
453 AsnLen listBytesDecoded
= 0;
456 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
458 tag1
= BDecTag (b
, listBytesDecoded
, env
);
459 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
461 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
464 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
466 Asn1Error
<< "Unexpected Tag" << endl
;
467 SnaccExcep::throwMe(-101);
470 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
472 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
475 bytesDecoded
+= listBytesDecoded
;
476 } // SigningCertificateSeqOf1::BDecContent
479 AsnType
*MLReceiptPolicySeqOf1::Clone() const
481 return new MLReceiptPolicySeqOf1
;
484 AsnType
*MLReceiptPolicySeqOf1::Copy() const
486 return new MLReceiptPolicySeqOf1 (*this);
489 AsnLen
MLReceiptPolicySeqOf1::BEnc (BUF_TYPE b
)
493 l
+= BEncConsLen (b
, l
);
494 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
498 void MLReceiptPolicySeqOf1::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
503 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
505 Asn1Error
<< "MLReceiptPolicySeqOf1::BDec: ERROR - wrong tag" << endl
;
506 SnaccExcep::throwMe(-102);
508 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
509 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
512 MLReceiptPolicySeqOf1::MLReceiptPolicySeqOf1 (const MLReceiptPolicySeqOf1
&)
514 Asn1Error
<< "use of incompletely defined MLReceiptPolicySeqOf1::MLReceiptPolicySeqOf1 (const MLReceiptPolicySeqOf1 &)" << endl
;
518 MLReceiptPolicySeqOf1::~MLReceiptPolicySeqOf1()
521 for (; Curr() != NULL
; RemoveCurrFromList())
523 } // end of destructor
526 MLReceiptPolicySeqOf1
&MLReceiptPolicySeqOf1::operator = (const MLReceiptPolicySeqOf1
&that
)
527 #else // SNACC_DEEP_COPY
528 MLReceiptPolicySeqOf1
&MLReceiptPolicySeqOf1::operator = (const MLReceiptPolicySeqOf1
&)
529 #endif // SNACC_DEEP_COPY
535 for (; Curr(); RemoveCurrFromList())
538 //that.SetCurrToFirst();
539 //for (; that.Curr(); that.GoNext())
540 // AppendCopy (*that.Curr());
541 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
542 AppendCopy (*run
->elmt
);
546 #else // SNACC_DEEP_COPY
547 Asn1Error
<< "use of incompletely defined MLReceiptPolicySeqOf1 &MLReceiptPolicySeqOf1::operator = (const MLReceiptPolicySeqOf1 &)" << endl
;
549 // if your compiler complains here, check the -novolat option
550 #endif // SNACC_DEEP_COPY
553 void MLReceiptPolicySeqOf1::Print (ostream
&os
) const
556 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
557 indentG
+= stdIndentG
;
559 //for (; Curr() != NULL; GoNext())
560 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
562 Indent (os
, indentG
);
565 //if (Curr() != Last())
570 indentG
-= stdIndentG
;
571 Indent (os
, indentG
);
579 void MLReceiptPolicySeqOf1::SetCurrElmt (unsigned long int index
)
584 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
586 } // MLReceiptPolicySeqOf1::SetCurrElmt
589 unsigned long int MLReceiptPolicySeqOf1::GetCurrElmtIndex()
595 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
604 } // MLReceiptPolicySeqOf1::GetCurrElmtIndex
607 // alloc new list elmt, put at end of list
608 // and return the component type
609 GeneralNames
*MLReceiptPolicySeqOf1::Append()
611 AsnListElmt
*newElmt
;
612 newElmt
= new AsnListElmt
;
613 newElmt
->elmt
= new GeneralNames
;
614 newElmt
->next
= NULL
;
617 newElmt
->prev
= NULL
;
618 first
= last
= newElmt
;
622 newElmt
->prev
= last
;
623 last
->next
= newElmt
;
627 return (curr
= newElmt
)->elmt
;
628 } // MLReceiptPolicySeqOf1::Append
631 // alloc new list elmt, put at begining of list
632 // and return the component type
633 GeneralNames
*MLReceiptPolicySeqOf1::Prepend()
635 AsnListElmt
*newElmt
;
636 newElmt
= new AsnListElmt
;
637 newElmt
->elmt
= new GeneralNames
;
638 newElmt
->prev
= NULL
;
641 newElmt
->next
= NULL
;
642 first
= last
= newElmt
;
646 newElmt
->next
= first
;
647 first
->prev
= newElmt
;
651 return (curr
= newElmt
)->elmt
;
652 } // MLReceiptPolicySeqOf1::Prepend
655 // alloc new list elmt, insert it before the
656 // current element and return the component type
657 // if the current element is null, the new element
658 // is placed at the beginning of the list.
659 GeneralNames
*MLReceiptPolicySeqOf1::InsertBefore()
661 AsnListElmt
*newElmt
;
662 newElmt
= new AsnListElmt
;
663 newElmt
->elmt
= new GeneralNames
;
666 newElmt
->next
= first
;
667 newElmt
->prev
= NULL
;
674 newElmt
->next
= curr
;
675 newElmt
->prev
= curr
->prev
;
676 curr
->prev
= newElmt
;
680 newElmt
->prev
->next
= newElmt
;
683 return (curr
= newElmt
)->elmt
;
684 } // MLReceiptPolicySeqOf1::InsertBefore
687 // alloc new list elmt, insert it after the
688 // current element and return the component type
689 // if the current element is null, the new element
690 // is placed at the end of the list.
691 GeneralNames
*MLReceiptPolicySeqOf1::InsertAfter()
693 AsnListElmt
*newElmt
;
694 newElmt
= new AsnListElmt
;
695 newElmt
->elmt
= new GeneralNames
;
698 newElmt
->prev
= last
;
699 newElmt
->next
= NULL
;
706 newElmt
->prev
= curr
;
707 newElmt
->next
= curr
->next
;
708 curr
->next
= newElmt
;
712 newElmt
->next
->prev
= newElmt
;
715 return (curr
= newElmt
)->elmt
;
716 } // MLReceiptPolicySeqOf1::InsertAfter
719 MLReceiptPolicySeqOf1
&MLReceiptPolicySeqOf1::AppendCopy (GeneralNames
&elmt
)
721 AsnListElmt
*newElmt
;
722 newElmt
= new AsnListElmt
;
723 newElmt
->elmt
= new GeneralNames
;
724 *newElmt
->elmt
= elmt
;
725 newElmt
->next
= NULL
;
728 newElmt
->prev
= NULL
;
729 first
= last
= newElmt
;
733 newElmt
->prev
= last
;
734 last
->next
= newElmt
;
742 MLReceiptPolicySeqOf1
&MLReceiptPolicySeqOf1::PrependCopy (GeneralNames
&elmt
)
744 AsnListElmt
*newElmt
;
745 newElmt
= new AsnListElmt
;
746 newElmt
->elmt
= new GeneralNames
;
747 *newElmt
->elmt
= elmt
;
748 newElmt
->prev
= NULL
;
751 newElmt
->next
= NULL
;
752 first
= last
= newElmt
;
756 newElmt
->next
= first
;
757 first
->prev
= newElmt
;
762 } // MLReceiptPolicySeqOf1::PrependCopy
765 // alloc new list elmt, insert it before the
766 // current element, copy the given elmt into the new elmt
767 // and return the component type.
768 // if the current element is null, the new element
769 // is placed at the beginning of the list.
770 MLReceiptPolicySeqOf1
&MLReceiptPolicySeqOf1::InsertBeforeAndCopy (GeneralNames
&elmt
)
772 AsnListElmt
*newElmt
;
774 newElmt
= new AsnListElmt
;
775 newElmt
->elmt
= new GeneralNames
;
776 *newElmt
->elmt
= elmt
;
780 newElmt
->next
= first
;
781 newElmt
->prev
= NULL
;
788 newElmt
->next
= curr
;
789 newElmt
->prev
= curr
->prev
;
790 curr
->prev
= newElmt
;
794 newElmt
->prev
->next
= newElmt
;
798 } // MLReceiptPolicySeqOf1::InsertBeforeAndCopy
801 // alloc new list elmt, insert it after the
802 // current element, copy given elmt in to new elmt
803 // and return the component type
804 // if the current element is null, the new element
805 // is placed at the end of the list.
806 MLReceiptPolicySeqOf1
&MLReceiptPolicySeqOf1::InsertAfterAndCopy (GeneralNames
&elmt
)
808 AsnListElmt
*newElmt
;
810 newElmt
= new AsnListElmt
;
811 newElmt
->elmt
= new GeneralNames
;
812 *newElmt
->elmt
= elmt
;
815 newElmt
->prev
= last
;
816 newElmt
->next
= NULL
;
823 newElmt
->prev
= curr
;
824 newElmt
->next
= curr
->next
;
825 curr
->next
= newElmt
;
829 newElmt
->next
->prev
= newElmt
;
833 } // MLReceiptPolicySeqOf1::InsertAfterAndCopy
836 // remove current element from list if current element is not NULL
837 // The new current element will be the next element.
838 // If the current element is the last element in the list
839 // the second but last element will become the new current element.
840 void MLReceiptPolicySeqOf1::RemoveCurrFromList()
842 AsnListElmt
*del_elmt
;
850 first
= last
= curr
= NULL
;
851 else if (curr
== first
)
853 curr
= first
= first
->next
;
856 else if (curr
== last
)
858 curr
= last
= last
->prev
;
863 curr
->prev
->next
= curr
->next
;
864 curr
->next
->prev
= curr
->prev
;
867 delete del_elmt
->elmt
;
873 AsnLen
MLReceiptPolicySeqOf1::BEncContent (BUF_TYPE b
)
875 AsnListElmt
*currElmt
;
878 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
881 elmtLen
= currElmt
->elmt
->BEncContent (b
);
882 elmtLen
+= BEncConsLen (b
, elmtLen
);
884 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
888 } // MLReceiptPolicySeqOf1::BEncContent
891 void MLReceiptPolicySeqOf1::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
892 AsnLen
&bytesDecoded
, ENV_TYPE env
)
894 GeneralNames
*listElmt
;
896 AsnLen listBytesDecoded
= 0;
899 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
901 tag1
= BDecTag (b
, listBytesDecoded
, env
);
902 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
904 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
907 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
909 Asn1Error
<< "Unexpected Tag" << endl
;
910 SnaccExcep::throwMe(-103);
913 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
915 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
918 bytesDecoded
+= listBytesDecoded
;
919 } // MLReceiptPolicySeqOf1::BDecContent
922 AsnType
*MLReceiptPolicySeqOf::Clone() const
924 return new MLReceiptPolicySeqOf
;
927 AsnType
*MLReceiptPolicySeqOf::Copy() const
929 return new MLReceiptPolicySeqOf (*this);
932 AsnLen
MLReceiptPolicySeqOf::BEnc (BUF_TYPE b
)
936 l
+= BEncConsLen (b
, l
);
937 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
941 void MLReceiptPolicySeqOf::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
946 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
948 Asn1Error
<< "MLReceiptPolicySeqOf::BDec: ERROR - wrong tag" << endl
;
949 SnaccExcep::throwMe(-104);
951 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
952 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
955 MLReceiptPolicySeqOf::MLReceiptPolicySeqOf (const MLReceiptPolicySeqOf
&)
957 Asn1Error
<< "use of incompletely defined MLReceiptPolicySeqOf::MLReceiptPolicySeqOf (const MLReceiptPolicySeqOf &)" << endl
;
961 MLReceiptPolicySeqOf::~MLReceiptPolicySeqOf()
964 for (; Curr() != NULL
; RemoveCurrFromList())
966 } // end of destructor
969 MLReceiptPolicySeqOf
&MLReceiptPolicySeqOf::operator = (const MLReceiptPolicySeqOf
&that
)
970 #else // SNACC_DEEP_COPY
971 MLReceiptPolicySeqOf
&MLReceiptPolicySeqOf::operator = (const MLReceiptPolicySeqOf
&)
972 #endif // SNACC_DEEP_COPY
978 for (; Curr(); RemoveCurrFromList())
981 //that.SetCurrToFirst();
982 //for (; that.Curr(); that.GoNext())
983 // AppendCopy (*that.Curr());
984 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
985 AppendCopy (*run
->elmt
);
989 #else // SNACC_DEEP_COPY
990 Asn1Error
<< "use of incompletely defined MLReceiptPolicySeqOf &MLReceiptPolicySeqOf::operator = (const MLReceiptPolicySeqOf &)" << endl
;
992 // if your compiler complains here, check the -novolat option
993 #endif // SNACC_DEEP_COPY
996 void MLReceiptPolicySeqOf::Print (ostream
&os
) const
999 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
1000 indentG
+= stdIndentG
;
1002 //for (; Curr() != NULL; GoNext())
1003 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
1005 Indent (os
, indentG
);
1008 //if (Curr() != Last())
1013 indentG
-= stdIndentG
;
1014 Indent (os
, indentG
);
1022 void MLReceiptPolicySeqOf::SetCurrElmt (unsigned long int index
)
1024 unsigned long int i
;
1027 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
1029 } // MLReceiptPolicySeqOf::SetCurrElmt
1032 unsigned long int MLReceiptPolicySeqOf::GetCurrElmtIndex()
1034 unsigned long int i
;
1038 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
1047 } // MLReceiptPolicySeqOf::GetCurrElmtIndex
1050 // alloc new list elmt, put at end of list
1051 // and return the component type
1052 GeneralNames
*MLReceiptPolicySeqOf::Append()
1054 AsnListElmt
*newElmt
;
1055 newElmt
= new AsnListElmt
;
1056 newElmt
->elmt
= new GeneralNames
;
1057 newElmt
->next
= NULL
;
1060 newElmt
->prev
= NULL
;
1061 first
= last
= newElmt
;
1065 newElmt
->prev
= last
;
1066 last
->next
= newElmt
;
1070 return (curr
= newElmt
)->elmt
;
1071 } // MLReceiptPolicySeqOf::Append
1074 // alloc new list elmt, put at begining of list
1075 // and return the component type
1076 GeneralNames
*MLReceiptPolicySeqOf::Prepend()
1078 AsnListElmt
*newElmt
;
1079 newElmt
= new AsnListElmt
;
1080 newElmt
->elmt
= new GeneralNames
;
1081 newElmt
->prev
= NULL
;
1084 newElmt
->next
= NULL
;
1085 first
= last
= newElmt
;
1089 newElmt
->next
= first
;
1090 first
->prev
= newElmt
;
1094 return (curr
= newElmt
)->elmt
;
1095 } // MLReceiptPolicySeqOf::Prepend
1098 // alloc new list elmt, insert it before the
1099 // current element and return the component type
1100 // if the current element is null, the new element
1101 // is placed at the beginning of the list.
1102 GeneralNames
*MLReceiptPolicySeqOf::InsertBefore()
1104 AsnListElmt
*newElmt
;
1105 newElmt
= new AsnListElmt
;
1106 newElmt
->elmt
= new GeneralNames
;
1109 newElmt
->next
= first
;
1110 newElmt
->prev
= NULL
;
1117 newElmt
->next
= curr
;
1118 newElmt
->prev
= curr
->prev
;
1119 curr
->prev
= newElmt
;
1123 newElmt
->prev
->next
= newElmt
;
1126 return (curr
= newElmt
)->elmt
;
1127 } // MLReceiptPolicySeqOf::InsertBefore
1130 // alloc new list elmt, insert it after the
1131 // current element and return the component type
1132 // if the current element is null, the new element
1133 // is placed at the end of the list.
1134 GeneralNames
*MLReceiptPolicySeqOf::InsertAfter()
1136 AsnListElmt
*newElmt
;
1137 newElmt
= new AsnListElmt
;
1138 newElmt
->elmt
= new GeneralNames
;
1141 newElmt
->prev
= last
;
1142 newElmt
->next
= NULL
;
1149 newElmt
->prev
= curr
;
1150 newElmt
->next
= curr
->next
;
1151 curr
->next
= newElmt
;
1155 newElmt
->next
->prev
= newElmt
;
1158 return (curr
= newElmt
)->elmt
;
1159 } // MLReceiptPolicySeqOf::InsertAfter
1162 MLReceiptPolicySeqOf
&MLReceiptPolicySeqOf::AppendCopy (GeneralNames
&elmt
)
1164 AsnListElmt
*newElmt
;
1165 newElmt
= new AsnListElmt
;
1166 newElmt
->elmt
= new GeneralNames
;
1167 *newElmt
->elmt
= elmt
;
1168 newElmt
->next
= NULL
;
1171 newElmt
->prev
= NULL
;
1172 first
= last
= newElmt
;
1176 newElmt
->prev
= last
;
1177 last
->next
= newElmt
;
1185 MLReceiptPolicySeqOf
&MLReceiptPolicySeqOf::PrependCopy (GeneralNames
&elmt
)
1187 AsnListElmt
*newElmt
;
1188 newElmt
= new AsnListElmt
;
1189 newElmt
->elmt
= new GeneralNames
;
1190 *newElmt
->elmt
= elmt
;
1191 newElmt
->prev
= NULL
;
1194 newElmt
->next
= NULL
;
1195 first
= last
= newElmt
;
1199 newElmt
->next
= first
;
1200 first
->prev
= newElmt
;
1205 } // MLReceiptPolicySeqOf::PrependCopy
1208 // alloc new list elmt, insert it before the
1209 // current element, copy the given elmt into the new elmt
1210 // and return the component type.
1211 // if the current element is null, the new element
1212 // is placed at the beginning of the list.
1213 MLReceiptPolicySeqOf
&MLReceiptPolicySeqOf::InsertBeforeAndCopy (GeneralNames
&elmt
)
1215 AsnListElmt
*newElmt
;
1217 newElmt
= new AsnListElmt
;
1218 newElmt
->elmt
= new GeneralNames
;
1219 *newElmt
->elmt
= elmt
;
1223 newElmt
->next
= first
;
1224 newElmt
->prev
= NULL
;
1231 newElmt
->next
= curr
;
1232 newElmt
->prev
= curr
->prev
;
1233 curr
->prev
= newElmt
;
1237 newElmt
->prev
->next
= newElmt
;
1241 } // MLReceiptPolicySeqOf::InsertBeforeAndCopy
1244 // alloc new list elmt, insert it after the
1245 // current element, copy given elmt in to new elmt
1246 // and return the component type
1247 // if the current element is null, the new element
1248 // is placed at the end of the list.
1249 MLReceiptPolicySeqOf
&MLReceiptPolicySeqOf::InsertAfterAndCopy (GeneralNames
&elmt
)
1251 AsnListElmt
*newElmt
;
1253 newElmt
= new AsnListElmt
;
1254 newElmt
->elmt
= new GeneralNames
;
1255 *newElmt
->elmt
= elmt
;
1258 newElmt
->prev
= last
;
1259 newElmt
->next
= NULL
;
1266 newElmt
->prev
= curr
;
1267 newElmt
->next
= curr
->next
;
1268 curr
->next
= newElmt
;
1272 newElmt
->next
->prev
= newElmt
;
1276 } // MLReceiptPolicySeqOf::InsertAfterAndCopy
1279 // remove current element from list if current element is not NULL
1280 // The new current element will be the next element.
1281 // If the current element is the last element in the list
1282 // the second but last element will become the new current element.
1283 void MLReceiptPolicySeqOf::RemoveCurrFromList()
1285 AsnListElmt
*del_elmt
;
1293 first
= last
= curr
= NULL
;
1294 else if (curr
== first
)
1296 curr
= first
= first
->next
;
1299 else if (curr
== last
)
1301 curr
= last
= last
->prev
;
1306 curr
->prev
->next
= curr
->next
;
1307 curr
->next
->prev
= curr
->prev
;
1310 delete del_elmt
->elmt
;
1316 AsnLen
MLReceiptPolicySeqOf::BEncContent (BUF_TYPE b
)
1318 AsnListElmt
*currElmt
;
1320 AsnLen totalLen
= 0;
1321 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
1324 elmtLen
= currElmt
->elmt
->BEncContent (b
);
1325 elmtLen
+= BEncConsLen (b
, elmtLen
);
1327 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1328 totalLen
+= elmtLen
;
1331 } // MLReceiptPolicySeqOf::BEncContent
1334 void MLReceiptPolicySeqOf::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
1335 AsnLen
&bytesDecoded
, ENV_TYPE env
)
1337 GeneralNames
*listElmt
;
1339 AsnLen listBytesDecoded
= 0;
1342 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
1344 tag1
= BDecTag (b
, listBytesDecoded
, env
);
1345 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
1347 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
1350 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
1352 Asn1Error
<< "Unexpected Tag" << endl
;
1353 SnaccExcep::throwMe(-105);
1356 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
1357 listElmt
= Append();
1358 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
1361 bytesDecoded
+= listBytesDecoded
;
1362 } // MLReceiptPolicySeqOf::BDecContent
1365 AsnType
*ReceiptsFromSeqOf::Clone() const
1367 return new ReceiptsFromSeqOf
;
1370 AsnType
*ReceiptsFromSeqOf::Copy() const
1372 return new ReceiptsFromSeqOf (*this);
1375 AsnLen
ReceiptsFromSeqOf::BEnc (BUF_TYPE b
)
1378 l
= BEncContent (b
);
1379 l
+= BEncConsLen (b
, l
);
1380 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1384 void ReceiptsFromSeqOf::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1389 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1391 Asn1Error
<< "ReceiptsFromSeqOf::BDec: ERROR - wrong tag" << endl
;
1392 SnaccExcep::throwMe(-106);
1394 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1395 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1398 ReceiptsFromSeqOf::ReceiptsFromSeqOf (const ReceiptsFromSeqOf
&)
1400 Asn1Error
<< "use of incompletely defined ReceiptsFromSeqOf::ReceiptsFromSeqOf (const ReceiptsFromSeqOf &)" << endl
;
1404 ReceiptsFromSeqOf::~ReceiptsFromSeqOf()
1407 for (; Curr() != NULL
; RemoveCurrFromList())
1409 } // end of destructor
1412 ReceiptsFromSeqOf
&ReceiptsFromSeqOf::operator = (const ReceiptsFromSeqOf
&that
)
1413 #else // SNACC_DEEP_COPY
1414 ReceiptsFromSeqOf
&ReceiptsFromSeqOf::operator = (const ReceiptsFromSeqOf
&)
1415 #endif // SNACC_DEEP_COPY
1421 for (; Curr(); RemoveCurrFromList())
1424 //that.SetCurrToFirst();
1425 //for (; that.Curr(); that.GoNext())
1426 // AppendCopy (*that.Curr());
1427 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
1428 AppendCopy (*run
->elmt
);
1432 #else // SNACC_DEEP_COPY
1433 Asn1Error
<< "use of incompletely defined ReceiptsFromSeqOf &ReceiptsFromSeqOf::operator = (const ReceiptsFromSeqOf &)" << endl
;
1435 // if your compiler complains here, check the -novolat option
1436 #endif // SNACC_DEEP_COPY
1439 void ReceiptsFromSeqOf::Print (ostream
&os
) const
1442 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
1443 indentG
+= stdIndentG
;
1445 //for (; Curr() != NULL; GoNext())
1446 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
1448 Indent (os
, indentG
);
1451 //if (Curr() != Last())
1456 indentG
-= stdIndentG
;
1457 Indent (os
, indentG
);
1465 void ReceiptsFromSeqOf::SetCurrElmt (unsigned long int index
)
1467 unsigned long int i
;
1470 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
1472 } // ReceiptsFromSeqOf::SetCurrElmt
1475 unsigned long int ReceiptsFromSeqOf::GetCurrElmtIndex()
1477 unsigned long int i
;
1481 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
1490 } // ReceiptsFromSeqOf::GetCurrElmtIndex
1493 // alloc new list elmt, put at end of list
1494 // and return the component type
1495 GeneralNames
*ReceiptsFromSeqOf::Append()
1497 AsnListElmt
*newElmt
;
1498 newElmt
= new AsnListElmt
;
1499 newElmt
->elmt
= new GeneralNames
;
1500 newElmt
->next
= NULL
;
1503 newElmt
->prev
= NULL
;
1504 first
= last
= newElmt
;
1508 newElmt
->prev
= last
;
1509 last
->next
= newElmt
;
1513 return (curr
= newElmt
)->elmt
;
1514 } // ReceiptsFromSeqOf::Append
1517 // alloc new list elmt, put at begining of list
1518 // and return the component type
1519 GeneralNames
*ReceiptsFromSeqOf::Prepend()
1521 AsnListElmt
*newElmt
;
1522 newElmt
= new AsnListElmt
;
1523 newElmt
->elmt
= new GeneralNames
;
1524 newElmt
->prev
= NULL
;
1527 newElmt
->next
= NULL
;
1528 first
= last
= newElmt
;
1532 newElmt
->next
= first
;
1533 first
->prev
= newElmt
;
1537 return (curr
= newElmt
)->elmt
;
1538 } // ReceiptsFromSeqOf::Prepend
1541 // alloc new list elmt, insert it before the
1542 // current element and return the component type
1543 // if the current element is null, the new element
1544 // is placed at the beginning of the list.
1545 GeneralNames
*ReceiptsFromSeqOf::InsertBefore()
1547 AsnListElmt
*newElmt
;
1548 newElmt
= new AsnListElmt
;
1549 newElmt
->elmt
= new GeneralNames
;
1552 newElmt
->next
= first
;
1553 newElmt
->prev
= NULL
;
1560 newElmt
->next
= curr
;
1561 newElmt
->prev
= curr
->prev
;
1562 curr
->prev
= newElmt
;
1566 newElmt
->prev
->next
= newElmt
;
1569 return (curr
= newElmt
)->elmt
;
1570 } // ReceiptsFromSeqOf::InsertBefore
1573 // alloc new list elmt, insert it after the
1574 // current element and return the component type
1575 // if the current element is null, the new element
1576 // is placed at the end of the list.
1577 GeneralNames
*ReceiptsFromSeqOf::InsertAfter()
1579 AsnListElmt
*newElmt
;
1580 newElmt
= new AsnListElmt
;
1581 newElmt
->elmt
= new GeneralNames
;
1584 newElmt
->prev
= last
;
1585 newElmt
->next
= NULL
;
1592 newElmt
->prev
= curr
;
1593 newElmt
->next
= curr
->next
;
1594 curr
->next
= newElmt
;
1598 newElmt
->next
->prev
= newElmt
;
1601 return (curr
= newElmt
)->elmt
;
1602 } // ReceiptsFromSeqOf::InsertAfter
1605 ReceiptsFromSeqOf
&ReceiptsFromSeqOf::AppendCopy (GeneralNames
&elmt
)
1607 AsnListElmt
*newElmt
;
1608 newElmt
= new AsnListElmt
;
1609 newElmt
->elmt
= new GeneralNames
;
1610 *newElmt
->elmt
= elmt
;
1611 newElmt
->next
= NULL
;
1614 newElmt
->prev
= NULL
;
1615 first
= last
= newElmt
;
1619 newElmt
->prev
= last
;
1620 last
->next
= newElmt
;
1628 ReceiptsFromSeqOf
&ReceiptsFromSeqOf::PrependCopy (GeneralNames
&elmt
)
1630 AsnListElmt
*newElmt
;
1631 newElmt
= new AsnListElmt
;
1632 newElmt
->elmt
= new GeneralNames
;
1633 *newElmt
->elmt
= elmt
;
1634 newElmt
->prev
= NULL
;
1637 newElmt
->next
= NULL
;
1638 first
= last
= newElmt
;
1642 newElmt
->next
= first
;
1643 first
->prev
= newElmt
;
1648 } // ReceiptsFromSeqOf::PrependCopy
1651 // alloc new list elmt, insert it before the
1652 // current element, copy the given elmt into the new elmt
1653 // and return the component type.
1654 // if the current element is null, the new element
1655 // is placed at the beginning of the list.
1656 ReceiptsFromSeqOf
&ReceiptsFromSeqOf::InsertBeforeAndCopy (GeneralNames
&elmt
)
1658 AsnListElmt
*newElmt
;
1660 newElmt
= new AsnListElmt
;
1661 newElmt
->elmt
= new GeneralNames
;
1662 *newElmt
->elmt
= elmt
;
1666 newElmt
->next
= first
;
1667 newElmt
->prev
= NULL
;
1674 newElmt
->next
= curr
;
1675 newElmt
->prev
= curr
->prev
;
1676 curr
->prev
= newElmt
;
1680 newElmt
->prev
->next
= newElmt
;
1684 } // ReceiptsFromSeqOf::InsertBeforeAndCopy
1687 // alloc new list elmt, insert it after the
1688 // current element, copy given elmt in to new elmt
1689 // and return the component type
1690 // if the current element is null, the new element
1691 // is placed at the end of the list.
1692 ReceiptsFromSeqOf
&ReceiptsFromSeqOf::InsertAfterAndCopy (GeneralNames
&elmt
)
1694 AsnListElmt
*newElmt
;
1696 newElmt
= new AsnListElmt
;
1697 newElmt
->elmt
= new GeneralNames
;
1698 *newElmt
->elmt
= elmt
;
1701 newElmt
->prev
= last
;
1702 newElmt
->next
= NULL
;
1709 newElmt
->prev
= curr
;
1710 newElmt
->next
= curr
->next
;
1711 curr
->next
= newElmt
;
1715 newElmt
->next
->prev
= newElmt
;
1719 } // ReceiptsFromSeqOf::InsertAfterAndCopy
1722 // remove current element from list if current element is not NULL
1723 // The new current element will be the next element.
1724 // If the current element is the last element in the list
1725 // the second but last element will become the new current element.
1726 void ReceiptsFromSeqOf::RemoveCurrFromList()
1728 AsnListElmt
*del_elmt
;
1736 first
= last
= curr
= NULL
;
1737 else if (curr
== first
)
1739 curr
= first
= first
->next
;
1742 else if (curr
== last
)
1744 curr
= last
= last
->prev
;
1749 curr
->prev
->next
= curr
->next
;
1750 curr
->next
->prev
= curr
->prev
;
1753 delete del_elmt
->elmt
;
1759 AsnLen
ReceiptsFromSeqOf::BEncContent (BUF_TYPE b
)
1761 AsnListElmt
*currElmt
;
1763 AsnLen totalLen
= 0;
1764 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
1767 elmtLen
= currElmt
->elmt
->BEncContent (b
);
1768 elmtLen
+= BEncConsLen (b
, elmtLen
);
1770 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1771 totalLen
+= elmtLen
;
1774 } // ReceiptsFromSeqOf::BEncContent
1777 void ReceiptsFromSeqOf::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
1778 AsnLen
&bytesDecoded
, ENV_TYPE env
)
1780 GeneralNames
*listElmt
;
1782 AsnLen listBytesDecoded
= 0;
1785 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
1787 tag1
= BDecTag (b
, listBytesDecoded
, env
);
1788 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
1790 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
1793 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
1795 Asn1Error
<< "Unexpected Tag" << endl
;
1796 SnaccExcep::throwMe(-107);
1799 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
1800 listElmt
= Append();
1801 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
1804 bytesDecoded
+= listBytesDecoded
;
1805 } // ReceiptsFromSeqOf::BDecContent
1808 AsnType
*ReceiptRequestSeqOf::Clone() const
1810 return new ReceiptRequestSeqOf
;
1813 AsnType
*ReceiptRequestSeqOf::Copy() const
1815 return new ReceiptRequestSeqOf (*this);
1818 AsnLen
ReceiptRequestSeqOf::BEnc (BUF_TYPE b
)
1821 l
= BEncContent (b
);
1822 l
+= BEncConsLen (b
, l
);
1823 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1827 void ReceiptRequestSeqOf::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1832 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1834 Asn1Error
<< "ReceiptRequestSeqOf::BDec: ERROR - wrong tag" << endl
;
1835 SnaccExcep::throwMe(-108);
1837 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1838 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1841 ReceiptRequestSeqOf::ReceiptRequestSeqOf (const ReceiptRequestSeqOf
&)
1843 Asn1Error
<< "use of incompletely defined ReceiptRequestSeqOf::ReceiptRequestSeqOf (const ReceiptRequestSeqOf &)" << endl
;
1847 ReceiptRequestSeqOf::~ReceiptRequestSeqOf()
1850 for (; Curr() != NULL
; RemoveCurrFromList())
1852 } // end of destructor
1855 ReceiptRequestSeqOf
&ReceiptRequestSeqOf::operator = (const ReceiptRequestSeqOf
&that
)
1856 #else // SNACC_DEEP_COPY
1857 ReceiptRequestSeqOf
&ReceiptRequestSeqOf::operator = (const ReceiptRequestSeqOf
&)
1858 #endif // SNACC_DEEP_COPY
1864 for (; Curr(); RemoveCurrFromList())
1867 //that.SetCurrToFirst();
1868 //for (; that.Curr(); that.GoNext())
1869 // AppendCopy (*that.Curr());
1870 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
1871 AppendCopy (*run
->elmt
);
1875 #else // SNACC_DEEP_COPY
1876 Asn1Error
<< "use of incompletely defined ReceiptRequestSeqOf &ReceiptRequestSeqOf::operator = (const ReceiptRequestSeqOf &)" << endl
;
1878 // if your compiler complains here, check the -novolat option
1879 #endif // SNACC_DEEP_COPY
1882 void ReceiptRequestSeqOf::Print (ostream
&os
) const
1885 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
1886 indentG
+= stdIndentG
;
1888 //for (; Curr() != NULL; GoNext())
1889 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
1891 Indent (os
, indentG
);
1894 //if (Curr() != Last())
1899 indentG
-= stdIndentG
;
1900 Indent (os
, indentG
);
1908 void ReceiptRequestSeqOf::SetCurrElmt (unsigned long int index
)
1910 unsigned long int i
;
1913 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
1915 } // ReceiptRequestSeqOf::SetCurrElmt
1918 unsigned long int ReceiptRequestSeqOf::GetCurrElmtIndex()
1920 unsigned long int i
;
1924 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
1933 } // ReceiptRequestSeqOf::GetCurrElmtIndex
1936 // alloc new list elmt, put at end of list
1937 // and return the component type
1938 GeneralNames
*ReceiptRequestSeqOf::Append()
1940 AsnListElmt
*newElmt
;
1941 newElmt
= new AsnListElmt
;
1942 newElmt
->elmt
= new GeneralNames
;
1943 newElmt
->next
= NULL
;
1946 newElmt
->prev
= NULL
;
1947 first
= last
= newElmt
;
1951 newElmt
->prev
= last
;
1952 last
->next
= newElmt
;
1956 return (curr
= newElmt
)->elmt
;
1957 } // ReceiptRequestSeqOf::Append
1960 // alloc new list elmt, put at begining of list
1961 // and return the component type
1962 GeneralNames
*ReceiptRequestSeqOf::Prepend()
1964 AsnListElmt
*newElmt
;
1965 newElmt
= new AsnListElmt
;
1966 newElmt
->elmt
= new GeneralNames
;
1967 newElmt
->prev
= NULL
;
1970 newElmt
->next
= NULL
;
1971 first
= last
= newElmt
;
1975 newElmt
->next
= first
;
1976 first
->prev
= newElmt
;
1980 return (curr
= newElmt
)->elmt
;
1981 } // ReceiptRequestSeqOf::Prepend
1984 // alloc new list elmt, insert it before the
1985 // current element and return the component type
1986 // if the current element is null, the new element
1987 // is placed at the beginning of the list.
1988 GeneralNames
*ReceiptRequestSeqOf::InsertBefore()
1990 AsnListElmt
*newElmt
;
1991 newElmt
= new AsnListElmt
;
1992 newElmt
->elmt
= new GeneralNames
;
1995 newElmt
->next
= first
;
1996 newElmt
->prev
= NULL
;
2003 newElmt
->next
= curr
;
2004 newElmt
->prev
= curr
->prev
;
2005 curr
->prev
= newElmt
;
2009 newElmt
->prev
->next
= newElmt
;
2012 return (curr
= newElmt
)->elmt
;
2013 } // ReceiptRequestSeqOf::InsertBefore
2016 // alloc new list elmt, insert it after the
2017 // current element and return the component type
2018 // if the current element is null, the new element
2019 // is placed at the end of the list.
2020 GeneralNames
*ReceiptRequestSeqOf::InsertAfter()
2022 AsnListElmt
*newElmt
;
2023 newElmt
= new AsnListElmt
;
2024 newElmt
->elmt
= new GeneralNames
;
2027 newElmt
->prev
= last
;
2028 newElmt
->next
= NULL
;
2035 newElmt
->prev
= curr
;
2036 newElmt
->next
= curr
->next
;
2037 curr
->next
= newElmt
;
2041 newElmt
->next
->prev
= newElmt
;
2044 return (curr
= newElmt
)->elmt
;
2045 } // ReceiptRequestSeqOf::InsertAfter
2048 ReceiptRequestSeqOf
&ReceiptRequestSeqOf::AppendCopy (GeneralNames
&elmt
)
2050 AsnListElmt
*newElmt
;
2051 newElmt
= new AsnListElmt
;
2052 newElmt
->elmt
= new GeneralNames
;
2053 *newElmt
->elmt
= elmt
;
2054 newElmt
->next
= NULL
;
2057 newElmt
->prev
= NULL
;
2058 first
= last
= newElmt
;
2062 newElmt
->prev
= last
;
2063 last
->next
= newElmt
;
2071 ReceiptRequestSeqOf
&ReceiptRequestSeqOf::PrependCopy (GeneralNames
&elmt
)
2073 AsnListElmt
*newElmt
;
2074 newElmt
= new AsnListElmt
;
2075 newElmt
->elmt
= new GeneralNames
;
2076 *newElmt
->elmt
= elmt
;
2077 newElmt
->prev
= NULL
;
2080 newElmt
->next
= NULL
;
2081 first
= last
= newElmt
;
2085 newElmt
->next
= first
;
2086 first
->prev
= newElmt
;
2091 } // ReceiptRequestSeqOf::PrependCopy
2094 // alloc new list elmt, insert it before the
2095 // current element, copy the given elmt into the new elmt
2096 // and return the component type.
2097 // if the current element is null, the new element
2098 // is placed at the beginning of the list.
2099 ReceiptRequestSeqOf
&ReceiptRequestSeqOf::InsertBeforeAndCopy (GeneralNames
&elmt
)
2101 AsnListElmt
*newElmt
;
2103 newElmt
= new AsnListElmt
;
2104 newElmt
->elmt
= new GeneralNames
;
2105 *newElmt
->elmt
= elmt
;
2109 newElmt
->next
= first
;
2110 newElmt
->prev
= NULL
;
2117 newElmt
->next
= curr
;
2118 newElmt
->prev
= curr
->prev
;
2119 curr
->prev
= newElmt
;
2123 newElmt
->prev
->next
= newElmt
;
2127 } // ReceiptRequestSeqOf::InsertBeforeAndCopy
2130 // alloc new list elmt, insert it after the
2131 // current element, copy given elmt in to new elmt
2132 // and return the component type
2133 // if the current element is null, the new element
2134 // is placed at the end of the list.
2135 ReceiptRequestSeqOf
&ReceiptRequestSeqOf::InsertAfterAndCopy (GeneralNames
&elmt
)
2137 AsnListElmt
*newElmt
;
2139 newElmt
= new AsnListElmt
;
2140 newElmt
->elmt
= new GeneralNames
;
2141 *newElmt
->elmt
= elmt
;
2144 newElmt
->prev
= last
;
2145 newElmt
->next
= NULL
;
2152 newElmt
->prev
= curr
;
2153 newElmt
->next
= curr
->next
;
2154 curr
->next
= newElmt
;
2158 newElmt
->next
->prev
= newElmt
;
2162 } // ReceiptRequestSeqOf::InsertAfterAndCopy
2165 // remove current element from list if current element is not NULL
2166 // The new current element will be the next element.
2167 // If the current element is the last element in the list
2168 // the second but last element will become the new current element.
2169 void ReceiptRequestSeqOf::RemoveCurrFromList()
2171 AsnListElmt
*del_elmt
;
2179 first
= last
= curr
= NULL
;
2180 else if (curr
== first
)
2182 curr
= first
= first
->next
;
2185 else if (curr
== last
)
2187 curr
= last
= last
->prev
;
2192 curr
->prev
->next
= curr
->next
;
2193 curr
->next
->prev
= curr
->prev
;
2196 delete del_elmt
->elmt
;
2202 AsnLen
ReceiptRequestSeqOf::BEncContent (BUF_TYPE b
)
2204 AsnListElmt
*currElmt
;
2206 AsnLen totalLen
= 0;
2207 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
2210 elmtLen
= currElmt
->elmt
->BEncContent (b
);
2211 elmtLen
+= BEncConsLen (b
, elmtLen
);
2213 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2214 totalLen
+= elmtLen
;
2217 } // ReceiptRequestSeqOf::BEncContent
2220 void ReceiptRequestSeqOf::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
2221 AsnLen
&bytesDecoded
, ENV_TYPE env
)
2223 GeneralNames
*listElmt
;
2225 AsnLen listBytesDecoded
= 0;
2228 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
2230 tag1
= BDecTag (b
, listBytesDecoded
, env
);
2231 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
2233 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
2236 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
2238 Asn1Error
<< "Unexpected Tag" << endl
;
2239 SnaccExcep::throwMe(-109);
2242 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
2243 listElmt
= Append();
2244 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
2247 bytesDecoded
+= listBytesDecoded
;
2248 } // ReceiptRequestSeqOf::BDecContent
2251 ESSPrivacyMark::ESSPrivacyMark()
2253 choiceId
= pStringCid
;
2255 pString
= new PrintableString
;
2257 pString
= NULL
; // incomplete initialization of mandatory element!
2261 ESSPrivacyMark::ESSPrivacyMark (const ESSPrivacyMark
&)
2263 Asn1Error
<< "use of incompletely defined ESSPrivacyMark::ESSPrivacyMark (const ESSPrivacyMark &)" << endl
;
2267 ESSPrivacyMark::~ESSPrivacyMark()
2278 } // end of destructor
2280 AsnType
*ESSPrivacyMark::Clone() const
2282 return new ESSPrivacyMark
;
2285 AsnType
*ESSPrivacyMark::Copy() const
2287 return new ESSPrivacyMark (*this);
2291 ESSPrivacyMark
&ESSPrivacyMark::operator = (const ESSPrivacyMark
&that
)
2292 #else // SNACC_DEEP_COPY
2293 ESSPrivacyMark
&ESSPrivacyMark::operator = (const ESSPrivacyMark
&)
2294 #endif // SNACC_DEEP_COPY
2308 switch (choiceId
= that
.choiceId
)
2311 pString
= new PrintableString
;
2312 *pString
= *that
.pString
;
2315 utf8String
= new UTF8String
;
2316 *utf8String
= *that
.utf8String
;
2322 #else // SNACC_DEEP_COPY
2323 Asn1Error
<< "use of incompletely defined ESSPrivacyMark &ESSPrivacyMark::operator = (const ESSPrivacyMark &)" << endl
;
2325 // if your compiler complains here, check the -novolat option
2326 #endif // SNACC_DEEP_COPY
2330 ESSPrivacyMark::BEncContent (BUF_TYPE b
)
2336 l
= pString
->BEncContent (b
);
2337 l
+= BEncDefLen (b
, l
);
2339 l
+= BEncTag1 (b
, UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
);
2343 l
= utf8String
->BEncContent (b
);
2344 l
+= BEncDefLen (b
, l
);
2346 l
+= BEncTag1 (b
, UNIV
, PRIM
, 12);
2351 } // ESSPrivacyMark::BEncContent
2354 void ESSPrivacyMark::BDecContent (BUF_TYPE b
, AsnTag tag
, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2358 case MAKE_TAG_ID (UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
):
2359 case MAKE_TAG_ID (UNIV
, CONS
, PRINTABLESTRING_TAG_CODE
):
2360 choiceId
= pStringCid
;
2361 pString
= new PrintableString
;
2362 pString
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
2365 case MAKE_TAG_ID (UNIV
, PRIM
, 12):
2366 case MAKE_TAG_ID (UNIV
, CONS
, 12):
2367 choiceId
= utf8StringCid
;
2368 utf8String
= new UTF8String
;
2369 utf8String
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
2373 Asn1Error
<< "ERROR - unexpected tag in CHOICE" << endl
;
2374 SnaccExcep::throwMe(-110);
2377 } // ESSPrivacyMark::BDecContent
2380 AsnLen
ESSPrivacyMark::BEnc (BUF_TYPE b
)
2383 l
= BEncContent (b
);
2387 void ESSPrivacyMark::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2392 /* CHOICEs are a special case - grab identifying tag */
2393 /* this allows easier handling of nested CHOICEs */
2394 tag
= BDecTag (b
, bytesDecoded
, env
);
2395 elmtLen
= BDecLen (b
, bytesDecoded
, env
);
2396 BDecContent (b
, tag
, elmtLen
, bytesDecoded
, env
);
2399 void ESSPrivacyMark::Print (ostream
&os
) const
2409 os
<< "-- void3 --\n";
2413 os
<< "utf8String ";
2417 os
<< "-- void3 --\n";
2422 } // ESSPrivacyMark::Print
2424 SecurityCategory::SecurityCategory()
2428 SecurityCategory::SecurityCategory (const SecurityCategory
&)
2430 Asn1Error
<< "use of incompletely defined SecurityCategory::SecurityCategory (const SecurityCategory &)" << endl
;
2434 SecurityCategory::~SecurityCategory()
2438 AsnType
*SecurityCategory::Clone() const
2440 return new SecurityCategory
;
2443 AsnType
*SecurityCategory::Copy() const
2445 return new SecurityCategory (*this);
2449 SecurityCategory
&SecurityCategory::operator = (const SecurityCategory
&that
)
2450 #else // SNACC_DEEP_COPY
2451 SecurityCategory
&SecurityCategory::operator = (const SecurityCategory
&)
2452 #endif // SNACC_DEEP_COPY
2462 #else // SNACC_DEEP_COPY
2463 Asn1Error
<< "use of incompletely defined SecurityCategory &SecurityCategory::operator = (const SecurityCategory &)" << endl
;
2465 // if your compiler complains here, check the -novolat option
2466 #endif // SNACC_DEEP_COPY
2470 SecurityCategory::BEncContent (BUF_TYPE b
)
2472 AsnLen totalLen
= 0;
2476 ENC_LOAD_ANYBUF(&value
, b
, l
);
2477 l
+= BEncConsLen (b
, l
);
2479 l
+= BEncTag1 (b
, CNTX
, CONS
, 1);
2482 l
= type
.BEncContent (b
);
2483 l
+= BEncDefLen (b
, l
);
2485 l
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
2489 } // SecurityCategory::BEncContent
2492 void SecurityCategory::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2495 AsnLen seqBytesDecoded
= 0;
2497 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
2499 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 0)))
2501 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
2502 type
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
2503 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
2507 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
2508 SnaccExcep::throwMe(-111);
2511 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
2513 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
2514 DEC_LOAD_ANYBUF(&value
, b
, seqBytesDecoded
, env
);
2515 if (elmtLen1
== INDEFINITE_LEN
)
2516 BDecEoc (b
, seqBytesDecoded
, env
);
2521 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
2522 SnaccExcep::throwMe(-112);
2525 bytesDecoded
+= seqBytesDecoded
;
2526 if (elmtLen0
== INDEFINITE_LEN
)
2528 BDecEoc (b
, bytesDecoded
, env
);
2531 else if (seqBytesDecoded
!= elmtLen0
)
2533 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
2534 SnaccExcep::throwMe(-113);
2538 } // SecurityCategory::BDecContent
2540 AsnLen
SecurityCategory::BEnc (BUF_TYPE b
)
2543 l
= BEncContent (b
);
2544 l
+= BEncConsLen (b
, l
);
2545 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2549 void SecurityCategory::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2554 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
2556 Asn1Error
<< "SecurityCategory::BDec: ERROR - wrong tag" << endl
;
2557 SnaccExcep::throwMe(-114);
2559 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
2560 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
2563 void SecurityCategory::Print (ostream
&os
) const
2566 os
<< "{ -- SEQUENCE --" << endl
;
2567 indentG
+= stdIndentG
;
2570 Indent (os
, indentG
);
2577 Indent (os
, indentG
);
2583 indentG
-= stdIndentG
;
2584 Indent (os
, indentG
);
2587 } // SecurityCategory::Print
2590 EntityIdentifier::EntityIdentifier()
2592 choiceId
= issuerAndSerialNumberCid
;
2594 issuerAndSerialNumber
= new IssuerAndSerialNumber
;
2596 issuerAndSerialNumber
= NULL
; // incomplete initialization of mandatory element!
2600 EntityIdentifier::EntityIdentifier (const EntityIdentifier
&)
2602 Asn1Error
<< "use of incompletely defined EntityIdentifier::EntityIdentifier (const EntityIdentifier &)" << endl
;
2606 EntityIdentifier::~EntityIdentifier()
2610 case issuerAndSerialNumberCid
:
2611 delete issuerAndSerialNumber
;
2613 case subjectKeyIdentifierCid
:
2614 delete subjectKeyIdentifier
;
2617 } // end of destructor
2619 AsnType
*EntityIdentifier::Clone() const
2621 return new EntityIdentifier
;
2624 AsnType
*EntityIdentifier::Copy() const
2626 return new EntityIdentifier (*this);
2630 EntityIdentifier
&EntityIdentifier::operator = (const EntityIdentifier
&that
)
2631 #else // SNACC_DEEP_COPY
2632 EntityIdentifier
&EntityIdentifier::operator = (const EntityIdentifier
&)
2633 #endif // SNACC_DEEP_COPY
2640 case issuerAndSerialNumberCid
:
2641 delete issuerAndSerialNumber
;
2643 case subjectKeyIdentifierCid
:
2644 delete subjectKeyIdentifier
;
2647 switch (choiceId
= that
.choiceId
)
2649 case issuerAndSerialNumberCid
:
2650 issuerAndSerialNumber
= new IssuerAndSerialNumber
;
2651 *issuerAndSerialNumber
= *that
.issuerAndSerialNumber
;
2653 case subjectKeyIdentifierCid
:
2654 subjectKeyIdentifier
= new KeyIdentifier
;
2655 *subjectKeyIdentifier
= *that
.subjectKeyIdentifier
;
2661 #else // SNACC_DEEP_COPY
2662 Asn1Error
<< "use of incompletely defined EntityIdentifier &EntityIdentifier::operator = (const EntityIdentifier &)" << endl
;
2664 // if your compiler complains here, check the -novolat option
2665 #endif // SNACC_DEEP_COPY
2669 EntityIdentifier::BEncContent (BUF_TYPE b
)
2674 case issuerAndSerialNumberCid
:
2676 l
= issuerAndSerialNumber
->BEncContent (b
);
2677 l
+= BEncConsLen (b
, l
);
2679 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2682 case subjectKeyIdentifierCid
:
2683 l
= subjectKeyIdentifier
->BEncContent (b
);
2684 l
+= BEncDefLen (b
, l
);
2686 l
+= BEncTag1 (b
, UNIV
, PRIM
, OCTETSTRING_TAG_CODE
);
2691 } // EntityIdentifier::BEncContent
2694 void EntityIdentifier::BDecContent (BUF_TYPE b
, AsnTag tag
, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2698 case MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
):
2699 choiceId
= issuerAndSerialNumberCid
;
2700 issuerAndSerialNumber
= new IssuerAndSerialNumber
;
2701 issuerAndSerialNumber
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
2704 case MAKE_TAG_ID (UNIV
, PRIM
, OCTETSTRING_TAG_CODE
):
2705 case MAKE_TAG_ID (UNIV
, CONS
, OCTETSTRING_TAG_CODE
):
2706 choiceId
= subjectKeyIdentifierCid
;
2707 subjectKeyIdentifier
= new KeyIdentifier
;
2708 subjectKeyIdentifier
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
2712 Asn1Error
<< "ERROR - unexpected tag in CHOICE" << endl
;
2713 SnaccExcep::throwMe(-115);
2716 } // EntityIdentifier::BDecContent
2719 AsnLen
EntityIdentifier::BEnc (BUF_TYPE b
)
2722 l
= BEncContent (b
);
2726 void EntityIdentifier::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2731 /* CHOICEs are a special case - grab identifying tag */
2732 /* this allows easier handling of nested CHOICEs */
2733 tag
= BDecTag (b
, bytesDecoded
, env
);
2734 elmtLen
= BDecLen (b
, bytesDecoded
, env
);
2735 BDecContent (b
, tag
, elmtLen
, bytesDecoded
, env
);
2738 void EntityIdentifier::Print (ostream
&os
) const
2743 case issuerAndSerialNumberCid
:
2744 os
<< "issuerAndSerialNumber ";
2745 if (issuerAndSerialNumber
)
2746 os
<< *issuerAndSerialNumber
;
2748 os
<< "-- void3 --\n";
2751 case subjectKeyIdentifierCid
:
2752 os
<< "subjectKeyIdentifier ";
2753 if (subjectKeyIdentifier
)
2754 os
<< *subjectKeyIdentifier
;
2756 os
<< "-- void3 --\n";
2761 } // EntityIdentifier::Print
2763 ReceiptsFrom::ReceiptsFrom()
2765 choiceId
= allOrFirstTierCid
;
2767 allOrFirstTier
= new AllOrFirstTier
;
2769 allOrFirstTier
= NULL
; // incomplete initialization of mandatory element!
2773 ReceiptsFrom::ReceiptsFrom (const ReceiptsFrom
&)
2775 Asn1Error
<< "use of incompletely defined ReceiptsFrom::ReceiptsFrom (const ReceiptsFrom &)" << endl
;
2779 ReceiptsFrom::~ReceiptsFrom()
2783 case allOrFirstTierCid
:
2784 delete allOrFirstTier
;
2786 case receiptListCid
:
2790 } // end of destructor
2792 AsnType
*ReceiptsFrom::Clone() const
2794 return new ReceiptsFrom
;
2797 AsnType
*ReceiptsFrom::Copy() const
2799 return new ReceiptsFrom (*this);
2803 ReceiptsFrom
&ReceiptsFrom::operator = (const ReceiptsFrom
&that
)
2804 #else // SNACC_DEEP_COPY
2805 ReceiptsFrom
&ReceiptsFrom::operator = (const ReceiptsFrom
&)
2806 #endif // SNACC_DEEP_COPY
2813 case allOrFirstTierCid
:
2814 delete allOrFirstTier
;
2816 case receiptListCid
:
2820 switch (choiceId
= that
.choiceId
)
2822 case allOrFirstTierCid
:
2823 allOrFirstTier
= new AllOrFirstTier
;
2824 *allOrFirstTier
= *that
.allOrFirstTier
;
2826 case receiptListCid
:
2827 receiptList
= new ReceiptsFromSeqOf
;
2828 *receiptList
= *that
.receiptList
;
2834 #else // SNACC_DEEP_COPY
2835 Asn1Error
<< "use of incompletely defined ReceiptsFrom &ReceiptsFrom::operator = (const ReceiptsFrom &)" << endl
;
2837 // if your compiler complains here, check the -novolat option
2838 #endif // SNACC_DEEP_COPY
2842 ReceiptsFrom::BEncContent (BUF_TYPE b
)
2847 case allOrFirstTierCid
:
2848 l
= allOrFirstTier
->BEncContent (b
);
2849 BEncDefLenTo127 (b
, l
);
2852 l
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
2855 case receiptListCid
:
2857 l
= receiptList
->BEncContent (b
);
2858 l
+= BEncConsLen (b
, l
);
2860 l
+= BEncTag1 (b
, CNTX
, CONS
, 1);
2865 } // ReceiptsFrom::BEncContent
2868 void ReceiptsFrom::BDecContent (BUF_TYPE b
, AsnTag tag
, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2872 case MAKE_TAG_ID (CNTX
, PRIM
, 0):
2873 choiceId
= allOrFirstTierCid
;
2874 allOrFirstTier
= new AllOrFirstTier
;
2875 allOrFirstTier
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
2878 case MAKE_TAG_ID (CNTX
, CONS
, 1):
2879 choiceId
= receiptListCid
;
2880 receiptList
= new ReceiptsFromSeqOf
;
2881 receiptList
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
2885 Asn1Error
<< "ERROR - unexpected tag in CHOICE" << endl
;
2886 SnaccExcep::throwMe(-116);
2889 } // ReceiptsFrom::BDecContent
2892 AsnLen
ReceiptsFrom::BEnc (BUF_TYPE b
)
2895 l
= BEncContent (b
);
2899 void ReceiptsFrom::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2904 /* CHOICEs are a special case - grab identifying tag */
2905 /* this allows easier handling of nested CHOICEs */
2906 tag
= BDecTag (b
, bytesDecoded
, env
);
2907 elmtLen
= BDecLen (b
, bytesDecoded
, env
);
2908 BDecContent (b
, tag
, elmtLen
, bytesDecoded
, env
);
2911 void ReceiptsFrom::Print (ostream
&os
) const
2916 case allOrFirstTierCid
:
2917 os
<< "allOrFirstTier ";
2919 os
<< *allOrFirstTier
;
2921 os
<< "-- void3 --\n";
2924 case receiptListCid
:
2925 os
<< "receiptList ";
2929 os
<< "-- void3 --\n";
2934 } // ReceiptsFrom::Print
2936 AsnType
*SecurityCategories::Clone() const
2938 return new SecurityCategories
;
2941 AsnType
*SecurityCategories::Copy() const
2943 return new SecurityCategories (*this);
2946 AsnLen
SecurityCategories::BEnc (BUF_TYPE b
)
2949 l
= BEncContent (b
);
2950 l
+= BEncConsLen (b
, l
);
2951 l
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
2955 void SecurityCategories::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2960 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
))
2962 Asn1Error
<< "SecurityCategories::BDec: ERROR - wrong tag" << endl
;
2963 SnaccExcep::throwMe(-117);
2965 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
2966 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
2969 SecurityCategories::SecurityCategories (const SecurityCategories
&)
2971 Asn1Error
<< "use of incompletely defined SecurityCategories::SecurityCategories (const SecurityCategories &)" << endl
;
2975 SecurityCategories::~SecurityCategories()
2978 for (; Curr() != NULL
; RemoveCurrFromList())
2980 } // end of destructor
2983 SecurityCategories
&SecurityCategories::operator = (const SecurityCategories
&that
)
2984 #else // SNACC_DEEP_COPY
2985 SecurityCategories
&SecurityCategories::operator = (const SecurityCategories
&)
2986 #endif // SNACC_DEEP_COPY
2992 for (; Curr(); RemoveCurrFromList())
2995 //that.SetCurrToFirst();
2996 //for (; that.Curr(); that.GoNext())
2997 // AppendCopy (*that.Curr());
2998 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
2999 AppendCopy (*run
->elmt
);
3003 #else // SNACC_DEEP_COPY
3004 Asn1Error
<< "use of incompletely defined SecurityCategories &SecurityCategories::operator = (const SecurityCategories &)" << endl
;
3006 // if your compiler complains here, check the -novolat option
3007 #endif // SNACC_DEEP_COPY
3010 void SecurityCategories::Print (ostream
&os
) const
3013 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
3014 indentG
+= stdIndentG
;
3016 //for (; Curr() != NULL; GoNext())
3017 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
3019 Indent (os
, indentG
);
3022 //if (Curr() != Last())
3027 indentG
-= stdIndentG
;
3028 Indent (os
, indentG
);
3036 void SecurityCategories::SetCurrElmt (unsigned long int index
)
3038 unsigned long int i
;
3041 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
3043 } // SecurityCategories::SetCurrElmt
3046 unsigned long int SecurityCategories::GetCurrElmtIndex()
3048 unsigned long int i
;
3052 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
3061 } // SecurityCategories::GetCurrElmtIndex
3064 // alloc new list elmt, put at end of list
3065 // and return the component type
3066 SecurityCategory
*SecurityCategories::Append()
3068 AsnListElmt
*newElmt
;
3069 newElmt
= new AsnListElmt
;
3070 newElmt
->elmt
= new SecurityCategory
;
3071 newElmt
->next
= NULL
;
3074 newElmt
->prev
= NULL
;
3075 first
= last
= newElmt
;
3079 newElmt
->prev
= last
;
3080 last
->next
= newElmt
;
3084 return (curr
= newElmt
)->elmt
;
3085 } // SecurityCategories::Append
3088 // alloc new list elmt, put at begining of list
3089 // and return the component type
3090 SecurityCategory
*SecurityCategories::Prepend()
3092 AsnListElmt
*newElmt
;
3093 newElmt
= new AsnListElmt
;
3094 newElmt
->elmt
= new SecurityCategory
;
3095 newElmt
->prev
= NULL
;
3098 newElmt
->next
= NULL
;
3099 first
= last
= newElmt
;
3103 newElmt
->next
= first
;
3104 first
->prev
= newElmt
;
3108 return (curr
= newElmt
)->elmt
;
3109 } // SecurityCategories::Prepend
3112 // alloc new list elmt, insert it before the
3113 // current element and return the component type
3114 // if the current element is null, the new element
3115 // is placed at the beginning of the list.
3116 SecurityCategory
*SecurityCategories::InsertBefore()
3118 AsnListElmt
*newElmt
;
3119 newElmt
= new AsnListElmt
;
3120 newElmt
->elmt
= new SecurityCategory
;
3123 newElmt
->next
= first
;
3124 newElmt
->prev
= NULL
;
3131 newElmt
->next
= curr
;
3132 newElmt
->prev
= curr
->prev
;
3133 curr
->prev
= newElmt
;
3137 newElmt
->prev
->next
= newElmt
;
3140 return (curr
= newElmt
)->elmt
;
3141 } // SecurityCategories::InsertBefore
3144 // alloc new list elmt, insert it after the
3145 // current element and return the component type
3146 // if the current element is null, the new element
3147 // is placed at the end of the list.
3148 SecurityCategory
*SecurityCategories::InsertAfter()
3150 AsnListElmt
*newElmt
;
3151 newElmt
= new AsnListElmt
;
3152 newElmt
->elmt
= new SecurityCategory
;
3155 newElmt
->prev
= last
;
3156 newElmt
->next
= NULL
;
3163 newElmt
->prev
= curr
;
3164 newElmt
->next
= curr
->next
;
3165 curr
->next
= newElmt
;
3169 newElmt
->next
->prev
= newElmt
;
3172 return (curr
= newElmt
)->elmt
;
3173 } // SecurityCategories::InsertAfter
3176 SecurityCategories
&SecurityCategories::AppendCopy (SecurityCategory
&elmt
)
3178 AsnListElmt
*newElmt
;
3179 newElmt
= new AsnListElmt
;
3180 newElmt
->elmt
= new SecurityCategory
;
3181 *newElmt
->elmt
= elmt
;
3182 newElmt
->next
= NULL
;
3185 newElmt
->prev
= NULL
;
3186 first
= last
= newElmt
;
3190 newElmt
->prev
= last
;
3191 last
->next
= newElmt
;
3199 SecurityCategories
&SecurityCategories::PrependCopy (SecurityCategory
&elmt
)
3201 AsnListElmt
*newElmt
;
3202 newElmt
= new AsnListElmt
;
3203 newElmt
->elmt
= new SecurityCategory
;
3204 *newElmt
->elmt
= elmt
;
3205 newElmt
->prev
= NULL
;
3208 newElmt
->next
= NULL
;
3209 first
= last
= newElmt
;
3213 newElmt
->next
= first
;
3214 first
->prev
= newElmt
;
3219 } // SecurityCategories::PrependCopy
3222 // alloc new list elmt, insert it before the
3223 // current element, copy the given elmt into the new elmt
3224 // and return the component type.
3225 // if the current element is null, the new element
3226 // is placed at the beginning of the list.
3227 SecurityCategories
&SecurityCategories::InsertBeforeAndCopy (SecurityCategory
&elmt
)
3229 AsnListElmt
*newElmt
;
3231 newElmt
= new AsnListElmt
;
3232 newElmt
->elmt
= new SecurityCategory
;
3233 *newElmt
->elmt
= elmt
;
3237 newElmt
->next
= first
;
3238 newElmt
->prev
= NULL
;
3245 newElmt
->next
= curr
;
3246 newElmt
->prev
= curr
->prev
;
3247 curr
->prev
= newElmt
;
3251 newElmt
->prev
->next
= newElmt
;
3255 } // SecurityCategories::InsertBeforeAndCopy
3258 // alloc new list elmt, insert it after the
3259 // current element, copy given elmt in to new elmt
3260 // and return the component type
3261 // if the current element is null, the new element
3262 // is placed at the end of the list.
3263 SecurityCategories
&SecurityCategories::InsertAfterAndCopy (SecurityCategory
&elmt
)
3265 AsnListElmt
*newElmt
;
3267 newElmt
= new AsnListElmt
;
3268 newElmt
->elmt
= new SecurityCategory
;
3269 *newElmt
->elmt
= elmt
;
3272 newElmt
->prev
= last
;
3273 newElmt
->next
= NULL
;
3280 newElmt
->prev
= curr
;
3281 newElmt
->next
= curr
->next
;
3282 curr
->next
= newElmt
;
3286 newElmt
->next
->prev
= newElmt
;
3290 } // SecurityCategories::InsertAfterAndCopy
3293 // remove current element from list if current element is not NULL
3294 // The new current element will be the next element.
3295 // If the current element is the last element in the list
3296 // the second but last element will become the new current element.
3297 void SecurityCategories::RemoveCurrFromList()
3299 AsnListElmt
*del_elmt
;
3307 first
= last
= curr
= NULL
;
3308 else if (curr
== first
)
3310 curr
= first
= first
->next
;
3313 else if (curr
== last
)
3315 curr
= last
= last
->prev
;
3320 curr
->prev
->next
= curr
->next
;
3321 curr
->next
->prev
= curr
->prev
;
3324 delete del_elmt
->elmt
;
3330 AsnLen
SecurityCategories::BEncContent (BUF_TYPE b
)
3332 AsnListElmt
*currElmt
;
3334 AsnLen totalLen
= 0;
3337 CSM_Buffer
**tmpEnc
=NULL
;
3338 for (currElmt
= last
,icount
=0; currElmt
!= NULL
; currElmt
= currElmt
->prev
, icount
++);
3339 tmpEnc
= (CSM_Buffer
**) calloc(sizeof(CSM_Buffer
*), icount
);
3340 for (currElmt
= last
, iii
=0; currElmt
!= NULL
; currElmt
= currElmt
->prev
,iii
++,elmtLen
=0)
3343 ENCODE_BUF1(currElmt
->elmt
->BEncContent
, elmtLen
);
3344 elmtLen
+= BEncConsLen (outputBuf
, elmtLen
);
3346 elmtLen
+= BEncTag1 (outputBuf
, UNIV
, CONS
, SEQ_TAG_CODE
);
3347 ENCODE_BUF2(tmpEnc
[iii
]);
3349 vdasnacc_sortSetOf(tmpEnc
, icount
);
3350 for (iii
=0,elmtLen
=0; iii
< icount
; elmtLen
+=tmpEnc
[iii
++]->Length())
3351 SM_WriteToAsnBuf(tmpEnc
[iii
], b
);
3352 for (iii
=0; iii
< icount
; iii
++) delete tmpEnc
[iii
];
3355 totalLen
+= elmtLen
;
3357 } // SecurityCategories::BEncContent
3360 void SecurityCategories::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
3361 AsnLen
&bytesDecoded
, ENV_TYPE env
)
3363 SecurityCategory
*listElmt
;
3365 AsnLen listBytesDecoded
= 0;
3368 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
3370 tag1
= BDecTag (b
, listBytesDecoded
, env
);
3371 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
3373 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
3376 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
3378 Asn1Error
<< "Unexpected Tag" << endl
;
3379 SnaccExcep::throwMe(-118);
3382 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
3383 listElmt
= Append();
3384 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
3387 bytesDecoded
+= listBytesDecoded
;
3388 } // SecurityCategories::BDecContent
3391 MLReceiptPolicy::MLReceiptPolicy()
3397 none
= NULL
; // incomplete initialization of mandatory element!
3401 MLReceiptPolicy::MLReceiptPolicy (const MLReceiptPolicy
&)
3403 Asn1Error
<< "use of incompletely defined MLReceiptPolicy::MLReceiptPolicy (const MLReceiptPolicy &)" << endl
;
3407 MLReceiptPolicy::~MLReceiptPolicy()
3417 case inAdditionToCid
:
3418 delete inAdditionTo
;
3421 } // end of destructor
3423 AsnType
*MLReceiptPolicy::Clone() const
3425 return new MLReceiptPolicy
;
3428 AsnType
*MLReceiptPolicy::Copy() const
3430 return new MLReceiptPolicy (*this);
3434 MLReceiptPolicy
&MLReceiptPolicy::operator = (const MLReceiptPolicy
&that
)
3435 #else // SNACC_DEEP_COPY
3436 MLReceiptPolicy
&MLReceiptPolicy::operator = (const MLReceiptPolicy
&)
3437 #endif // SNACC_DEEP_COPY
3450 case inAdditionToCid
:
3451 delete inAdditionTo
;
3454 switch (choiceId
= that
.choiceId
)
3461 insteadOf
= new MLReceiptPolicySeqOf
;
3462 *insteadOf
= *that
.insteadOf
;
3464 case inAdditionToCid
:
3465 inAdditionTo
= new MLReceiptPolicySeqOf1
;
3466 *inAdditionTo
= *that
.inAdditionTo
;
3472 #else // SNACC_DEEP_COPY
3473 Asn1Error
<< "use of incompletely defined MLReceiptPolicy &MLReceiptPolicy::operator = (const MLReceiptPolicy &)" << endl
;
3475 // if your compiler complains here, check the -novolat option
3476 #endif // SNACC_DEEP_COPY
3480 MLReceiptPolicy::BEncContent (BUF_TYPE b
)
3486 l
= none
->BEncContent (b
);
3487 BEncDefLenTo127 (b
, l
);
3490 l
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
3495 l
= insteadOf
->BEncContent (b
);
3496 l
+= BEncConsLen (b
, l
);
3498 l
+= BEncTag1 (b
, CNTX
, CONS
, 1);
3501 case inAdditionToCid
:
3503 l
= inAdditionTo
->BEncContent (b
);
3504 l
+= BEncConsLen (b
, l
);
3506 l
+= BEncTag1 (b
, CNTX
, CONS
, 2);
3511 } // MLReceiptPolicy::BEncContent
3514 void MLReceiptPolicy::BDecContent (BUF_TYPE b
, AsnTag tag
, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3518 case MAKE_TAG_ID (CNTX
, PRIM
, 0):
3521 none
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
3524 case MAKE_TAG_ID (CNTX
, CONS
, 1):
3525 choiceId
= insteadOfCid
;
3526 insteadOf
= new MLReceiptPolicySeqOf
;
3527 insteadOf
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
3530 case MAKE_TAG_ID (CNTX
, CONS
, 2):
3531 choiceId
= inAdditionToCid
;
3532 inAdditionTo
= new MLReceiptPolicySeqOf1
;
3533 inAdditionTo
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
3537 Asn1Error
<< "ERROR - unexpected tag in CHOICE" << endl
;
3538 SnaccExcep::throwMe(-119);
3541 } // MLReceiptPolicy::BDecContent
3544 AsnLen
MLReceiptPolicy::BEnc (BUF_TYPE b
)
3547 l
= BEncContent (b
);
3551 void MLReceiptPolicy::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3556 /* CHOICEs are a special case - grab identifying tag */
3557 /* this allows easier handling of nested CHOICEs */
3558 tag
= BDecTag (b
, bytesDecoded
, env
);
3559 elmtLen
= BDecLen (b
, bytesDecoded
, env
);
3560 BDecContent (b
, tag
, elmtLen
, bytesDecoded
, env
);
3563 void MLReceiptPolicy::Print (ostream
&os
) const
3573 os
<< "-- void3 --\n";
3581 os
<< "-- void3 --\n";
3584 case inAdditionToCid
:
3585 os
<< "inAdditionTo ";
3587 os
<< *inAdditionTo
;
3589 os
<< "-- void3 --\n";
3594 } // MLReceiptPolicy::Print
3596 ESSCertID::ESSCertID()
3598 issuerSerial
= NULL
;
3601 ESSCertID::ESSCertID (const ESSCertID
&)
3603 Asn1Error
<< "use of incompletely defined ESSCertID::ESSCertID (const ESSCertID &)" << endl
;
3607 ESSCertID::~ESSCertID()
3609 delete issuerSerial
;
3612 AsnType
*ESSCertID::Clone() const
3614 return new ESSCertID
;
3617 AsnType
*ESSCertID::Copy() const
3619 return new ESSCertID (*this);
3623 ESSCertID
&ESSCertID::operator = (const ESSCertID
&that
)
3624 #else // SNACC_DEEP_COPY
3625 ESSCertID
&ESSCertID::operator = (const ESSCertID
&)
3626 #endif // SNACC_DEEP_COPY
3631 certHash
= that
.certHash
;
3632 if (that
.issuerSerial
)
3635 issuerSerial
= new IssuerSerial
;
3636 *issuerSerial
= *that
.issuerSerial
;
3640 delete issuerSerial
;
3641 issuerSerial
= NULL
;
3646 #else // SNACC_DEEP_COPY
3647 Asn1Error
<< "use of incompletely defined ESSCertID &ESSCertID::operator = (const ESSCertID &)" << endl
;
3649 // if your compiler complains here, check the -novolat option
3650 #endif // SNACC_DEEP_COPY
3654 ESSCertID::BEncContent (BUF_TYPE b
)
3656 AsnLen totalLen
= 0;
3659 if (NOT_NULL (issuerSerial
))
3662 l
= issuerSerial
->BEncContent (b
);
3663 l
+= BEncConsLen (b
, l
);
3665 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3669 l
= certHash
.BEncContent (b
);
3670 l
+= BEncDefLen (b
, l
);
3672 l
+= BEncTag1 (b
, UNIV
, PRIM
, OCTETSTRING_TAG_CODE
);
3676 } // ESSCertID::BEncContent
3679 void ESSCertID::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3682 AsnLen seqBytesDecoded
= 0;
3684 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3686 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OCTETSTRING_TAG_CODE
))
3687 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, OCTETSTRING_TAG_CODE
)))
3689 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3690 certHash
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3691 if (seqBytesDecoded
== elmtLen0
)
3693 bytesDecoded
+= seqBytesDecoded
;
3698 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3700 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3702 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3703 bytesDecoded
+= seqBytesDecoded
;
3710 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
3711 SnaccExcep::throwMe(-120);
3714 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
3716 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3717 issuerSerial
= new IssuerSerial
;
3718 issuerSerial
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3721 bytesDecoded
+= seqBytesDecoded
;
3722 if (elmtLen0
== INDEFINITE_LEN
)
3724 BDecEoc (b
, bytesDecoded
, env
);
3727 else if (seqBytesDecoded
!= elmtLen0
)
3729 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
3730 SnaccExcep::throwMe(-121);
3734 } // ESSCertID::BDecContent
3736 AsnLen
ESSCertID::BEnc (BUF_TYPE b
)
3739 l
= BEncContent (b
);
3740 l
+= BEncConsLen (b
, l
);
3741 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3745 void ESSCertID::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3750 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
3752 Asn1Error
<< "ESSCertID::BDec: ERROR - wrong tag" << endl
;
3753 SnaccExcep::throwMe(-122);
3755 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
3756 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
3759 void ESSCertID::Print (ostream
&os
) const
3762 os
<< "{ -- SEQUENCE --" << endl
;
3763 indentG
+= stdIndentG
;
3766 Indent (os
, indentG
);
3772 if (NOT_NULL (issuerSerial
))
3775 Indent (os
, indentG
);
3776 os
<< "issuerSerial ";
3777 os
<< *issuerSerial
;
3781 Indent (os
, indentG
);
3782 os
<< "issuerSerial ";
3788 indentG
-= stdIndentG
;
3789 Indent (os
, indentG
);
3792 } // ESSCertID::Print
3795 AsnType
*SigningCertificateSeqOf::Clone() const
3797 return new SigningCertificateSeqOf
;
3800 AsnType
*SigningCertificateSeqOf::Copy() const
3802 return new SigningCertificateSeqOf (*this);
3805 AsnLen
SigningCertificateSeqOf::BEnc (BUF_TYPE b
)
3808 l
= BEncContent (b
);
3809 l
+= BEncConsLen (b
, l
);
3810 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3814 void SigningCertificateSeqOf::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3819 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
3821 Asn1Error
<< "SigningCertificateSeqOf::BDec: ERROR - wrong tag" << endl
;
3822 SnaccExcep::throwMe(-123);
3824 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
3825 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
3828 SigningCertificateSeqOf::SigningCertificateSeqOf (const SigningCertificateSeqOf
&)
3830 Asn1Error
<< "use of incompletely defined SigningCertificateSeqOf::SigningCertificateSeqOf (const SigningCertificateSeqOf &)" << endl
;
3834 SigningCertificateSeqOf::~SigningCertificateSeqOf()
3837 for (; Curr() != NULL
; RemoveCurrFromList())
3839 } // end of destructor
3842 SigningCertificateSeqOf
&SigningCertificateSeqOf::operator = (const SigningCertificateSeqOf
&that
)
3843 #else // SNACC_DEEP_COPY
3844 SigningCertificateSeqOf
&SigningCertificateSeqOf::operator = (const SigningCertificateSeqOf
&)
3845 #endif // SNACC_DEEP_COPY
3851 for (; Curr(); RemoveCurrFromList())
3854 //that.SetCurrToFirst();
3855 //for (; that.Curr(); that.GoNext())
3856 // AppendCopy (*that.Curr());
3857 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
3858 AppendCopy (*run
->elmt
);
3862 #else // SNACC_DEEP_COPY
3863 Asn1Error
<< "use of incompletely defined SigningCertificateSeqOf &SigningCertificateSeqOf::operator = (const SigningCertificateSeqOf &)" << endl
;
3865 // if your compiler complains here, check the -novolat option
3866 #endif // SNACC_DEEP_COPY
3869 void SigningCertificateSeqOf::Print (ostream
&os
) const
3872 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
3873 indentG
+= stdIndentG
;
3875 //for (; Curr() != NULL; GoNext())
3876 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
3878 Indent (os
, indentG
);
3881 //if (Curr() != Last())
3886 indentG
-= stdIndentG
;
3887 Indent (os
, indentG
);
3895 void SigningCertificateSeqOf::SetCurrElmt (unsigned long int index
)
3897 unsigned long int i
;
3900 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
3902 } // SigningCertificateSeqOf::SetCurrElmt
3905 unsigned long int SigningCertificateSeqOf::GetCurrElmtIndex()
3907 unsigned long int i
;
3911 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
3920 } // SigningCertificateSeqOf::GetCurrElmtIndex
3923 // alloc new list elmt, put at end of list
3924 // and return the component type
3925 ESSCertID
*SigningCertificateSeqOf::Append()
3927 AsnListElmt
*newElmt
;
3928 newElmt
= new AsnListElmt
;
3929 newElmt
->elmt
= new ESSCertID
;
3930 newElmt
->next
= NULL
;
3933 newElmt
->prev
= NULL
;
3934 first
= last
= newElmt
;
3938 newElmt
->prev
= last
;
3939 last
->next
= newElmt
;
3943 return (curr
= newElmt
)->elmt
;
3944 } // SigningCertificateSeqOf::Append
3947 // alloc new list elmt, put at begining of list
3948 // and return the component type
3949 ESSCertID
*SigningCertificateSeqOf::Prepend()
3951 AsnListElmt
*newElmt
;
3952 newElmt
= new AsnListElmt
;
3953 newElmt
->elmt
= new ESSCertID
;
3954 newElmt
->prev
= NULL
;
3957 newElmt
->next
= NULL
;
3958 first
= last
= newElmt
;
3962 newElmt
->next
= first
;
3963 first
->prev
= newElmt
;
3967 return (curr
= newElmt
)->elmt
;
3968 } // SigningCertificateSeqOf::Prepend
3971 // alloc new list elmt, insert it before the
3972 // current element and return the component type
3973 // if the current element is null, the new element
3974 // is placed at the beginning of the list.
3975 ESSCertID
*SigningCertificateSeqOf::InsertBefore()
3977 AsnListElmt
*newElmt
;
3978 newElmt
= new AsnListElmt
;
3979 newElmt
->elmt
= new ESSCertID
;
3982 newElmt
->next
= first
;
3983 newElmt
->prev
= NULL
;
3990 newElmt
->next
= curr
;
3991 newElmt
->prev
= curr
->prev
;
3992 curr
->prev
= newElmt
;
3996 newElmt
->prev
->next
= newElmt
;
3999 return (curr
= newElmt
)->elmt
;
4000 } // SigningCertificateSeqOf::InsertBefore
4003 // alloc new list elmt, insert it after the
4004 // current element and return the component type
4005 // if the current element is null, the new element
4006 // is placed at the end of the list.
4007 ESSCertID
*SigningCertificateSeqOf::InsertAfter()
4009 AsnListElmt
*newElmt
;
4010 newElmt
= new AsnListElmt
;
4011 newElmt
->elmt
= new ESSCertID
;
4014 newElmt
->prev
= last
;
4015 newElmt
->next
= NULL
;
4022 newElmt
->prev
= curr
;
4023 newElmt
->next
= curr
->next
;
4024 curr
->next
= newElmt
;
4028 newElmt
->next
->prev
= newElmt
;
4031 return (curr
= newElmt
)->elmt
;
4032 } // SigningCertificateSeqOf::InsertAfter
4035 SigningCertificateSeqOf
&SigningCertificateSeqOf::AppendCopy (ESSCertID
&elmt
)
4037 AsnListElmt
*newElmt
;
4038 newElmt
= new AsnListElmt
;
4039 newElmt
->elmt
= new ESSCertID
;
4040 *newElmt
->elmt
= elmt
;
4041 newElmt
->next
= NULL
;
4044 newElmt
->prev
= NULL
;
4045 first
= last
= newElmt
;
4049 newElmt
->prev
= last
;
4050 last
->next
= newElmt
;
4058 SigningCertificateSeqOf
&SigningCertificateSeqOf::PrependCopy (ESSCertID
&elmt
)
4060 AsnListElmt
*newElmt
;
4061 newElmt
= new AsnListElmt
;
4062 newElmt
->elmt
= new ESSCertID
;
4063 *newElmt
->elmt
= elmt
;
4064 newElmt
->prev
= NULL
;
4067 newElmt
->next
= NULL
;
4068 first
= last
= newElmt
;
4072 newElmt
->next
= first
;
4073 first
->prev
= newElmt
;
4078 } // SigningCertificateSeqOf::PrependCopy
4081 // alloc new list elmt, insert it before the
4082 // current element, copy the given elmt into the new elmt
4083 // and return the component type.
4084 // if the current element is null, the new element
4085 // is placed at the beginning of the list.
4086 SigningCertificateSeqOf
&SigningCertificateSeqOf::InsertBeforeAndCopy (ESSCertID
&elmt
)
4088 AsnListElmt
*newElmt
;
4090 newElmt
= new AsnListElmt
;
4091 newElmt
->elmt
= new ESSCertID
;
4092 *newElmt
->elmt
= elmt
;
4096 newElmt
->next
= first
;
4097 newElmt
->prev
= NULL
;
4104 newElmt
->next
= curr
;
4105 newElmt
->prev
= curr
->prev
;
4106 curr
->prev
= newElmt
;
4110 newElmt
->prev
->next
= newElmt
;
4114 } // SigningCertificateSeqOf::InsertBeforeAndCopy
4117 // alloc new list elmt, insert it after the
4118 // current element, copy given elmt in to new elmt
4119 // and return the component type
4120 // if the current element is null, the new element
4121 // is placed at the end of the list.
4122 SigningCertificateSeqOf
&SigningCertificateSeqOf::InsertAfterAndCopy (ESSCertID
&elmt
)
4124 AsnListElmt
*newElmt
;
4126 newElmt
= new AsnListElmt
;
4127 newElmt
->elmt
= new ESSCertID
;
4128 *newElmt
->elmt
= elmt
;
4131 newElmt
->prev
= last
;
4132 newElmt
->next
= NULL
;
4139 newElmt
->prev
= curr
;
4140 newElmt
->next
= curr
->next
;
4141 curr
->next
= newElmt
;
4145 newElmt
->next
->prev
= newElmt
;
4149 } // SigningCertificateSeqOf::InsertAfterAndCopy
4152 // remove current element from list if current element is not NULL
4153 // The new current element will be the next element.
4154 // If the current element is the last element in the list
4155 // the second but last element will become the new current element.
4156 void SigningCertificateSeqOf::RemoveCurrFromList()
4158 AsnListElmt
*del_elmt
;
4166 first
= last
= curr
= NULL
;
4167 else if (curr
== first
)
4169 curr
= first
= first
->next
;
4172 else if (curr
== last
)
4174 curr
= last
= last
->prev
;
4179 curr
->prev
->next
= curr
->next
;
4180 curr
->next
->prev
= curr
->prev
;
4183 delete del_elmt
->elmt
;
4189 AsnLen
SigningCertificateSeqOf::BEncContent (BUF_TYPE b
)
4191 AsnListElmt
*currElmt
;
4193 AsnLen totalLen
= 0;
4194 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
4197 elmtLen
= currElmt
->elmt
->BEncContent (b
);
4198 elmtLen
+= BEncConsLen (b
, elmtLen
);
4200 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4201 totalLen
+= elmtLen
;
4204 } // SigningCertificateSeqOf::BEncContent
4207 void SigningCertificateSeqOf::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
4208 AsnLen
&bytesDecoded
, ENV_TYPE env
)
4210 ESSCertID
*listElmt
;
4212 AsnLen listBytesDecoded
= 0;
4215 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
4217 tag1
= BDecTag (b
, listBytesDecoded
, env
);
4218 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
4220 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
4223 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
4225 Asn1Error
<< "Unexpected Tag" << endl
;
4226 SnaccExcep::throwMe(-124);
4229 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
4230 listElmt
= Append();
4231 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
4234 bytesDecoded
+= listBytesDecoded
;
4235 } // SigningCertificateSeqOf::BDecContent
4238 ESSSecurityLabel::ESSSecurityLabel()
4240 security_classification
= NULL
;
4241 privacy_mark
= NULL
;
4242 security_categories
= NULL
;
4245 ESSSecurityLabel::ESSSecurityLabel (const ESSSecurityLabel
&)
4247 Asn1Error
<< "use of incompletely defined ESSSecurityLabel::ESSSecurityLabel (const ESSSecurityLabel &)" << endl
;
4251 ESSSecurityLabel::~ESSSecurityLabel()
4253 delete security_classification
;
4254 delete privacy_mark
;
4255 delete security_categories
;
4258 AsnType
*ESSSecurityLabel::Clone() const
4260 return new ESSSecurityLabel
;
4263 AsnType
*ESSSecurityLabel::Copy() const
4265 return new ESSSecurityLabel (*this);
4269 ESSSecurityLabel
&ESSSecurityLabel::operator = (const ESSSecurityLabel
&that
)
4270 #else // SNACC_DEEP_COPY
4271 ESSSecurityLabel
&ESSSecurityLabel::operator = (const ESSSecurityLabel
&)
4272 #endif // SNACC_DEEP_COPY
4277 security_policy_identifier
= that
.security_policy_identifier
;
4278 if (that
.security_classification
)
4280 if (!security_classification
)
4281 security_classification
= new SecurityClassification
;
4282 *security_classification
= *that
.security_classification
;
4286 delete security_classification
;
4287 security_classification
= NULL
;
4289 if (that
.privacy_mark
)
4292 privacy_mark
= new ESSPrivacyMark
;
4293 *privacy_mark
= *that
.privacy_mark
;
4297 delete privacy_mark
;
4298 privacy_mark
= NULL
;
4300 if (that
.security_categories
)
4302 if (!security_categories
)
4303 security_categories
= new SecurityCategories
;
4304 *security_categories
= *that
.security_categories
;
4308 delete security_categories
;
4309 security_categories
= NULL
;
4314 #else // SNACC_DEEP_COPY
4315 Asn1Error
<< "use of incompletely defined ESSSecurityLabel &ESSSecurityLabel::operator = (const ESSSecurityLabel &)" << endl
;
4317 // if your compiler complains here, check the -novolat option
4318 #endif // SNACC_DEEP_COPY
4321 AsnLen
ESSSecurityLabel::BEncContent (BUF_TYPE b
)
4323 AsnLen totalLen
= 0;
4327 int iii
=0, tmpCount
=0;
4328 char *lpszBuf
= (char *)calloc(1, 1024);
4329 outputBuf
.Init(lpszBuf
, 1024);
4330 outputBuf
.ResetInWriteRvsMode();
4331 CSM_Buffer
*tmpEnc
[4];
4332 if (NOT_NULL (security_categories
))
4335 l
= security_categories
->BEncContent (outputBuf
);
4336 l
+= BEncConsLen (outputBuf
, l
);
4338 l
+= BEncTag1 (outputBuf
, UNIV
, CONS
, SET_TAG_CODE
);
4340 SNACC_BUFRESET_READ(&outputBuf
);
4341 SM_ReadFromAsnBuf(tmpEnc
[iii
], outputBuf
,outputBuf
.DataLen(),NULL
);
4342 SNACC_BUFRESET_WRITE(&outputBuf
);
4346 if (NOT_NULL (privacy_mark
))
4348 l
= privacy_mark
->BEncContent (outputBuf
);
4350 SNACC_BUFRESET_READ(&outputBuf
);
4351 SM_ReadFromAsnBuf(tmpEnc
[iii
], outputBuf
,outputBuf
.DataLen(),NULL
);
4352 SNACC_BUFRESET_WRITE(&outputBuf
);
4356 if (NOT_NULL (security_classification
))
4358 l
= security_classification
->BEncContent (outputBuf
);
4359 BEncDefLenTo127 (outputBuf
, l
);
4362 l
+= BEncTag1 (outputBuf
, UNIV
, PRIM
, INTEGER_TAG_CODE
);
4364 SNACC_BUFRESET_READ(&outputBuf
);
4365 SM_ReadFromAsnBuf(tmpEnc
[iii
], outputBuf
,outputBuf
.DataLen(),NULL
);
4366 SNACC_BUFRESET_WRITE(&outputBuf
);
4370 l
= security_policy_identifier
.BEncContent (outputBuf
);
4371 l
+= BEncDefLen (outputBuf
, l
);
4373 l
+= BEncTag1 (outputBuf
, UNIV
, PRIM
, OID_TAG_CODE
);
4375 SNACC_BUFRESET_READ(&outputBuf
);
4376 SM_ReadFromAsnBuf(tmpEnc
[iii
], outputBuf
,outputBuf
.DataLen(),NULL
);
4377 SNACC_BUFRESET_WRITE(&outputBuf
);
4380 vdasnacc_sortSet(tmpEnc
, iii
);
4381 tmpCount
= iii
; /** REMEMBER how many we have**/
4382 for (iii
=0; iii
< tmpCount
; iii
++)
4383 SM_WriteToAsnBuf(tmpEnc
[iii
], b
);
4384 for (iii
=0; iii
< tmpCount
; iii
++) delete tmpEnc
[iii
];
4387 } // ESSSecurityLabel::BEncContent
4390 void ESSSecurityLabel::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4393 AsnLen setBytesDecoded
= 0;
4394 unsigned int mandatoryElmtsDecoded
= 0;
4397 for (; (setBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
); )
4399 tag1
= BDecTag (b
, setBytesDecoded
, env
);
4401 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
4403 BDEC_2ND_EOC_OCTET (b
, setBytesDecoded
, env
)
4404 break; /* exit for loop */
4406 elmtLen1
= BDecLen (b
, setBytesDecoded
, env
);
4409 case MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
):
4410 security_policy_identifier
.BDecContent (b
, tag1
, elmtLen1
, setBytesDecoded
, env
);
4411 mandatoryElmtsDecoded
++;
4414 case MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
):
4415 security_classification
= new SecurityClassification
;
4416 security_classification
->BDecContent (b
, tag1
, elmtLen1
, setBytesDecoded
, env
);
4419 case MAKE_TAG_ID (UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
):
4420 case MAKE_TAG_ID (UNIV
, CONS
, PRINTABLESTRING_TAG_CODE
):
4421 case MAKE_TAG_ID (UNIV
, PRIM
, 12):
4422 case MAKE_TAG_ID (UNIV
, CONS
, 12):
4423 privacy_mark
= new ESSPrivacyMark
;
4424 privacy_mark
->BDecContent (b
, tag1
, elmtLen1
, setBytesDecoded
, env
);
4427 case MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
):
4428 security_categories
= new SecurityCategories
;
4429 security_categories
->BDecContent (b
, tag1
, elmtLen1
, setBytesDecoded
, env
);
4433 Asn1Error
<< "Unexpected Tag on SET elmt." << endl
;
4434 SnaccExcep::throwMe(-125);
4437 bytesDecoded
+= setBytesDecoded
;
4438 if (mandatoryElmtsDecoded
!= 1)
4440 Asn1Error
<< "ERROR - non-optional SET element missing." << endl
;
4441 SnaccExcep::throwMe(-126);
4443 } // ESSSecurityLabel::BDecContent
4446 ESSSecurityLabel::BEnc (BUF_TYPE b
)
4449 l
= BEncContent (b
);
4450 l
+= BEncConsLen (b
, l
);
4451 l
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
4455 void ESSSecurityLabel::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4460 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
))
4462 Asn1Error
<< "ESSSecurityLabel::BDec: ERROR - wrong tag" << endl
;
4463 SnaccExcep::throwMe(-127);
4465 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
4466 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
4469 void ESSSecurityLabel::Print (ostream
&os
) const
4472 os
<< "{ -- SET --" << endl
;
4473 indentG
+= stdIndentG
;
4476 Indent (os
, indentG
);
4477 os
<< "security-policy-identifier ";
4478 os
<< security_policy_identifier
;
4481 if (NOT_NULL (security_classification
))
4484 Indent (os
, indentG
);
4485 os
<< "security-classification ";
4486 os
<< *security_classification
;
4489 os
<< "-- void2 --\n";
4491 if (NOT_NULL (privacy_mark
))
4494 Indent (os
, indentG
);
4495 os
<< "privacy-mark ";
4496 os
<< *privacy_mark
;
4499 os
<< "-- void2 --\n";
4501 if (NOT_NULL (security_categories
))
4504 Indent (os
, indentG
);
4505 os
<< "security-categories ";
4506 os
<< *security_categories
;
4509 os
<< "-- void2 --\n";
4512 indentG
-= stdIndentG
;
4513 Indent (os
, indentG
);
4516 } // ESSSecurityLabel - operator <<
4522 mailListIdentifier
= new EntityIdentifier
;
4524 mailListIdentifier
= NULL
; // incomplete initialization of mandatory element!
4526 mlReceiptPolicy
= NULL
;
4529 MLData::MLData (const MLData
&)
4531 Asn1Error
<< "use of incompletely defined MLData::MLData (const MLData &)" << endl
;
4537 delete mailListIdentifier
;
4538 delete mlReceiptPolicy
;
4541 AsnType
*MLData::Clone() const
4546 AsnType
*MLData::Copy() const
4548 return new MLData (*this);
4552 MLData
&MLData::operator = (const MLData
&that
)
4553 #else // SNACC_DEEP_COPY
4554 MLData
&MLData::operator = (const MLData
&)
4555 #endif // SNACC_DEEP_COPY
4560 if (that
.mailListIdentifier
)
4562 if (!mailListIdentifier
)
4563 mailListIdentifier
= new EntityIdentifier
;
4564 *mailListIdentifier
= *that
.mailListIdentifier
;
4568 delete mailListIdentifier
;
4569 mailListIdentifier
= NULL
;
4571 expansionTime
= that
.expansionTime
;
4572 if (that
.mlReceiptPolicy
)
4574 if (!mlReceiptPolicy
)
4575 mlReceiptPolicy
= new MLReceiptPolicy
;
4576 *mlReceiptPolicy
= *that
.mlReceiptPolicy
;
4580 delete mlReceiptPolicy
;
4581 mlReceiptPolicy
= NULL
;
4586 #else // SNACC_DEEP_COPY
4587 Asn1Error
<< "use of incompletely defined MLData &MLData::operator = (const MLData &)" << endl
;
4589 // if your compiler complains here, check the -novolat option
4590 #endif // SNACC_DEEP_COPY
4594 MLData::BEncContent (BUF_TYPE b
)
4596 AsnLen totalLen
= 0;
4599 if (NOT_NULL (mlReceiptPolicy
))
4601 l
= mlReceiptPolicy
->BEncContent (b
);
4605 l
= expansionTime
.BEncContent (b
);
4606 l
+= BEncDefLen (b
, l
);
4608 l
+= BEncTag1 (b
, UNIV
, PRIM
, GENERALIZEDTIME_TAG_CODE
);
4611 l
= mailListIdentifier
->BEncContent (b
);
4615 } // MLData::BEncContent
4618 void MLData::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4621 AsnLen seqBytesDecoded
= 0;
4623 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4625 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
4626 || (tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OCTETSTRING_TAG_CODE
))
4627 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, OCTETSTRING_TAG_CODE
)))
4629 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4630 mailListIdentifier
= new EntityIdentifier
;
4631 mailListIdentifier
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4632 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4636 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
4637 SnaccExcep::throwMe(-128);
4640 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, GENERALIZEDTIME_TAG_CODE
))
4641 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, GENERALIZEDTIME_TAG_CODE
)))
4643 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4644 expansionTime
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4645 if (seqBytesDecoded
== elmtLen0
)
4647 bytesDecoded
+= seqBytesDecoded
;
4652 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4654 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
4656 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
4657 bytesDecoded
+= seqBytesDecoded
;
4664 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
4665 SnaccExcep::throwMe(-129);
4668 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 0))
4669 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1))
4670 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 2)))
4672 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4673 mlReceiptPolicy
= new MLReceiptPolicy
;
4674 mlReceiptPolicy
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4677 bytesDecoded
+= seqBytesDecoded
;
4678 if (elmtLen0
== INDEFINITE_LEN
)
4680 BDecEoc (b
, bytesDecoded
, env
);
4683 else if (seqBytesDecoded
!= elmtLen0
)
4685 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
4686 SnaccExcep::throwMe(-130);
4690 } // MLData::BDecContent
4692 AsnLen
MLData::BEnc (BUF_TYPE b
)
4695 l
= BEncContent (b
);
4696 l
+= BEncConsLen (b
, l
);
4697 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4701 void MLData::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4706 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
4708 Asn1Error
<< "MLData::BDec: ERROR - wrong tag" << endl
;
4709 SnaccExcep::throwMe(-131);
4711 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
4712 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
4715 void MLData::Print (ostream
&os
) const
4718 os
<< "{ -- SEQUENCE --" << endl
;
4719 indentG
+= stdIndentG
;
4721 if (NOT_NULL (mailListIdentifier
))
4723 Indent (os
, indentG
);
4724 os
<< "mailListIdentifier ";
4725 os
<< *mailListIdentifier
;
4729 Indent (os
, indentG
);
4730 os
<< "mailListIdentifier ";
4736 Indent (os
, indentG
);
4737 os
<< "expansionTime ";
4738 os
<< expansionTime
;
4742 if (NOT_NULL (mlReceiptPolicy
))
4745 Indent (os
, indentG
);
4746 os
<< "mlReceiptPolicy ";
4747 os
<< *mlReceiptPolicy
;
4751 Indent (os
, indentG
);
4752 os
<< "mlReceiptPolicy ";
4758 indentG
-= stdIndentG
;
4759 Indent (os
, indentG
);
4765 ReceiptRequest::ReceiptRequest()
4768 receiptsFrom
= new ReceiptsFrom
;
4770 receiptsFrom
= NULL
; // incomplete initialization of mandatory element!
4774 ReceiptRequest::ReceiptRequest (const ReceiptRequest
&)
4776 Asn1Error
<< "use of incompletely defined ReceiptRequest::ReceiptRequest (const ReceiptRequest &)" << endl
;
4780 ReceiptRequest::~ReceiptRequest()
4782 delete receiptsFrom
;
4785 AsnType
*ReceiptRequest::Clone() const
4787 return new ReceiptRequest
;
4790 AsnType
*ReceiptRequest::Copy() const
4792 return new ReceiptRequest (*this);
4796 ReceiptRequest
&ReceiptRequest::operator = (const ReceiptRequest
&that
)
4797 #else // SNACC_DEEP_COPY
4798 ReceiptRequest
&ReceiptRequest::operator = (const ReceiptRequest
&)
4799 #endif // SNACC_DEEP_COPY
4804 signedContentIdentifier
= that
.signedContentIdentifier
;
4805 if (that
.receiptsFrom
)
4808 receiptsFrom
= new ReceiptsFrom
;
4809 *receiptsFrom
= *that
.receiptsFrom
;
4813 delete receiptsFrom
;
4814 receiptsFrom
= NULL
;
4816 receiptsTo
= that
.receiptsTo
;
4820 #else // SNACC_DEEP_COPY
4821 Asn1Error
<< "use of incompletely defined ReceiptRequest &ReceiptRequest::operator = (const ReceiptRequest &)" << endl
;
4823 // if your compiler complains here, check the -novolat option
4824 #endif // SNACC_DEEP_COPY
4828 ReceiptRequest::BEncContent (BUF_TYPE b
)
4830 AsnLen totalLen
= 0;
4834 l
= receiptsTo
.BEncContent (b
);
4835 l
+= BEncConsLen (b
, l
);
4837 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4840 l
= receiptsFrom
->BEncContent (b
);
4843 l
= signedContentIdentifier
.BEncContent (b
);
4844 l
+= BEncDefLen (b
, l
);
4846 l
+= BEncTag1 (b
, UNIV
, PRIM
, OCTETSTRING_TAG_CODE
);
4850 } // ReceiptRequest::BEncContent
4853 void ReceiptRequest::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4856 AsnLen seqBytesDecoded
= 0;
4858 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4860 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OCTETSTRING_TAG_CODE
))
4861 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, OCTETSTRING_TAG_CODE
)))
4863 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4864 signedContentIdentifier
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4865 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4869 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
4870 SnaccExcep::throwMe(-132);
4873 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 0))
4874 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
4876 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4877 receiptsFrom
= new ReceiptsFrom
;
4878 receiptsFrom
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4879 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4883 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
4884 SnaccExcep::throwMe(-133);
4887 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
4889 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4890 receiptsTo
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4894 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
4895 SnaccExcep::throwMe(-134);
4898 bytesDecoded
+= seqBytesDecoded
;
4899 if (elmtLen0
== INDEFINITE_LEN
)
4901 BDecEoc (b
, bytesDecoded
, env
);
4904 else if (seqBytesDecoded
!= elmtLen0
)
4906 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
4907 SnaccExcep::throwMe(-135);
4911 } // ReceiptRequest::BDecContent
4913 AsnLen
ReceiptRequest::BEnc (BUF_TYPE b
)
4916 l
= BEncContent (b
);
4917 l
+= BEncConsLen (b
, l
);
4918 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4922 void ReceiptRequest::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4927 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
4929 Asn1Error
<< "ReceiptRequest::BDec: ERROR - wrong tag" << endl
;
4930 SnaccExcep::throwMe(-136);
4932 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
4933 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
4936 void ReceiptRequest::Print (ostream
&os
) const
4939 os
<< "{ -- SEQUENCE --" << endl
;
4940 indentG
+= stdIndentG
;
4943 Indent (os
, indentG
);
4944 os
<< "signedContentIdentifier ";
4945 os
<< signedContentIdentifier
;
4949 if (NOT_NULL (receiptsFrom
))
4951 Indent (os
, indentG
);
4952 os
<< "receiptsFrom ";
4953 os
<< *receiptsFrom
;
4957 Indent (os
, indentG
);
4958 os
<< "receiptsFrom ";
4964 Indent (os
, indentG
);
4965 os
<< "receiptsTo ";
4970 indentG
-= stdIndentG
;
4971 Indent (os
, indentG
);
4974 } // ReceiptRequest::Print
4981 Receipt::Receipt (const Receipt
&)
4983 Asn1Error
<< "use of incompletely defined Receipt::Receipt (const Receipt &)" << endl
;
4991 AsnType
*Receipt::Clone() const
4996 AsnType
*Receipt::Copy() const
4998 return new Receipt (*this);
5002 Receipt
&Receipt::operator = (const Receipt
&that
)
5003 #else // SNACC_DEEP_COPY
5004 Receipt
&Receipt::operator = (const Receipt
&)
5005 #endif // SNACC_DEEP_COPY
5010 version
= that
.version
;
5011 contentType
= that
.contentType
;
5012 signedContentIdentifier
= that
.signedContentIdentifier
;
5013 originatorSignatureValue
= that
.originatorSignatureValue
;
5017 #else // SNACC_DEEP_COPY
5018 Asn1Error
<< "use of incompletely defined Receipt &Receipt::operator = (const Receipt &)" << endl
;
5020 // if your compiler complains here, check the -novolat option
5021 #endif // SNACC_DEEP_COPY
5025 Receipt::BEncContent (BUF_TYPE b
)
5027 AsnLen totalLen
= 0;
5030 l
= originatorSignatureValue
.BEncContent (b
);
5031 l
+= BEncDefLen (b
, l
);
5033 l
+= BEncTag1 (b
, UNIV
, PRIM
, OCTETSTRING_TAG_CODE
);
5036 l
= signedContentIdentifier
.BEncContent (b
);
5037 l
+= BEncDefLen (b
, l
);
5039 l
+= BEncTag1 (b
, UNIV
, PRIM
, OCTETSTRING_TAG_CODE
);
5042 l
= contentType
.BEncContent (b
);
5043 l
+= BEncDefLen (b
, l
);
5045 l
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
5048 l
= version
.BEncContent (b
);
5049 BEncDefLenTo127 (b
, l
);
5052 l
+= BEncTag1 (b
, UNIV
, PRIM
, INTEGER_TAG_CODE
);
5056 } // Receipt::BEncContent
5059 void Receipt::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5062 AsnLen seqBytesDecoded
= 0;
5064 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5066 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
)))
5068 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5069 version
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5070 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5074 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
5075 SnaccExcep::throwMe(-137);
5078 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
5080 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5081 contentType
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5082 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5086 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
5087 SnaccExcep::throwMe(-138);
5090 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OCTETSTRING_TAG_CODE
))
5091 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, OCTETSTRING_TAG_CODE
)))
5093 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5094 signedContentIdentifier
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5095 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5099 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
5100 SnaccExcep::throwMe(-139);
5103 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OCTETSTRING_TAG_CODE
))
5104 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, OCTETSTRING_TAG_CODE
)))
5106 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5107 originatorSignatureValue
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5111 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
5112 SnaccExcep::throwMe(-140);
5115 bytesDecoded
+= seqBytesDecoded
;
5116 if (elmtLen0
== INDEFINITE_LEN
)
5118 BDecEoc (b
, bytesDecoded
, env
);
5121 else if (seqBytesDecoded
!= elmtLen0
)
5123 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
5124 SnaccExcep::throwMe(-141);
5128 } // Receipt::BDecContent
5130 AsnLen
Receipt::BEnc (BUF_TYPE b
)
5133 l
= BEncContent (b
);
5134 l
+= BEncConsLen (b
, l
);
5135 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5139 void Receipt::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5144 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
5146 Asn1Error
<< "Receipt::BDec: ERROR - wrong tag" << endl
;
5147 SnaccExcep::throwMe(-142);
5149 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
5150 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
5153 void Receipt::Print (ostream
&os
) const
5156 os
<< "{ -- SEQUENCE --" << endl
;
5157 indentG
+= stdIndentG
;
5160 Indent (os
, indentG
);
5167 Indent (os
, indentG
);
5168 os
<< "contentType ";
5174 Indent (os
, indentG
);
5175 os
<< "signedContentIdentifier ";
5176 os
<< signedContentIdentifier
;
5181 Indent (os
, indentG
);
5182 os
<< "originatorSignatureValue ";
5183 os
<< originatorSignatureValue
;
5187 indentG
-= stdIndentG
;
5188 Indent (os
, indentG
);
5194 ContentHints::ContentHints()
5196 contentDescription
= NULL
;
5199 ContentHints::ContentHints (const ContentHints
&)
5201 Asn1Error
<< "use of incompletely defined ContentHints::ContentHints (const ContentHints &)" << endl
;
5205 ContentHints::~ContentHints()
5207 delete contentDescription
;
5210 AsnType
*ContentHints::Clone() const
5212 return new ContentHints
;
5215 AsnType
*ContentHints::Copy() const
5217 return new ContentHints (*this);
5221 ContentHints
&ContentHints::operator = (const ContentHints
&that
)
5222 #else // SNACC_DEEP_COPY
5223 ContentHints
&ContentHints::operator = (const ContentHints
&)
5224 #endif // SNACC_DEEP_COPY
5229 if (that
.contentDescription
)
5231 if (!contentDescription
)
5232 contentDescription
= new UTF8String
;
5233 *contentDescription
= *that
.contentDescription
;
5237 delete contentDescription
;
5238 contentDescription
= NULL
;
5240 contentType
= that
.contentType
;
5244 #else // SNACC_DEEP_COPY
5245 Asn1Error
<< "use of incompletely defined ContentHints &ContentHints::operator = (const ContentHints &)" << endl
;
5247 // if your compiler complains here, check the -novolat option
5248 #endif // SNACC_DEEP_COPY
5252 ContentHints::BEncContent (BUF_TYPE b
)
5254 AsnLen totalLen
= 0;
5257 l
= contentType
.BEncContent (b
);
5258 l
+= BEncDefLen (b
, l
);
5260 l
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
5263 if (NOT_NULL (contentDescription
))
5265 l
= contentDescription
->BEncContent (b
);
5266 l
+= BEncDefLen (b
, l
);
5268 l
+= BEncTag1 (b
, UNIV
, PRIM
, 12);
5273 } // ContentHints::BEncContent
5276 void ContentHints::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5279 AsnLen seqBytesDecoded
= 0;
5281 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5283 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, 12))
5284 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, 12)))
5286 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5287 contentDescription
= new UTF8String
;
5288 contentDescription
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5289 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5292 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
5294 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5295 contentType
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5299 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
5300 SnaccExcep::throwMe(-143);
5303 bytesDecoded
+= seqBytesDecoded
;
5304 if (elmtLen0
== INDEFINITE_LEN
)
5306 BDecEoc (b
, bytesDecoded
, env
);
5309 else if (seqBytesDecoded
!= elmtLen0
)
5311 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
5312 SnaccExcep::throwMe(-144);
5316 } // ContentHints::BDecContent
5318 AsnLen
ContentHints::BEnc (BUF_TYPE b
)
5321 l
= BEncContent (b
);
5322 l
+= BEncConsLen (b
, l
);
5323 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5327 void ContentHints::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5332 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
5334 Asn1Error
<< "ContentHints::BDec: ERROR - wrong tag" << endl
;
5335 SnaccExcep::throwMe(-145);
5337 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
5338 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
5341 void ContentHints::Print (ostream
&os
) const
5344 os
<< "{ -- SEQUENCE --" << endl
;
5345 indentG
+= stdIndentG
;
5347 if (NOT_NULL (contentDescription
))
5349 Indent (os
, indentG
);
5350 os
<< "contentDescription ";
5351 os
<< *contentDescription
;
5355 Indent (os
, indentG
);
5356 os
<< "contentDescription ";
5362 Indent (os
, indentG
);
5363 os
<< "contentType ";
5368 indentG
-= stdIndentG
;
5369 Indent (os
, indentG
);
5372 } // ContentHints::Print
5375 ContentReference::ContentReference()
5379 ContentReference::ContentReference (const ContentReference
&)
5381 Asn1Error
<< "use of incompletely defined ContentReference::ContentReference (const ContentReference &)" << endl
;
5385 ContentReference::~ContentReference()
5389 AsnType
*ContentReference::Clone() const
5391 return new ContentReference
;
5394 AsnType
*ContentReference::Copy() const
5396 return new ContentReference (*this);
5400 ContentReference
&ContentReference::operator = (const ContentReference
&that
)
5401 #else // SNACC_DEEP_COPY
5402 ContentReference
&ContentReference::operator = (const ContentReference
&)
5403 #endif // SNACC_DEEP_COPY
5408 contentType
= that
.contentType
;
5409 signedContentIdentifier
= that
.signedContentIdentifier
;
5410 originatorSignatureValue
= that
.originatorSignatureValue
;
5414 #else // SNACC_DEEP_COPY
5415 Asn1Error
<< "use of incompletely defined ContentReference &ContentReference::operator = (const ContentReference &)" << endl
;
5417 // if your compiler complains here, check the -novolat option
5418 #endif // SNACC_DEEP_COPY
5422 ContentReference::BEncContent (BUF_TYPE b
)
5424 AsnLen totalLen
= 0;
5427 l
= originatorSignatureValue
.BEncContent (b
);
5428 l
+= BEncDefLen (b
, l
);
5430 l
+= BEncTag1 (b
, UNIV
, PRIM
, OCTETSTRING_TAG_CODE
);
5433 l
= signedContentIdentifier
.BEncContent (b
);
5434 l
+= BEncDefLen (b
, l
);
5436 l
+= BEncTag1 (b
, UNIV
, PRIM
, OCTETSTRING_TAG_CODE
);
5439 l
= contentType
.BEncContent (b
);
5440 l
+= BEncDefLen (b
, l
);
5442 l
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
5446 } // ContentReference::BEncContent
5449 void ContentReference::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5452 AsnLen seqBytesDecoded
= 0;
5454 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5456 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
5458 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5459 contentType
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5460 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5464 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
5465 SnaccExcep::throwMe(-146);
5468 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OCTETSTRING_TAG_CODE
))
5469 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, OCTETSTRING_TAG_CODE
)))
5471 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5472 signedContentIdentifier
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5473 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5477 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
5478 SnaccExcep::throwMe(-147);
5481 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OCTETSTRING_TAG_CODE
))
5482 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, OCTETSTRING_TAG_CODE
)))
5484 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5485 originatorSignatureValue
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5489 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
5490 SnaccExcep::throwMe(-148);
5493 bytesDecoded
+= seqBytesDecoded
;
5494 if (elmtLen0
== INDEFINITE_LEN
)
5496 BDecEoc (b
, bytesDecoded
, env
);
5499 else if (seqBytesDecoded
!= elmtLen0
)
5501 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
5502 SnaccExcep::throwMe(-149);
5506 } // ContentReference::BDecContent
5508 AsnLen
ContentReference::BEnc (BUF_TYPE b
)
5511 l
= BEncContent (b
);
5512 l
+= BEncConsLen (b
, l
);
5513 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5517 void ContentReference::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5522 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
5524 Asn1Error
<< "ContentReference::BDec: ERROR - wrong tag" << endl
;
5525 SnaccExcep::throwMe(-150);
5527 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
5528 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
5531 void ContentReference::Print (ostream
&os
) const
5534 os
<< "{ -- SEQUENCE --" << endl
;
5535 indentG
+= stdIndentG
;
5538 Indent (os
, indentG
);
5539 os
<< "contentType ";
5545 Indent (os
, indentG
);
5546 os
<< "signedContentIdentifier ";
5547 os
<< signedContentIdentifier
;
5552 Indent (os
, indentG
);
5553 os
<< "originatorSignatureValue ";
5554 os
<< originatorSignatureValue
;
5558 indentG
-= stdIndentG
;
5559 Indent (os
, indentG
);
5562 } // ContentReference::Print
5565 AsnType
*EquivalentLabels::Clone() const
5567 return new EquivalentLabels
;
5570 AsnType
*EquivalentLabels::Copy() const
5572 return new EquivalentLabels (*this);
5575 AsnLen
EquivalentLabels::BEnc (BUF_TYPE b
)
5578 l
= BEncContent (b
);
5579 l
+= BEncConsLen (b
, l
);
5580 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5584 void EquivalentLabels::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5589 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
5591 Asn1Error
<< "EquivalentLabels::BDec: ERROR - wrong tag" << endl
;
5592 SnaccExcep::throwMe(-151);
5594 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
5595 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
5598 EquivalentLabels::EquivalentLabels (const EquivalentLabels
&)
5600 Asn1Error
<< "use of incompletely defined EquivalentLabels::EquivalentLabels (const EquivalentLabels &)" << endl
;
5604 EquivalentLabels::~EquivalentLabels()
5607 for (; Curr() != NULL
; RemoveCurrFromList())
5609 } // end of destructor
5612 EquivalentLabels
&EquivalentLabels::operator = (const EquivalentLabels
&that
)
5613 #else // SNACC_DEEP_COPY
5614 EquivalentLabels
&EquivalentLabels::operator = (const EquivalentLabels
&)
5615 #endif // SNACC_DEEP_COPY
5621 for (; Curr(); RemoveCurrFromList())
5624 //that.SetCurrToFirst();
5625 //for (; that.Curr(); that.GoNext())
5626 // AppendCopy (*that.Curr());
5627 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
5628 AppendCopy (*run
->elmt
);
5632 #else // SNACC_DEEP_COPY
5633 Asn1Error
<< "use of incompletely defined EquivalentLabels &EquivalentLabels::operator = (const EquivalentLabels &)" << endl
;
5635 // if your compiler complains here, check the -novolat option
5636 #endif // SNACC_DEEP_COPY
5639 void EquivalentLabels::Print (ostream
&os
) const
5642 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
5643 indentG
+= stdIndentG
;
5645 //for (; Curr() != NULL; GoNext())
5646 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
5648 Indent (os
, indentG
);
5651 //if (Curr() != Last())
5656 indentG
-= stdIndentG
;
5657 Indent (os
, indentG
);
5665 void EquivalentLabels::SetCurrElmt (unsigned long int index
)
5667 unsigned long int i
;
5670 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
5672 } // EquivalentLabels::SetCurrElmt
5675 unsigned long int EquivalentLabels::GetCurrElmtIndex()
5677 unsigned long int i
;
5681 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
5690 } // EquivalentLabels::GetCurrElmtIndex
5693 // alloc new list elmt, put at end of list
5694 // and return the component type
5695 ESSSecurityLabel
*EquivalentLabels::Append()
5697 AsnListElmt
*newElmt
;
5698 newElmt
= new AsnListElmt
;
5699 newElmt
->elmt
= new ESSSecurityLabel
;
5700 newElmt
->next
= NULL
;
5703 newElmt
->prev
= NULL
;
5704 first
= last
= newElmt
;
5708 newElmt
->prev
= last
;
5709 last
->next
= newElmt
;
5713 return (curr
= newElmt
)->elmt
;
5714 } // EquivalentLabels::Append
5717 // alloc new list elmt, put at begining of list
5718 // and return the component type
5719 ESSSecurityLabel
*EquivalentLabels::Prepend()
5721 AsnListElmt
*newElmt
;
5722 newElmt
= new AsnListElmt
;
5723 newElmt
->elmt
= new ESSSecurityLabel
;
5724 newElmt
->prev
= NULL
;
5727 newElmt
->next
= NULL
;
5728 first
= last
= newElmt
;
5732 newElmt
->next
= first
;
5733 first
->prev
= newElmt
;
5737 return (curr
= newElmt
)->elmt
;
5738 } // EquivalentLabels::Prepend
5741 // alloc new list elmt, insert it before the
5742 // current element and return the component type
5743 // if the current element is null, the new element
5744 // is placed at the beginning of the list.
5745 ESSSecurityLabel
*EquivalentLabels::InsertBefore()
5747 AsnListElmt
*newElmt
;
5748 newElmt
= new AsnListElmt
;
5749 newElmt
->elmt
= new ESSSecurityLabel
;
5752 newElmt
->next
= first
;
5753 newElmt
->prev
= NULL
;
5760 newElmt
->next
= curr
;
5761 newElmt
->prev
= curr
->prev
;
5762 curr
->prev
= newElmt
;
5766 newElmt
->prev
->next
= newElmt
;
5769 return (curr
= newElmt
)->elmt
;
5770 } // EquivalentLabels::InsertBefore
5773 // alloc new list elmt, insert it after the
5774 // current element and return the component type
5775 // if the current element is null, the new element
5776 // is placed at the end of the list.
5777 ESSSecurityLabel
*EquivalentLabels::InsertAfter()
5779 AsnListElmt
*newElmt
;
5780 newElmt
= new AsnListElmt
;
5781 newElmt
->elmt
= new ESSSecurityLabel
;
5784 newElmt
->prev
= last
;
5785 newElmt
->next
= NULL
;
5792 newElmt
->prev
= curr
;
5793 newElmt
->next
= curr
->next
;
5794 curr
->next
= newElmt
;
5798 newElmt
->next
->prev
= newElmt
;
5801 return (curr
= newElmt
)->elmt
;
5802 } // EquivalentLabels::InsertAfter
5805 EquivalentLabels
&EquivalentLabels::AppendCopy (ESSSecurityLabel
&elmt
)
5807 AsnListElmt
*newElmt
;
5808 newElmt
= new AsnListElmt
;
5809 newElmt
->elmt
= new ESSSecurityLabel
;
5810 *newElmt
->elmt
= elmt
;
5811 newElmt
->next
= NULL
;
5814 newElmt
->prev
= NULL
;
5815 first
= last
= newElmt
;
5819 newElmt
->prev
= last
;
5820 last
->next
= newElmt
;
5828 EquivalentLabels
&EquivalentLabels::PrependCopy (ESSSecurityLabel
&elmt
)
5830 AsnListElmt
*newElmt
;
5831 newElmt
= new AsnListElmt
;
5832 newElmt
->elmt
= new ESSSecurityLabel
;
5833 *newElmt
->elmt
= elmt
;
5834 newElmt
->prev
= NULL
;
5837 newElmt
->next
= NULL
;
5838 first
= last
= newElmt
;
5842 newElmt
->next
= first
;
5843 first
->prev
= newElmt
;
5848 } // EquivalentLabels::PrependCopy
5851 // alloc new list elmt, insert it before the
5852 // current element, copy the given elmt into the new elmt
5853 // and return the component type.
5854 // if the current element is null, the new element
5855 // is placed at the beginning of the list.
5856 EquivalentLabels
&EquivalentLabels::InsertBeforeAndCopy (ESSSecurityLabel
&elmt
)
5858 AsnListElmt
*newElmt
;
5860 newElmt
= new AsnListElmt
;
5861 newElmt
->elmt
= new ESSSecurityLabel
;
5862 *newElmt
->elmt
= elmt
;
5866 newElmt
->next
= first
;
5867 newElmt
->prev
= NULL
;
5874 newElmt
->next
= curr
;
5875 newElmt
->prev
= curr
->prev
;
5876 curr
->prev
= newElmt
;
5880 newElmt
->prev
->next
= newElmt
;
5884 } // EquivalentLabels::InsertBeforeAndCopy
5887 // alloc new list elmt, insert it after the
5888 // current element, copy given elmt in to new elmt
5889 // and return the component type
5890 // if the current element is null, the new element
5891 // is placed at the end of the list.
5892 EquivalentLabels
&EquivalentLabels::InsertAfterAndCopy (ESSSecurityLabel
&elmt
)
5894 AsnListElmt
*newElmt
;
5896 newElmt
= new AsnListElmt
;
5897 newElmt
->elmt
= new ESSSecurityLabel
;
5898 *newElmt
->elmt
= elmt
;
5901 newElmt
->prev
= last
;
5902 newElmt
->next
= NULL
;
5909 newElmt
->prev
= curr
;
5910 newElmt
->next
= curr
->next
;
5911 curr
->next
= newElmt
;
5915 newElmt
->next
->prev
= newElmt
;
5919 } // EquivalentLabels::InsertAfterAndCopy
5922 // remove current element from list if current element is not NULL
5923 // The new current element will be the next element.
5924 // If the current element is the last element in the list
5925 // the second but last element will become the new current element.
5926 void EquivalentLabels::RemoveCurrFromList()
5928 AsnListElmt
*del_elmt
;
5936 first
= last
= curr
= NULL
;
5937 else if (curr
== first
)
5939 curr
= first
= first
->next
;
5942 else if (curr
== last
)
5944 curr
= last
= last
->prev
;
5949 curr
->prev
->next
= curr
->next
;
5950 curr
->next
->prev
= curr
->prev
;
5953 delete del_elmt
->elmt
;
5959 AsnLen
EquivalentLabels::BEncContent (BUF_TYPE b
)
5961 AsnListElmt
*currElmt
;
5963 AsnLen totalLen
= 0;
5964 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
5967 elmtLen
= currElmt
->elmt
->BEncContent (b
);
5968 elmtLen
+= BEncConsLen (b
, elmtLen
);
5970 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
5971 totalLen
+= elmtLen
;
5974 } // EquivalentLabels::BEncContent
5977 void EquivalentLabels::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
5978 AsnLen
&bytesDecoded
, ENV_TYPE env
)
5980 ESSSecurityLabel
*listElmt
;
5982 AsnLen listBytesDecoded
= 0;
5985 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
5987 tag1
= BDecTag (b
, listBytesDecoded
, env
);
5988 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
5990 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
5993 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
)))
5995 Asn1Error
<< "Unexpected Tag" << endl
;
5996 SnaccExcep::throwMe(-152);
5999 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
6000 listElmt
= Append();
6001 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
6004 bytesDecoded
+= listBytesDecoded
;
6005 } // EquivalentLabels::BDecContent
6008 AsnType
*MLExpansionHistory::Clone() const
6010 return new MLExpansionHistory
;
6013 AsnType
*MLExpansionHistory::Copy() const
6015 return new MLExpansionHistory (*this);
6018 AsnLen
MLExpansionHistory::BEnc (BUF_TYPE b
)
6021 l
= BEncContent (b
);
6022 l
+= BEncConsLen (b
, l
);
6023 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6027 void MLExpansionHistory::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
6032 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
6034 Asn1Error
<< "MLExpansionHistory::BDec: ERROR - wrong tag" << endl
;
6035 SnaccExcep::throwMe(-153);
6037 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
6038 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
6041 MLExpansionHistory::MLExpansionHistory (const MLExpansionHistory
&)
6043 Asn1Error
<< "use of incompletely defined MLExpansionHistory::MLExpansionHistory (const MLExpansionHistory &)" << endl
;
6047 MLExpansionHistory::~MLExpansionHistory()
6050 for (; Curr() != NULL
; RemoveCurrFromList())
6052 } // end of destructor
6055 MLExpansionHistory
&MLExpansionHistory::operator = (const MLExpansionHistory
&that
)
6056 #else // SNACC_DEEP_COPY
6057 MLExpansionHistory
&MLExpansionHistory::operator = (const MLExpansionHistory
&)
6058 #endif // SNACC_DEEP_COPY
6064 for (; Curr(); RemoveCurrFromList())
6067 //that.SetCurrToFirst();
6068 //for (; that.Curr(); that.GoNext())
6069 // AppendCopy (*that.Curr());
6070 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
6071 AppendCopy (*run
->elmt
);
6075 #else // SNACC_DEEP_COPY
6076 Asn1Error
<< "use of incompletely defined MLExpansionHistory &MLExpansionHistory::operator = (const MLExpansionHistory &)" << endl
;
6078 // if your compiler complains here, check the -novolat option
6079 #endif // SNACC_DEEP_COPY
6082 void MLExpansionHistory::Print (ostream
&os
) const
6085 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
6086 indentG
+= stdIndentG
;
6088 //for (; Curr() != NULL; GoNext())
6089 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
6091 Indent (os
, indentG
);
6094 //if (Curr() != Last())
6099 indentG
-= stdIndentG
;
6100 Indent (os
, indentG
);
6108 void MLExpansionHistory::SetCurrElmt (unsigned long int index
)
6110 unsigned long int i
;
6113 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
6115 } // MLExpansionHistory::SetCurrElmt
6118 unsigned long int MLExpansionHistory::GetCurrElmtIndex()
6120 unsigned long int i
;
6124 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
6133 } // MLExpansionHistory::GetCurrElmtIndex
6136 // alloc new list elmt, put at end of list
6137 // and return the component type
6138 MLData
*MLExpansionHistory::Append()
6140 AsnListElmt
*newElmt
;
6141 newElmt
= new AsnListElmt
;
6142 newElmt
->elmt
= new MLData
;
6143 newElmt
->next
= NULL
;
6146 newElmt
->prev
= NULL
;
6147 first
= last
= newElmt
;
6151 newElmt
->prev
= last
;
6152 last
->next
= newElmt
;
6156 return (curr
= newElmt
)->elmt
;
6157 } // MLExpansionHistory::Append
6160 // alloc new list elmt, put at begining of list
6161 // and return the component type
6162 MLData
*MLExpansionHistory::Prepend()
6164 AsnListElmt
*newElmt
;
6165 newElmt
= new AsnListElmt
;
6166 newElmt
->elmt
= new MLData
;
6167 newElmt
->prev
= NULL
;
6170 newElmt
->next
= NULL
;
6171 first
= last
= newElmt
;
6175 newElmt
->next
= first
;
6176 first
->prev
= newElmt
;
6180 return (curr
= newElmt
)->elmt
;
6181 } // MLExpansionHistory::Prepend
6184 // alloc new list elmt, insert it before the
6185 // current element and return the component type
6186 // if the current element is null, the new element
6187 // is placed at the beginning of the list.
6188 MLData
*MLExpansionHistory::InsertBefore()
6190 AsnListElmt
*newElmt
;
6191 newElmt
= new AsnListElmt
;
6192 newElmt
->elmt
= new MLData
;
6195 newElmt
->next
= first
;
6196 newElmt
->prev
= NULL
;
6203 newElmt
->next
= curr
;
6204 newElmt
->prev
= curr
->prev
;
6205 curr
->prev
= newElmt
;
6209 newElmt
->prev
->next
= newElmt
;
6212 return (curr
= newElmt
)->elmt
;
6213 } // MLExpansionHistory::InsertBefore
6216 // alloc new list elmt, insert it after the
6217 // current element and return the component type
6218 // if the current element is null, the new element
6219 // is placed at the end of the list.
6220 MLData
*MLExpansionHistory::InsertAfter()
6222 AsnListElmt
*newElmt
;
6223 newElmt
= new AsnListElmt
;
6224 newElmt
->elmt
= new MLData
;
6227 newElmt
->prev
= last
;
6228 newElmt
->next
= NULL
;
6235 newElmt
->prev
= curr
;
6236 newElmt
->next
= curr
->next
;
6237 curr
->next
= newElmt
;
6241 newElmt
->next
->prev
= newElmt
;
6244 return (curr
= newElmt
)->elmt
;
6245 } // MLExpansionHistory::InsertAfter
6248 MLExpansionHistory
&MLExpansionHistory::AppendCopy (MLData
&elmt
)
6250 AsnListElmt
*newElmt
;
6251 newElmt
= new AsnListElmt
;
6252 newElmt
->elmt
= new MLData
;
6253 *newElmt
->elmt
= elmt
;
6254 newElmt
->next
= NULL
;
6257 newElmt
->prev
= NULL
;
6258 first
= last
= newElmt
;
6262 newElmt
->prev
= last
;
6263 last
->next
= newElmt
;
6271 MLExpansionHistory
&MLExpansionHistory::PrependCopy (MLData
&elmt
)
6273 AsnListElmt
*newElmt
;
6274 newElmt
= new AsnListElmt
;
6275 newElmt
->elmt
= new MLData
;
6276 *newElmt
->elmt
= elmt
;
6277 newElmt
->prev
= NULL
;
6280 newElmt
->next
= NULL
;
6281 first
= last
= newElmt
;
6285 newElmt
->next
= first
;
6286 first
->prev
= newElmt
;
6291 } // MLExpansionHistory::PrependCopy
6294 // alloc new list elmt, insert it before the
6295 // current element, copy the given elmt into the new elmt
6296 // and return the component type.
6297 // if the current element is null, the new element
6298 // is placed at the beginning of the list.
6299 MLExpansionHistory
&MLExpansionHistory::InsertBeforeAndCopy (MLData
&elmt
)
6301 AsnListElmt
*newElmt
;
6303 newElmt
= new AsnListElmt
;
6304 newElmt
->elmt
= new MLData
;
6305 *newElmt
->elmt
= elmt
;
6309 newElmt
->next
= first
;
6310 newElmt
->prev
= NULL
;
6317 newElmt
->next
= curr
;
6318 newElmt
->prev
= curr
->prev
;
6319 curr
->prev
= newElmt
;
6323 newElmt
->prev
->next
= newElmt
;
6327 } // MLExpansionHistory::InsertBeforeAndCopy
6330 // alloc new list elmt, insert it after the
6331 // current element, copy given elmt in to new elmt
6332 // and return the component type
6333 // if the current element is null, the new element
6334 // is placed at the end of the list.
6335 MLExpansionHistory
&MLExpansionHistory::InsertAfterAndCopy (MLData
&elmt
)
6337 AsnListElmt
*newElmt
;
6339 newElmt
= new AsnListElmt
;
6340 newElmt
->elmt
= new MLData
;
6341 *newElmt
->elmt
= elmt
;
6344 newElmt
->prev
= last
;
6345 newElmt
->next
= NULL
;
6352 newElmt
->prev
= curr
;
6353 newElmt
->next
= curr
->next
;
6354 curr
->next
= newElmt
;
6358 newElmt
->next
->prev
= newElmt
;
6362 } // MLExpansionHistory::InsertAfterAndCopy
6365 // remove current element from list if current element is not NULL
6366 // The new current element will be the next element.
6367 // If the current element is the last element in the list
6368 // the second but last element will become the new current element.
6369 void MLExpansionHistory::RemoveCurrFromList()
6371 AsnListElmt
*del_elmt
;
6379 first
= last
= curr
= NULL
;
6380 else if (curr
== first
)
6382 curr
= first
= first
->next
;
6385 else if (curr
== last
)
6387 curr
= last
= last
->prev
;
6392 curr
->prev
->next
= curr
->next
;
6393 curr
->next
->prev
= curr
->prev
;
6396 delete del_elmt
->elmt
;
6402 AsnLen
MLExpansionHistory::BEncContent (BUF_TYPE b
)
6404 AsnListElmt
*currElmt
;
6406 AsnLen totalLen
= 0;
6407 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
6410 elmtLen
= currElmt
->elmt
->BEncContent (b
);
6411 elmtLen
+= BEncConsLen (b
, elmtLen
);
6413 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6414 totalLen
+= elmtLen
;
6417 } // MLExpansionHistory::BEncContent
6420 void MLExpansionHistory::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
6421 AsnLen
&bytesDecoded
, ENV_TYPE env
)
6425 AsnLen listBytesDecoded
= 0;
6428 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
6430 tag1
= BDecTag (b
, listBytesDecoded
, env
);
6431 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
6433 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
6436 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
6438 Asn1Error
<< "Unexpected Tag" << endl
;
6439 SnaccExcep::throwMe(-154);
6442 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
6443 listElmt
= Append();
6444 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
6447 bytesDecoded
+= listBytesDecoded
;
6448 } // MLExpansionHistory::BDecContent
6451 SigningCertificate::SigningCertificate()
6456 SigningCertificate::SigningCertificate (const SigningCertificate
&)
6458 Asn1Error
<< "use of incompletely defined SigningCertificate::SigningCertificate (const SigningCertificate &)" << endl
;
6462 SigningCertificate::~SigningCertificate()
6467 AsnType
*SigningCertificate::Clone() const
6469 return new SigningCertificate
;
6472 AsnType
*SigningCertificate::Copy() const
6474 return new SigningCertificate (*this);
6478 SigningCertificate
&SigningCertificate::operator = (const SigningCertificate
&that
)
6479 #else // SNACC_DEEP_COPY
6480 SigningCertificate
&SigningCertificate::operator = (const SigningCertificate
&)
6481 #endif // SNACC_DEEP_COPY
6490 policies
= new SigningCertificateSeqOf1
;
6491 *policies
= *that
.policies
;
6501 #else // SNACC_DEEP_COPY
6502 Asn1Error
<< "use of incompletely defined SigningCertificate &SigningCertificate::operator = (const SigningCertificate &)" << endl
;
6504 // if your compiler complains here, check the -novolat option
6505 #endif // SNACC_DEEP_COPY
6509 SigningCertificate::BEncContent (BUF_TYPE b
)
6511 AsnLen totalLen
= 0;
6514 if (NOT_NULL (policies
))
6517 l
= policies
->BEncContent (b
);
6518 l
+= BEncConsLen (b
, l
);
6520 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6525 l
= certs
.BEncContent (b
);
6526 l
+= BEncConsLen (b
, l
);
6528 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6532 } // SigningCertificate::BEncContent
6535 void SigningCertificate::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
6538 AsnLen seqBytesDecoded
= 0;
6540 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6542 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
6544 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6545 certs
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
6546 if (seqBytesDecoded
== elmtLen0
)
6548 bytesDecoded
+= seqBytesDecoded
;
6553 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6555 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
6557 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
6558 bytesDecoded
+= seqBytesDecoded
;
6565 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
6566 SnaccExcep::throwMe(-155);
6569 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
6571 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6572 policies
= new SigningCertificateSeqOf1
;
6573 policies
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
6576 bytesDecoded
+= seqBytesDecoded
;
6577 if (elmtLen0
== INDEFINITE_LEN
)
6579 BDecEoc (b
, bytesDecoded
, env
);
6582 else if (seqBytesDecoded
!= elmtLen0
)
6584 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
6585 SnaccExcep::throwMe(-156);
6589 } // SigningCertificate::BDecContent
6591 AsnLen
SigningCertificate::BEnc (BUF_TYPE b
)
6594 l
= BEncContent (b
);
6595 l
+= BEncConsLen (b
, l
);
6596 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6600 void SigningCertificate::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
6605 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
6607 Asn1Error
<< "SigningCertificate::BDec: ERROR - wrong tag" << endl
;
6608 SnaccExcep::throwMe(-157);
6610 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
6611 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
6614 void SigningCertificate::Print (ostream
&os
) const
6617 os
<< "{ -- SEQUENCE --" << endl
;
6618 indentG
+= stdIndentG
;
6621 Indent (os
, indentG
);
6627 if (NOT_NULL (policies
))
6630 Indent (os
, indentG
);
6636 Indent (os
, indentG
);
6643 indentG
-= stdIndentG
;
6644 Indent (os
, indentG
);
6647 } // SigningCertificate::Print