1 // NOTE: this is a machine generated file--editing not recommended
3 // sm_x501if.cpp - class member functions for ASN.1 module InformationFramework
5 // This file was generated by snacc on Wed Jun 27 16:40:55 2001
6 // UBC snacc written by Mike Sample
7 // A couple of enhancements made by IBM European Networking Center
11 #include "sm_vdatypes.h"
12 #include "sm_x501ud.h"
13 #include "sm_x411ub.h"
14 #include "sm_x411mtsas.h"
15 #include "sm_x501if.h"
16 #include "sm_x520sa.h"
17 #include "sm_x509cmn.h"
18 #include "sm_x509af.h"
19 #include "sm_x509ce.h"
20 #include "pkcs1oids.h"
21 #include "pkcs9oids.h"
26 #include "appleoids.h"
28 //------------------------------------------------------------------------------
32 //------------------------------------------------------------------------------
33 // class member definitions:
35 AsnType
*AttributeTypeAndDistinguishedValueSetOfSeqSetOf::Clone() const
37 return new AttributeTypeAndDistinguishedValueSetOfSeqSetOf
;
40 AsnType
*AttributeTypeAndDistinguishedValueSetOfSeqSetOf::Copy() const
42 return new AttributeTypeAndDistinguishedValueSetOfSeqSetOf (*this);
45 AsnLen
AttributeTypeAndDistinguishedValueSetOfSeqSetOf::BEnc (BUF_TYPE b
)
49 l
+= BEncConsLen (b
, l
);
50 l
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
54 void AttributeTypeAndDistinguishedValueSetOfSeqSetOf::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
59 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
))
61 Asn1Error
<< "AttributeTypeAndDistinguishedValueSetOfSeqSetOf::BDec: ERROR - wrong tag" << endl
;
64 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
65 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
68 AttributeTypeAndDistinguishedValueSetOfSeqSetOf::AttributeTypeAndDistinguishedValueSetOfSeqSetOf (const AttributeTypeAndDistinguishedValueSetOfSeqSetOf
&)
70 Asn1Error
<< "use of incompletely defined AttributeTypeAndDistinguishedValueSetOfSeqSetOf::AttributeTypeAndDistinguishedValueSetOfSeqSetOf (const AttributeTypeAndDistinguishedValueSetOfSeqSetOf &)" << endl
;
74 AttributeTypeAndDistinguishedValueSetOfSeqSetOf::~AttributeTypeAndDistinguishedValueSetOfSeqSetOf()
77 for (; Curr() != NULL
; RemoveCurrFromList())
79 } // end of destructor
82 AttributeTypeAndDistinguishedValueSetOfSeqSetOf
&AttributeTypeAndDistinguishedValueSetOfSeqSetOf::operator = (const AttributeTypeAndDistinguishedValueSetOfSeqSetOf
&that
)
83 #else // SNACC_DEEP_COPY
84 AttributeTypeAndDistinguishedValueSetOfSeqSetOf
&AttributeTypeAndDistinguishedValueSetOfSeqSetOf::operator = (const AttributeTypeAndDistinguishedValueSetOfSeqSetOf
&)
85 #endif // SNACC_DEEP_COPY
91 for (; Curr(); RemoveCurrFromList())
94 //that.SetCurrToFirst();
95 //for (; that.Curr(); that.GoNext())
96 // AppendCopy (*that.Curr());
97 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
98 AppendCopy (*run
->elmt
);
102 #else // SNACC_DEEP_COPY
103 Asn1Error
<< "use of incompletely defined AttributeTypeAndDistinguishedValueSetOfSeqSetOf &AttributeTypeAndDistinguishedValueSetOfSeqSetOf::operator = (const AttributeTypeAndDistinguishedValueSetOfSeqSetOf &)" << endl
;
105 // if your compiler complains here, check the -novolat option
106 #endif // SNACC_DEEP_COPY
109 void AttributeTypeAndDistinguishedValueSetOfSeqSetOf::Print (ostream
&os
) const
112 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
113 indentG
+= stdIndentG
;
115 //for (; Curr() != NULL; GoNext())
116 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
118 Indent (os
, indentG
);
121 //if (Curr() != Last())
126 indentG
-= stdIndentG
;
127 Indent (os
, indentG
);
135 void AttributeTypeAndDistinguishedValueSetOfSeqSetOf::SetCurrElmt (unsigned long int index
)
140 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
142 } // AttributeTypeAndDistinguishedValueSetOfSeqSetOf::SetCurrElmt
145 unsigned long int AttributeTypeAndDistinguishedValueSetOfSeqSetOf::GetCurrElmtIndex()
151 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
160 } // AttributeTypeAndDistinguishedValueSetOfSeqSetOf::GetCurrElmtIndex
163 // alloc new list elmt, put at end of list
164 // and return the component type
165 AsnAny
*AttributeTypeAndDistinguishedValueSetOfSeqSetOf::Append()
167 AsnListElmt
*newElmt
;
168 newElmt
= new AsnListElmt
;
169 newElmt
->elmt
= new AsnAny
;
170 newElmt
->next
= NULL
;
173 newElmt
->prev
= NULL
;
174 first
= last
= newElmt
;
178 newElmt
->prev
= last
;
179 last
->next
= newElmt
;
183 return (curr
= newElmt
)->elmt
;
184 } // AttributeTypeAndDistinguishedValueSetOfSeqSetOf::Append
187 // alloc new list elmt, put at begining of list
188 // and return the component type
189 AsnAny
*AttributeTypeAndDistinguishedValueSetOfSeqSetOf::Prepend()
191 AsnListElmt
*newElmt
;
192 newElmt
= new AsnListElmt
;
193 newElmt
->elmt
= new AsnAny
;
194 newElmt
->prev
= NULL
;
197 newElmt
->next
= NULL
;
198 first
= last
= newElmt
;
202 newElmt
->next
= first
;
203 first
->prev
= newElmt
;
207 return (curr
= newElmt
)->elmt
;
208 } // AttributeTypeAndDistinguishedValueSetOfSeqSetOf::Prepend
211 // alloc new list elmt, insert it before the
212 // current element and return the component type
213 // if the current element is null, the new element
214 // is placed at the beginning of the list.
215 AsnAny
*AttributeTypeAndDistinguishedValueSetOfSeqSetOf::InsertBefore()
217 AsnListElmt
*newElmt
;
218 newElmt
= new AsnListElmt
;
219 newElmt
->elmt
= new AsnAny
;
222 newElmt
->next
= first
;
223 newElmt
->prev
= NULL
;
230 newElmt
->next
= curr
;
231 newElmt
->prev
= curr
->prev
;
232 curr
->prev
= newElmt
;
236 newElmt
->prev
->next
= newElmt
;
239 return (curr
= newElmt
)->elmt
;
240 } // AttributeTypeAndDistinguishedValueSetOfSeqSetOf::InsertBefore
243 // alloc new list elmt, insert it after the
244 // current element and return the component type
245 // if the current element is null, the new element
246 // is placed at the end of the list.
247 AsnAny
*AttributeTypeAndDistinguishedValueSetOfSeqSetOf::InsertAfter()
249 AsnListElmt
*newElmt
;
250 newElmt
= new AsnListElmt
;
251 newElmt
->elmt
= new AsnAny
;
254 newElmt
->prev
= last
;
255 newElmt
->next
= NULL
;
262 newElmt
->prev
= curr
;
263 newElmt
->next
= curr
->next
;
264 curr
->next
= newElmt
;
268 newElmt
->next
->prev
= newElmt
;
271 return (curr
= newElmt
)->elmt
;
272 } // AttributeTypeAndDistinguishedValueSetOfSeqSetOf::InsertAfter
275 AttributeTypeAndDistinguishedValueSetOfSeqSetOf
&AttributeTypeAndDistinguishedValueSetOfSeqSetOf::AppendCopy (AsnAny
&elmt
)
277 AsnListElmt
*newElmt
;
278 newElmt
= new AsnListElmt
;
279 newElmt
->elmt
= new AsnAny
;
280 *newElmt
->elmt
= elmt
;
281 newElmt
->next
= NULL
;
284 newElmt
->prev
= NULL
;
285 first
= last
= newElmt
;
289 newElmt
->prev
= last
;
290 last
->next
= newElmt
;
298 AttributeTypeAndDistinguishedValueSetOfSeqSetOf
&AttributeTypeAndDistinguishedValueSetOfSeqSetOf::PrependCopy (AsnAny
&elmt
)
300 AsnListElmt
*newElmt
;
301 newElmt
= new AsnListElmt
;
302 newElmt
->elmt
= new AsnAny
;
303 *newElmt
->elmt
= elmt
;
304 newElmt
->prev
= NULL
;
307 newElmt
->next
= NULL
;
308 first
= last
= newElmt
;
312 newElmt
->next
= first
;
313 first
->prev
= newElmt
;
318 } // AttributeTypeAndDistinguishedValueSetOfSeqSetOf::PrependCopy
321 // alloc new list elmt, insert it before the
322 // current element, copy the given elmt into the new elmt
323 // and return the component type.
324 // if the current element is null, the new element
325 // is placed at the beginning of the list.
326 AttributeTypeAndDistinguishedValueSetOfSeqSetOf
&AttributeTypeAndDistinguishedValueSetOfSeqSetOf::InsertBeforeAndCopy (AsnAny
&elmt
)
328 AsnListElmt
*newElmt
;
330 newElmt
= new AsnListElmt
;
331 newElmt
->elmt
= new AsnAny
;
332 *newElmt
->elmt
= elmt
;
336 newElmt
->next
= first
;
337 newElmt
->prev
= NULL
;
344 newElmt
->next
= curr
;
345 newElmt
->prev
= curr
->prev
;
346 curr
->prev
= newElmt
;
350 newElmt
->prev
->next
= newElmt
;
354 } // AttributeTypeAndDistinguishedValueSetOfSeqSetOf::InsertBeforeAndCopy
357 // alloc new list elmt, insert it after the
358 // current element, copy given elmt in to new elmt
359 // and return the component type
360 // if the current element is null, the new element
361 // is placed at the end of the list.
362 AttributeTypeAndDistinguishedValueSetOfSeqSetOf
&AttributeTypeAndDistinguishedValueSetOfSeqSetOf::InsertAfterAndCopy (AsnAny
&elmt
)
364 AsnListElmt
*newElmt
;
366 newElmt
= new AsnListElmt
;
367 newElmt
->elmt
= new AsnAny
;
368 *newElmt
->elmt
= elmt
;
371 newElmt
->prev
= last
;
372 newElmt
->next
= NULL
;
379 newElmt
->prev
= curr
;
380 newElmt
->next
= curr
->next
;
381 curr
->next
= newElmt
;
385 newElmt
->next
->prev
= newElmt
;
389 } // AttributeTypeAndDistinguishedValueSetOfSeqSetOf::InsertAfterAndCopy
392 // remove current element from list if current element is not NULL
393 // The new current element will be the next element.
394 // If the current element is the last element in the list
395 // the second but last element will become the new current element.
396 void AttributeTypeAndDistinguishedValueSetOfSeqSetOf::RemoveCurrFromList()
398 AsnListElmt
*del_elmt
;
406 first
= last
= curr
= NULL
;
407 else if (curr
== first
)
409 curr
= first
= first
->next
;
412 else if (curr
== last
)
414 curr
= last
= last
->prev
;
419 curr
->prev
->next
= curr
->next
;
420 curr
->next
->prev
= curr
->prev
;
423 delete del_elmt
->elmt
;
429 AsnLen
AttributeTypeAndDistinguishedValueSetOfSeqSetOf::BEncContent (BUF_TYPE b
)
431 AsnListElmt
*currElmt
;
436 CSM_Buffer
**tmpEnc
=NULL
;
437 for (currElmt
= last
,icount
=0; currElmt
!= NULL
; currElmt
= currElmt
->prev
, icount
++);
438 tmpEnc
= (CSM_Buffer
**) calloc(sizeof(CSM_Buffer
*), icount
);
439 for (currElmt
= last
, iii
=0; currElmt
!= NULL
; currElmt
= currElmt
->prev
,iii
++,elmtLen
=0)
441 tmpEnc
[iii
] = (CSM_Buffer
*)currElmt
->elmt
->value
;
443 vdasnacc_sortSetOf(tmpEnc
, icount
);
444 for (iii
=0,elmtLen
=0; iii
< icount
; elmtLen
+=tmpEnc
[iii
++]->Length())
445 SM_WriteToAsnBuf(tmpEnc
[iii
], b
);
450 } // AttributeTypeAndDistinguishedValueSetOfSeqSetOf::BEncContent
453 void AttributeTypeAndDistinguishedValueSetOfSeqSetOf::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
454 AsnLen
&bytesDecoded
, ENV_TYPE env
)
457 AsnLen listBytesDecoded
= 0;
459 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
462 DEC_LOAD_ANYBUF(listElmt
, b
, listBytesDecoded
, env
);
465 bytesDecoded
+= listBytesDecoded
;
466 } // AttributeTypeAndDistinguishedValueSetOfSeqSetOf::BDecContent
469 AttributeTypeAndDistinguishedValueSetOfSeq::AttributeTypeAndDistinguishedValueSetOfSeq()
471 distingAttrValue
= NULL
;
474 AttributeTypeAndDistinguishedValueSetOfSeq::AttributeTypeAndDistinguishedValueSetOfSeq (const AttributeTypeAndDistinguishedValueSetOfSeq
&)
476 Asn1Error
<< "use of incompletely defined AttributeTypeAndDistinguishedValueSetOfSeq::AttributeTypeAndDistinguishedValueSetOfSeq (const AttributeTypeAndDistinguishedValueSetOfSeq &)" << endl
;
480 AttributeTypeAndDistinguishedValueSetOfSeq::~AttributeTypeAndDistinguishedValueSetOfSeq()
482 delete distingAttrValue
;
485 AsnType
*AttributeTypeAndDistinguishedValueSetOfSeq::Clone() const
487 return new AttributeTypeAndDistinguishedValueSetOfSeq
;
490 AsnType
*AttributeTypeAndDistinguishedValueSetOfSeq::Copy() const
492 return new AttributeTypeAndDistinguishedValueSetOfSeq (*this);
496 AttributeTypeAndDistinguishedValueSetOfSeq
&AttributeTypeAndDistinguishedValueSetOfSeq::operator = (const AttributeTypeAndDistinguishedValueSetOfSeq
&that
)
497 #else // SNACC_DEEP_COPY
498 AttributeTypeAndDistinguishedValueSetOfSeq
&AttributeTypeAndDistinguishedValueSetOfSeq::operator = (const AttributeTypeAndDistinguishedValueSetOfSeq
&)
499 #endif // SNACC_DEEP_COPY
504 if (that
.distingAttrValue
)
506 if (!distingAttrValue
)
507 distingAttrValue
= new AsnOid
;
508 *distingAttrValue
= *that
.distingAttrValue
;
512 delete distingAttrValue
;
513 distingAttrValue
= NULL
;
515 contextList
= that
.contextList
;
519 #else // SNACC_DEEP_COPY
520 Asn1Error
<< "use of incompletely defined AttributeTypeAndDistinguishedValueSetOfSeq &AttributeTypeAndDistinguishedValueSetOfSeq::operator = (const AttributeTypeAndDistinguishedValueSetOfSeq &)" << endl
;
522 // if your compiler complains here, check the -novolat option
523 #endif // SNACC_DEEP_COPY
527 AttributeTypeAndDistinguishedValueSetOfSeq::BEncContent (BUF_TYPE b
)
533 l
= contextList
.BEncContent (b
);
534 l
+= BEncConsLen (b
, l
);
536 l
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
539 if (NOT_NULL (distingAttrValue
))
541 l
= distingAttrValue
->BEncContent (b
);
542 l
+= BEncDefLen (b
, l
);
544 l
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
549 } // AttributeTypeAndDistinguishedValueSetOfSeq::BEncContent
552 void AttributeTypeAndDistinguishedValueSetOfSeq::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
555 AsnLen seqBytesDecoded
= 0;
557 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
559 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
561 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
562 distingAttrValue
= new AsnOid
;
563 distingAttrValue
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
564 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
567 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
)))
569 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
570 contextList
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
574 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
578 bytesDecoded
+= seqBytesDecoded
;
579 if (elmtLen0
== INDEFINITE_LEN
)
581 BDecEoc (b
, bytesDecoded
, env
);
584 else if (seqBytesDecoded
!= elmtLen0
)
586 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
591 } // AttributeTypeAndDistinguishedValueSetOfSeq::BDecContent
593 AsnLen
AttributeTypeAndDistinguishedValueSetOfSeq::BEnc (BUF_TYPE b
)
597 l
+= BEncConsLen (b
, l
);
598 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
602 void AttributeTypeAndDistinguishedValueSetOfSeq::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
607 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
609 Asn1Error
<< "AttributeTypeAndDistinguishedValueSetOfSeq::BDec: ERROR - wrong tag" << endl
;
612 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
613 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
616 int AttributeTypeAndDistinguishedValueSetOfSeq::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
618 bytesEncoded
= BEnc (b
);
619 return !b
.WriteError();
622 int AttributeTypeAndDistinguishedValueSetOfSeq::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
628 if ((val
= setjmp (env
)) == 0)
630 BDec (b
, bytesDecoded
, env
);
631 return !b
.ReadError();
637 void AttributeTypeAndDistinguishedValueSetOfSeq::Print (ostream
&os
) const
640 os
<< "{ -- SEQUENCE --" << endl
;
641 indentG
+= stdIndentG
;
643 if (NOT_NULL (distingAttrValue
))
645 Indent (os
, indentG
);
646 os
<< "distingAttrValue ";
647 os
<< *distingAttrValue
;
651 Indent (os
, indentG
);
652 os
<< "distingAttrValue ";
658 Indent (os
, indentG
);
659 os
<< "contextList ";
664 indentG
-= stdIndentG
;
665 Indent (os
, indentG
);
668 } // AttributeTypeAndDistinguishedValueSetOfSeq::Print
671 AsnType
*AttributeTypeAndDistinguishedValueSetOf::Clone() const
673 return new AttributeTypeAndDistinguishedValueSetOf
;
676 AsnType
*AttributeTypeAndDistinguishedValueSetOf::Copy() const
678 return new AttributeTypeAndDistinguishedValueSetOf (*this);
681 AsnLen
AttributeTypeAndDistinguishedValueSetOf::BEnc (BUF_TYPE b
)
685 l
+= BEncConsLen (b
, l
);
686 l
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
690 void AttributeTypeAndDistinguishedValueSetOf::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
695 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
))
697 Asn1Error
<< "AttributeTypeAndDistinguishedValueSetOf::BDec: ERROR - wrong tag" << endl
;
700 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
701 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
704 AttributeTypeAndDistinguishedValueSetOf::AttributeTypeAndDistinguishedValueSetOf (const AttributeTypeAndDistinguishedValueSetOf
&)
706 Asn1Error
<< "use of incompletely defined AttributeTypeAndDistinguishedValueSetOf::AttributeTypeAndDistinguishedValueSetOf (const AttributeTypeAndDistinguishedValueSetOf &)" << endl
;
710 AttributeTypeAndDistinguishedValueSetOf::~AttributeTypeAndDistinguishedValueSetOf()
713 for (; Curr() != NULL
; RemoveCurrFromList())
715 } // end of destructor
718 AttributeTypeAndDistinguishedValueSetOf
&AttributeTypeAndDistinguishedValueSetOf::operator = (const AttributeTypeAndDistinguishedValueSetOf
&that
)
719 #else // SNACC_DEEP_COPY
720 AttributeTypeAndDistinguishedValueSetOf
&AttributeTypeAndDistinguishedValueSetOf::operator = (const AttributeTypeAndDistinguishedValueSetOf
&)
721 #endif // SNACC_DEEP_COPY
727 for (; Curr(); RemoveCurrFromList())
730 //that.SetCurrToFirst();
731 //for (; that.Curr(); that.GoNext())
732 // AppendCopy (*that.Curr());
733 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
734 AppendCopy (*run
->elmt
);
738 #else // SNACC_DEEP_COPY
739 Asn1Error
<< "use of incompletely defined AttributeTypeAndDistinguishedValueSetOf &AttributeTypeAndDistinguishedValueSetOf::operator = (const AttributeTypeAndDistinguishedValueSetOf &)" << endl
;
741 // if your compiler complains here, check the -novolat option
742 #endif // SNACC_DEEP_COPY
745 void AttributeTypeAndDistinguishedValueSetOf::Print (ostream
&os
) const
748 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
749 indentG
+= stdIndentG
;
751 //for (; Curr() != NULL; GoNext())
752 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
754 Indent (os
, indentG
);
757 //if (Curr() != Last())
762 indentG
-= stdIndentG
;
763 Indent (os
, indentG
);
771 void AttributeTypeAndDistinguishedValueSetOf::SetCurrElmt (unsigned long int index
)
776 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
778 } // AttributeTypeAndDistinguishedValueSetOf::SetCurrElmt
781 unsigned long int AttributeTypeAndDistinguishedValueSetOf::GetCurrElmtIndex()
787 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
796 } // AttributeTypeAndDistinguishedValueSetOf::GetCurrElmtIndex
799 // alloc new list elmt, put at end of list
800 // and return the component type
801 AttributeTypeAndDistinguishedValueSetOfSeq
*AttributeTypeAndDistinguishedValueSetOf::Append()
803 AsnListElmt
*newElmt
;
804 newElmt
= new AsnListElmt
;
805 newElmt
->elmt
= new AttributeTypeAndDistinguishedValueSetOfSeq
;
806 newElmt
->next
= NULL
;
809 newElmt
->prev
= NULL
;
810 first
= last
= newElmt
;
814 newElmt
->prev
= last
;
815 last
->next
= newElmt
;
819 return (curr
= newElmt
)->elmt
;
820 } // AttributeTypeAndDistinguishedValueSetOf::Append
823 // alloc new list elmt, put at begining of list
824 // and return the component type
825 AttributeTypeAndDistinguishedValueSetOfSeq
*AttributeTypeAndDistinguishedValueSetOf::Prepend()
827 AsnListElmt
*newElmt
;
828 newElmt
= new AsnListElmt
;
829 newElmt
->elmt
= new AttributeTypeAndDistinguishedValueSetOfSeq
;
830 newElmt
->prev
= NULL
;
833 newElmt
->next
= NULL
;
834 first
= last
= newElmt
;
838 newElmt
->next
= first
;
839 first
->prev
= newElmt
;
843 return (curr
= newElmt
)->elmt
;
844 } // AttributeTypeAndDistinguishedValueSetOf::Prepend
847 // alloc new list elmt, insert it before the
848 // current element and return the component type
849 // if the current element is null, the new element
850 // is placed at the beginning of the list.
851 AttributeTypeAndDistinguishedValueSetOfSeq
*AttributeTypeAndDistinguishedValueSetOf::InsertBefore()
853 AsnListElmt
*newElmt
;
854 newElmt
= new AsnListElmt
;
855 newElmt
->elmt
= new AttributeTypeAndDistinguishedValueSetOfSeq
;
858 newElmt
->next
= first
;
859 newElmt
->prev
= NULL
;
866 newElmt
->next
= curr
;
867 newElmt
->prev
= curr
->prev
;
868 curr
->prev
= newElmt
;
872 newElmt
->prev
->next
= newElmt
;
875 return (curr
= newElmt
)->elmt
;
876 } // AttributeTypeAndDistinguishedValueSetOf::InsertBefore
879 // alloc new list elmt, insert it after the
880 // current element and return the component type
881 // if the current element is null, the new element
882 // is placed at the end of the list.
883 AttributeTypeAndDistinguishedValueSetOfSeq
*AttributeTypeAndDistinguishedValueSetOf::InsertAfter()
885 AsnListElmt
*newElmt
;
886 newElmt
= new AsnListElmt
;
887 newElmt
->elmt
= new AttributeTypeAndDistinguishedValueSetOfSeq
;
890 newElmt
->prev
= last
;
891 newElmt
->next
= NULL
;
898 newElmt
->prev
= curr
;
899 newElmt
->next
= curr
->next
;
900 curr
->next
= newElmt
;
904 newElmt
->next
->prev
= newElmt
;
907 return (curr
= newElmt
)->elmt
;
908 } // AttributeTypeAndDistinguishedValueSetOf::InsertAfter
911 AttributeTypeAndDistinguishedValueSetOf
&AttributeTypeAndDistinguishedValueSetOf::AppendCopy (AttributeTypeAndDistinguishedValueSetOfSeq
&elmt
)
913 AsnListElmt
*newElmt
;
914 newElmt
= new AsnListElmt
;
915 newElmt
->elmt
= new AttributeTypeAndDistinguishedValueSetOfSeq
;
916 *newElmt
->elmt
= elmt
;
917 newElmt
->next
= NULL
;
920 newElmt
->prev
= NULL
;
921 first
= last
= newElmt
;
925 newElmt
->prev
= last
;
926 last
->next
= newElmt
;
934 AttributeTypeAndDistinguishedValueSetOf
&AttributeTypeAndDistinguishedValueSetOf::PrependCopy (AttributeTypeAndDistinguishedValueSetOfSeq
&elmt
)
936 AsnListElmt
*newElmt
;
937 newElmt
= new AsnListElmt
;
938 newElmt
->elmt
= new AttributeTypeAndDistinguishedValueSetOfSeq
;
939 *newElmt
->elmt
= elmt
;
940 newElmt
->prev
= NULL
;
943 newElmt
->next
= NULL
;
944 first
= last
= newElmt
;
948 newElmt
->next
= first
;
949 first
->prev
= newElmt
;
954 } // AttributeTypeAndDistinguishedValueSetOf::PrependCopy
957 // alloc new list elmt, insert it before the
958 // current element, copy the given elmt into the new elmt
959 // and return the component type.
960 // if the current element is null, the new element
961 // is placed at the beginning of the list.
962 AttributeTypeAndDistinguishedValueSetOf
&AttributeTypeAndDistinguishedValueSetOf::InsertBeforeAndCopy (AttributeTypeAndDistinguishedValueSetOfSeq
&elmt
)
964 AsnListElmt
*newElmt
;
966 newElmt
= new AsnListElmt
;
967 newElmt
->elmt
= new AttributeTypeAndDistinguishedValueSetOfSeq
;
968 *newElmt
->elmt
= elmt
;
972 newElmt
->next
= first
;
973 newElmt
->prev
= NULL
;
980 newElmt
->next
= curr
;
981 newElmt
->prev
= curr
->prev
;
982 curr
->prev
= newElmt
;
986 newElmt
->prev
->next
= newElmt
;
990 } // AttributeTypeAndDistinguishedValueSetOf::InsertBeforeAndCopy
993 // alloc new list elmt, insert it after the
994 // current element, copy given elmt in to new elmt
995 // and return the component type
996 // if the current element is null, the new element
997 // is placed at the end of the list.
998 AttributeTypeAndDistinguishedValueSetOf
&AttributeTypeAndDistinguishedValueSetOf::InsertAfterAndCopy (AttributeTypeAndDistinguishedValueSetOfSeq
&elmt
)
1000 AsnListElmt
*newElmt
;
1002 newElmt
= new AsnListElmt
;
1003 newElmt
->elmt
= new AttributeTypeAndDistinguishedValueSetOfSeq
;
1004 *newElmt
->elmt
= elmt
;
1007 newElmt
->prev
= last
;
1008 newElmt
->next
= NULL
;
1015 newElmt
->prev
= curr
;
1016 newElmt
->next
= curr
->next
;
1017 curr
->next
= newElmt
;
1021 newElmt
->next
->prev
= newElmt
;
1025 } // AttributeTypeAndDistinguishedValueSetOf::InsertAfterAndCopy
1028 // remove current element from list if current element is not NULL
1029 // The new current element will be the next element.
1030 // If the current element is the last element in the list
1031 // the second but last element will become the new current element.
1032 void AttributeTypeAndDistinguishedValueSetOf::RemoveCurrFromList()
1034 AsnListElmt
*del_elmt
;
1042 first
= last
= curr
= NULL
;
1043 else if (curr
== first
)
1045 curr
= first
= first
->next
;
1048 else if (curr
== last
)
1050 curr
= last
= last
->prev
;
1055 curr
->prev
->next
= curr
->next
;
1056 curr
->next
->prev
= curr
->prev
;
1059 delete del_elmt
->elmt
;
1065 AsnLen
AttributeTypeAndDistinguishedValueSetOf::BEncContent (BUF_TYPE b
)
1067 AsnListElmt
*currElmt
;
1069 AsnLen totalLen
= 0;
1072 CSM_Buffer
**tmpEnc
=NULL
;
1073 for (currElmt
= last
,icount
=0; currElmt
!= NULL
; currElmt
= currElmt
->prev
, icount
++);
1074 tmpEnc
= (CSM_Buffer
**) calloc(sizeof(CSM_Buffer
*), icount
);
1075 for (currElmt
= last
, iii
=0; currElmt
!= NULL
; currElmt
= currElmt
->prev
,iii
++,elmtLen
=0)
1078 ENCODE_BUF1(currElmt
->elmt
->BEncContent
, elmtLen
);
1079 elmtLen
+= BEncConsLen (outputBuf
, elmtLen
);
1081 elmtLen
+= BEncTag1 (outputBuf
, UNIV
, CONS
, SEQ_TAG_CODE
);
1082 ENCODE_BUF2(tmpEnc
[iii
]);
1084 vdasnacc_sortSetOf(tmpEnc
, icount
);
1085 for (iii
=0,elmtLen
=0; iii
< icount
; elmtLen
+=tmpEnc
[iii
++]->Length())
1086 SM_WriteToAsnBuf(tmpEnc
[iii
], b
);
1087 for (iii
=0; iii
< icount
; iii
++) delete tmpEnc
[iii
];
1090 totalLen
+= elmtLen
;
1092 } // AttributeTypeAndDistinguishedValueSetOf::BEncContent
1095 void AttributeTypeAndDistinguishedValueSetOf::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
1096 AsnLen
&bytesDecoded
, ENV_TYPE env
)
1098 AttributeTypeAndDistinguishedValueSetOfSeq
*listElmt
;
1100 AsnLen listBytesDecoded
= 0;
1103 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
1105 tag1
= BDecTag (b
, listBytesDecoded
, env
);
1106 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
1108 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
1111 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
1113 Asn1Error
<< "Unexpected Tag" << endl
;
1114 longjmp (env
, -105);
1117 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
1118 listElmt
= Append();
1119 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
1122 bytesDecoded
+= listBytesDecoded
;
1123 } // AttributeTypeAndDistinguishedValueSetOf::BDecContent
1126 AsnType
*AttributeSetOf::Clone() const
1128 return new AttributeSetOf
;
1131 AsnType
*AttributeSetOf::Copy() const
1133 return new AttributeSetOf (*this);
1136 AsnLen
AttributeSetOf::BEnc (BUF_TYPE b
)
1139 l
= BEncContent (b
);
1140 l
+= BEncConsLen (b
, l
);
1141 l
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
1145 void AttributeSetOf::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1150 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
))
1152 Asn1Error
<< "AttributeSetOf::BDec: ERROR - wrong tag" << endl
;
1153 longjmp (env
, -106);
1155 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1156 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1159 AttributeSetOf::AttributeSetOf (const AttributeSetOf
&)
1161 Asn1Error
<< "use of incompletely defined AttributeSetOf::AttributeSetOf (const AttributeSetOf &)" << endl
;
1165 AttributeSetOf::~AttributeSetOf()
1168 for (; Curr() != NULL
; RemoveCurrFromList())
1170 } // end of destructor
1173 AttributeSetOf
&AttributeSetOf::operator = (const AttributeSetOf
&that
)
1174 #else // SNACC_DEEP_COPY
1175 AttributeSetOf
&AttributeSetOf::operator = (const AttributeSetOf
&)
1176 #endif // SNACC_DEEP_COPY
1182 for (; Curr(); RemoveCurrFromList())
1185 //that.SetCurrToFirst();
1186 //for (; that.Curr(); that.GoNext())
1187 // AppendCopy (*that.Curr());
1188 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
1189 AppendCopy (*run
->elmt
);
1193 #else // SNACC_DEEP_COPY
1194 Asn1Error
<< "use of incompletely defined AttributeSetOf &AttributeSetOf::operator = (const AttributeSetOf &)" << endl
;
1196 // if your compiler complains here, check the -novolat option
1197 #endif // SNACC_DEEP_COPY
1200 void AttributeSetOf::Print (ostream
&os
) const
1203 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
1204 indentG
+= stdIndentG
;
1206 //for (; Curr() != NULL; GoNext())
1207 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
1209 Indent (os
, indentG
);
1212 //if (Curr() != Last())
1217 indentG
-= stdIndentG
;
1218 Indent (os
, indentG
);
1226 void AttributeSetOf::SetCurrElmt (unsigned long int index
)
1228 unsigned long int i
;
1231 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
1233 } // AttributeSetOf::SetCurrElmt
1236 unsigned long int AttributeSetOf::GetCurrElmtIndex()
1238 unsigned long int i
;
1242 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
1251 } // AttributeSetOf::GetCurrElmtIndex
1254 // alloc new list elmt, put at end of list
1255 // and return the component type
1256 AttributeValue
*AttributeSetOf::Append()
1258 AsnListElmt
*newElmt
;
1259 newElmt
= new AsnListElmt
;
1260 newElmt
->elmt
= new AttributeValue
;
1261 newElmt
->next
= NULL
;
1264 newElmt
->prev
= NULL
;
1265 first
= last
= newElmt
;
1269 newElmt
->prev
= last
;
1270 last
->next
= newElmt
;
1274 return (curr
= newElmt
)->elmt
;
1275 } // AttributeSetOf::Append
1278 // alloc new list elmt, put at begining of list
1279 // and return the component type
1280 AttributeValue
*AttributeSetOf::Prepend()
1282 AsnListElmt
*newElmt
;
1283 newElmt
= new AsnListElmt
;
1284 newElmt
->elmt
= new AttributeValue
;
1285 newElmt
->prev
= NULL
;
1288 newElmt
->next
= NULL
;
1289 first
= last
= newElmt
;
1293 newElmt
->next
= first
;
1294 first
->prev
= newElmt
;
1298 return (curr
= newElmt
)->elmt
;
1299 } // AttributeSetOf::Prepend
1302 // alloc new list elmt, insert it before the
1303 // current element and return the component type
1304 // if the current element is null, the new element
1305 // is placed at the beginning of the list.
1306 AttributeValue
*AttributeSetOf::InsertBefore()
1308 AsnListElmt
*newElmt
;
1309 newElmt
= new AsnListElmt
;
1310 newElmt
->elmt
= new AttributeValue
;
1313 newElmt
->next
= first
;
1314 newElmt
->prev
= NULL
;
1321 newElmt
->next
= curr
;
1322 newElmt
->prev
= curr
->prev
;
1323 curr
->prev
= newElmt
;
1327 newElmt
->prev
->next
= newElmt
;
1330 return (curr
= newElmt
)->elmt
;
1331 } // AttributeSetOf::InsertBefore
1334 // alloc new list elmt, insert it after the
1335 // current element and return the component type
1336 // if the current element is null, the new element
1337 // is placed at the end of the list.
1338 AttributeValue
*AttributeSetOf::InsertAfter()
1340 AsnListElmt
*newElmt
;
1341 newElmt
= new AsnListElmt
;
1342 newElmt
->elmt
= new AttributeValue
;
1345 newElmt
->prev
= last
;
1346 newElmt
->next
= NULL
;
1353 newElmt
->prev
= curr
;
1354 newElmt
->next
= curr
->next
;
1355 curr
->next
= newElmt
;
1359 newElmt
->next
->prev
= newElmt
;
1362 return (curr
= newElmt
)->elmt
;
1363 } // AttributeSetOf::InsertAfter
1366 AttributeSetOf
&AttributeSetOf::AppendCopy (AttributeValue
&elmt
)
1368 AsnListElmt
*newElmt
;
1369 newElmt
= new AsnListElmt
;
1370 newElmt
->elmt
= new AttributeValue
;
1371 *newElmt
->elmt
= elmt
;
1372 newElmt
->next
= NULL
;
1375 newElmt
->prev
= NULL
;
1376 first
= last
= newElmt
;
1380 newElmt
->prev
= last
;
1381 last
->next
= newElmt
;
1389 AttributeSetOf
&AttributeSetOf::PrependCopy (AttributeValue
&elmt
)
1391 AsnListElmt
*newElmt
;
1392 newElmt
= new AsnListElmt
;
1393 newElmt
->elmt
= new AttributeValue
;
1394 *newElmt
->elmt
= elmt
;
1395 newElmt
->prev
= NULL
;
1398 newElmt
->next
= NULL
;
1399 first
= last
= newElmt
;
1403 newElmt
->next
= first
;
1404 first
->prev
= newElmt
;
1409 } // AttributeSetOf::PrependCopy
1412 // alloc new list elmt, insert it before the
1413 // current element, copy the given elmt into the new elmt
1414 // and return the component type.
1415 // if the current element is null, the new element
1416 // is placed at the beginning of the list.
1417 AttributeSetOf
&AttributeSetOf::InsertBeforeAndCopy (AttributeValue
&elmt
)
1419 AsnListElmt
*newElmt
;
1421 newElmt
= new AsnListElmt
;
1422 newElmt
->elmt
= new AttributeValue
;
1423 *newElmt
->elmt
= elmt
;
1427 newElmt
->next
= first
;
1428 newElmt
->prev
= NULL
;
1435 newElmt
->next
= curr
;
1436 newElmt
->prev
= curr
->prev
;
1437 curr
->prev
= newElmt
;
1441 newElmt
->prev
->next
= newElmt
;
1445 } // AttributeSetOf::InsertBeforeAndCopy
1448 // alloc new list elmt, insert it after the
1449 // current element, copy given elmt in to new elmt
1450 // and return the component type
1451 // if the current element is null, the new element
1452 // is placed at the end of the list.
1453 AttributeSetOf
&AttributeSetOf::InsertAfterAndCopy (AttributeValue
&elmt
)
1455 AsnListElmt
*newElmt
;
1457 newElmt
= new AsnListElmt
;
1458 newElmt
->elmt
= new AttributeValue
;
1459 *newElmt
->elmt
= elmt
;
1462 newElmt
->prev
= last
;
1463 newElmt
->next
= NULL
;
1470 newElmt
->prev
= curr
;
1471 newElmt
->next
= curr
->next
;
1472 curr
->next
= newElmt
;
1476 newElmt
->next
->prev
= newElmt
;
1480 } // AttributeSetOf::InsertAfterAndCopy
1483 // remove current element from list if current element is not NULL
1484 // The new current element will be the next element.
1485 // If the current element is the last element in the list
1486 // the second but last element will become the new current element.
1487 void AttributeSetOf::RemoveCurrFromList()
1489 AsnListElmt
*del_elmt
;
1497 first
= last
= curr
= NULL
;
1498 else if (curr
== first
)
1500 curr
= first
= first
->next
;
1503 else if (curr
== last
)
1505 curr
= last
= last
->prev
;
1510 curr
->prev
->next
= curr
->next
;
1511 curr
->next
->prev
= curr
->prev
;
1514 delete del_elmt
->elmt
;
1520 AsnLen
AttributeSetOf::BEncContent (BUF_TYPE b
)
1522 AsnListElmt
*currElmt
;
1524 AsnLen totalLen
= 0;
1527 CSM_Buffer
**tmpEnc
=NULL
;
1528 for (currElmt
= last
,icount
=0; currElmt
!= NULL
; currElmt
= currElmt
->prev
, icount
++);
1529 tmpEnc
= (CSM_Buffer
**) calloc(sizeof(CSM_Buffer
*), icount
);
1530 for (currElmt
= last
, iii
=0; currElmt
!= NULL
; currElmt
= currElmt
->prev
,iii
++,elmtLen
=0)
1532 tmpEnc
[iii
] = (CSM_Buffer
*)currElmt
->elmt
->value
;
1534 vdasnacc_sortSetOf(tmpEnc
, icount
);
1535 for (iii
=0,elmtLen
=0; iii
< icount
; elmtLen
+=tmpEnc
[iii
++]->Length())
1536 SM_WriteToAsnBuf(tmpEnc
[iii
], b
);
1539 totalLen
+= elmtLen
;
1541 } // AttributeSetOf::BEncContent
1544 void AttributeSetOf::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
1545 AsnLen
&bytesDecoded
, ENV_TYPE env
)
1547 AttributeValue
*listElmt
;
1548 AsnLen listBytesDecoded
= 0;
1550 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
1552 listElmt
= Append();
1553 DEC_LOAD_ANYBUF(listElmt
, b
, listBytesDecoded
, env
);
1556 bytesDecoded
+= listBytesDecoded
;
1557 } // AttributeSetOf::BDecContent
1560 Attribute::Attribute()
1564 Attribute::Attribute (const Attribute
&)
1566 Asn1Error
<< "use of incompletely defined Attribute::Attribute (const Attribute &)" << endl
;
1570 Attribute::~Attribute()
1574 AsnType
*Attribute::Clone() const
1576 return new Attribute
;
1579 AsnType
*Attribute::Copy() const
1581 return new Attribute (*this);
1585 Attribute
&Attribute::operator = (const Attribute
&that
)
1586 #else // SNACC_DEEP_COPY
1587 Attribute
&Attribute::operator = (const Attribute
&)
1588 #endif // SNACC_DEEP_COPY
1594 values
= that
.values
;
1598 #else // SNACC_DEEP_COPY
1599 Asn1Error
<< "use of incompletely defined Attribute &Attribute::operator = (const Attribute &)" << endl
;
1601 // if your compiler complains here, check the -novolat option
1602 #endif // SNACC_DEEP_COPY
1606 Attribute::BEncContent (BUF_TYPE b
)
1608 AsnLen totalLen
= 0;
1612 l
= values
.BEncContent (b
);
1613 l
+= BEncConsLen (b
, l
);
1615 l
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
1618 l
= type
.BEncContent (b
);
1619 l
+= BEncDefLen (b
, l
);
1621 l
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
1625 } // Attribute::BEncContent
1628 void Attribute::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1631 AsnLen seqBytesDecoded
= 0;
1633 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1635 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
1637 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1638 type
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1639 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1643 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1644 longjmp (env
, -107);
1647 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
)))
1649 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1650 values
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1654 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1655 longjmp (env
, -108);
1658 bytesDecoded
+= seqBytesDecoded
;
1659 if (elmtLen0
== INDEFINITE_LEN
)
1661 BDecEoc (b
, bytesDecoded
, env
);
1664 else if (seqBytesDecoded
!= elmtLen0
)
1666 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
1667 longjmp (env
, -109);
1671 } // Attribute::BDecContent
1673 AsnLen
Attribute::BEnc (BUF_TYPE b
)
1676 l
= BEncContent (b
);
1677 l
+= BEncConsLen (b
, l
);
1678 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1682 void Attribute::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1687 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1689 Asn1Error
<< "Attribute::BDec: ERROR - wrong tag" << endl
;
1690 longjmp (env
, -110);
1692 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1693 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1696 int Attribute::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
1698 bytesEncoded
= BEnc (b
);
1699 return !b
.WriteError();
1702 int Attribute::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
1708 if ((val
= setjmp (env
)) == 0)
1710 BDec (b
, bytesDecoded
, env
);
1711 return !b
.ReadError();
1717 void Attribute::Print (ostream
&os
) const
1720 os
<< "{ -- SEQUENCE --" << endl
;
1721 indentG
+= stdIndentG
;
1724 Indent (os
, indentG
);
1731 Indent (os
, indentG
);
1737 indentG
-= stdIndentG
;
1738 Indent (os
, indentG
);
1741 } // Attribute::Print
1744 AttributeTypeAndDistinguishedValue::AttributeTypeAndDistinguishedValue()
1746 primaryDistinguished
= NULL
;
1747 valuesWithContext
= NULL
;
1750 AttributeTypeAndDistinguishedValue::AttributeTypeAndDistinguishedValue (const AttributeTypeAndDistinguishedValue
&)
1752 Asn1Error
<< "use of incompletely defined AttributeTypeAndDistinguishedValue::AttributeTypeAndDistinguishedValue (const AttributeTypeAndDistinguishedValue &)" << endl
;
1756 AttributeTypeAndDistinguishedValue::~AttributeTypeAndDistinguishedValue()
1758 delete primaryDistinguished
;
1759 delete valuesWithContext
;
1762 AsnType
*AttributeTypeAndDistinguishedValue::Clone() const
1764 return new AttributeTypeAndDistinguishedValue
;
1767 AsnType
*AttributeTypeAndDistinguishedValue::Copy() const
1769 return new AttributeTypeAndDistinguishedValue (*this);
1773 AttributeTypeAndDistinguishedValue
&AttributeTypeAndDistinguishedValue::operator = (const AttributeTypeAndDistinguishedValue
&that
)
1774 #else // SNACC_DEEP_COPY
1775 AttributeTypeAndDistinguishedValue
&AttributeTypeAndDistinguishedValue::operator = (const AttributeTypeAndDistinguishedValue
&)
1776 #endif // SNACC_DEEP_COPY
1783 if (that
.primaryDistinguished
)
1785 if (!primaryDistinguished
)
1786 primaryDistinguished
= new AsnBool
;
1787 *primaryDistinguished
= *that
.primaryDistinguished
;
1791 delete primaryDistinguished
;
1792 primaryDistinguished
= NULL
;
1794 if (that
.valuesWithContext
)
1796 if (!valuesWithContext
)
1797 valuesWithContext
= new AttributeTypeAndDistinguishedValueSetOf
;
1798 *valuesWithContext
= *that
.valuesWithContext
;
1802 delete valuesWithContext
;
1803 valuesWithContext
= NULL
;
1808 #else // SNACC_DEEP_COPY
1809 Asn1Error
<< "use of incompletely defined AttributeTypeAndDistinguishedValue &AttributeTypeAndDistinguishedValue::operator = (const AttributeTypeAndDistinguishedValue &)" << endl
;
1811 // if your compiler complains here, check the -novolat option
1812 #endif // SNACC_DEEP_COPY
1816 AttributeTypeAndDistinguishedValue::BEncContent (BUF_TYPE b
)
1818 AsnLen totalLen
= 0;
1821 if (NOT_NULL (valuesWithContext
))
1824 l
= valuesWithContext
->BEncContent (b
);
1825 l
+= BEncConsLen (b
, l
);
1827 l
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
1831 if (NOT_NULL (primaryDistinguished
))
1833 l
= primaryDistinguished
->BEncContent (b
);
1834 BEncDefLenTo127 (b
, l
);
1837 l
+= BEncTag1 (b
, UNIV
, PRIM
, BOOLEAN_TAG_CODE
);
1841 ENC_LOAD_ANYBUF(&value
, b
, l
);
1844 l
= type
.BEncContent (b
);
1845 l
+= BEncDefLen (b
, l
);
1847 l
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
1851 } // AttributeTypeAndDistinguishedValue::BEncContent
1854 void AttributeTypeAndDistinguishedValue::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1857 AsnLen seqBytesDecoded
= 0;
1859 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1861 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
1863 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1864 type
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1868 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1869 longjmp (env
, -111);
1873 DEC_LOAD_ANYBUF(&value
, b
, seqBytesDecoded
, env
);
1874 if (seqBytesDecoded
== elmtLen0
)
1876 bytesDecoded
+= seqBytesDecoded
;
1881 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1883 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
1885 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
1886 bytesDecoded
+= seqBytesDecoded
;
1892 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, BOOLEAN_TAG_CODE
)))
1894 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1895 primaryDistinguished
= new AsnBool
;
1896 primaryDistinguished
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1897 if (seqBytesDecoded
== elmtLen0
)
1899 bytesDecoded
+= seqBytesDecoded
;
1904 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1906 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
1908 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
1909 bytesDecoded
+= seqBytesDecoded
;
1915 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
)))
1917 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1918 valuesWithContext
= new AttributeTypeAndDistinguishedValueSetOf
;
1919 valuesWithContext
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1922 bytesDecoded
+= seqBytesDecoded
;
1923 if (elmtLen0
== INDEFINITE_LEN
)
1925 BDecEoc (b
, bytesDecoded
, env
);
1928 else if (seqBytesDecoded
!= elmtLen0
)
1930 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
1931 longjmp (env
, -112);
1935 } // AttributeTypeAndDistinguishedValue::BDecContent
1937 AsnLen
AttributeTypeAndDistinguishedValue::BEnc (BUF_TYPE b
)
1940 l
= BEncContent (b
);
1941 l
+= BEncConsLen (b
, l
);
1942 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1946 void AttributeTypeAndDistinguishedValue::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1951 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1953 Asn1Error
<< "AttributeTypeAndDistinguishedValue::BDec: ERROR - wrong tag" << endl
;
1954 longjmp (env
, -113);
1956 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1957 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1960 int AttributeTypeAndDistinguishedValue::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
1962 bytesEncoded
= BEnc (b
);
1963 return !b
.WriteError();
1966 int AttributeTypeAndDistinguishedValue::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
1972 if ((val
= setjmp (env
)) == 0)
1974 BDec (b
, bytesDecoded
, env
);
1975 return !b
.ReadError();
1981 void AttributeTypeAndDistinguishedValue::Print (ostream
&os
) const
1984 os
<< "{ -- SEQUENCE --" << endl
;
1985 indentG
+= stdIndentG
;
1988 Indent (os
, indentG
);
1995 Indent (os
, indentG
);
2001 if (NOT_NULL (primaryDistinguished
))
2004 Indent (os
, indentG
);
2005 os
<< "primaryDistinguished ";
2006 os
<< *primaryDistinguished
;
2010 Indent (os
, indentG
);
2011 os
<< "primaryDistinguished ";
2016 if (NOT_NULL (valuesWithContext
))
2019 Indent (os
, indentG
);
2020 os
<< "valuesWithContext ";
2021 os
<< *valuesWithContext
;
2025 Indent (os
, indentG
);
2026 os
<< "valuesWithContext ";
2032 indentG
-= stdIndentG
;
2033 Indent (os
, indentG
);
2036 } // AttributeTypeAndDistinguishedValue::Print
2039 AsnType
*RelativeDistinguishedName::Clone() const
2041 return new RelativeDistinguishedName
;
2044 AsnType
*RelativeDistinguishedName::Copy() const
2046 return new RelativeDistinguishedName (*this);
2049 AsnLen
RelativeDistinguishedName::BEnc (BUF_TYPE b
)
2052 l
= BEncContent (b
);
2053 l
+= BEncConsLen (b
, l
);
2054 l
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
2058 void RelativeDistinguishedName::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2063 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
))
2065 Asn1Error
<< "RelativeDistinguishedName::BDec: ERROR - wrong tag" << endl
;
2066 longjmp (env
, -114);
2068 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
2069 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
2072 RelativeDistinguishedName::RelativeDistinguishedName (const RelativeDistinguishedName
&)
2074 Asn1Error
<< "use of incompletely defined RelativeDistinguishedName::RelativeDistinguishedName (const RelativeDistinguishedName &)" << endl
;
2078 RelativeDistinguishedName::~RelativeDistinguishedName()
2081 for (; Curr() != NULL
; RemoveCurrFromList())
2083 } // end of destructor
2086 RelativeDistinguishedName
&RelativeDistinguishedName::operator = (const RelativeDistinguishedName
&that
)
2087 #else // SNACC_DEEP_COPY
2088 RelativeDistinguishedName
&RelativeDistinguishedName::operator = (const RelativeDistinguishedName
&)
2089 #endif // SNACC_DEEP_COPY
2095 for (; Curr(); RemoveCurrFromList())
2098 //that.SetCurrToFirst();
2099 //for (; that.Curr(); that.GoNext())
2100 // AppendCopy (*that.Curr());
2101 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
2102 AppendCopy (*run
->elmt
);
2106 #else // SNACC_DEEP_COPY
2107 Asn1Error
<< "use of incompletely defined RelativeDistinguishedName &RelativeDistinguishedName::operator = (const RelativeDistinguishedName &)" << endl
;
2109 // if your compiler complains here, check the -novolat option
2110 #endif // SNACC_DEEP_COPY
2113 void RelativeDistinguishedName::Print (ostream
&os
) const
2116 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
2117 indentG
+= stdIndentG
;
2119 //for (; Curr() != NULL; GoNext())
2120 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
2122 Indent (os
, indentG
);
2125 //if (Curr() != Last())
2130 indentG
-= stdIndentG
;
2131 Indent (os
, indentG
);
2139 void RelativeDistinguishedName::SetCurrElmt (unsigned long int index
)
2141 unsigned long int i
;
2144 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
2146 } // RelativeDistinguishedName::SetCurrElmt
2149 unsigned long int RelativeDistinguishedName::GetCurrElmtIndex()
2151 unsigned long int i
;
2155 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
2164 } // RelativeDistinguishedName::GetCurrElmtIndex
2167 // alloc new list elmt, put at end of list
2168 // and return the component type
2169 AttributeTypeAndDistinguishedValue
*RelativeDistinguishedName::Append()
2171 AsnListElmt
*newElmt
;
2172 newElmt
= new AsnListElmt
;
2173 newElmt
->elmt
= new AttributeTypeAndDistinguishedValue
;
2174 newElmt
->next
= NULL
;
2177 newElmt
->prev
= NULL
;
2178 first
= last
= newElmt
;
2182 newElmt
->prev
= last
;
2183 last
->next
= newElmt
;
2187 return (curr
= newElmt
)->elmt
;
2188 } // RelativeDistinguishedName::Append
2191 // alloc new list elmt, put at begining of list
2192 // and return the component type
2193 AttributeTypeAndDistinguishedValue
*RelativeDistinguishedName::Prepend()
2195 AsnListElmt
*newElmt
;
2196 newElmt
= new AsnListElmt
;
2197 newElmt
->elmt
= new AttributeTypeAndDistinguishedValue
;
2198 newElmt
->prev
= NULL
;
2201 newElmt
->next
= NULL
;
2202 first
= last
= newElmt
;
2206 newElmt
->next
= first
;
2207 first
->prev
= newElmt
;
2211 return (curr
= newElmt
)->elmt
;
2212 } // RelativeDistinguishedName::Prepend
2215 // alloc new list elmt, insert it before the
2216 // current element and return the component type
2217 // if the current element is null, the new element
2218 // is placed at the beginning of the list.
2219 AttributeTypeAndDistinguishedValue
*RelativeDistinguishedName::InsertBefore()
2221 AsnListElmt
*newElmt
;
2222 newElmt
= new AsnListElmt
;
2223 newElmt
->elmt
= new AttributeTypeAndDistinguishedValue
;
2226 newElmt
->next
= first
;
2227 newElmt
->prev
= NULL
;
2234 newElmt
->next
= curr
;
2235 newElmt
->prev
= curr
->prev
;
2236 curr
->prev
= newElmt
;
2240 newElmt
->prev
->next
= newElmt
;
2243 return (curr
= newElmt
)->elmt
;
2244 } // RelativeDistinguishedName::InsertBefore
2247 // alloc new list elmt, insert it after the
2248 // current element and return the component type
2249 // if the current element is null, the new element
2250 // is placed at the end of the list.
2251 AttributeTypeAndDistinguishedValue
*RelativeDistinguishedName::InsertAfter()
2253 AsnListElmt
*newElmt
;
2254 newElmt
= new AsnListElmt
;
2255 newElmt
->elmt
= new AttributeTypeAndDistinguishedValue
;
2258 newElmt
->prev
= last
;
2259 newElmt
->next
= NULL
;
2266 newElmt
->prev
= curr
;
2267 newElmt
->next
= curr
->next
;
2268 curr
->next
= newElmt
;
2272 newElmt
->next
->prev
= newElmt
;
2275 return (curr
= newElmt
)->elmt
;
2276 } // RelativeDistinguishedName::InsertAfter
2279 RelativeDistinguishedName
&RelativeDistinguishedName::AppendCopy (AttributeTypeAndDistinguishedValue
&elmt
)
2281 AsnListElmt
*newElmt
;
2282 newElmt
= new AsnListElmt
;
2283 newElmt
->elmt
= new AttributeTypeAndDistinguishedValue
;
2284 *newElmt
->elmt
= elmt
;
2285 newElmt
->next
= NULL
;
2288 newElmt
->prev
= NULL
;
2289 first
= last
= newElmt
;
2293 newElmt
->prev
= last
;
2294 last
->next
= newElmt
;
2302 RelativeDistinguishedName
&RelativeDistinguishedName::PrependCopy (AttributeTypeAndDistinguishedValue
&elmt
)
2304 AsnListElmt
*newElmt
;
2305 newElmt
= new AsnListElmt
;
2306 newElmt
->elmt
= new AttributeTypeAndDistinguishedValue
;
2307 *newElmt
->elmt
= elmt
;
2308 newElmt
->prev
= NULL
;
2311 newElmt
->next
= NULL
;
2312 first
= last
= newElmt
;
2316 newElmt
->next
= first
;
2317 first
->prev
= newElmt
;
2322 } // RelativeDistinguishedName::PrependCopy
2325 // alloc new list elmt, insert it before the
2326 // current element, copy the given elmt into the new elmt
2327 // and return the component type.
2328 // if the current element is null, the new element
2329 // is placed at the beginning of the list.
2330 RelativeDistinguishedName
&RelativeDistinguishedName::InsertBeforeAndCopy (AttributeTypeAndDistinguishedValue
&elmt
)
2332 AsnListElmt
*newElmt
;
2334 newElmt
= new AsnListElmt
;
2335 newElmt
->elmt
= new AttributeTypeAndDistinguishedValue
;
2336 *newElmt
->elmt
= elmt
;
2340 newElmt
->next
= first
;
2341 newElmt
->prev
= NULL
;
2348 newElmt
->next
= curr
;
2349 newElmt
->prev
= curr
->prev
;
2350 curr
->prev
= newElmt
;
2354 newElmt
->prev
->next
= newElmt
;
2358 } // RelativeDistinguishedName::InsertBeforeAndCopy
2361 // alloc new list elmt, insert it after the
2362 // current element, copy given elmt in to new elmt
2363 // and return the component type
2364 // if the current element is null, the new element
2365 // is placed at the end of the list.
2366 RelativeDistinguishedName
&RelativeDistinguishedName::InsertAfterAndCopy (AttributeTypeAndDistinguishedValue
&elmt
)
2368 AsnListElmt
*newElmt
;
2370 newElmt
= new AsnListElmt
;
2371 newElmt
->elmt
= new AttributeTypeAndDistinguishedValue
;
2372 *newElmt
->elmt
= elmt
;
2375 newElmt
->prev
= last
;
2376 newElmt
->next
= NULL
;
2383 newElmt
->prev
= curr
;
2384 newElmt
->next
= curr
->next
;
2385 curr
->next
= newElmt
;
2389 newElmt
->next
->prev
= newElmt
;
2393 } // RelativeDistinguishedName::InsertAfterAndCopy
2396 // remove current element from list if current element is not NULL
2397 // The new current element will be the next element.
2398 // If the current element is the last element in the list
2399 // the second but last element will become the new current element.
2400 void RelativeDistinguishedName::RemoveCurrFromList()
2402 AsnListElmt
*del_elmt
;
2410 first
= last
= curr
= NULL
;
2411 else if (curr
== first
)
2413 curr
= first
= first
->next
;
2416 else if (curr
== last
)
2418 curr
= last
= last
->prev
;
2423 curr
->prev
->next
= curr
->next
;
2424 curr
->next
->prev
= curr
->prev
;
2427 delete del_elmt
->elmt
;
2433 AsnLen
RelativeDistinguishedName::BEncContent (BUF_TYPE b
)
2435 AsnListElmt
*currElmt
;
2437 AsnLen totalLen
= 0;
2440 CSM_Buffer
**tmpEnc
=NULL
;
2441 for (currElmt
= last
,icount
=0; currElmt
!= NULL
; currElmt
= currElmt
->prev
, icount
++);
2442 tmpEnc
= (CSM_Buffer
**) calloc(sizeof(CSM_Buffer
*), icount
);
2443 for (currElmt
= last
, iii
=0; currElmt
!= NULL
; currElmt
= currElmt
->prev
,iii
++,elmtLen
=0)
2446 ENCODE_BUF1(currElmt
->elmt
->BEncContent
, elmtLen
);
2447 elmtLen
+= BEncConsLen (outputBuf
, elmtLen
);
2449 elmtLen
+= BEncTag1 (outputBuf
, UNIV
, CONS
, SEQ_TAG_CODE
);
2450 ENCODE_BUF2(tmpEnc
[iii
]);
2452 vdasnacc_sortSetOf(tmpEnc
, icount
);
2453 for (iii
=0,elmtLen
=0; iii
< icount
; elmtLen
+=tmpEnc
[iii
++]->Length())
2454 SM_WriteToAsnBuf(tmpEnc
[iii
], b
);
2455 for (iii
=0; iii
< icount
; iii
++) delete tmpEnc
[iii
];
2458 totalLen
+= elmtLen
;
2460 } // RelativeDistinguishedName::BEncContent
2463 void RelativeDistinguishedName::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
2464 AsnLen
&bytesDecoded
, ENV_TYPE env
)
2466 AttributeTypeAndDistinguishedValue
*listElmt
;
2468 AsnLen listBytesDecoded
= 0;
2471 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
2473 tag1
= BDecTag (b
, listBytesDecoded
, env
);
2474 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
2476 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
2479 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
2481 Asn1Error
<< "Unexpected Tag" << endl
;
2482 longjmp (env
, -115);
2485 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
2486 listElmt
= Append();
2487 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
2490 bytesDecoded
+= listBytesDecoded
;
2491 } // RelativeDistinguishedName::BDecContent
2494 AsnType
*RDNSequence::Clone() const
2496 return new RDNSequence
;
2499 AsnType
*RDNSequence::Copy() const
2501 return new RDNSequence (*this);
2504 AsnLen
RDNSequence::BEnc (BUF_TYPE b
)
2507 l
= BEncContent (b
);
2508 l
+= BEncConsLen (b
, l
);
2509 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2513 void RDNSequence::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2518 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
2520 Asn1Error
<< "RDNSequence::BDec: ERROR - wrong tag" << endl
;
2521 longjmp (env
, -116);
2523 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
2524 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
2527 RDNSequence::RDNSequence (const RDNSequence
&)
2529 Asn1Error
<< "use of incompletely defined RDNSequence::RDNSequence (const RDNSequence &)" << endl
;
2533 RDNSequence::~RDNSequence()
2536 for (; Curr() != NULL
; RemoveCurrFromList())
2538 } // end of destructor
2541 RDNSequence
&RDNSequence::operator = (const RDNSequence
&that
)
2542 #else // SNACC_DEEP_COPY
2543 RDNSequence
&RDNSequence::operator = (const RDNSequence
&)
2544 #endif // SNACC_DEEP_COPY
2550 for (; Curr(); RemoveCurrFromList())
2553 //that.SetCurrToFirst();
2554 //for (; that.Curr(); that.GoNext())
2555 // AppendCopy (*that.Curr());
2556 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
2557 AppendCopy (*run
->elmt
);
2561 #else // SNACC_DEEP_COPY
2562 Asn1Error
<< "use of incompletely defined RDNSequence &RDNSequence::operator = (const RDNSequence &)" << endl
;
2564 // if your compiler complains here, check the -novolat option
2565 #endif // SNACC_DEEP_COPY
2568 void RDNSequence::Print (ostream
&os
) const
2571 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
2572 indentG
+= stdIndentG
;
2574 //for (; Curr() != NULL; GoNext())
2575 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
2577 Indent (os
, indentG
);
2580 //if (Curr() != Last())
2585 indentG
-= stdIndentG
;
2586 Indent (os
, indentG
);
2594 void RDNSequence::SetCurrElmt (unsigned long int index
)
2596 unsigned long int i
;
2599 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
2601 } // RDNSequence::SetCurrElmt
2604 unsigned long int RDNSequence::GetCurrElmtIndex()
2606 unsigned long int i
;
2610 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
2619 } // RDNSequence::GetCurrElmtIndex
2622 // alloc new list elmt, put at end of list
2623 // and return the component type
2624 RelativeDistinguishedName
*RDNSequence::Append()
2626 AsnListElmt
*newElmt
;
2627 newElmt
= new AsnListElmt
;
2628 newElmt
->elmt
= new RelativeDistinguishedName
;
2629 newElmt
->next
= NULL
;
2632 newElmt
->prev
= NULL
;
2633 first
= last
= newElmt
;
2637 newElmt
->prev
= last
;
2638 last
->next
= newElmt
;
2642 return (curr
= newElmt
)->elmt
;
2643 } // RDNSequence::Append
2646 // alloc new list elmt, put at begining of list
2647 // and return the component type
2648 RelativeDistinguishedName
*RDNSequence::Prepend()
2650 AsnListElmt
*newElmt
;
2651 newElmt
= new AsnListElmt
;
2652 newElmt
->elmt
= new RelativeDistinguishedName
;
2653 newElmt
->prev
= NULL
;
2656 newElmt
->next
= NULL
;
2657 first
= last
= newElmt
;
2661 newElmt
->next
= first
;
2662 first
->prev
= newElmt
;
2666 return (curr
= newElmt
)->elmt
;
2667 } // RDNSequence::Prepend
2670 // alloc new list elmt, insert it before the
2671 // current element and return the component type
2672 // if the current element is null, the new element
2673 // is placed at the beginning of the list.
2674 RelativeDistinguishedName
*RDNSequence::InsertBefore()
2676 AsnListElmt
*newElmt
;
2677 newElmt
= new AsnListElmt
;
2678 newElmt
->elmt
= new RelativeDistinguishedName
;
2681 newElmt
->next
= first
;
2682 newElmt
->prev
= NULL
;
2689 newElmt
->next
= curr
;
2690 newElmt
->prev
= curr
->prev
;
2691 curr
->prev
= newElmt
;
2695 newElmt
->prev
->next
= newElmt
;
2698 return (curr
= newElmt
)->elmt
;
2699 } // RDNSequence::InsertBefore
2702 // alloc new list elmt, insert it after the
2703 // current element and return the component type
2704 // if the current element is null, the new element
2705 // is placed at the end of the list.
2706 RelativeDistinguishedName
*RDNSequence::InsertAfter()
2708 AsnListElmt
*newElmt
;
2709 newElmt
= new AsnListElmt
;
2710 newElmt
->elmt
= new RelativeDistinguishedName
;
2713 newElmt
->prev
= last
;
2714 newElmt
->next
= NULL
;
2721 newElmt
->prev
= curr
;
2722 newElmt
->next
= curr
->next
;
2723 curr
->next
= newElmt
;
2727 newElmt
->next
->prev
= newElmt
;
2730 return (curr
= newElmt
)->elmt
;
2731 } // RDNSequence::InsertAfter
2734 RDNSequence
&RDNSequence::AppendCopy (RelativeDistinguishedName
&elmt
)
2736 AsnListElmt
*newElmt
;
2737 newElmt
= new AsnListElmt
;
2738 newElmt
->elmt
= new RelativeDistinguishedName
;
2739 *newElmt
->elmt
= elmt
;
2740 newElmt
->next
= NULL
;
2743 newElmt
->prev
= NULL
;
2744 first
= last
= newElmt
;
2748 newElmt
->prev
= last
;
2749 last
->next
= newElmt
;
2757 RDNSequence
&RDNSequence::PrependCopy (RelativeDistinguishedName
&elmt
)
2759 AsnListElmt
*newElmt
;
2760 newElmt
= new AsnListElmt
;
2761 newElmt
->elmt
= new RelativeDistinguishedName
;
2762 *newElmt
->elmt
= elmt
;
2763 newElmt
->prev
= NULL
;
2766 newElmt
->next
= NULL
;
2767 first
= last
= newElmt
;
2771 newElmt
->next
= first
;
2772 first
->prev
= newElmt
;
2777 } // RDNSequence::PrependCopy
2780 // alloc new list elmt, insert it before the
2781 // current element, copy the given elmt into the new elmt
2782 // and return the component type.
2783 // if the current element is null, the new element
2784 // is placed at the beginning of the list.
2785 RDNSequence
&RDNSequence::InsertBeforeAndCopy (RelativeDistinguishedName
&elmt
)
2787 AsnListElmt
*newElmt
;
2789 newElmt
= new AsnListElmt
;
2790 newElmt
->elmt
= new RelativeDistinguishedName
;
2791 *newElmt
->elmt
= elmt
;
2795 newElmt
->next
= first
;
2796 newElmt
->prev
= NULL
;
2803 newElmt
->next
= curr
;
2804 newElmt
->prev
= curr
->prev
;
2805 curr
->prev
= newElmt
;
2809 newElmt
->prev
->next
= newElmt
;
2813 } // RDNSequence::InsertBeforeAndCopy
2816 // alloc new list elmt, insert it after the
2817 // current element, copy given elmt in to new elmt
2818 // and return the component type
2819 // if the current element is null, the new element
2820 // is placed at the end of the list.
2821 RDNSequence
&RDNSequence::InsertAfterAndCopy (RelativeDistinguishedName
&elmt
)
2823 AsnListElmt
*newElmt
;
2825 newElmt
= new AsnListElmt
;
2826 newElmt
->elmt
= new RelativeDistinguishedName
;
2827 *newElmt
->elmt
= elmt
;
2830 newElmt
->prev
= last
;
2831 newElmt
->next
= NULL
;
2838 newElmt
->prev
= curr
;
2839 newElmt
->next
= curr
->next
;
2840 curr
->next
= newElmt
;
2844 newElmt
->next
->prev
= newElmt
;
2848 } // RDNSequence::InsertAfterAndCopy
2851 // remove current element from list if current element is not NULL
2852 // The new current element will be the next element.
2853 // If the current element is the last element in the list
2854 // the second but last element will become the new current element.
2855 void RDNSequence::RemoveCurrFromList()
2857 AsnListElmt
*del_elmt
;
2865 first
= last
= curr
= NULL
;
2866 else if (curr
== first
)
2868 curr
= first
= first
->next
;
2871 else if (curr
== last
)
2873 curr
= last
= last
->prev
;
2878 curr
->prev
->next
= curr
->next
;
2879 curr
->next
->prev
= curr
->prev
;
2882 delete del_elmt
->elmt
;
2888 AsnLen
RDNSequence::BEncContent (BUF_TYPE b
)
2890 AsnListElmt
*currElmt
;
2892 AsnLen totalLen
= 0;
2893 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
2896 elmtLen
= currElmt
->elmt
->BEncContent (b
);
2897 elmtLen
+= BEncConsLen (b
, elmtLen
);
2899 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
2900 totalLen
+= elmtLen
;
2903 } // RDNSequence::BEncContent
2906 void RDNSequence::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
2907 AsnLen
&bytesDecoded
, ENV_TYPE env
)
2909 RelativeDistinguishedName
*listElmt
;
2911 AsnLen listBytesDecoded
= 0;
2914 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
2916 tag1
= BDecTag (b
, listBytesDecoded
, env
);
2917 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
2919 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
2922 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
)))
2924 Asn1Error
<< "Unexpected Tag" << endl
;
2925 longjmp (env
, -117);
2928 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
2929 listElmt
= Append();
2930 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
2933 bytesDecoded
+= listBytesDecoded
;
2934 } // RDNSequence::BDecContent
2937 AsnType
*Attributes::Clone() const
2939 return new Attributes
;
2942 AsnType
*Attributes::Copy() const
2944 return new Attributes (*this);
2947 AsnLen
Attributes::BEnc (BUF_TYPE b
)
2950 l
= BEncContent (b
);
2951 l
+= BEncConsLen (b
, l
);
2952 l
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
2956 void Attributes::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2961 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
))
2963 Asn1Error
<< "Attributes::BDec: ERROR - wrong tag" << endl
;
2964 longjmp (env
, -118);
2966 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
2967 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
2970 Attributes::Attributes (const Attributes
&)
2972 Asn1Error
<< "use of incompletely defined Attributes::Attributes (const Attributes &)" << endl
;
2976 Attributes::~Attributes()
2979 for (; Curr() != NULL
; RemoveCurrFromList())
2981 } // end of destructor
2984 Attributes
&Attributes::operator = (const Attributes
&that
)
2985 #else // SNACC_DEEP_COPY
2986 Attributes
&Attributes::operator = (const Attributes
&)
2987 #endif // SNACC_DEEP_COPY
2993 for (; Curr(); RemoveCurrFromList())
2996 //that.SetCurrToFirst();
2997 //for (; that.Curr(); that.GoNext())
2998 // AppendCopy (*that.Curr());
2999 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
3000 AppendCopy (*run
->elmt
);
3004 #else // SNACC_DEEP_COPY
3005 Asn1Error
<< "use of incompletely defined Attributes &Attributes::operator = (const Attributes &)" << endl
;
3007 // if your compiler complains here, check the -novolat option
3008 #endif // SNACC_DEEP_COPY
3011 void Attributes::Print (ostream
&os
) const
3014 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
3015 indentG
+= stdIndentG
;
3017 //for (; Curr() != NULL; GoNext())
3018 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
3020 Indent (os
, indentG
);
3023 //if (Curr() != Last())
3028 indentG
-= stdIndentG
;
3029 Indent (os
, indentG
);
3037 void Attributes::SetCurrElmt (unsigned long int index
)
3039 unsigned long int i
;
3042 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
3044 } // Attributes::SetCurrElmt
3047 unsigned long int Attributes::GetCurrElmtIndex()
3049 unsigned long int i
;
3053 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
3062 } // Attributes::GetCurrElmtIndex
3065 // alloc new list elmt, put at end of list
3066 // and return the component type
3067 Attribute
*Attributes::Append()
3069 AsnListElmt
*newElmt
;
3070 newElmt
= new AsnListElmt
;
3071 newElmt
->elmt
= new Attribute
;
3072 newElmt
->next
= NULL
;
3075 newElmt
->prev
= NULL
;
3076 first
= last
= newElmt
;
3080 newElmt
->prev
= last
;
3081 last
->next
= newElmt
;
3085 return (curr
= newElmt
)->elmt
;
3086 } // Attributes::Append
3089 // alloc new list elmt, put at begining of list
3090 // and return the component type
3091 Attribute
*Attributes::Prepend()
3093 AsnListElmt
*newElmt
;
3094 newElmt
= new AsnListElmt
;
3095 newElmt
->elmt
= new Attribute
;
3096 newElmt
->prev
= NULL
;
3099 newElmt
->next
= NULL
;
3100 first
= last
= newElmt
;
3104 newElmt
->next
= first
;
3105 first
->prev
= newElmt
;
3109 return (curr
= newElmt
)->elmt
;
3110 } // Attributes::Prepend
3113 // alloc new list elmt, insert it before the
3114 // current element and return the component type
3115 // if the current element is null, the new element
3116 // is placed at the beginning of the list.
3117 Attribute
*Attributes::InsertBefore()
3119 AsnListElmt
*newElmt
;
3120 newElmt
= new AsnListElmt
;
3121 newElmt
->elmt
= new Attribute
;
3124 newElmt
->next
= first
;
3125 newElmt
->prev
= NULL
;
3132 newElmt
->next
= curr
;
3133 newElmt
->prev
= curr
->prev
;
3134 curr
->prev
= newElmt
;
3138 newElmt
->prev
->next
= newElmt
;
3141 return (curr
= newElmt
)->elmt
;
3142 } // Attributes::InsertBefore
3145 // alloc new list elmt, insert it after the
3146 // current element and return the component type
3147 // if the current element is null, the new element
3148 // is placed at the end of the list.
3149 Attribute
*Attributes::InsertAfter()
3151 AsnListElmt
*newElmt
;
3152 newElmt
= new AsnListElmt
;
3153 newElmt
->elmt
= new Attribute
;
3156 newElmt
->prev
= last
;
3157 newElmt
->next
= NULL
;
3164 newElmt
->prev
= curr
;
3165 newElmt
->next
= curr
->next
;
3166 curr
->next
= newElmt
;
3170 newElmt
->next
->prev
= newElmt
;
3173 return (curr
= newElmt
)->elmt
;
3174 } // Attributes::InsertAfter
3177 Attributes
&Attributes::AppendCopy (Attribute
&elmt
)
3179 AsnListElmt
*newElmt
;
3180 newElmt
= new AsnListElmt
;
3181 newElmt
->elmt
= new Attribute
;
3182 *newElmt
->elmt
= elmt
;
3183 newElmt
->next
= NULL
;
3186 newElmt
->prev
= NULL
;
3187 first
= last
= newElmt
;
3191 newElmt
->prev
= last
;
3192 last
->next
= newElmt
;
3200 Attributes
&Attributes::PrependCopy (Attribute
&elmt
)
3202 AsnListElmt
*newElmt
;
3203 newElmt
= new AsnListElmt
;
3204 newElmt
->elmt
= new Attribute
;
3205 *newElmt
->elmt
= elmt
;
3206 newElmt
->prev
= NULL
;
3209 newElmt
->next
= NULL
;
3210 first
= last
= newElmt
;
3214 newElmt
->next
= first
;
3215 first
->prev
= newElmt
;
3220 } // Attributes::PrependCopy
3223 // alloc new list elmt, insert it before the
3224 // current element, copy the given elmt into the new elmt
3225 // and return the component type.
3226 // if the current element is null, the new element
3227 // is placed at the beginning of the list.
3228 Attributes
&Attributes::InsertBeforeAndCopy (Attribute
&elmt
)
3230 AsnListElmt
*newElmt
;
3232 newElmt
= new AsnListElmt
;
3233 newElmt
->elmt
= new Attribute
;
3234 *newElmt
->elmt
= elmt
;
3238 newElmt
->next
= first
;
3239 newElmt
->prev
= NULL
;
3246 newElmt
->next
= curr
;
3247 newElmt
->prev
= curr
->prev
;
3248 curr
->prev
= newElmt
;
3252 newElmt
->prev
->next
= newElmt
;
3256 } // Attributes::InsertBeforeAndCopy
3259 // alloc new list elmt, insert it after the
3260 // current element, copy given elmt in to new elmt
3261 // and return the component type
3262 // if the current element is null, the new element
3263 // is placed at the end of the list.
3264 Attributes
&Attributes::InsertAfterAndCopy (Attribute
&elmt
)
3266 AsnListElmt
*newElmt
;
3268 newElmt
= new AsnListElmt
;
3269 newElmt
->elmt
= new Attribute
;
3270 *newElmt
->elmt
= elmt
;
3273 newElmt
->prev
= last
;
3274 newElmt
->next
= NULL
;
3281 newElmt
->prev
= curr
;
3282 newElmt
->next
= curr
->next
;
3283 curr
->next
= newElmt
;
3287 newElmt
->next
->prev
= newElmt
;
3291 } // Attributes::InsertAfterAndCopy
3294 // remove current element from list if current element is not NULL
3295 // The new current element will be the next element.
3296 // If the current element is the last element in the list
3297 // the second but last element will become the new current element.
3298 void Attributes::RemoveCurrFromList()
3300 AsnListElmt
*del_elmt
;
3308 first
= last
= curr
= NULL
;
3309 else if (curr
== first
)
3311 curr
= first
= first
->next
;
3314 else if (curr
== last
)
3316 curr
= last
= last
->prev
;
3321 curr
->prev
->next
= curr
->next
;
3322 curr
->next
->prev
= curr
->prev
;
3325 delete del_elmt
->elmt
;
3331 AsnLen
Attributes::BEncContent (BUF_TYPE b
)
3333 AsnListElmt
*currElmt
;
3335 AsnLen totalLen
= 0;
3338 CSM_Buffer
**tmpEnc
=NULL
;
3339 for (currElmt
= last
,icount
=0; currElmt
!= NULL
; currElmt
= currElmt
->prev
, icount
++);
3340 tmpEnc
= (CSM_Buffer
**) calloc(sizeof(CSM_Buffer
*), icount
);
3341 for (currElmt
= last
, iii
=0; currElmt
!= NULL
; currElmt
= currElmt
->prev
,iii
++,elmtLen
=0)
3344 ENCODE_BUF1(currElmt
->elmt
->BEncContent
, elmtLen
);
3345 elmtLen
+= BEncConsLen (outputBuf
, elmtLen
);
3347 elmtLen
+= BEncTag1 (outputBuf
, UNIV
, CONS
, SEQ_TAG_CODE
);
3348 ENCODE_BUF2(tmpEnc
[iii
]);
3350 vdasnacc_sortSetOf(tmpEnc
, icount
);
3351 for (iii
=0,elmtLen
=0; iii
< icount
; elmtLen
+=tmpEnc
[iii
++]->Length())
3352 SM_WriteToAsnBuf(tmpEnc
[iii
], b
);
3353 for (iii
=0; iii
< icount
; iii
++) delete tmpEnc
[iii
];
3356 totalLen
+= elmtLen
;
3358 } // Attributes::BEncContent
3361 void Attributes::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
3362 AsnLen
&bytesDecoded
, ENV_TYPE env
)
3364 Attribute
*listElmt
;
3366 AsnLen listBytesDecoded
= 0;
3369 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
3371 tag1
= BDecTag (b
, listBytesDecoded
, env
);
3372 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
3374 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
3377 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
3379 Asn1Error
<< "Unexpected Tag" << endl
;
3380 longjmp (env
, -119);
3383 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
3384 listElmt
= Append();
3385 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
3388 bytesDecoded
+= listBytesDecoded
;
3389 } // Attributes::BDecContent
3394 choiceId
= rDNSequenceCid
;
3396 rDNSequence
= new RDNSequence
;
3398 rDNSequence
= NULL
; // incomplete initialization of mandatory element!
3402 Name::Name (const Name
&)
3404 Asn1Error
<< "use of incompletely defined Name::Name (const Name &)" << endl
;
3412 case rDNSequenceCid
:
3416 } // end of destructor
3418 AsnType
*Name::Clone() const
3423 AsnType
*Name::Copy() const
3425 return new Name (*this);
3429 Name
&Name::operator = (const Name
&that
)
3430 #else // SNACC_DEEP_COPY
3431 Name
&Name::operator = (const Name
&)
3432 #endif // SNACC_DEEP_COPY
3439 case rDNSequenceCid
:
3443 switch (choiceId
= that
.choiceId
)
3445 case rDNSequenceCid
:
3446 rDNSequence
= new RDNSequence
;
3447 *rDNSequence
= *that
.rDNSequence
;
3453 #else // SNACC_DEEP_COPY
3454 Asn1Error
<< "use of incompletely defined Name &Name::operator = (const Name &)" << endl
;
3456 // if your compiler complains here, check the -novolat option
3457 #endif // SNACC_DEEP_COPY
3461 Name::BEncContent (BUF_TYPE b
)
3466 case rDNSequenceCid
:
3468 l
= rDNSequence
->BEncContent (b
);
3469 l
+= BEncConsLen (b
, l
);
3471 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3476 } // Name::BEncContent
3479 void Name::BDecContent (BUF_TYPE b
, AsnTag tag
, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3483 case MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
):
3484 choiceId
= rDNSequenceCid
;
3485 rDNSequence
= new RDNSequence
;
3486 rDNSequence
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
3490 Asn1Error
<< "ERROR - unexpected tag in CHOICE" << endl
;
3491 longjmp (env
, -120);
3494 } // Name::BDecContent
3497 AsnLen
Name::BEnc (BUF_TYPE b
)
3500 l
= BEncContent (b
);
3504 void Name::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3509 /* CHOICEs are a special case - grab identifying tag */
3510 /* this allows easier handling of nested CHOICEs */
3511 tag
= BDecTag (b
, bytesDecoded
, env
);
3512 elmtLen
= BDecLen (b
, bytesDecoded
, env
);
3513 BDecContent (b
, tag
, elmtLen
, bytesDecoded
, env
);
3516 int Name::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
3518 bytesEncoded
= BEnc (b
);
3519 return !b
.WriteError();
3522 int Name::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
3528 if ((val
= setjmp (env
)) == 0)
3530 BDec (b
, bytesDecoded
, env
);
3531 return !b
.ReadError();
3537 void Name::Print (ostream
&os
) const
3542 case rDNSequenceCid
:
3543 os
<< "rDNSequence ";
3547 os
<< "-- void3 --\n";