1 // NOTE: this is a machine generated file--editing not recommended
3 // sm_x411mtsas.cpp - class member functions for ASN.1 module MTSAbstractService
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 CountryName::CountryName()
37 choiceId
= x121_dcc_codeCid
;
39 x121_dcc_code
= new NumericString
;
41 x121_dcc_code
= NULL
; // incomplete initialization of mandatory element!
45 CountryName::CountryName (const CountryName
&)
47 Asn1Error
<< "use of incompletely defined CountryName::CountryName (const CountryName &)" << endl
;
51 CountryName::~CountryName()
55 case x121_dcc_codeCid
:
58 case iso_3166_alpha2_codeCid
:
59 delete iso_3166_alpha2_code
;
62 } // end of destructor
64 AsnType
*CountryName::Clone() const
66 return new CountryName
;
69 AsnType
*CountryName::Copy() const
71 return new CountryName (*this);
75 CountryName
&CountryName::operator = (const CountryName
&that
)
76 #else // SNACC_DEEP_COPY
77 CountryName
&CountryName::operator = (const CountryName
&)
78 #endif // SNACC_DEEP_COPY
85 case x121_dcc_codeCid
:
88 case iso_3166_alpha2_codeCid
:
89 delete iso_3166_alpha2_code
;
92 switch (choiceId
= that
.choiceId
)
94 case x121_dcc_codeCid
:
95 x121_dcc_code
= new NumericString
;
96 *x121_dcc_code
= *that
.x121_dcc_code
;
98 case iso_3166_alpha2_codeCid
:
99 iso_3166_alpha2_code
= new PrintableString
;
100 *iso_3166_alpha2_code
= *that
.iso_3166_alpha2_code
;
106 #else // SNACC_DEEP_COPY
107 Asn1Error
<< "use of incompletely defined CountryName &CountryName::operator = (const CountryName &)" << endl
;
109 // if your compiler complains here, check the -novolat option
110 #endif // SNACC_DEEP_COPY
114 CountryName::BEncContent (BUF_TYPE b
)
119 case x121_dcc_codeCid
:
120 l
= x121_dcc_code
->BEncContent (b
);
121 l
+= BEncDefLen (b
, l
);
123 l
+= BEncTag1 (b
, UNIV
, PRIM
, NUMERICSTRING_TAG_CODE
);
126 case iso_3166_alpha2_codeCid
:
127 l
= iso_3166_alpha2_code
->BEncContent (b
);
128 l
+= BEncDefLen (b
, l
);
130 l
+= BEncTag1 (b
, UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
);
135 } // CountryName::BEncContent
138 void CountryName::BDecContent (BUF_TYPE b
, AsnTag tag
, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
142 case MAKE_TAG_ID (UNIV
, PRIM
, NUMERICSTRING_TAG_CODE
):
143 case MAKE_TAG_ID (UNIV
, CONS
, NUMERICSTRING_TAG_CODE
):
144 choiceId
= x121_dcc_codeCid
;
145 x121_dcc_code
= new NumericString
;
146 x121_dcc_code
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
149 case MAKE_TAG_ID (UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
):
150 case MAKE_TAG_ID (UNIV
, CONS
, PRINTABLESTRING_TAG_CODE
):
151 choiceId
= iso_3166_alpha2_codeCid
;
152 iso_3166_alpha2_code
= new PrintableString
;
153 iso_3166_alpha2_code
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
157 Asn1Error
<< "ERROR - unexpected tag in CHOICE" << endl
;
161 } // CountryName::BDecContent
164 AsnLen
CountryName::BEnc (BUF_TYPE b
)
168 l
+= BEncConsLen (b
, l
);
169 l
+= BEncTag1 (b
, APPL
, CONS
, 1);
173 void CountryName::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
179 if (BDecTag (b
, bytesDecoded
, env
) != MAKE_TAG_ID (APPL
, CONS
, 1)) {
180 Asn1Error
<< "CountryName::BDec: ERROR - wrong tag" << endl
;
183 extraLen1
= BDecLen (b
, bytesDecoded
, env
);
184 /* CHOICEs are a special case - grab identifying tag */
185 /* this allows easier handling of nested CHOICEs */
186 tag
= BDecTag (b
, bytesDecoded
, env
);
187 elmtLen
= BDecLen (b
, bytesDecoded
, env
);
188 BDecContent (b
, tag
, elmtLen
, bytesDecoded
, env
);
189 if (extraLen1
== INDEFINITE_LEN
)
190 BDecEoc (b
, bytesDecoded
, env
);
193 int CountryName::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
195 bytesEncoded
= BEnc (b
);
196 return !b
.WriteError();
199 int CountryName::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
205 if ((val
= setjmp (env
)) == 0)
207 BDec (b
, bytesDecoded
, env
);
208 return !b
.ReadError();
214 void CountryName::Print (ostream
&os
) const
219 case x121_dcc_codeCid
:
220 os
<< "x121-dcc-code ";
222 os
<< *x121_dcc_code
;
224 os
<< "-- void3 --\n";
227 case iso_3166_alpha2_codeCid
:
228 os
<< "iso-3166-alpha2-code ";
229 if (iso_3166_alpha2_code
)
230 os
<< *iso_3166_alpha2_code
;
232 os
<< "-- void3 --\n";
237 } // CountryName::Print
239 AdministrationDomainName::AdministrationDomainName()
241 choiceId
= numericCid
;
243 numeric
= new NumericString
;
245 numeric
= NULL
; // incomplete initialization of mandatory element!
249 AdministrationDomainName::AdministrationDomainName (const AdministrationDomainName
&)
251 Asn1Error
<< "use of incompletely defined AdministrationDomainName::AdministrationDomainName (const AdministrationDomainName &)" << endl
;
255 AdministrationDomainName::~AdministrationDomainName()
266 } // end of destructor
268 AsnType
*AdministrationDomainName::Clone() const
270 return new AdministrationDomainName
;
273 AsnType
*AdministrationDomainName::Copy() const
275 return new AdministrationDomainName (*this);
279 AdministrationDomainName
&AdministrationDomainName::operator = (const AdministrationDomainName
&that
)
280 #else // SNACC_DEEP_COPY
281 AdministrationDomainName
&AdministrationDomainName::operator = (const AdministrationDomainName
&)
282 #endif // SNACC_DEEP_COPY
296 switch (choiceId
= that
.choiceId
)
299 numeric
= new NumericString
;
300 *numeric
= *that
.numeric
;
303 printable
= new PrintableString
;
304 *printable
= *that
.printable
;
310 #else // SNACC_DEEP_COPY
311 Asn1Error
<< "use of incompletely defined AdministrationDomainName &AdministrationDomainName::operator = (const AdministrationDomainName &)" << endl
;
313 // if your compiler complains here, check the -novolat option
314 #endif // SNACC_DEEP_COPY
318 AdministrationDomainName::BEncContent (BUF_TYPE b
)
324 l
= numeric
->BEncContent (b
);
325 l
+= BEncDefLen (b
, l
);
327 l
+= BEncTag1 (b
, UNIV
, PRIM
, NUMERICSTRING_TAG_CODE
);
331 l
= printable
->BEncContent (b
);
332 l
+= BEncDefLen (b
, l
);
334 l
+= BEncTag1 (b
, UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
);
339 } // AdministrationDomainName::BEncContent
342 void AdministrationDomainName::BDecContent (BUF_TYPE b
, AsnTag tag
, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
346 case MAKE_TAG_ID (UNIV
, PRIM
, NUMERICSTRING_TAG_CODE
):
347 case MAKE_TAG_ID (UNIV
, CONS
, NUMERICSTRING_TAG_CODE
):
348 choiceId
= numericCid
;
349 numeric
= new NumericString
;
350 numeric
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
353 case MAKE_TAG_ID (UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
):
354 case MAKE_TAG_ID (UNIV
, CONS
, PRINTABLESTRING_TAG_CODE
):
355 choiceId
= printableCid
;
356 printable
= new PrintableString
;
357 printable
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
361 Asn1Error
<< "ERROR - unexpected tag in CHOICE" << endl
;
365 } // AdministrationDomainName::BDecContent
368 AsnLen
AdministrationDomainName::BEnc (BUF_TYPE b
)
372 l
+= BEncConsLen (b
, l
);
373 l
+= BEncTag1 (b
, APPL
, CONS
, 2);
377 void AdministrationDomainName::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
383 if (BDecTag (b
, bytesDecoded
, env
) != MAKE_TAG_ID (APPL
, CONS
, 2)) {
384 Asn1Error
<< "AdministrationDomainName::BDec: ERROR - wrong tag" << endl
;
387 extraLen1
= BDecLen (b
, bytesDecoded
, env
);
388 /* CHOICEs are a special case - grab identifying tag */
389 /* this allows easier handling of nested CHOICEs */
390 tag
= BDecTag (b
, bytesDecoded
, env
);
391 elmtLen
= BDecLen (b
, bytesDecoded
, env
);
392 BDecContent (b
, tag
, elmtLen
, bytesDecoded
, env
);
393 if (extraLen1
== INDEFINITE_LEN
)
394 BDecEoc (b
, bytesDecoded
, env
);
397 int AdministrationDomainName::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
399 bytesEncoded
= BEnc (b
);
400 return !b
.WriteError();
403 int AdministrationDomainName::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
409 if ((val
= setjmp (env
)) == 0)
411 BDec (b
, bytesDecoded
, env
);
412 return !b
.ReadError();
418 void AdministrationDomainName::Print (ostream
&os
) const
428 os
<< "-- void3 --\n";
436 os
<< "-- void3 --\n";
441 } // AdministrationDomainName::Print
443 PrivateDomainName::PrivateDomainName()
445 choiceId
= numericCid
;
447 numeric
= new NumericString
;
449 numeric
= NULL
; // incomplete initialization of mandatory element!
453 PrivateDomainName::PrivateDomainName (const PrivateDomainName
&)
455 Asn1Error
<< "use of incompletely defined PrivateDomainName::PrivateDomainName (const PrivateDomainName &)" << endl
;
459 PrivateDomainName::~PrivateDomainName()
470 } // end of destructor
472 AsnType
*PrivateDomainName::Clone() const
474 return new PrivateDomainName
;
477 AsnType
*PrivateDomainName::Copy() const
479 return new PrivateDomainName (*this);
483 PrivateDomainName
&PrivateDomainName::operator = (const PrivateDomainName
&that
)
484 #else // SNACC_DEEP_COPY
485 PrivateDomainName
&PrivateDomainName::operator = (const PrivateDomainName
&)
486 #endif // SNACC_DEEP_COPY
500 switch (choiceId
= that
.choiceId
)
503 numeric
= new NumericString
;
504 *numeric
= *that
.numeric
;
507 printable
= new PrintableString
;
508 *printable
= *that
.printable
;
514 #else // SNACC_DEEP_COPY
515 Asn1Error
<< "use of incompletely defined PrivateDomainName &PrivateDomainName::operator = (const PrivateDomainName &)" << endl
;
517 // if your compiler complains here, check the -novolat option
518 #endif // SNACC_DEEP_COPY
522 PrivateDomainName::BEncContent (BUF_TYPE b
)
528 l
= numeric
->BEncContent (b
);
529 l
+= BEncDefLen (b
, l
);
531 l
+= BEncTag1 (b
, UNIV
, PRIM
, NUMERICSTRING_TAG_CODE
);
535 l
= printable
->BEncContent (b
);
536 l
+= BEncDefLen (b
, l
);
538 l
+= BEncTag1 (b
, UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
);
543 } // PrivateDomainName::BEncContent
546 void PrivateDomainName::BDecContent (BUF_TYPE b
, AsnTag tag
, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
550 case MAKE_TAG_ID (UNIV
, PRIM
, NUMERICSTRING_TAG_CODE
):
551 case MAKE_TAG_ID (UNIV
, CONS
, NUMERICSTRING_TAG_CODE
):
552 choiceId
= numericCid
;
553 numeric
= new NumericString
;
554 numeric
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
557 case MAKE_TAG_ID (UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
):
558 case MAKE_TAG_ID (UNIV
, CONS
, PRINTABLESTRING_TAG_CODE
):
559 choiceId
= printableCid
;
560 printable
= new PrintableString
;
561 printable
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
565 Asn1Error
<< "ERROR - unexpected tag in CHOICE" << endl
;
569 } // PrivateDomainName::BDecContent
572 AsnLen
PrivateDomainName::BEnc (BUF_TYPE b
)
579 void PrivateDomainName::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
584 /* CHOICEs are a special case - grab identifying tag */
585 /* this allows easier handling of nested CHOICEs */
586 tag
= BDecTag (b
, bytesDecoded
, env
);
587 elmtLen
= BDecLen (b
, bytesDecoded
, env
);
588 BDecContent (b
, tag
, elmtLen
, bytesDecoded
, env
);
591 int PrivateDomainName::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
593 bytesEncoded
= BEnc (b
);
594 return !b
.WriteError();
597 int PrivateDomainName::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
603 if ((val
= setjmp (env
)) == 0)
605 BDec (b
, bytesDecoded
, env
);
606 return !b
.ReadError();
612 void PrivateDomainName::Print (ostream
&os
) const
622 os
<< "-- void3 --\n";
630 os
<< "-- void3 --\n";
635 } // PrivateDomainName::Print
637 PersonalName::PersonalName()
641 generation_qualifier
= NULL
;
644 PersonalName::PersonalName (const PersonalName
&)
646 Asn1Error
<< "use of incompletely defined PersonalName::PersonalName (const PersonalName &)" << endl
;
650 PersonalName::~PersonalName()
654 delete generation_qualifier
;
657 AsnType
*PersonalName::Clone() const
659 return new PersonalName
;
662 AsnType
*PersonalName::Copy() const
664 return new PersonalName (*this);
668 PersonalName
&PersonalName::operator = (const PersonalName
&that
)
669 #else // SNACC_DEEP_COPY
670 PersonalName
&PersonalName::operator = (const PersonalName
&)
671 #endif // SNACC_DEEP_COPY
676 surname
= that
.surname
;
680 given_name
= new PrintableString
;
681 *given_name
= *that
.given_name
;
691 initials
= new PrintableString
;
692 *initials
= *that
.initials
;
699 if (that
.generation_qualifier
)
701 if (!generation_qualifier
)
702 generation_qualifier
= new PrintableString
;
703 *generation_qualifier
= *that
.generation_qualifier
;
707 delete generation_qualifier
;
708 generation_qualifier
= NULL
;
713 #else // SNACC_DEEP_COPY
714 Asn1Error
<< "use of incompletely defined PersonalName &PersonalName::operator = (const PersonalName &)" << endl
;
716 // if your compiler complains here, check the -novolat option
717 #endif // SNACC_DEEP_COPY
720 AsnLen
PersonalName::BEncContent (BUF_TYPE b
)
726 int iii
=0, tmpCount
=0;
727 char *lpszBuf
= (char *)calloc(1, 1024);
728 outputBuf
.Init(lpszBuf
, 1024);
729 outputBuf
.ResetInWriteRvsMode();
730 CSM_Buffer
*tmpEnc
[4];
731 if (NOT_NULL (generation_qualifier
))
733 l
= generation_qualifier
->BEncContent (outputBuf
);
734 l
+= BEncDefLen (outputBuf
, l
);
736 l
+= BEncTag1 (outputBuf
, CNTX
, PRIM
, 3);
738 SNACC_BUFRESET_READ(&outputBuf
);
739 SM_ReadFromAsnBuf(tmpEnc
[iii
], outputBuf
,outputBuf
.DataLen(),NULL
);
740 SNACC_BUFRESET_WRITE(&outputBuf
);
744 if (NOT_NULL (initials
))
746 l
= initials
->BEncContent (outputBuf
);
747 l
+= BEncDefLen (outputBuf
, l
);
749 l
+= BEncTag1 (outputBuf
, CNTX
, PRIM
, 2);
751 SNACC_BUFRESET_READ(&outputBuf
);
752 SM_ReadFromAsnBuf(tmpEnc
[iii
], outputBuf
,outputBuf
.DataLen(),NULL
);
753 SNACC_BUFRESET_WRITE(&outputBuf
);
757 if (NOT_NULL (given_name
))
759 l
= given_name
->BEncContent (outputBuf
);
760 l
+= BEncDefLen (outputBuf
, l
);
762 l
+= BEncTag1 (outputBuf
, CNTX
, PRIM
, 1);
764 SNACC_BUFRESET_READ(&outputBuf
);
765 SM_ReadFromAsnBuf(tmpEnc
[iii
], outputBuf
,outputBuf
.DataLen(),NULL
);
766 SNACC_BUFRESET_WRITE(&outputBuf
);
770 l
= surname
.BEncContent (outputBuf
);
771 l
+= BEncDefLen (outputBuf
, l
);
773 l
+= BEncTag1 (outputBuf
, CNTX
, PRIM
, 0);
775 SNACC_BUFRESET_READ(&outputBuf
);
776 SM_ReadFromAsnBuf(tmpEnc
[iii
], outputBuf
,outputBuf
.DataLen(),NULL
);
777 SNACC_BUFRESET_WRITE(&outputBuf
);
780 vdasnacc_sortSet(tmpEnc
, iii
);
781 tmpCount
= iii
; /** REMEMBER how many we have**/
782 for (iii
=0; iii
< tmpCount
; iii
++)
783 SM_WriteToAsnBuf(tmpEnc
[iii
], b
);
784 for (iii
=0; iii
< tmpCount
; iii
++) delete tmpEnc
[iii
];
787 } // PersonalName::BEncContent
790 void PersonalName::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
793 AsnLen setBytesDecoded
= 0;
794 unsigned int mandatoryElmtsDecoded
= 0;
797 for (; (setBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
); )
799 tag1
= BDecTag (b
, setBytesDecoded
, env
);
801 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
803 BDEC_2ND_EOC_OCTET (b
, setBytesDecoded
, env
)
804 break; /* exit for loop */
806 elmtLen1
= BDecLen (b
, setBytesDecoded
, env
);
809 case MAKE_TAG_ID (CNTX
, PRIM
, 0):
810 case MAKE_TAG_ID (CNTX
, CONS
, 0):
811 surname
.BDecContent (b
, tag1
, elmtLen1
, setBytesDecoded
, env
);
812 mandatoryElmtsDecoded
++;
815 case MAKE_TAG_ID (CNTX
, PRIM
, 1):
816 case MAKE_TAG_ID (CNTX
, CONS
, 1):
817 given_name
= new PrintableString
;
818 given_name
->BDecContent (b
, tag1
, elmtLen1
, setBytesDecoded
, env
);
821 case MAKE_TAG_ID (CNTX
, PRIM
, 2):
822 case MAKE_TAG_ID (CNTX
, CONS
, 2):
823 initials
= new PrintableString
;
824 initials
->BDecContent (b
, tag1
, elmtLen1
, setBytesDecoded
, env
);
827 case MAKE_TAG_ID (CNTX
, PRIM
, 3):
828 case MAKE_TAG_ID (CNTX
, CONS
, 3):
829 generation_qualifier
= new PrintableString
;
830 generation_qualifier
->BDecContent (b
, tag1
, elmtLen1
, setBytesDecoded
, env
);
834 Asn1Error
<< "Unexpected Tag on SET elmt." << endl
;
838 bytesDecoded
+= setBytesDecoded
;
839 if (mandatoryElmtsDecoded
!= 1)
841 Asn1Error
<< "ERROR - non-optional SET element missing." << endl
;
844 } // PersonalName::BDecContent
847 PersonalName::BEnc (BUF_TYPE b
)
851 l
+= BEncConsLen (b
, l
);
852 l
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
856 void PersonalName::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
861 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
))
863 Asn1Error
<< "PersonalName::BDec: ERROR - wrong tag" << endl
;
866 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
867 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
870 int PersonalName::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
872 bytesEncoded
= BEnc (b
);
873 return !b
.WriteError();
876 int PersonalName::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
882 if ((val
= setjmp (env
)) == 0)
884 BDec (b
, bytesDecoded
, env
);
885 return !b
.ReadError();
891 void PersonalName::Print (ostream
&os
) const
894 os
<< "{ -- SET --" << endl
;
895 indentG
+= stdIndentG
;
898 Indent (os
, indentG
);
903 if (NOT_NULL (given_name
))
906 Indent (os
, indentG
);
911 os
<< "-- void2 --\n";
913 if (NOT_NULL (initials
))
916 Indent (os
, indentG
);
921 os
<< "-- void2 --\n";
923 if (NOT_NULL (generation_qualifier
))
926 Indent (os
, indentG
);
927 os
<< "generation-qualifier ";
928 os
<< *generation_qualifier
;
931 os
<< "-- void2 --\n";
934 indentG
-= stdIndentG
;
935 Indent (os
, indentG
);
938 } // PersonalName - operator <<
941 DomainDefinedAttribute::DomainDefinedAttribute()
945 DomainDefinedAttribute::DomainDefinedAttribute (const DomainDefinedAttribute
&)
947 Asn1Error
<< "use of incompletely defined DomainDefinedAttribute::DomainDefinedAttribute (const DomainDefinedAttribute &)" << endl
;
951 DomainDefinedAttribute::~DomainDefinedAttribute()
955 AsnType
*DomainDefinedAttribute::Clone() const
957 return new DomainDefinedAttribute
;
960 AsnType
*DomainDefinedAttribute::Copy() const
962 return new DomainDefinedAttribute (*this);
966 DomainDefinedAttribute
&DomainDefinedAttribute::operator = (const DomainDefinedAttribute
&that
)
967 #else // SNACC_DEEP_COPY
968 DomainDefinedAttribute
&DomainDefinedAttribute::operator = (const DomainDefinedAttribute
&)
969 #endif // SNACC_DEEP_COPY
979 #else // SNACC_DEEP_COPY
980 Asn1Error
<< "use of incompletely defined DomainDefinedAttribute &DomainDefinedAttribute::operator = (const DomainDefinedAttribute &)" << endl
;
982 // if your compiler complains here, check the -novolat option
983 #endif // SNACC_DEEP_COPY
987 DomainDefinedAttribute::BEncContent (BUF_TYPE b
)
992 l
= value
.BEncContent (b
);
993 l
+= BEncDefLen (b
, l
);
995 l
+= BEncTag1 (b
, UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
);
998 l
= type
.BEncContent (b
);
999 l
+= BEncDefLen (b
, l
);
1001 l
+= BEncTag1 (b
, UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
);
1005 } // DomainDefinedAttribute::BEncContent
1008 void DomainDefinedAttribute::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1011 AsnLen seqBytesDecoded
= 0;
1013 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1015 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
))
1016 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, PRINTABLESTRING_TAG_CODE
)))
1018 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1019 type
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1020 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1024 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1025 longjmp (env
, -108);
1028 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
))
1029 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, PRINTABLESTRING_TAG_CODE
)))
1031 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1032 value
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1036 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1037 longjmp (env
, -109);
1040 bytesDecoded
+= seqBytesDecoded
;
1041 if (elmtLen0
== INDEFINITE_LEN
)
1043 BDecEoc (b
, bytesDecoded
, env
);
1046 else if (seqBytesDecoded
!= elmtLen0
)
1048 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
1049 longjmp (env
, -110);
1053 } // DomainDefinedAttribute::BDecContent
1055 AsnLen
DomainDefinedAttribute::BEnc (BUF_TYPE b
)
1058 l
= BEncContent (b
);
1059 l
+= BEncConsLen (b
, l
);
1060 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1064 void DomainDefinedAttribute::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1069 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1071 Asn1Error
<< "DomainDefinedAttribute::BDec: ERROR - wrong tag" << endl
;
1072 longjmp (env
, -111);
1074 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1075 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1078 int DomainDefinedAttribute::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
1080 bytesEncoded
= BEnc (b
);
1081 return !b
.WriteError();
1084 int DomainDefinedAttribute::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
1090 if ((val
= setjmp (env
)) == 0)
1092 BDec (b
, bytesDecoded
, env
);
1093 return !b
.ReadError();
1099 void DomainDefinedAttribute::Print (ostream
&os
) const
1102 os
<< "{ -- SEQUENCE --" << endl
;
1103 indentG
+= stdIndentG
;
1106 Indent (os
, indentG
);
1113 Indent (os
, indentG
);
1119 indentG
-= stdIndentG
;
1120 Indent (os
, indentG
);
1123 } // DomainDefinedAttribute::Print
1126 ExtensionAttribute::ExtensionAttribute()
1130 ExtensionAttribute::ExtensionAttribute (const ExtensionAttribute
&)
1132 Asn1Error
<< "use of incompletely defined ExtensionAttribute::ExtensionAttribute (const ExtensionAttribute &)" << endl
;
1136 ExtensionAttribute::~ExtensionAttribute()
1140 AsnType
*ExtensionAttribute::Clone() const
1142 return new ExtensionAttribute
;
1145 AsnType
*ExtensionAttribute::Copy() const
1147 return new ExtensionAttribute (*this);
1151 ExtensionAttribute
&ExtensionAttribute::operator = (const ExtensionAttribute
&that
)
1152 #else // SNACC_DEEP_COPY
1153 ExtensionAttribute
&ExtensionAttribute::operator = (const ExtensionAttribute
&)
1154 #endif // SNACC_DEEP_COPY
1159 extension_attribute_type
= that
.extension_attribute_type
;
1160 extension_attribute_value
= that
.extension_attribute_value
;
1164 #else // SNACC_DEEP_COPY
1165 Asn1Error
<< "use of incompletely defined ExtensionAttribute &ExtensionAttribute::operator = (const ExtensionAttribute &)" << endl
;
1167 // if your compiler complains here, check the -novolat option
1168 #endif // SNACC_DEEP_COPY
1172 ExtensionAttribute::BEncContent (BUF_TYPE b
)
1174 AsnLen totalLen
= 0;
1178 ENC_LOAD_ANYBUF(&extension_attribute_value
, b
, l
);
1179 l
+= BEncConsLen (b
, l
);
1181 l
+= BEncTag1 (b
, CNTX
, CONS
, 1);
1184 l
= extension_attribute_type
.BEncContent (b
);
1185 BEncDefLenTo127 (b
, l
);
1188 l
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
1192 } // ExtensionAttribute::BEncContent
1195 void ExtensionAttribute::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1198 AsnLen seqBytesDecoded
= 0;
1200 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1202 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 0)))
1204 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1205 extension_attribute_type
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1206 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1210 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1211 longjmp (env
, -112);
1214 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
1216 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1217 DEC_LOAD_ANYBUF(&extension_attribute_value
, b
, seqBytesDecoded
, env
);
1218 if (elmtLen1
== INDEFINITE_LEN
)
1219 BDecEoc (b
, seqBytesDecoded
, env
);
1224 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1225 longjmp (env
, -113);
1228 bytesDecoded
+= seqBytesDecoded
;
1229 if (elmtLen0
== INDEFINITE_LEN
)
1231 BDecEoc (b
, bytesDecoded
, env
);
1234 else if (seqBytesDecoded
!= elmtLen0
)
1236 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
1237 longjmp (env
, -114);
1241 } // ExtensionAttribute::BDecContent
1243 AsnLen
ExtensionAttribute::BEnc (BUF_TYPE b
)
1246 l
= BEncContent (b
);
1247 l
+= BEncConsLen (b
, l
);
1248 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1252 void ExtensionAttribute::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1257 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1259 Asn1Error
<< "ExtensionAttribute::BDec: ERROR - wrong tag" << endl
;
1260 longjmp (env
, -115);
1262 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1263 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1266 int ExtensionAttribute::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
1268 bytesEncoded
= BEnc (b
);
1269 return !b
.WriteError();
1272 int ExtensionAttribute::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
1278 if ((val
= setjmp (env
)) == 0)
1280 BDec (b
, bytesDecoded
, env
);
1281 return !b
.ReadError();
1287 void ExtensionAttribute::Print (ostream
&os
) const
1290 os
<< "{ -- SEQUENCE --" << endl
;
1291 indentG
+= stdIndentG
;
1294 Indent (os
, indentG
);
1295 os
<< "extension-attribute-type ";
1296 os
<< extension_attribute_type
;
1301 Indent (os
, indentG
);
1302 os
<< "extension-attribute-value ";
1303 os
<< extension_attribute_value
;
1307 indentG
-= stdIndentG
;
1308 Indent (os
, indentG
);
1311 } // ExtensionAttribute::Print
1314 TeletexDomainDefinedAttribute::TeletexDomainDefinedAttribute()
1318 TeletexDomainDefinedAttribute::TeletexDomainDefinedAttribute (const TeletexDomainDefinedAttribute
&)
1320 Asn1Error
<< "use of incompletely defined TeletexDomainDefinedAttribute::TeletexDomainDefinedAttribute (const TeletexDomainDefinedAttribute &)" << endl
;
1324 TeletexDomainDefinedAttribute::~TeletexDomainDefinedAttribute()
1328 AsnType
*TeletexDomainDefinedAttribute::Clone() const
1330 return new TeletexDomainDefinedAttribute
;
1333 AsnType
*TeletexDomainDefinedAttribute::Copy() const
1335 return new TeletexDomainDefinedAttribute (*this);
1339 TeletexDomainDefinedAttribute
&TeletexDomainDefinedAttribute::operator = (const TeletexDomainDefinedAttribute
&that
)
1340 #else // SNACC_DEEP_COPY
1341 TeletexDomainDefinedAttribute
&TeletexDomainDefinedAttribute::operator = (const TeletexDomainDefinedAttribute
&)
1342 #endif // SNACC_DEEP_COPY
1352 #else // SNACC_DEEP_COPY
1353 Asn1Error
<< "use of incompletely defined TeletexDomainDefinedAttribute &TeletexDomainDefinedAttribute::operator = (const TeletexDomainDefinedAttribute &)" << endl
;
1355 // if your compiler complains here, check the -novolat option
1356 #endif // SNACC_DEEP_COPY
1360 TeletexDomainDefinedAttribute::BEncContent (BUF_TYPE b
)
1362 AsnLen totalLen
= 0;
1365 l
= value
.BEncContent (b
);
1366 l
+= BEncDefLen (b
, l
);
1368 l
+= BEncTag1 (b
, UNIV
, PRIM
, TELETEXSTRING_TAG_CODE
);
1371 l
= type
.BEncContent (b
);
1372 l
+= BEncDefLen (b
, l
);
1374 l
+= BEncTag1 (b
, UNIV
, PRIM
, TELETEXSTRING_TAG_CODE
);
1378 } // TeletexDomainDefinedAttribute::BEncContent
1381 void TeletexDomainDefinedAttribute::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1384 AsnLen seqBytesDecoded
= 0;
1386 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1388 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, TELETEXSTRING_TAG_CODE
))
1389 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, TELETEXSTRING_TAG_CODE
)))
1391 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1392 type
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1393 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1397 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1398 longjmp (env
, -116);
1401 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, TELETEXSTRING_TAG_CODE
))
1402 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, TELETEXSTRING_TAG_CODE
)))
1404 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1405 value
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1409 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1410 longjmp (env
, -117);
1413 bytesDecoded
+= seqBytesDecoded
;
1414 if (elmtLen0
== INDEFINITE_LEN
)
1416 BDecEoc (b
, bytesDecoded
, env
);
1419 else if (seqBytesDecoded
!= elmtLen0
)
1421 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
1422 longjmp (env
, -118);
1426 } // TeletexDomainDefinedAttribute::BDecContent
1428 AsnLen
TeletexDomainDefinedAttribute::BEnc (BUF_TYPE b
)
1431 l
= BEncContent (b
);
1432 l
+= BEncConsLen (b
, l
);
1433 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1437 void TeletexDomainDefinedAttribute::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1442 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1444 Asn1Error
<< "TeletexDomainDefinedAttribute::BDec: ERROR - wrong tag" << endl
;
1445 longjmp (env
, -119);
1447 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1448 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1451 int TeletexDomainDefinedAttribute::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
1453 bytesEncoded
= BEnc (b
);
1454 return !b
.WriteError();
1457 int TeletexDomainDefinedAttribute::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
1463 if ((val
= setjmp (env
)) == 0)
1465 BDec (b
, bytesDecoded
, env
);
1466 return !b
.ReadError();
1472 void TeletexDomainDefinedAttribute::Print (ostream
&os
) const
1475 os
<< "{ -- SEQUENCE --" << endl
;
1476 indentG
+= stdIndentG
;
1479 Indent (os
, indentG
);
1486 Indent (os
, indentG
);
1492 indentG
-= stdIndentG
;
1493 Indent (os
, indentG
);
1496 } // TeletexDomainDefinedAttribute::Print
1499 AsnType
*OrganizationUnitNames::Clone() const
1501 return new OrganizationUnitNames
;
1504 AsnType
*OrganizationUnitNames::Copy() const
1506 return new OrganizationUnitNames (*this);
1509 AsnLen
OrganizationUnitNames::BEnc (BUF_TYPE b
)
1512 l
= BEncContent (b
);
1513 l
+= BEncConsLen (b
, l
);
1514 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1518 void OrganizationUnitNames::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1523 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1525 Asn1Error
<< "OrganizationUnitNames::BDec: ERROR - wrong tag" << endl
;
1526 longjmp (env
, -120);
1528 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1529 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1532 OrganizationUnitNames::OrganizationUnitNames (const OrganizationUnitNames
&)
1534 Asn1Error
<< "use of incompletely defined OrganizationUnitNames::OrganizationUnitNames (const OrganizationUnitNames &)" << endl
;
1538 OrganizationUnitNames::~OrganizationUnitNames()
1541 for (; Curr() != NULL
; RemoveCurrFromList())
1543 } // end of destructor
1546 OrganizationUnitNames
&OrganizationUnitNames::operator = (const OrganizationUnitNames
&that
)
1547 #else // SNACC_DEEP_COPY
1548 OrganizationUnitNames
&OrganizationUnitNames::operator = (const OrganizationUnitNames
&)
1549 #endif // SNACC_DEEP_COPY
1555 for (; Curr(); RemoveCurrFromList())
1558 //that.SetCurrToFirst();
1559 //for (; that.Curr(); that.GoNext())
1560 // AppendCopy (*that.Curr());
1561 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
1562 AppendCopy (*run
->elmt
);
1566 #else // SNACC_DEEP_COPY
1567 Asn1Error
<< "use of incompletely defined OrganizationUnitNames &OrganizationUnitNames::operator = (const OrganizationUnitNames &)" << endl
;
1569 // if your compiler complains here, check the -novolat option
1570 #endif // SNACC_DEEP_COPY
1573 void OrganizationUnitNames::Print (ostream
&os
) const
1576 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
1577 indentG
+= stdIndentG
;
1579 //for (; Curr() != NULL; GoNext())
1580 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
1582 Indent (os
, indentG
);
1585 //if (Curr() != Last())
1590 indentG
-= stdIndentG
;
1591 Indent (os
, indentG
);
1599 void OrganizationUnitNames::SetCurrElmt (unsigned long int index
)
1601 unsigned long int i
;
1604 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
1606 } // OrganizationUnitNames::SetCurrElmt
1609 unsigned long int OrganizationUnitNames::GetCurrElmtIndex()
1611 unsigned long int i
;
1615 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
1624 } // OrganizationUnitNames::GetCurrElmtIndex
1627 // alloc new list elmt, put at end of list
1628 // and return the component type
1629 OrganizationUnitName
*OrganizationUnitNames::Append()
1631 AsnListElmt
*newElmt
;
1632 newElmt
= new AsnListElmt
;
1633 newElmt
->elmt
= new OrganizationUnitName
;
1634 newElmt
->next
= NULL
;
1637 newElmt
->prev
= NULL
;
1638 first
= last
= newElmt
;
1642 newElmt
->prev
= last
;
1643 last
->next
= newElmt
;
1647 return (curr
= newElmt
)->elmt
;
1648 } // OrganizationUnitNames::Append
1651 // alloc new list elmt, put at begining of list
1652 // and return the component type
1653 OrganizationUnitName
*OrganizationUnitNames::Prepend()
1655 AsnListElmt
*newElmt
;
1656 newElmt
= new AsnListElmt
;
1657 newElmt
->elmt
= new OrganizationUnitName
;
1658 newElmt
->prev
= NULL
;
1661 newElmt
->next
= NULL
;
1662 first
= last
= newElmt
;
1666 newElmt
->next
= first
;
1667 first
->prev
= newElmt
;
1671 return (curr
= newElmt
)->elmt
;
1672 } // OrganizationUnitNames::Prepend
1675 // alloc new list elmt, insert it before the
1676 // current element and return the component type
1677 // if the current element is null, the new element
1678 // is placed at the beginning of the list.
1679 OrganizationUnitName
*OrganizationUnitNames::InsertBefore()
1681 AsnListElmt
*newElmt
;
1682 newElmt
= new AsnListElmt
;
1683 newElmt
->elmt
= new OrganizationUnitName
;
1686 newElmt
->next
= first
;
1687 newElmt
->prev
= NULL
;
1694 newElmt
->next
= curr
;
1695 newElmt
->prev
= curr
->prev
;
1696 curr
->prev
= newElmt
;
1700 newElmt
->prev
->next
= newElmt
;
1703 return (curr
= newElmt
)->elmt
;
1704 } // OrganizationUnitNames::InsertBefore
1707 // alloc new list elmt, insert it after the
1708 // current element and return the component type
1709 // if the current element is null, the new element
1710 // is placed at the end of the list.
1711 OrganizationUnitName
*OrganizationUnitNames::InsertAfter()
1713 AsnListElmt
*newElmt
;
1714 newElmt
= new AsnListElmt
;
1715 newElmt
->elmt
= new OrganizationUnitName
;
1718 newElmt
->prev
= last
;
1719 newElmt
->next
= NULL
;
1726 newElmt
->prev
= curr
;
1727 newElmt
->next
= curr
->next
;
1728 curr
->next
= newElmt
;
1732 newElmt
->next
->prev
= newElmt
;
1735 return (curr
= newElmt
)->elmt
;
1736 } // OrganizationUnitNames::InsertAfter
1739 OrganizationUnitNames
&OrganizationUnitNames::AppendCopy (OrganizationUnitName
&elmt
)
1741 AsnListElmt
*newElmt
;
1742 newElmt
= new AsnListElmt
;
1743 newElmt
->elmt
= new OrganizationUnitName
;
1744 *newElmt
->elmt
= elmt
;
1745 newElmt
->next
= NULL
;
1748 newElmt
->prev
= NULL
;
1749 first
= last
= newElmt
;
1753 newElmt
->prev
= last
;
1754 last
->next
= newElmt
;
1762 OrganizationUnitNames
&OrganizationUnitNames::PrependCopy (OrganizationUnitName
&elmt
)
1764 AsnListElmt
*newElmt
;
1765 newElmt
= new AsnListElmt
;
1766 newElmt
->elmt
= new OrganizationUnitName
;
1767 *newElmt
->elmt
= elmt
;
1768 newElmt
->prev
= NULL
;
1771 newElmt
->next
= NULL
;
1772 first
= last
= newElmt
;
1776 newElmt
->next
= first
;
1777 first
->prev
= newElmt
;
1782 } // OrganizationUnitNames::PrependCopy
1785 // alloc new list elmt, insert it before the
1786 // current element, copy the given elmt into the new elmt
1787 // and return the component type.
1788 // if the current element is null, the new element
1789 // is placed at the beginning of the list.
1790 OrganizationUnitNames
&OrganizationUnitNames::InsertBeforeAndCopy (OrganizationUnitName
&elmt
)
1792 AsnListElmt
*newElmt
;
1794 newElmt
= new AsnListElmt
;
1795 newElmt
->elmt
= new OrganizationUnitName
;
1796 *newElmt
->elmt
= elmt
;
1800 newElmt
->next
= first
;
1801 newElmt
->prev
= NULL
;
1808 newElmt
->next
= curr
;
1809 newElmt
->prev
= curr
->prev
;
1810 curr
->prev
= newElmt
;
1814 newElmt
->prev
->next
= newElmt
;
1818 } // OrganizationUnitNames::InsertBeforeAndCopy
1821 // alloc new list elmt, insert it after the
1822 // current element, copy given elmt in to new elmt
1823 // and return the component type
1824 // if the current element is null, the new element
1825 // is placed at the end of the list.
1826 OrganizationUnitNames
&OrganizationUnitNames::InsertAfterAndCopy (OrganizationUnitName
&elmt
)
1828 AsnListElmt
*newElmt
;
1830 newElmt
= new AsnListElmt
;
1831 newElmt
->elmt
= new OrganizationUnitName
;
1832 *newElmt
->elmt
= elmt
;
1835 newElmt
->prev
= last
;
1836 newElmt
->next
= NULL
;
1843 newElmt
->prev
= curr
;
1844 newElmt
->next
= curr
->next
;
1845 curr
->next
= newElmt
;
1849 newElmt
->next
->prev
= newElmt
;
1853 } // OrganizationUnitNames::InsertAfterAndCopy
1856 // remove current element from list if current element is not NULL
1857 // The new current element will be the next element.
1858 // If the current element is the last element in the list
1859 // the second but last element will become the new current element.
1860 void OrganizationUnitNames::RemoveCurrFromList()
1862 AsnListElmt
*del_elmt
;
1870 first
= last
= curr
= NULL
;
1871 else if (curr
== first
)
1873 curr
= first
= first
->next
;
1876 else if (curr
== last
)
1878 curr
= last
= last
->prev
;
1883 curr
->prev
->next
= curr
->next
;
1884 curr
->next
->prev
= curr
->prev
;
1887 delete del_elmt
->elmt
;
1893 AsnLen
OrganizationUnitNames::BEncContent (BUF_TYPE b
)
1895 AsnListElmt
*currElmt
;
1897 AsnLen totalLen
= 0;
1898 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
1900 elmtLen
= currElmt
->elmt
->BEncContent (b
);
1901 elmtLen
+= BEncDefLen (b
, elmtLen
);
1903 elmtLen
+= BEncTag1 (b
, UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
);
1904 totalLen
+= elmtLen
;
1907 } // OrganizationUnitNames::BEncContent
1910 void OrganizationUnitNames::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
1911 AsnLen
&bytesDecoded
, ENV_TYPE env
)
1913 OrganizationUnitName
*listElmt
;
1915 AsnLen listBytesDecoded
= 0;
1918 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
1920 tag1
= BDecTag (b
, listBytesDecoded
, env
);
1921 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
1923 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
1926 if ((tag1
!= MAKE_TAG_ID (UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
))
1927 && (tag1
!= MAKE_TAG_ID (UNIV
, CONS
, PRINTABLESTRING_TAG_CODE
)))
1929 Asn1Error
<< "Unexpected Tag" << endl
;
1930 longjmp (env
, -121);
1933 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
1934 listElmt
= Append();
1935 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
1938 bytesDecoded
+= listBytesDecoded
;
1939 } // OrganizationUnitNames::BDecContent
1942 AsnType
*DomainDefinedAttributes::Clone() const
1944 return new DomainDefinedAttributes
;
1947 AsnType
*DomainDefinedAttributes::Copy() const
1949 return new DomainDefinedAttributes (*this);
1952 AsnLen
DomainDefinedAttributes::BEnc (BUF_TYPE b
)
1955 l
= BEncContent (b
);
1956 l
+= BEncConsLen (b
, l
);
1957 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1961 void DomainDefinedAttributes::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1966 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1968 Asn1Error
<< "DomainDefinedAttributes::BDec: ERROR - wrong tag" << endl
;
1969 longjmp (env
, -122);
1971 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1972 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1975 DomainDefinedAttributes::DomainDefinedAttributes (const DomainDefinedAttributes
&)
1977 Asn1Error
<< "use of incompletely defined DomainDefinedAttributes::DomainDefinedAttributes (const DomainDefinedAttributes &)" << endl
;
1981 DomainDefinedAttributes::~DomainDefinedAttributes()
1984 for (; Curr() != NULL
; RemoveCurrFromList())
1986 } // end of destructor
1989 DomainDefinedAttributes
&DomainDefinedAttributes::operator = (const DomainDefinedAttributes
&that
)
1990 #else // SNACC_DEEP_COPY
1991 DomainDefinedAttributes
&DomainDefinedAttributes::operator = (const DomainDefinedAttributes
&)
1992 #endif // SNACC_DEEP_COPY
1998 for (; Curr(); RemoveCurrFromList())
2001 //that.SetCurrToFirst();
2002 //for (; that.Curr(); that.GoNext())
2003 // AppendCopy (*that.Curr());
2004 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
2005 AppendCopy (*run
->elmt
);
2009 #else // SNACC_DEEP_COPY
2010 Asn1Error
<< "use of incompletely defined DomainDefinedAttributes &DomainDefinedAttributes::operator = (const DomainDefinedAttributes &)" << endl
;
2012 // if your compiler complains here, check the -novolat option
2013 #endif // SNACC_DEEP_COPY
2016 void DomainDefinedAttributes::Print (ostream
&os
) const
2019 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
2020 indentG
+= stdIndentG
;
2022 //for (; Curr() != NULL; GoNext())
2023 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
2025 Indent (os
, indentG
);
2028 //if (Curr() != Last())
2033 indentG
-= stdIndentG
;
2034 Indent (os
, indentG
);
2042 void DomainDefinedAttributes::SetCurrElmt (unsigned long int index
)
2044 unsigned long int i
;
2047 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
2049 } // DomainDefinedAttributes::SetCurrElmt
2052 unsigned long int DomainDefinedAttributes::GetCurrElmtIndex()
2054 unsigned long int i
;
2058 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
2067 } // DomainDefinedAttributes::GetCurrElmtIndex
2070 // alloc new list elmt, put at end of list
2071 // and return the component type
2072 DomainDefinedAttribute
*DomainDefinedAttributes::Append()
2074 AsnListElmt
*newElmt
;
2075 newElmt
= new AsnListElmt
;
2076 newElmt
->elmt
= new DomainDefinedAttribute
;
2077 newElmt
->next
= NULL
;
2080 newElmt
->prev
= NULL
;
2081 first
= last
= newElmt
;
2085 newElmt
->prev
= last
;
2086 last
->next
= newElmt
;
2090 return (curr
= newElmt
)->elmt
;
2091 } // DomainDefinedAttributes::Append
2094 // alloc new list elmt, put at begining of list
2095 // and return the component type
2096 DomainDefinedAttribute
*DomainDefinedAttributes::Prepend()
2098 AsnListElmt
*newElmt
;
2099 newElmt
= new AsnListElmt
;
2100 newElmt
->elmt
= new DomainDefinedAttribute
;
2101 newElmt
->prev
= NULL
;
2104 newElmt
->next
= NULL
;
2105 first
= last
= newElmt
;
2109 newElmt
->next
= first
;
2110 first
->prev
= newElmt
;
2114 return (curr
= newElmt
)->elmt
;
2115 } // DomainDefinedAttributes::Prepend
2118 // alloc new list elmt, insert it before the
2119 // current element and return the component type
2120 // if the current element is null, the new element
2121 // is placed at the beginning of the list.
2122 DomainDefinedAttribute
*DomainDefinedAttributes::InsertBefore()
2124 AsnListElmt
*newElmt
;
2125 newElmt
= new AsnListElmt
;
2126 newElmt
->elmt
= new DomainDefinedAttribute
;
2129 newElmt
->next
= first
;
2130 newElmt
->prev
= NULL
;
2137 newElmt
->next
= curr
;
2138 newElmt
->prev
= curr
->prev
;
2139 curr
->prev
= newElmt
;
2143 newElmt
->prev
->next
= newElmt
;
2146 return (curr
= newElmt
)->elmt
;
2147 } // DomainDefinedAttributes::InsertBefore
2150 // alloc new list elmt, insert it after the
2151 // current element and return the component type
2152 // if the current element is null, the new element
2153 // is placed at the end of the list.
2154 DomainDefinedAttribute
*DomainDefinedAttributes::InsertAfter()
2156 AsnListElmt
*newElmt
;
2157 newElmt
= new AsnListElmt
;
2158 newElmt
->elmt
= new DomainDefinedAttribute
;
2161 newElmt
->prev
= last
;
2162 newElmt
->next
= NULL
;
2169 newElmt
->prev
= curr
;
2170 newElmt
->next
= curr
->next
;
2171 curr
->next
= newElmt
;
2175 newElmt
->next
->prev
= newElmt
;
2178 return (curr
= newElmt
)->elmt
;
2179 } // DomainDefinedAttributes::InsertAfter
2182 DomainDefinedAttributes
&DomainDefinedAttributes::AppendCopy (DomainDefinedAttribute
&elmt
)
2184 AsnListElmt
*newElmt
;
2185 newElmt
= new AsnListElmt
;
2186 newElmt
->elmt
= new DomainDefinedAttribute
;
2187 *newElmt
->elmt
= elmt
;
2188 newElmt
->next
= NULL
;
2191 newElmt
->prev
= NULL
;
2192 first
= last
= newElmt
;
2196 newElmt
->prev
= last
;
2197 last
->next
= newElmt
;
2205 DomainDefinedAttributes
&DomainDefinedAttributes::PrependCopy (DomainDefinedAttribute
&elmt
)
2207 AsnListElmt
*newElmt
;
2208 newElmt
= new AsnListElmt
;
2209 newElmt
->elmt
= new DomainDefinedAttribute
;
2210 *newElmt
->elmt
= elmt
;
2211 newElmt
->prev
= NULL
;
2214 newElmt
->next
= NULL
;
2215 first
= last
= newElmt
;
2219 newElmt
->next
= first
;
2220 first
->prev
= newElmt
;
2225 } // DomainDefinedAttributes::PrependCopy
2228 // alloc new list elmt, insert it before the
2229 // current element, copy the given elmt into the new elmt
2230 // and return the component type.
2231 // if the current element is null, the new element
2232 // is placed at the beginning of the list.
2233 DomainDefinedAttributes
&DomainDefinedAttributes::InsertBeforeAndCopy (DomainDefinedAttribute
&elmt
)
2235 AsnListElmt
*newElmt
;
2237 newElmt
= new AsnListElmt
;
2238 newElmt
->elmt
= new DomainDefinedAttribute
;
2239 *newElmt
->elmt
= elmt
;
2243 newElmt
->next
= first
;
2244 newElmt
->prev
= NULL
;
2251 newElmt
->next
= curr
;
2252 newElmt
->prev
= curr
->prev
;
2253 curr
->prev
= newElmt
;
2257 newElmt
->prev
->next
= newElmt
;
2261 } // DomainDefinedAttributes::InsertBeforeAndCopy
2264 // alloc new list elmt, insert it after the
2265 // current element, copy given elmt in to new elmt
2266 // and return the component type
2267 // if the current element is null, the new element
2268 // is placed at the end of the list.
2269 DomainDefinedAttributes
&DomainDefinedAttributes::InsertAfterAndCopy (DomainDefinedAttribute
&elmt
)
2271 AsnListElmt
*newElmt
;
2273 newElmt
= new AsnListElmt
;
2274 newElmt
->elmt
= new DomainDefinedAttribute
;
2275 *newElmt
->elmt
= elmt
;
2278 newElmt
->prev
= last
;
2279 newElmt
->next
= NULL
;
2286 newElmt
->prev
= curr
;
2287 newElmt
->next
= curr
->next
;
2288 curr
->next
= newElmt
;
2292 newElmt
->next
->prev
= newElmt
;
2296 } // DomainDefinedAttributes::InsertAfterAndCopy
2299 // remove current element from list if current element is not NULL
2300 // The new current element will be the next element.
2301 // If the current element is the last element in the list
2302 // the second but last element will become the new current element.
2303 void DomainDefinedAttributes::RemoveCurrFromList()
2305 AsnListElmt
*del_elmt
;
2313 first
= last
= curr
= NULL
;
2314 else if (curr
== first
)
2316 curr
= first
= first
->next
;
2319 else if (curr
== last
)
2321 curr
= last
= last
->prev
;
2326 curr
->prev
->next
= curr
->next
;
2327 curr
->next
->prev
= curr
->prev
;
2330 delete del_elmt
->elmt
;
2336 AsnLen
DomainDefinedAttributes::BEncContent (BUF_TYPE b
)
2338 AsnListElmt
*currElmt
;
2340 AsnLen totalLen
= 0;
2341 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
2344 elmtLen
= currElmt
->elmt
->BEncContent (b
);
2345 elmtLen
+= BEncConsLen (b
, elmtLen
);
2347 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2348 totalLen
+= elmtLen
;
2351 } // DomainDefinedAttributes::BEncContent
2354 void DomainDefinedAttributes::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
2355 AsnLen
&bytesDecoded
, ENV_TYPE env
)
2357 DomainDefinedAttribute
*listElmt
;
2359 AsnLen listBytesDecoded
= 0;
2362 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
2364 tag1
= BDecTag (b
, listBytesDecoded
, env
);
2365 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
2367 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
2370 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
2372 Asn1Error
<< "Unexpected Tag" << endl
;
2373 longjmp (env
, -123);
2376 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
2377 listElmt
= Append();
2378 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
2381 bytesDecoded
+= listBytesDecoded
;
2382 } // DomainDefinedAttributes::BDecContent
2385 AsnType
*ExtensionAttributes::Clone() const
2387 return new ExtensionAttributes
;
2390 AsnType
*ExtensionAttributes::Copy() const
2392 return new ExtensionAttributes (*this);
2395 AsnLen
ExtensionAttributes::BEnc (BUF_TYPE b
)
2398 l
= BEncContent (b
);
2399 l
+= BEncConsLen (b
, l
);
2400 l
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
2404 void ExtensionAttributes::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2409 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
))
2411 Asn1Error
<< "ExtensionAttributes::BDec: ERROR - wrong tag" << endl
;
2412 longjmp (env
, -124);
2414 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
2415 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
2418 ExtensionAttributes::ExtensionAttributes (const ExtensionAttributes
&)
2420 Asn1Error
<< "use of incompletely defined ExtensionAttributes::ExtensionAttributes (const ExtensionAttributes &)" << endl
;
2424 ExtensionAttributes::~ExtensionAttributes()
2427 for (; Curr() != NULL
; RemoveCurrFromList())
2429 } // end of destructor
2432 ExtensionAttributes
&ExtensionAttributes::operator = (const ExtensionAttributes
&that
)
2433 #else // SNACC_DEEP_COPY
2434 ExtensionAttributes
&ExtensionAttributes::operator = (const ExtensionAttributes
&)
2435 #endif // SNACC_DEEP_COPY
2441 for (; Curr(); RemoveCurrFromList())
2444 //that.SetCurrToFirst();
2445 //for (; that.Curr(); that.GoNext())
2446 // AppendCopy (*that.Curr());
2447 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
2448 AppendCopy (*run
->elmt
);
2452 #else // SNACC_DEEP_COPY
2453 Asn1Error
<< "use of incompletely defined ExtensionAttributes &ExtensionAttributes::operator = (const ExtensionAttributes &)" << endl
;
2455 // if your compiler complains here, check the -novolat option
2456 #endif // SNACC_DEEP_COPY
2459 void ExtensionAttributes::Print (ostream
&os
) const
2462 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
2463 indentG
+= stdIndentG
;
2465 //for (; Curr() != NULL; GoNext())
2466 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
2468 Indent (os
, indentG
);
2471 //if (Curr() != Last())
2476 indentG
-= stdIndentG
;
2477 Indent (os
, indentG
);
2485 void ExtensionAttributes::SetCurrElmt (unsigned long int index
)
2487 unsigned long int i
;
2490 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
2492 } // ExtensionAttributes::SetCurrElmt
2495 unsigned long int ExtensionAttributes::GetCurrElmtIndex()
2497 unsigned long int i
;
2501 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
2510 } // ExtensionAttributes::GetCurrElmtIndex
2513 // alloc new list elmt, put at end of list
2514 // and return the component type
2515 ExtensionAttribute
*ExtensionAttributes::Append()
2517 AsnListElmt
*newElmt
;
2518 newElmt
= new AsnListElmt
;
2519 newElmt
->elmt
= new ExtensionAttribute
;
2520 newElmt
->next
= NULL
;
2523 newElmt
->prev
= NULL
;
2524 first
= last
= newElmt
;
2528 newElmt
->prev
= last
;
2529 last
->next
= newElmt
;
2533 return (curr
= newElmt
)->elmt
;
2534 } // ExtensionAttributes::Append
2537 // alloc new list elmt, put at begining of list
2538 // and return the component type
2539 ExtensionAttribute
*ExtensionAttributes::Prepend()
2541 AsnListElmt
*newElmt
;
2542 newElmt
= new AsnListElmt
;
2543 newElmt
->elmt
= new ExtensionAttribute
;
2544 newElmt
->prev
= NULL
;
2547 newElmt
->next
= NULL
;
2548 first
= last
= newElmt
;
2552 newElmt
->next
= first
;
2553 first
->prev
= newElmt
;
2557 return (curr
= newElmt
)->elmt
;
2558 } // ExtensionAttributes::Prepend
2561 // alloc new list elmt, insert it before the
2562 // current element and return the component type
2563 // if the current element is null, the new element
2564 // is placed at the beginning of the list.
2565 ExtensionAttribute
*ExtensionAttributes::InsertBefore()
2567 AsnListElmt
*newElmt
;
2568 newElmt
= new AsnListElmt
;
2569 newElmt
->elmt
= new ExtensionAttribute
;
2572 newElmt
->next
= first
;
2573 newElmt
->prev
= NULL
;
2580 newElmt
->next
= curr
;
2581 newElmt
->prev
= curr
->prev
;
2582 curr
->prev
= newElmt
;
2586 newElmt
->prev
->next
= newElmt
;
2589 return (curr
= newElmt
)->elmt
;
2590 } // ExtensionAttributes::InsertBefore
2593 // alloc new list elmt, insert it after the
2594 // current element and return the component type
2595 // if the current element is null, the new element
2596 // is placed at the end of the list.
2597 ExtensionAttribute
*ExtensionAttributes::InsertAfter()
2599 AsnListElmt
*newElmt
;
2600 newElmt
= new AsnListElmt
;
2601 newElmt
->elmt
= new ExtensionAttribute
;
2604 newElmt
->prev
= last
;
2605 newElmt
->next
= NULL
;
2612 newElmt
->prev
= curr
;
2613 newElmt
->next
= curr
->next
;
2614 curr
->next
= newElmt
;
2618 newElmt
->next
->prev
= newElmt
;
2621 return (curr
= newElmt
)->elmt
;
2622 } // ExtensionAttributes::InsertAfter
2625 ExtensionAttributes
&ExtensionAttributes::AppendCopy (ExtensionAttribute
&elmt
)
2627 AsnListElmt
*newElmt
;
2628 newElmt
= new AsnListElmt
;
2629 newElmt
->elmt
= new ExtensionAttribute
;
2630 *newElmt
->elmt
= elmt
;
2631 newElmt
->next
= NULL
;
2634 newElmt
->prev
= NULL
;
2635 first
= last
= newElmt
;
2639 newElmt
->prev
= last
;
2640 last
->next
= newElmt
;
2648 ExtensionAttributes
&ExtensionAttributes::PrependCopy (ExtensionAttribute
&elmt
)
2650 AsnListElmt
*newElmt
;
2651 newElmt
= new AsnListElmt
;
2652 newElmt
->elmt
= new ExtensionAttribute
;
2653 *newElmt
->elmt
= elmt
;
2654 newElmt
->prev
= NULL
;
2657 newElmt
->next
= NULL
;
2658 first
= last
= newElmt
;
2662 newElmt
->next
= first
;
2663 first
->prev
= newElmt
;
2668 } // ExtensionAttributes::PrependCopy
2671 // alloc new list elmt, insert it before the
2672 // current element, copy the given elmt into the new elmt
2673 // and return the component type.
2674 // if the current element is null, the new element
2675 // is placed at the beginning of the list.
2676 ExtensionAttributes
&ExtensionAttributes::InsertBeforeAndCopy (ExtensionAttribute
&elmt
)
2678 AsnListElmt
*newElmt
;
2680 newElmt
= new AsnListElmt
;
2681 newElmt
->elmt
= new ExtensionAttribute
;
2682 *newElmt
->elmt
= elmt
;
2686 newElmt
->next
= first
;
2687 newElmt
->prev
= NULL
;
2694 newElmt
->next
= curr
;
2695 newElmt
->prev
= curr
->prev
;
2696 curr
->prev
= newElmt
;
2700 newElmt
->prev
->next
= newElmt
;
2704 } // ExtensionAttributes::InsertBeforeAndCopy
2707 // alloc new list elmt, insert it after the
2708 // current element, copy given elmt in to new elmt
2709 // and return the component type
2710 // if the current element is null, the new element
2711 // is placed at the end of the list.
2712 ExtensionAttributes
&ExtensionAttributes::InsertAfterAndCopy (ExtensionAttribute
&elmt
)
2714 AsnListElmt
*newElmt
;
2716 newElmt
= new AsnListElmt
;
2717 newElmt
->elmt
= new ExtensionAttribute
;
2718 *newElmt
->elmt
= elmt
;
2721 newElmt
->prev
= last
;
2722 newElmt
->next
= NULL
;
2729 newElmt
->prev
= curr
;
2730 newElmt
->next
= curr
->next
;
2731 curr
->next
= newElmt
;
2735 newElmt
->next
->prev
= newElmt
;
2739 } // ExtensionAttributes::InsertAfterAndCopy
2742 // remove current element from list if current element is not NULL
2743 // The new current element will be the next element.
2744 // If the current element is the last element in the list
2745 // the second but last element will become the new current element.
2746 void ExtensionAttributes::RemoveCurrFromList()
2748 AsnListElmt
*del_elmt
;
2756 first
= last
= curr
= NULL
;
2757 else if (curr
== first
)
2759 curr
= first
= first
->next
;
2762 else if (curr
== last
)
2764 curr
= last
= last
->prev
;
2769 curr
->prev
->next
= curr
->next
;
2770 curr
->next
->prev
= curr
->prev
;
2773 delete del_elmt
->elmt
;
2779 AsnLen
ExtensionAttributes::BEncContent (BUF_TYPE b
)
2781 AsnListElmt
*currElmt
;
2783 AsnLen totalLen
= 0;
2786 CSM_Buffer
**tmpEnc
=NULL
;
2787 for (currElmt
= last
,icount
=0; currElmt
!= NULL
; currElmt
= currElmt
->prev
, icount
++);
2788 tmpEnc
= (CSM_Buffer
**) calloc(sizeof(CSM_Buffer
*), icount
);
2789 for (currElmt
= last
, iii
=0; currElmt
!= NULL
; currElmt
= currElmt
->prev
,iii
++,elmtLen
=0)
2792 ENCODE_BUF1(currElmt
->elmt
->BEncContent
, elmtLen
);
2793 elmtLen
+= BEncConsLen (outputBuf
, elmtLen
);
2795 elmtLen
+= BEncTag1 (outputBuf
, UNIV
, CONS
, SEQ_TAG_CODE
);
2796 ENCODE_BUF2(tmpEnc
[iii
]);
2798 vdasnacc_sortSetOf(tmpEnc
, icount
);
2799 for (iii
=0,elmtLen
=0; iii
< icount
; elmtLen
+=tmpEnc
[iii
++]->Length())
2800 SM_WriteToAsnBuf(tmpEnc
[iii
], b
);
2801 for (iii
=0; iii
< icount
; iii
++) delete tmpEnc
[iii
];
2804 totalLen
+= elmtLen
;
2806 } // ExtensionAttributes::BEncContent
2809 void ExtensionAttributes::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
2810 AsnLen
&bytesDecoded
, ENV_TYPE env
)
2812 ExtensionAttribute
*listElmt
;
2814 AsnLen listBytesDecoded
= 0;
2817 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
2819 tag1
= BDecTag (b
, listBytesDecoded
, env
);
2820 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
2822 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
2825 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
2827 Asn1Error
<< "Unexpected Tag" << endl
;
2828 longjmp (env
, -125);
2831 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
2832 listElmt
= Append();
2833 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
2836 bytesDecoded
+= listBytesDecoded
;
2837 } // ExtensionAttributes::BDecContent
2840 StandardAttributes::StandardAttributes()
2842 country_name
= NULL
;
2843 administration_domain_name
= NULL
;
2844 network_address
= NULL
;
2845 terminal_identifier
= NULL
;
2846 private_domain_name
= NULL
;
2847 organization_name
= NULL
;
2848 numeric_user_identifier
= NULL
;
2849 personal_name
= NULL
;
2850 organizational_unit_names
= NULL
;
2853 StandardAttributes::StandardAttributes (const StandardAttributes
&)
2855 Asn1Error
<< "use of incompletely defined StandardAttributes::StandardAttributes (const StandardAttributes &)" << endl
;
2859 StandardAttributes::~StandardAttributes()
2861 delete country_name
;
2862 delete administration_domain_name
;
2863 delete network_address
;
2864 delete terminal_identifier
;
2865 delete private_domain_name
;
2866 delete organization_name
;
2867 delete numeric_user_identifier
;
2868 delete personal_name
;
2869 delete organizational_unit_names
;
2872 AsnType
*StandardAttributes::Clone() const
2874 return new StandardAttributes
;
2877 AsnType
*StandardAttributes::Copy() const
2879 return new StandardAttributes (*this);
2883 StandardAttributes
&StandardAttributes::operator = (const StandardAttributes
&that
)
2884 #else // SNACC_DEEP_COPY
2885 StandardAttributes
&StandardAttributes::operator = (const StandardAttributes
&)
2886 #endif // SNACC_DEEP_COPY
2891 if (that
.country_name
)
2894 country_name
= new CountryName
;
2895 *country_name
= *that
.country_name
;
2899 delete country_name
;
2900 country_name
= NULL
;
2902 if (that
.administration_domain_name
)
2904 if (!administration_domain_name
)
2905 administration_domain_name
= new AdministrationDomainName
;
2906 *administration_domain_name
= *that
.administration_domain_name
;
2910 delete administration_domain_name
;
2911 administration_domain_name
= NULL
;
2913 if (that
.network_address
)
2915 if (!network_address
)
2916 network_address
= new NetworkAddress
;
2917 *network_address
= *that
.network_address
;
2921 delete network_address
;
2922 network_address
= NULL
;
2924 if (that
.terminal_identifier
)
2926 if (!terminal_identifier
)
2927 terminal_identifier
= new TerminalIdentifier
;
2928 *terminal_identifier
= *that
.terminal_identifier
;
2932 delete terminal_identifier
;
2933 terminal_identifier
= NULL
;
2935 if (that
.private_domain_name
)
2937 if (!private_domain_name
)
2938 private_domain_name
= new PrivateDomainName
;
2939 *private_domain_name
= *that
.private_domain_name
;
2943 delete private_domain_name
;
2944 private_domain_name
= NULL
;
2946 if (that
.organization_name
)
2948 if (!organization_name
)
2949 organization_name
= new OrganizationName
;
2950 *organization_name
= *that
.organization_name
;
2954 delete organization_name
;
2955 organization_name
= NULL
;
2957 if (that
.numeric_user_identifier
)
2959 if (!numeric_user_identifier
)
2960 numeric_user_identifier
= new NumericUserIdentifier
;
2961 *numeric_user_identifier
= *that
.numeric_user_identifier
;
2965 delete numeric_user_identifier
;
2966 numeric_user_identifier
= NULL
;
2968 if (that
.personal_name
)
2971 personal_name
= new PersonalName
;
2972 *personal_name
= *that
.personal_name
;
2976 delete personal_name
;
2977 personal_name
= NULL
;
2979 if (that
.organizational_unit_names
)
2981 if (!organizational_unit_names
)
2982 organizational_unit_names
= new OrganizationUnitNames
;
2983 *organizational_unit_names
= *that
.organizational_unit_names
;
2987 delete organizational_unit_names
;
2988 organizational_unit_names
= NULL
;
2993 #else // SNACC_DEEP_COPY
2994 Asn1Error
<< "use of incompletely defined StandardAttributes &StandardAttributes::operator = (const StandardAttributes &)" << endl
;
2996 // if your compiler complains here, check the -novolat option
2997 #endif // SNACC_DEEP_COPY
3001 StandardAttributes::BEncContent (BUF_TYPE b
)
3003 AsnLen totalLen
= 0;
3006 if (NOT_NULL (organizational_unit_names
))
3009 l
= organizational_unit_names
->BEncContent (b
);
3010 l
+= BEncConsLen (b
, l
);
3012 l
+= BEncTag1 (b
, CNTX
, CONS
, 6);
3016 if (NOT_NULL (personal_name
))
3019 l
= personal_name
->BEncContent (b
);
3020 l
+= BEncConsLen (b
, l
);
3022 l
+= BEncTag1 (b
, CNTX
, CONS
, 5);
3026 if (NOT_NULL (numeric_user_identifier
))
3028 l
= numeric_user_identifier
->BEncContent (b
);
3029 l
+= BEncDefLen (b
, l
);
3031 l
+= BEncTag1 (b
, CNTX
, PRIM
, 4);
3035 if (NOT_NULL (organization_name
))
3037 l
= organization_name
->BEncContent (b
);
3038 l
+= BEncDefLen (b
, l
);
3040 l
+= BEncTag1 (b
, CNTX
, PRIM
, 3);
3044 if (NOT_NULL (private_domain_name
))
3047 l
= private_domain_name
->BEncContent (b
);
3048 l
+= BEncConsLen (b
, l
);
3050 l
+= BEncTag1 (b
, CNTX
, CONS
, 2);
3054 if (NOT_NULL (terminal_identifier
))
3056 l
= terminal_identifier
->BEncContent (b
);
3057 l
+= BEncDefLen (b
, l
);
3059 l
+= BEncTag1 (b
, CNTX
, PRIM
, 1);
3063 if (NOT_NULL (network_address
))
3065 l
= network_address
->BEncContent (b
);
3066 l
+= BEncDefLen (b
, l
);
3068 l
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
3072 if (NOT_NULL (administration_domain_name
))
3075 l
= administration_domain_name
->BEncContent (b
);
3076 l
+= BEncConsLen (b
, l
);
3078 l
+= BEncTag1 (b
, APPL
, CONS
, 2);
3082 if (NOT_NULL (country_name
))
3085 l
= country_name
->BEncContent (b
);
3086 l
+= BEncConsLen (b
, l
);
3088 l
+= BEncTag1 (b
, APPL
, CONS
, 1);
3093 } // StandardAttributes::BEncContent
3096 void StandardAttributes::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3099 AsnLen seqBytesDecoded
= 0;
3106 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3108 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3110 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3111 bytesDecoded
+= seqBytesDecoded
;
3116 if ((tag1
== MAKE_TAG_ID (APPL
, CONS
, 1)))
3118 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3119 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3120 elmtLen2
= BDecLen (b
, seqBytesDecoded
, env
);
3121 country_name
= new CountryName
;
3122 country_name
->BDecContent (b
, tag1
, elmtLen2
, seqBytesDecoded
, env
);
3123 if (elmtLen1
== INDEFINITE_LEN
)
3124 BDecEoc (b
, seqBytesDecoded
, env
);
3126 if (seqBytesDecoded
== elmtLen0
)
3128 bytesDecoded
+= seqBytesDecoded
;
3133 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3135 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3137 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3138 bytesDecoded
+= seqBytesDecoded
;
3144 if ((tag1
== MAKE_TAG_ID (APPL
, CONS
, 2)))
3146 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3147 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3148 elmtLen2
= BDecLen (b
, seqBytesDecoded
, env
);
3149 administration_domain_name
= new AdministrationDomainName
;
3150 administration_domain_name
->BDecContent (b
, tag1
, elmtLen2
, seqBytesDecoded
, env
);
3151 if (elmtLen1
== INDEFINITE_LEN
)
3152 BDecEoc (b
, seqBytesDecoded
, env
);
3154 if (seqBytesDecoded
== elmtLen0
)
3156 bytesDecoded
+= seqBytesDecoded
;
3161 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3163 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3165 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3166 bytesDecoded
+= seqBytesDecoded
;
3172 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 0))
3173 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0)))
3175 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3176 network_address
= new NetworkAddress
;
3177 network_address
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3178 if (seqBytesDecoded
== elmtLen0
)
3180 bytesDecoded
+= seqBytesDecoded
;
3185 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3187 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3189 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3190 bytesDecoded
+= seqBytesDecoded
;
3196 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 1))
3197 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
3199 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3200 terminal_identifier
= new TerminalIdentifier
;
3201 terminal_identifier
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3202 if (seqBytesDecoded
== elmtLen0
)
3204 bytesDecoded
+= seqBytesDecoded
;
3209 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3211 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3213 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3214 bytesDecoded
+= seqBytesDecoded
;
3220 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 2)))
3222 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3223 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3224 elmtLen2
= BDecLen (b
, seqBytesDecoded
, env
);
3225 private_domain_name
= new PrivateDomainName
;
3226 private_domain_name
->BDecContent (b
, tag1
, elmtLen2
, seqBytesDecoded
, env
);
3227 if (elmtLen1
== INDEFINITE_LEN
)
3228 BDecEoc (b
, seqBytesDecoded
, env
);
3230 if (seqBytesDecoded
== elmtLen0
)
3232 bytesDecoded
+= seqBytesDecoded
;
3237 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3239 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3241 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3242 bytesDecoded
+= seqBytesDecoded
;
3248 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 3))
3249 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 3)))
3251 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3252 organization_name
= new OrganizationName
;
3253 organization_name
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3254 if (seqBytesDecoded
== elmtLen0
)
3256 bytesDecoded
+= seqBytesDecoded
;
3261 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3263 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3265 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3266 bytesDecoded
+= seqBytesDecoded
;
3272 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 4))
3273 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 4)))
3275 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3276 numeric_user_identifier
= new NumericUserIdentifier
;
3277 numeric_user_identifier
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3278 if (seqBytesDecoded
== elmtLen0
)
3280 bytesDecoded
+= seqBytesDecoded
;
3285 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3287 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3289 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3290 bytesDecoded
+= seqBytesDecoded
;
3296 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 5)))
3298 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3299 personal_name
= new PersonalName
;
3300 personal_name
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3301 if (seqBytesDecoded
== elmtLen0
)
3303 bytesDecoded
+= seqBytesDecoded
;
3308 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3310 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3312 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3313 bytesDecoded
+= seqBytesDecoded
;
3319 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 6)))
3321 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3322 organizational_unit_names
= new OrganizationUnitNames
;
3323 organizational_unit_names
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3326 bytesDecoded
+= seqBytesDecoded
;
3327 if (elmtLen0
== INDEFINITE_LEN
)
3329 BDecEoc (b
, bytesDecoded
, env
);
3332 else if (seqBytesDecoded
!= elmtLen0
)
3334 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
3335 longjmp (env
, -126);
3339 } // StandardAttributes::BDecContent
3341 AsnLen
StandardAttributes::BEnc (BUF_TYPE b
)
3344 l
= BEncContent (b
);
3345 l
+= BEncConsLen (b
, l
);
3346 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3350 void StandardAttributes::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3355 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
3357 Asn1Error
<< "StandardAttributes::BDec: ERROR - wrong tag" << endl
;
3358 longjmp (env
, -127);
3360 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
3361 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
3364 int StandardAttributes::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
3366 bytesEncoded
= BEnc (b
);
3367 return !b
.WriteError();
3370 int StandardAttributes::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
3376 if ((val
= setjmp (env
)) == 0)
3378 BDec (b
, bytesDecoded
, env
);
3379 return !b
.ReadError();
3385 void StandardAttributes::Print (ostream
&os
) const
3388 int nonePrinted
= true;
3389 os
<< "{ -- SEQUENCE --" << endl
;
3390 indentG
+= stdIndentG
;
3392 if (NOT_NULL (country_name
))
3394 nonePrinted
= false;
3395 Indent (os
, indentG
);
3396 os
<< "country-name ";
3397 os
<< *country_name
;
3401 Indent (os
, indentG
);
3402 os
<< "country-name ";
3407 if (NOT_NULL (administration_domain_name
))
3411 nonePrinted
= false;
3412 Indent (os
, indentG
);
3413 os
<< "administration-domain-name ";
3414 os
<< *administration_domain_name
;
3418 Indent (os
, indentG
);
3419 os
<< "administration-domain-name ";
3424 if (NOT_NULL (network_address
))
3428 nonePrinted
= false;
3429 Indent (os
, indentG
);
3430 os
<< "network-address ";
3431 os
<< *network_address
;
3435 Indent (os
, indentG
);
3436 os
<< "network-address ";
3441 if (NOT_NULL (terminal_identifier
))
3445 nonePrinted
= false;
3446 Indent (os
, indentG
);
3447 os
<< "terminal-identifier ";
3448 os
<< *terminal_identifier
;
3452 Indent (os
, indentG
);
3453 os
<< "terminal-identifier ";
3458 if (NOT_NULL (private_domain_name
))
3462 nonePrinted
= false;
3463 Indent (os
, indentG
);
3464 os
<< "private-domain-name ";
3465 os
<< *private_domain_name
;
3469 Indent (os
, indentG
);
3470 os
<< "private-domain-name ";
3475 if (NOT_NULL (organization_name
))
3479 nonePrinted
= false;
3480 Indent (os
, indentG
);
3481 os
<< "organization-name ";
3482 os
<< *organization_name
;
3486 Indent (os
, indentG
);
3487 os
<< "organization-name ";
3492 if (NOT_NULL (numeric_user_identifier
))
3496 nonePrinted
= false;
3497 Indent (os
, indentG
);
3498 os
<< "numeric-user-identifier ";
3499 os
<< *numeric_user_identifier
;
3503 Indent (os
, indentG
);
3504 os
<< "numeric-user-identifier ";
3509 if (NOT_NULL (personal_name
))
3513 nonePrinted
= false;
3514 Indent (os
, indentG
);
3515 os
<< "personal-name ";
3516 os
<< *personal_name
;
3520 Indent (os
, indentG
);
3521 os
<< "personal-name ";
3526 if (NOT_NULL (organizational_unit_names
))
3530 nonePrinted
= false;
3531 Indent (os
, indentG
);
3532 os
<< "organizational-unit-names ";
3533 os
<< *organizational_unit_names
;
3537 Indent (os
, indentG
);
3538 os
<< "organizational-unit-names ";
3544 indentG
-= stdIndentG
;
3545 Indent (os
, indentG
);
3548 } // StandardAttributes::Print
3551 ORAddress::ORAddress()
3554 standard_attributes
= new StandardAttributes
;
3556 standard_attributes
= NULL
; // incomplete initialization of mandatory element!
3558 domain_defined_attributes
= NULL
;
3559 extension_attributes
= NULL
;
3562 ORAddress::ORAddress (const ORAddress
&)
3564 Asn1Error
<< "use of incompletely defined ORAddress::ORAddress (const ORAddress &)" << endl
;
3568 ORAddress::~ORAddress()
3570 delete standard_attributes
;
3571 delete domain_defined_attributes
;
3572 delete extension_attributes
;
3575 AsnType
*ORAddress::Clone() const
3577 return new ORAddress
;
3580 AsnType
*ORAddress::Copy() const
3582 return new ORAddress (*this);
3586 ORAddress
&ORAddress::operator = (const ORAddress
&that
)
3587 #else // SNACC_DEEP_COPY
3588 ORAddress
&ORAddress::operator = (const ORAddress
&)
3589 #endif // SNACC_DEEP_COPY
3594 if (that
.standard_attributes
)
3596 if (!standard_attributes
)
3597 standard_attributes
= new StandardAttributes
;
3598 *standard_attributes
= *that
.standard_attributes
;
3602 delete standard_attributes
;
3603 standard_attributes
= NULL
;
3605 if (that
.domain_defined_attributes
)
3607 if (!domain_defined_attributes
)
3608 domain_defined_attributes
= new DomainDefinedAttributes
;
3609 *domain_defined_attributes
= *that
.domain_defined_attributes
;
3613 delete domain_defined_attributes
;
3614 domain_defined_attributes
= NULL
;
3616 if (that
.extension_attributes
)
3618 if (!extension_attributes
)
3619 extension_attributes
= new ExtensionAttributes
;
3620 *extension_attributes
= *that
.extension_attributes
;
3624 delete extension_attributes
;
3625 extension_attributes
= NULL
;
3630 #else // SNACC_DEEP_COPY
3631 Asn1Error
<< "use of incompletely defined ORAddress &ORAddress::operator = (const ORAddress &)" << endl
;
3633 // if your compiler complains here, check the -novolat option
3634 #endif // SNACC_DEEP_COPY
3638 ORAddress::BEncContent (BUF_TYPE b
)
3640 AsnLen totalLen
= 0;
3643 if (NOT_NULL (extension_attributes
))
3646 l
= extension_attributes
->BEncContent (b
);
3647 l
+= BEncConsLen (b
, l
);
3649 l
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
3653 if (NOT_NULL (domain_defined_attributes
))
3656 l
= domain_defined_attributes
->BEncContent (b
);
3657 l
+= BEncConsLen (b
, l
);
3659 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3664 l
= standard_attributes
->BEncContent (b
);
3665 l
+= BEncConsLen (b
, l
);
3667 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3671 } // ORAddress::BEncContent
3674 void ORAddress::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3677 AsnLen seqBytesDecoded
= 0;
3679 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3681 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
3683 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3684 standard_attributes
= new StandardAttributes
;
3685 standard_attributes
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3686 if (seqBytesDecoded
== elmtLen0
)
3688 bytesDecoded
+= seqBytesDecoded
;
3693 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3695 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3697 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3698 bytesDecoded
+= seqBytesDecoded
;
3705 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
3706 longjmp (env
, -128);
3709 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
3711 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3712 domain_defined_attributes
= new DomainDefinedAttributes
;
3713 domain_defined_attributes
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3714 if (seqBytesDecoded
== elmtLen0
)
3716 bytesDecoded
+= seqBytesDecoded
;
3721 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3723 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3725 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3726 bytesDecoded
+= seqBytesDecoded
;
3732 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
)))
3734 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3735 extension_attributes
= new ExtensionAttributes
;
3736 extension_attributes
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3739 bytesDecoded
+= seqBytesDecoded
;
3740 if (elmtLen0
== INDEFINITE_LEN
)
3742 BDecEoc (b
, bytesDecoded
, env
);
3745 else if (seqBytesDecoded
!= elmtLen0
)
3747 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
3748 longjmp (env
, -129);
3752 } // ORAddress::BDecContent
3754 AsnLen
ORAddress::BEnc (BUF_TYPE b
)
3757 l
= BEncContent (b
);
3758 l
+= BEncConsLen (b
, l
);
3759 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3763 void ORAddress::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3768 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
3770 Asn1Error
<< "ORAddress::BDec: ERROR - wrong tag" << endl
;
3771 longjmp (env
, -130);
3773 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
3774 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
3777 int ORAddress::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
3779 bytesEncoded
= BEnc (b
);
3780 return !b
.WriteError();
3783 int ORAddress::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
3789 if ((val
= setjmp (env
)) == 0)
3791 BDec (b
, bytesDecoded
, env
);
3792 return !b
.ReadError();
3798 void ORAddress::Print (ostream
&os
) const
3801 os
<< "{ -- SEQUENCE --" << endl
;
3802 indentG
+= stdIndentG
;
3804 if (NOT_NULL (standard_attributes
))
3806 Indent (os
, indentG
);
3807 os
<< "standard-attributes ";
3808 os
<< *standard_attributes
;
3812 Indent (os
, indentG
);
3813 os
<< "standard-attributes ";
3818 if (NOT_NULL (domain_defined_attributes
))
3821 Indent (os
, indentG
);
3822 os
<< "domain-defined-attributes ";
3823 os
<< *domain_defined_attributes
;
3827 Indent (os
, indentG
);
3828 os
<< "domain-defined-attributes ";
3833 if (NOT_NULL (extension_attributes
))
3836 Indent (os
, indentG
);
3837 os
<< "extension-attributes ";
3838 os
<< *extension_attributes
;
3842 Indent (os
, indentG
);
3843 os
<< "extension-attributes ";
3849 indentG
-= stdIndentG
;
3850 Indent (os
, indentG
);
3853 } // ORAddress::Print
3856 TeletexPersonalName::TeletexPersonalName()
3860 generation_qualifier
= NULL
;
3863 TeletexPersonalName::TeletexPersonalName (const TeletexPersonalName
&)
3865 Asn1Error
<< "use of incompletely defined TeletexPersonalName::TeletexPersonalName (const TeletexPersonalName &)" << endl
;
3869 TeletexPersonalName::~TeletexPersonalName()
3873 delete generation_qualifier
;
3876 AsnType
*TeletexPersonalName::Clone() const
3878 return new TeletexPersonalName
;
3881 AsnType
*TeletexPersonalName::Copy() const
3883 return new TeletexPersonalName (*this);
3887 TeletexPersonalName
&TeletexPersonalName::operator = (const TeletexPersonalName
&that
)
3888 #else // SNACC_DEEP_COPY
3889 TeletexPersonalName
&TeletexPersonalName::operator = (const TeletexPersonalName
&)
3890 #endif // SNACC_DEEP_COPY
3895 surname
= that
.surname
;
3896 if (that
.given_name
)
3899 given_name
= new TeletexString
;
3900 *given_name
= *that
.given_name
;
3910 initials
= new TeletexString
;
3911 *initials
= *that
.initials
;
3918 if (that
.generation_qualifier
)
3920 if (!generation_qualifier
)
3921 generation_qualifier
= new TeletexString
;
3922 *generation_qualifier
= *that
.generation_qualifier
;
3926 delete generation_qualifier
;
3927 generation_qualifier
= NULL
;
3932 #else // SNACC_DEEP_COPY
3933 Asn1Error
<< "use of incompletely defined TeletexPersonalName &TeletexPersonalName::operator = (const TeletexPersonalName &)" << endl
;
3935 // if your compiler complains here, check the -novolat option
3936 #endif // SNACC_DEEP_COPY
3939 AsnLen
TeletexPersonalName::BEncContent (BUF_TYPE b
)
3941 AsnLen totalLen
= 0;
3945 int iii
=0, tmpCount
=0;
3946 char *lpszBuf
= (char *)calloc(1, 1024);
3947 outputBuf
.Init(lpszBuf
, 1024);
3948 outputBuf
.ResetInWriteRvsMode();
3949 CSM_Buffer
*tmpEnc
[4];
3950 if (NOT_NULL (generation_qualifier
))
3952 l
= generation_qualifier
->BEncContent (outputBuf
);
3953 l
+= BEncDefLen (outputBuf
, l
);
3955 l
+= BEncTag1 (outputBuf
, CNTX
, PRIM
, 3);
3957 SNACC_BUFRESET_READ(&outputBuf
);
3958 SM_ReadFromAsnBuf(tmpEnc
[iii
], outputBuf
,outputBuf
.DataLen(),NULL
);
3959 SNACC_BUFRESET_WRITE(&outputBuf
);
3963 if (NOT_NULL (initials
))
3965 l
= initials
->BEncContent (outputBuf
);
3966 l
+= BEncDefLen (outputBuf
, l
);
3968 l
+= BEncTag1 (outputBuf
, CNTX
, PRIM
, 2);
3970 SNACC_BUFRESET_READ(&outputBuf
);
3971 SM_ReadFromAsnBuf(tmpEnc
[iii
], outputBuf
,outputBuf
.DataLen(),NULL
);
3972 SNACC_BUFRESET_WRITE(&outputBuf
);
3976 if (NOT_NULL (given_name
))
3978 l
= given_name
->BEncContent (outputBuf
);
3979 l
+= BEncDefLen (outputBuf
, l
);
3981 l
+= BEncTag1 (outputBuf
, CNTX
, PRIM
, 1);
3983 SNACC_BUFRESET_READ(&outputBuf
);
3984 SM_ReadFromAsnBuf(tmpEnc
[iii
], outputBuf
,outputBuf
.DataLen(),NULL
);
3985 SNACC_BUFRESET_WRITE(&outputBuf
);
3989 l
= surname
.BEncContent (outputBuf
);
3990 l
+= BEncDefLen (outputBuf
, l
);
3992 l
+= BEncTag1 (outputBuf
, CNTX
, PRIM
, 0);
3994 SNACC_BUFRESET_READ(&outputBuf
);
3995 SM_ReadFromAsnBuf(tmpEnc
[iii
], outputBuf
,outputBuf
.DataLen(),NULL
);
3996 SNACC_BUFRESET_WRITE(&outputBuf
);
3999 vdasnacc_sortSet(tmpEnc
, iii
);
4000 tmpCount
= iii
; /** REMEMBER how many we have**/
4001 for (iii
=0; iii
< tmpCount
; iii
++)
4002 SM_WriteToAsnBuf(tmpEnc
[iii
], b
);
4003 for (iii
=0; iii
< tmpCount
; iii
++) delete tmpEnc
[iii
];
4006 } // TeletexPersonalName::BEncContent
4009 void TeletexPersonalName::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4012 AsnLen setBytesDecoded
= 0;
4013 unsigned int mandatoryElmtsDecoded
= 0;
4016 for (; (setBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
); )
4018 tag1
= BDecTag (b
, setBytesDecoded
, env
);
4020 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
4022 BDEC_2ND_EOC_OCTET (b
, setBytesDecoded
, env
)
4023 break; /* exit for loop */
4025 elmtLen1
= BDecLen (b
, setBytesDecoded
, env
);
4028 case MAKE_TAG_ID (CNTX
, PRIM
, 0):
4029 case MAKE_TAG_ID (CNTX
, CONS
, 0):
4030 surname
.BDecContent (b
, tag1
, elmtLen1
, setBytesDecoded
, env
);
4031 mandatoryElmtsDecoded
++;
4034 case MAKE_TAG_ID (CNTX
, PRIM
, 1):
4035 case MAKE_TAG_ID (CNTX
, CONS
, 1):
4036 given_name
= new TeletexString
;
4037 given_name
->BDecContent (b
, tag1
, elmtLen1
, setBytesDecoded
, env
);
4040 case MAKE_TAG_ID (CNTX
, PRIM
, 2):
4041 case MAKE_TAG_ID (CNTX
, CONS
, 2):
4042 initials
= new TeletexString
;
4043 initials
->BDecContent (b
, tag1
, elmtLen1
, setBytesDecoded
, env
);
4046 case MAKE_TAG_ID (CNTX
, PRIM
, 3):
4047 case MAKE_TAG_ID (CNTX
, CONS
, 3):
4048 generation_qualifier
= new TeletexString
;
4049 generation_qualifier
->BDecContent (b
, tag1
, elmtLen1
, setBytesDecoded
, env
);
4053 Asn1Error
<< "Unexpected Tag on SET elmt." << endl
;
4054 longjmp (env
, -131);
4057 bytesDecoded
+= setBytesDecoded
;
4058 if (mandatoryElmtsDecoded
!= 1)
4060 Asn1Error
<< "ERROR - non-optional SET element missing." << endl
;
4061 longjmp (env
, -132);
4063 } // TeletexPersonalName::BDecContent
4066 TeletexPersonalName::BEnc (BUF_TYPE b
)
4069 l
= BEncContent (b
);
4070 l
+= BEncConsLen (b
, l
);
4071 l
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
4075 void TeletexPersonalName::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4080 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
))
4082 Asn1Error
<< "TeletexPersonalName::BDec: ERROR - wrong tag" << endl
;
4083 longjmp (env
, -133);
4085 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
4086 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
4089 int TeletexPersonalName::BEncPdu (BUF_TYPE b
, AsnLen
&bytesEncoded
)
4091 bytesEncoded
= BEnc (b
);
4092 return !b
.WriteError();
4095 int TeletexPersonalName::BDecPdu (BUF_TYPE b
, AsnLen
&bytesDecoded
)
4101 if ((val
= setjmp (env
)) == 0)
4103 BDec (b
, bytesDecoded
, env
);
4104 return !b
.ReadError();
4110 void TeletexPersonalName::Print (ostream
&os
) const
4113 os
<< "{ -- SET --" << endl
;
4114 indentG
+= stdIndentG
;
4117 Indent (os
, indentG
);
4122 if (NOT_NULL (given_name
))
4125 Indent (os
, indentG
);
4126 os
<< "given-name ";
4130 os
<< "-- void2 --\n";
4132 if (NOT_NULL (initials
))
4135 Indent (os
, indentG
);
4140 os
<< "-- void2 --\n";
4142 if (NOT_NULL (generation_qualifier
))
4145 Indent (os
, indentG
);
4146 os
<< "generation-qualifier ";
4147 os
<< *generation_qualifier
;
4150 os
<< "-- void2 --\n";
4153 indentG
-= stdIndentG
;
4154 Indent (os
, indentG
);
4157 } // TeletexPersonalName - operator <<
4160 AsnType
*TeletexOrganizationUnitNames::Clone() const
4162 return new TeletexOrganizationUnitNames
;
4165 AsnType
*TeletexOrganizationUnitNames::Copy() const
4167 return new TeletexOrganizationUnitNames (*this);
4170 AsnLen
TeletexOrganizationUnitNames::BEnc (BUF_TYPE b
)
4173 l
= BEncContent (b
);
4174 l
+= BEncConsLen (b
, l
);
4175 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4179 void TeletexOrganizationUnitNames::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4184 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
4186 Asn1Error
<< "TeletexOrganizationUnitNames::BDec: ERROR - wrong tag" << endl
;
4187 longjmp (env
, -134);
4189 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
4190 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
4193 TeletexOrganizationUnitNames::TeletexOrganizationUnitNames (const TeletexOrganizationUnitNames
&)
4195 Asn1Error
<< "use of incompletely defined TeletexOrganizationUnitNames::TeletexOrganizationUnitNames (const TeletexOrganizationUnitNames &)" << endl
;
4199 TeletexOrganizationUnitNames::~TeletexOrganizationUnitNames()
4202 for (; Curr() != NULL
; RemoveCurrFromList())
4204 } // end of destructor
4207 TeletexOrganizationUnitNames
&TeletexOrganizationUnitNames::operator = (const TeletexOrganizationUnitNames
&that
)
4208 #else // SNACC_DEEP_COPY
4209 TeletexOrganizationUnitNames
&TeletexOrganizationUnitNames::operator = (const TeletexOrganizationUnitNames
&)
4210 #endif // SNACC_DEEP_COPY
4216 for (; Curr(); RemoveCurrFromList())
4219 //that.SetCurrToFirst();
4220 //for (; that.Curr(); that.GoNext())
4221 // AppendCopy (*that.Curr());
4222 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
4223 AppendCopy (*run
->elmt
);
4227 #else // SNACC_DEEP_COPY
4228 Asn1Error
<< "use of incompletely defined TeletexOrganizationUnitNames &TeletexOrganizationUnitNames::operator = (const TeletexOrganizationUnitNames &)" << endl
;
4230 // if your compiler complains here, check the -novolat option
4231 #endif // SNACC_DEEP_COPY
4234 void TeletexOrganizationUnitNames::Print (ostream
&os
) const
4237 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
4238 indentG
+= stdIndentG
;
4240 //for (; Curr() != NULL; GoNext())
4241 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
4243 Indent (os
, indentG
);
4246 //if (Curr() != Last())
4251 indentG
-= stdIndentG
;
4252 Indent (os
, indentG
);
4260 void TeletexOrganizationUnitNames::SetCurrElmt (unsigned long int index
)
4262 unsigned long int i
;
4265 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
4267 } // TeletexOrganizationUnitNames::SetCurrElmt
4270 unsigned long int TeletexOrganizationUnitNames::GetCurrElmtIndex()
4272 unsigned long int i
;
4276 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
4285 } // TeletexOrganizationUnitNames::GetCurrElmtIndex
4288 // alloc new list elmt, put at end of list
4289 // and return the component type
4290 TeletexOrganizationalUnitName
*TeletexOrganizationUnitNames::Append()
4292 AsnListElmt
*newElmt
;
4293 newElmt
= new AsnListElmt
;
4294 newElmt
->elmt
= new TeletexOrganizationalUnitName
;
4295 newElmt
->next
= NULL
;
4298 newElmt
->prev
= NULL
;
4299 first
= last
= newElmt
;
4303 newElmt
->prev
= last
;
4304 last
->next
= newElmt
;
4308 return (curr
= newElmt
)->elmt
;
4309 } // TeletexOrganizationUnitNames::Append
4312 // alloc new list elmt, put at begining of list
4313 // and return the component type
4314 TeletexOrganizationalUnitName
*TeletexOrganizationUnitNames::Prepend()
4316 AsnListElmt
*newElmt
;
4317 newElmt
= new AsnListElmt
;
4318 newElmt
->elmt
= new TeletexOrganizationalUnitName
;
4319 newElmt
->prev
= NULL
;
4322 newElmt
->next
= NULL
;
4323 first
= last
= newElmt
;
4327 newElmt
->next
= first
;
4328 first
->prev
= newElmt
;
4332 return (curr
= newElmt
)->elmt
;
4333 } // TeletexOrganizationUnitNames::Prepend
4336 // alloc new list elmt, insert it before the
4337 // current element and return the component type
4338 // if the current element is null, the new element
4339 // is placed at the beginning of the list.
4340 TeletexOrganizationalUnitName
*TeletexOrganizationUnitNames::InsertBefore()
4342 AsnListElmt
*newElmt
;
4343 newElmt
= new AsnListElmt
;
4344 newElmt
->elmt
= new TeletexOrganizationalUnitName
;
4347 newElmt
->next
= first
;
4348 newElmt
->prev
= NULL
;
4355 newElmt
->next
= curr
;
4356 newElmt
->prev
= curr
->prev
;
4357 curr
->prev
= newElmt
;
4361 newElmt
->prev
->next
= newElmt
;
4364 return (curr
= newElmt
)->elmt
;
4365 } // TeletexOrganizationUnitNames::InsertBefore
4368 // alloc new list elmt, insert it after the
4369 // current element and return the component type
4370 // if the current element is null, the new element
4371 // is placed at the end of the list.
4372 TeletexOrganizationalUnitName
*TeletexOrganizationUnitNames::InsertAfter()
4374 AsnListElmt
*newElmt
;
4375 newElmt
= new AsnListElmt
;
4376 newElmt
->elmt
= new TeletexOrganizationalUnitName
;
4379 newElmt
->prev
= last
;
4380 newElmt
->next
= NULL
;
4387 newElmt
->prev
= curr
;
4388 newElmt
->next
= curr
->next
;
4389 curr
->next
= newElmt
;
4393 newElmt
->next
->prev
= newElmt
;
4396 return (curr
= newElmt
)->elmt
;
4397 } // TeletexOrganizationUnitNames::InsertAfter
4400 TeletexOrganizationUnitNames
&TeletexOrganizationUnitNames::AppendCopy (TeletexOrganizationalUnitName
&elmt
)
4402 AsnListElmt
*newElmt
;
4403 newElmt
= new AsnListElmt
;
4404 newElmt
->elmt
= new TeletexOrganizationalUnitName
;
4405 *newElmt
->elmt
= elmt
;
4406 newElmt
->next
= NULL
;
4409 newElmt
->prev
= NULL
;
4410 first
= last
= newElmt
;
4414 newElmt
->prev
= last
;
4415 last
->next
= newElmt
;
4423 TeletexOrganizationUnitNames
&TeletexOrganizationUnitNames::PrependCopy (TeletexOrganizationalUnitName
&elmt
)
4425 AsnListElmt
*newElmt
;
4426 newElmt
= new AsnListElmt
;
4427 newElmt
->elmt
= new TeletexOrganizationalUnitName
;
4428 *newElmt
->elmt
= elmt
;
4429 newElmt
->prev
= NULL
;
4432 newElmt
->next
= NULL
;
4433 first
= last
= newElmt
;
4437 newElmt
->next
= first
;
4438 first
->prev
= newElmt
;
4443 } // TeletexOrganizationUnitNames::PrependCopy
4446 // alloc new list elmt, insert it before the
4447 // current element, copy the given elmt into the new elmt
4448 // and return the component type.
4449 // if the current element is null, the new element
4450 // is placed at the beginning of the list.
4451 TeletexOrganizationUnitNames
&TeletexOrganizationUnitNames::InsertBeforeAndCopy (TeletexOrganizationalUnitName
&elmt
)
4453 AsnListElmt
*newElmt
;
4455 newElmt
= new AsnListElmt
;
4456 newElmt
->elmt
= new TeletexOrganizationalUnitName
;
4457 *newElmt
->elmt
= elmt
;
4461 newElmt
->next
= first
;
4462 newElmt
->prev
= NULL
;
4469 newElmt
->next
= curr
;
4470 newElmt
->prev
= curr
->prev
;
4471 curr
->prev
= newElmt
;
4475 newElmt
->prev
->next
= newElmt
;
4479 } // TeletexOrganizationUnitNames::InsertBeforeAndCopy
4482 // alloc new list elmt, insert it after the
4483 // current element, copy given elmt in to new elmt
4484 // and return the component type
4485 // if the current element is null, the new element
4486 // is placed at the end of the list.
4487 TeletexOrganizationUnitNames
&TeletexOrganizationUnitNames::InsertAfterAndCopy (TeletexOrganizationalUnitName
&elmt
)
4489 AsnListElmt
*newElmt
;
4491 newElmt
= new AsnListElmt
;
4492 newElmt
->elmt
= new TeletexOrganizationalUnitName
;
4493 *newElmt
->elmt
= elmt
;
4496 newElmt
->prev
= last
;
4497 newElmt
->next
= NULL
;
4504 newElmt
->prev
= curr
;
4505 newElmt
->next
= curr
->next
;
4506 curr
->next
= newElmt
;
4510 newElmt
->next
->prev
= newElmt
;
4514 } // TeletexOrganizationUnitNames::InsertAfterAndCopy
4517 // remove current element from list if current element is not NULL
4518 // The new current element will be the next element.
4519 // If the current element is the last element in the list
4520 // the second but last element will become the new current element.
4521 void TeletexOrganizationUnitNames::RemoveCurrFromList()
4523 AsnListElmt
*del_elmt
;
4531 first
= last
= curr
= NULL
;
4532 else if (curr
== first
)
4534 curr
= first
= first
->next
;
4537 else if (curr
== last
)
4539 curr
= last
= last
->prev
;
4544 curr
->prev
->next
= curr
->next
;
4545 curr
->next
->prev
= curr
->prev
;
4548 delete del_elmt
->elmt
;
4554 AsnLen
TeletexOrganizationUnitNames::BEncContent (BUF_TYPE b
)
4556 AsnListElmt
*currElmt
;
4558 AsnLen totalLen
= 0;
4559 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
4561 elmtLen
= currElmt
->elmt
->BEncContent (b
);
4562 elmtLen
+= BEncDefLen (b
, elmtLen
);
4564 elmtLen
+= BEncTag1 (b
, UNIV
, PRIM
, TELETEXSTRING_TAG_CODE
);
4565 totalLen
+= elmtLen
;
4568 } // TeletexOrganizationUnitNames::BEncContent
4571 void TeletexOrganizationUnitNames::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
4572 AsnLen
&bytesDecoded
, ENV_TYPE env
)
4574 TeletexOrganizationalUnitName
*listElmt
;
4576 AsnLen listBytesDecoded
= 0;
4579 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
4581 tag1
= BDecTag (b
, listBytesDecoded
, env
);
4582 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
4584 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
4587 if ((tag1
!= MAKE_TAG_ID (UNIV
, PRIM
, TELETEXSTRING_TAG_CODE
))
4588 && (tag1
!= MAKE_TAG_ID (UNIV
, CONS
, TELETEXSTRING_TAG_CODE
)))
4590 Asn1Error
<< "Unexpected Tag" << endl
;
4591 longjmp (env
, -135);
4594 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
4595 listElmt
= Append();
4596 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
4599 bytesDecoded
+= listBytesDecoded
;
4600 } // TeletexOrganizationUnitNames::BDecContent
4603 AsnType
*TeletexDomainDefinedAttributes::Clone() const
4605 return new TeletexDomainDefinedAttributes
;
4608 AsnType
*TeletexDomainDefinedAttributes::Copy() const
4610 return new TeletexDomainDefinedAttributes (*this);
4613 AsnLen
TeletexDomainDefinedAttributes::BEnc (BUF_TYPE b
)
4616 l
= BEncContent (b
);
4617 l
+= BEncConsLen (b
, l
);
4618 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4622 void TeletexDomainDefinedAttributes::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4627 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
4629 Asn1Error
<< "TeletexDomainDefinedAttributes::BDec: ERROR - wrong tag" << endl
;
4630 longjmp (env
, -136);
4632 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
4633 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
4636 TeletexDomainDefinedAttributes::TeletexDomainDefinedAttributes (const TeletexDomainDefinedAttributes
&)
4638 Asn1Error
<< "use of incompletely defined TeletexDomainDefinedAttributes::TeletexDomainDefinedAttributes (const TeletexDomainDefinedAttributes &)" << endl
;
4642 TeletexDomainDefinedAttributes::~TeletexDomainDefinedAttributes()
4645 for (; Curr() != NULL
; RemoveCurrFromList())
4647 } // end of destructor
4650 TeletexDomainDefinedAttributes
&TeletexDomainDefinedAttributes::operator = (const TeletexDomainDefinedAttributes
&that
)
4651 #else // SNACC_DEEP_COPY
4652 TeletexDomainDefinedAttributes
&TeletexDomainDefinedAttributes::operator = (const TeletexDomainDefinedAttributes
&)
4653 #endif // SNACC_DEEP_COPY
4659 for (; Curr(); RemoveCurrFromList())
4662 //that.SetCurrToFirst();
4663 //for (; that.Curr(); that.GoNext())
4664 // AppendCopy (*that.Curr());
4665 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
4666 AppendCopy (*run
->elmt
);
4670 #else // SNACC_DEEP_COPY
4671 Asn1Error
<< "use of incompletely defined TeletexDomainDefinedAttributes &TeletexDomainDefinedAttributes::operator = (const TeletexDomainDefinedAttributes &)" << endl
;
4673 // if your compiler complains here, check the -novolat option
4674 #endif // SNACC_DEEP_COPY
4677 void TeletexDomainDefinedAttributes::Print (ostream
&os
) const
4680 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
4681 indentG
+= stdIndentG
;
4683 //for (; Curr() != NULL; GoNext())
4684 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
4686 Indent (os
, indentG
);
4689 //if (Curr() != Last())
4694 indentG
-= stdIndentG
;
4695 Indent (os
, indentG
);
4703 void TeletexDomainDefinedAttributes::SetCurrElmt (unsigned long int index
)
4705 unsigned long int i
;
4708 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
4710 } // TeletexDomainDefinedAttributes::SetCurrElmt
4713 unsigned long int TeletexDomainDefinedAttributes::GetCurrElmtIndex()
4715 unsigned long int i
;
4719 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
4728 } // TeletexDomainDefinedAttributes::GetCurrElmtIndex
4731 // alloc new list elmt, put at end of list
4732 // and return the component type
4733 TeletexDomainDefinedAttribute
*TeletexDomainDefinedAttributes::Append()
4735 AsnListElmt
*newElmt
;
4736 newElmt
= new AsnListElmt
;
4737 newElmt
->elmt
= new TeletexDomainDefinedAttribute
;
4738 newElmt
->next
= NULL
;
4741 newElmt
->prev
= NULL
;
4742 first
= last
= newElmt
;
4746 newElmt
->prev
= last
;
4747 last
->next
= newElmt
;
4751 return (curr
= newElmt
)->elmt
;
4752 } // TeletexDomainDefinedAttributes::Append
4755 // alloc new list elmt, put at begining of list
4756 // and return the component type
4757 TeletexDomainDefinedAttribute
*TeletexDomainDefinedAttributes::Prepend()
4759 AsnListElmt
*newElmt
;
4760 newElmt
= new AsnListElmt
;
4761 newElmt
->elmt
= new TeletexDomainDefinedAttribute
;
4762 newElmt
->prev
= NULL
;
4765 newElmt
->next
= NULL
;
4766 first
= last
= newElmt
;
4770 newElmt
->next
= first
;
4771 first
->prev
= newElmt
;
4775 return (curr
= newElmt
)->elmt
;
4776 } // TeletexDomainDefinedAttributes::Prepend
4779 // alloc new list elmt, insert it before the
4780 // current element and return the component type
4781 // if the current element is null, the new element
4782 // is placed at the beginning of the list.
4783 TeletexDomainDefinedAttribute
*TeletexDomainDefinedAttributes::InsertBefore()
4785 AsnListElmt
*newElmt
;
4786 newElmt
= new AsnListElmt
;
4787 newElmt
->elmt
= new TeletexDomainDefinedAttribute
;
4790 newElmt
->next
= first
;
4791 newElmt
->prev
= NULL
;
4798 newElmt
->next
= curr
;
4799 newElmt
->prev
= curr
->prev
;
4800 curr
->prev
= newElmt
;
4804 newElmt
->prev
->next
= newElmt
;
4807 return (curr
= newElmt
)->elmt
;
4808 } // TeletexDomainDefinedAttributes::InsertBefore
4811 // alloc new list elmt, insert it after the
4812 // current element and return the component type
4813 // if the current element is null, the new element
4814 // is placed at the end of the list.
4815 TeletexDomainDefinedAttribute
*TeletexDomainDefinedAttributes::InsertAfter()
4817 AsnListElmt
*newElmt
;
4818 newElmt
= new AsnListElmt
;
4819 newElmt
->elmt
= new TeletexDomainDefinedAttribute
;
4822 newElmt
->prev
= last
;
4823 newElmt
->next
= NULL
;
4830 newElmt
->prev
= curr
;
4831 newElmt
->next
= curr
->next
;
4832 curr
->next
= newElmt
;
4836 newElmt
->next
->prev
= newElmt
;
4839 return (curr
= newElmt
)->elmt
;
4840 } // TeletexDomainDefinedAttributes::InsertAfter
4843 TeletexDomainDefinedAttributes
&TeletexDomainDefinedAttributes::AppendCopy (TeletexDomainDefinedAttribute
&elmt
)
4845 AsnListElmt
*newElmt
;
4846 newElmt
= new AsnListElmt
;
4847 newElmt
->elmt
= new TeletexDomainDefinedAttribute
;
4848 *newElmt
->elmt
= elmt
;
4849 newElmt
->next
= NULL
;
4852 newElmt
->prev
= NULL
;
4853 first
= last
= newElmt
;
4857 newElmt
->prev
= last
;
4858 last
->next
= newElmt
;
4866 TeletexDomainDefinedAttributes
&TeletexDomainDefinedAttributes::PrependCopy (TeletexDomainDefinedAttribute
&elmt
)
4868 AsnListElmt
*newElmt
;
4869 newElmt
= new AsnListElmt
;
4870 newElmt
->elmt
= new TeletexDomainDefinedAttribute
;
4871 *newElmt
->elmt
= elmt
;
4872 newElmt
->prev
= NULL
;
4875 newElmt
->next
= NULL
;
4876 first
= last
= newElmt
;
4880 newElmt
->next
= first
;
4881 first
->prev
= newElmt
;
4886 } // TeletexDomainDefinedAttributes::PrependCopy
4889 // alloc new list elmt, insert it before the
4890 // current element, copy the given elmt into the new elmt
4891 // and return the component type.
4892 // if the current element is null, the new element
4893 // is placed at the beginning of the list.
4894 TeletexDomainDefinedAttributes
&TeletexDomainDefinedAttributes::InsertBeforeAndCopy (TeletexDomainDefinedAttribute
&elmt
)
4896 AsnListElmt
*newElmt
;
4898 newElmt
= new AsnListElmt
;
4899 newElmt
->elmt
= new TeletexDomainDefinedAttribute
;
4900 *newElmt
->elmt
= elmt
;
4904 newElmt
->next
= first
;
4905 newElmt
->prev
= NULL
;
4912 newElmt
->next
= curr
;
4913 newElmt
->prev
= curr
->prev
;
4914 curr
->prev
= newElmt
;
4918 newElmt
->prev
->next
= newElmt
;
4922 } // TeletexDomainDefinedAttributes::InsertBeforeAndCopy
4925 // alloc new list elmt, insert it after the
4926 // current element, copy given elmt in to new elmt
4927 // and return the component type
4928 // if the current element is null, the new element
4929 // is placed at the end of the list.
4930 TeletexDomainDefinedAttributes
&TeletexDomainDefinedAttributes::InsertAfterAndCopy (TeletexDomainDefinedAttribute
&elmt
)
4932 AsnListElmt
*newElmt
;
4934 newElmt
= new AsnListElmt
;
4935 newElmt
->elmt
= new TeletexDomainDefinedAttribute
;
4936 *newElmt
->elmt
= elmt
;
4939 newElmt
->prev
= last
;
4940 newElmt
->next
= NULL
;
4947 newElmt
->prev
= curr
;
4948 newElmt
->next
= curr
->next
;
4949 curr
->next
= newElmt
;
4953 newElmt
->next
->prev
= newElmt
;
4957 } // TeletexDomainDefinedAttributes::InsertAfterAndCopy
4960 // remove current element from list if current element is not NULL
4961 // The new current element will be the next element.
4962 // If the current element is the last element in the list
4963 // the second but last element will become the new current element.
4964 void TeletexDomainDefinedAttributes::RemoveCurrFromList()
4966 AsnListElmt
*del_elmt
;
4974 first
= last
= curr
= NULL
;
4975 else if (curr
== first
)
4977 curr
= first
= first
->next
;
4980 else if (curr
== last
)
4982 curr
= last
= last
->prev
;
4987 curr
->prev
->next
= curr
->next
;
4988 curr
->next
->prev
= curr
->prev
;
4991 delete del_elmt
->elmt
;
4997 AsnLen
TeletexDomainDefinedAttributes::BEncContent (BUF_TYPE b
)
4999 AsnListElmt
*currElmt
;
5001 AsnLen totalLen
= 0;
5002 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
5005 elmtLen
= currElmt
->elmt
->BEncContent (b
);
5006 elmtLen
+= BEncConsLen (b
, elmtLen
);
5008 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5009 totalLen
+= elmtLen
;
5012 } // TeletexDomainDefinedAttributes::BEncContent
5015 void TeletexDomainDefinedAttributes::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
5016 AsnLen
&bytesDecoded
, ENV_TYPE env
)
5018 TeletexDomainDefinedAttribute
*listElmt
;
5020 AsnLen listBytesDecoded
= 0;
5023 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
5025 tag1
= BDecTag (b
, listBytesDecoded
, env
);
5026 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
5028 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
5031 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
5033 Asn1Error
<< "Unexpected Tag" << endl
;
5034 longjmp (env
, -137);
5037 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
5038 listElmt
= Append();
5039 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
5042 bytesDecoded
+= listBytesDecoded
;
5043 } // TeletexDomainDefinedAttributes::BDecContent