]> git.saurik.com Git - apple/security.git/blob - SecurityASN1/c++/sm_x411mtsas.cpp
Security-30.1.tar.gz
[apple/security.git] / SecurityASN1 / c++ / sm_x411mtsas.cpp
1 // NOTE: this is a machine generated file--editing not recommended
2 //
3 // sm_x411mtsas.cpp - class member functions for ASN.1 module MTSAbstractService
4 //
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
8
9
10 #include "asn-incl.h"
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"
22 #include "sm_cms.h"
23 #include "sm_ess.h"
24 #include "pkcs7.h"
25 #include "pkcs8.h"
26 #include "appleoids.h"
27
28 //------------------------------------------------------------------------------
29 // value defs
30
31
32 //------------------------------------------------------------------------------
33 // class member definitions:
34
35 CountryName::CountryName()
36 {
37 choiceId = x121_dcc_codeCid;
38 #if TCL
39 x121_dcc_code = new NumericString;
40 #else
41 x121_dcc_code = NULL; // incomplete initialization of mandatory element!
42 #endif // TCL
43 }
44
45 CountryName::CountryName (const CountryName &)
46 {
47 Asn1Error << "use of incompletely defined CountryName::CountryName (const CountryName &)" << endl;
48 abort();
49 }
50
51 CountryName::~CountryName()
52 {
53 switch (choiceId)
54 {
55 case x121_dcc_codeCid:
56 delete x121_dcc_code;
57 break;
58 case iso_3166_alpha2_codeCid:
59 delete iso_3166_alpha2_code;
60 break;
61 } // end of switch
62 } // end of destructor
63
64 AsnType *CountryName::Clone() const
65 {
66 return new CountryName;
67 }
68
69 AsnType *CountryName::Copy() const
70 {
71 return new CountryName (*this);
72 }
73
74 #if SNACC_DEEP_COPY
75 CountryName &CountryName::operator = (const CountryName &that)
76 #else // SNACC_DEEP_COPY
77 CountryName &CountryName::operator = (const CountryName &)
78 #endif // SNACC_DEEP_COPY
79 {
80 #if SNACC_DEEP_COPY
81 if (this != &that)
82 {
83 switch (choiceId)
84 {
85 case x121_dcc_codeCid:
86 delete x121_dcc_code;
87 break;
88 case iso_3166_alpha2_codeCid:
89 delete iso_3166_alpha2_code;
90 break;
91 }
92 switch (choiceId = that.choiceId)
93 {
94 case x121_dcc_codeCid:
95 x121_dcc_code = new NumericString;
96 *x121_dcc_code = *that.x121_dcc_code;
97 break;
98 case iso_3166_alpha2_codeCid:
99 iso_3166_alpha2_code = new PrintableString;
100 *iso_3166_alpha2_code = *that.iso_3166_alpha2_code;
101 break;
102 }
103 }
104
105 return *this;
106 #else // SNACC_DEEP_COPY
107 Asn1Error << "use of incompletely defined CountryName &CountryName::operator = (const CountryName &)" << endl;
108 abort();
109 // if your compiler complains here, check the -novolat option
110 #endif // SNACC_DEEP_COPY
111 }
112
113 AsnLen
114 CountryName::BEncContent (BUF_TYPE b)
115 {
116 AsnLen l;
117 switch (choiceId)
118 {
119 case x121_dcc_codeCid:
120 l = x121_dcc_code->BEncContent (b);
121 l += BEncDefLen (b, l);
122
123 l += BEncTag1 (b, UNIV, PRIM, NUMERICSTRING_TAG_CODE);
124 break;
125
126 case iso_3166_alpha2_codeCid:
127 l = iso_3166_alpha2_code->BEncContent (b);
128 l += BEncDefLen (b, l);
129
130 l += BEncTag1 (b, UNIV, PRIM, PRINTABLESTRING_TAG_CODE);
131 break;
132
133 } // end switch
134 return l;
135 } // CountryName::BEncContent
136
137
138 void CountryName::BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
139 {
140 switch (tag)
141 {
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);
147 break;
148
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);
154 break;
155
156 default:
157 Asn1Error << "ERROR - unexpected tag in CHOICE" << endl;
158 longjmp (env, -100);
159 break;
160 } // end switch
161 } // CountryName::BDecContent
162
163
164 AsnLen CountryName::BEnc (BUF_TYPE b)
165 {
166 AsnLen l;
167 l = BEncContent (b);
168 l += BEncConsLen (b, l);
169 l += BEncTag1 (b, APPL, CONS, 1);
170 return l;
171 }
172
173 void CountryName::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
174 {
175 AsnLen elmtLen;
176 AsnTag tag;
177 AsnLen extraLen1;
178
179 if (BDecTag (b, bytesDecoded, env) != MAKE_TAG_ID (APPL, CONS, 1)) {
180 Asn1Error << "CountryName::BDec: ERROR - wrong tag" << endl;
181 longjmp (env, -101);
182 }
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);
191 }
192
193 int CountryName::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded)
194 {
195 bytesEncoded = BEnc (b);
196 return !b.WriteError();
197 }
198
199 int CountryName::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded)
200 {
201 ENV_TYPE env;
202 int val;
203
204 bytesDecoded = 0;
205 if ((val = setjmp (env)) == 0)
206 {
207 BDec (b, bytesDecoded, env);
208 return !b.ReadError();
209 }
210 else
211 return false;
212 }
213
214 void CountryName::Print (ostream &os) const
215 {
216 #ifndef NDEBUG
217 switch (choiceId)
218 {
219 case x121_dcc_codeCid:
220 os << "x121-dcc-code ";
221 if (x121_dcc_code)
222 os << *x121_dcc_code;
223 else
224 os << "-- void3 --\n";
225 break;
226
227 case iso_3166_alpha2_codeCid:
228 os << "iso-3166-alpha2-code ";
229 if (iso_3166_alpha2_code)
230 os << *iso_3166_alpha2_code;
231 else
232 os << "-- void3 --\n";
233 break;
234
235 } // end of switch
236 #endif /* NDEBUG */
237 } // CountryName::Print
238
239 AdministrationDomainName::AdministrationDomainName()
240 {
241 choiceId = numericCid;
242 #if TCL
243 numeric = new NumericString;
244 #else
245 numeric = NULL; // incomplete initialization of mandatory element!
246 #endif // TCL
247 }
248
249 AdministrationDomainName::AdministrationDomainName (const AdministrationDomainName &)
250 {
251 Asn1Error << "use of incompletely defined AdministrationDomainName::AdministrationDomainName (const AdministrationDomainName &)" << endl;
252 abort();
253 }
254
255 AdministrationDomainName::~AdministrationDomainName()
256 {
257 switch (choiceId)
258 {
259 case numericCid:
260 delete numeric;
261 break;
262 case printableCid:
263 delete printable;
264 break;
265 } // end of switch
266 } // end of destructor
267
268 AsnType *AdministrationDomainName::Clone() const
269 {
270 return new AdministrationDomainName;
271 }
272
273 AsnType *AdministrationDomainName::Copy() const
274 {
275 return new AdministrationDomainName (*this);
276 }
277
278 #if SNACC_DEEP_COPY
279 AdministrationDomainName &AdministrationDomainName::operator = (const AdministrationDomainName &that)
280 #else // SNACC_DEEP_COPY
281 AdministrationDomainName &AdministrationDomainName::operator = (const AdministrationDomainName &)
282 #endif // SNACC_DEEP_COPY
283 {
284 #if SNACC_DEEP_COPY
285 if (this != &that)
286 {
287 switch (choiceId)
288 {
289 case numericCid:
290 delete numeric;
291 break;
292 case printableCid:
293 delete printable;
294 break;
295 }
296 switch (choiceId = that.choiceId)
297 {
298 case numericCid:
299 numeric = new NumericString;
300 *numeric = *that.numeric;
301 break;
302 case printableCid:
303 printable = new PrintableString;
304 *printable = *that.printable;
305 break;
306 }
307 }
308
309 return *this;
310 #else // SNACC_DEEP_COPY
311 Asn1Error << "use of incompletely defined AdministrationDomainName &AdministrationDomainName::operator = (const AdministrationDomainName &)" << endl;
312 abort();
313 // if your compiler complains here, check the -novolat option
314 #endif // SNACC_DEEP_COPY
315 }
316
317 AsnLen
318 AdministrationDomainName::BEncContent (BUF_TYPE b)
319 {
320 AsnLen l;
321 switch (choiceId)
322 {
323 case numericCid:
324 l = numeric->BEncContent (b);
325 l += BEncDefLen (b, l);
326
327 l += BEncTag1 (b, UNIV, PRIM, NUMERICSTRING_TAG_CODE);
328 break;
329
330 case printableCid:
331 l = printable->BEncContent (b);
332 l += BEncDefLen (b, l);
333
334 l += BEncTag1 (b, UNIV, PRIM, PRINTABLESTRING_TAG_CODE);
335 break;
336
337 } // end switch
338 return l;
339 } // AdministrationDomainName::BEncContent
340
341
342 void AdministrationDomainName::BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
343 {
344 switch (tag)
345 {
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);
351 break;
352
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);
358 break;
359
360 default:
361 Asn1Error << "ERROR - unexpected tag in CHOICE" << endl;
362 longjmp (env, -102);
363 break;
364 } // end switch
365 } // AdministrationDomainName::BDecContent
366
367
368 AsnLen AdministrationDomainName::BEnc (BUF_TYPE b)
369 {
370 AsnLen l;
371 l = BEncContent (b);
372 l += BEncConsLen (b, l);
373 l += BEncTag1 (b, APPL, CONS, 2);
374 return l;
375 }
376
377 void AdministrationDomainName::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
378 {
379 AsnLen elmtLen;
380 AsnTag tag;
381 AsnLen extraLen1;
382
383 if (BDecTag (b, bytesDecoded, env) != MAKE_TAG_ID (APPL, CONS, 2)) {
384 Asn1Error << "AdministrationDomainName::BDec: ERROR - wrong tag" << endl;
385 longjmp (env, -103);
386 }
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);
395 }
396
397 int AdministrationDomainName::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded)
398 {
399 bytesEncoded = BEnc (b);
400 return !b.WriteError();
401 }
402
403 int AdministrationDomainName::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded)
404 {
405 ENV_TYPE env;
406 int val;
407
408 bytesDecoded = 0;
409 if ((val = setjmp (env)) == 0)
410 {
411 BDec (b, bytesDecoded, env);
412 return !b.ReadError();
413 }
414 else
415 return false;
416 }
417
418 void AdministrationDomainName::Print (ostream &os) const
419 {
420 #ifndef NDEBUG
421 switch (choiceId)
422 {
423 case numericCid:
424 os << "numeric ";
425 if (numeric)
426 os << *numeric;
427 else
428 os << "-- void3 --\n";
429 break;
430
431 case printableCid:
432 os << "printable ";
433 if (printable)
434 os << *printable;
435 else
436 os << "-- void3 --\n";
437 break;
438
439 } // end of switch
440 #endif /* NDEBUG */
441 } // AdministrationDomainName::Print
442
443 PrivateDomainName::PrivateDomainName()
444 {
445 choiceId = numericCid;
446 #if TCL
447 numeric = new NumericString;
448 #else
449 numeric = NULL; // incomplete initialization of mandatory element!
450 #endif // TCL
451 }
452
453 PrivateDomainName::PrivateDomainName (const PrivateDomainName &)
454 {
455 Asn1Error << "use of incompletely defined PrivateDomainName::PrivateDomainName (const PrivateDomainName &)" << endl;
456 abort();
457 }
458
459 PrivateDomainName::~PrivateDomainName()
460 {
461 switch (choiceId)
462 {
463 case numericCid:
464 delete numeric;
465 break;
466 case printableCid:
467 delete printable;
468 break;
469 } // end of switch
470 } // end of destructor
471
472 AsnType *PrivateDomainName::Clone() const
473 {
474 return new PrivateDomainName;
475 }
476
477 AsnType *PrivateDomainName::Copy() const
478 {
479 return new PrivateDomainName (*this);
480 }
481
482 #if SNACC_DEEP_COPY
483 PrivateDomainName &PrivateDomainName::operator = (const PrivateDomainName &that)
484 #else // SNACC_DEEP_COPY
485 PrivateDomainName &PrivateDomainName::operator = (const PrivateDomainName &)
486 #endif // SNACC_DEEP_COPY
487 {
488 #if SNACC_DEEP_COPY
489 if (this != &that)
490 {
491 switch (choiceId)
492 {
493 case numericCid:
494 delete numeric;
495 break;
496 case printableCid:
497 delete printable;
498 break;
499 }
500 switch (choiceId = that.choiceId)
501 {
502 case numericCid:
503 numeric = new NumericString;
504 *numeric = *that.numeric;
505 break;
506 case printableCid:
507 printable = new PrintableString;
508 *printable = *that.printable;
509 break;
510 }
511 }
512
513 return *this;
514 #else // SNACC_DEEP_COPY
515 Asn1Error << "use of incompletely defined PrivateDomainName &PrivateDomainName::operator = (const PrivateDomainName &)" << endl;
516 abort();
517 // if your compiler complains here, check the -novolat option
518 #endif // SNACC_DEEP_COPY
519 }
520
521 AsnLen
522 PrivateDomainName::BEncContent (BUF_TYPE b)
523 {
524 AsnLen l;
525 switch (choiceId)
526 {
527 case numericCid:
528 l = numeric->BEncContent (b);
529 l += BEncDefLen (b, l);
530
531 l += BEncTag1 (b, UNIV, PRIM, NUMERICSTRING_TAG_CODE);
532 break;
533
534 case printableCid:
535 l = printable->BEncContent (b);
536 l += BEncDefLen (b, l);
537
538 l += BEncTag1 (b, UNIV, PRIM, PRINTABLESTRING_TAG_CODE);
539 break;
540
541 } // end switch
542 return l;
543 } // PrivateDomainName::BEncContent
544
545
546 void PrivateDomainName::BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
547 {
548 switch (tag)
549 {
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);
555 break;
556
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);
562 break;
563
564 default:
565 Asn1Error << "ERROR - unexpected tag in CHOICE" << endl;
566 longjmp (env, -104);
567 break;
568 } // end switch
569 } // PrivateDomainName::BDecContent
570
571
572 AsnLen PrivateDomainName::BEnc (BUF_TYPE b)
573 {
574 AsnLen l;
575 l = BEncContent (b);
576 return l;
577 }
578
579 void PrivateDomainName::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
580 {
581 AsnLen elmtLen;
582 AsnTag tag;
583
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);
589 }
590
591 int PrivateDomainName::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded)
592 {
593 bytesEncoded = BEnc (b);
594 return !b.WriteError();
595 }
596
597 int PrivateDomainName::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded)
598 {
599 ENV_TYPE env;
600 int val;
601
602 bytesDecoded = 0;
603 if ((val = setjmp (env)) == 0)
604 {
605 BDec (b, bytesDecoded, env);
606 return !b.ReadError();
607 }
608 else
609 return false;
610 }
611
612 void PrivateDomainName::Print (ostream &os) const
613 {
614 #ifndef NDEBUG
615 switch (choiceId)
616 {
617 case numericCid:
618 os << "numeric ";
619 if (numeric)
620 os << *numeric;
621 else
622 os << "-- void3 --\n";
623 break;
624
625 case printableCid:
626 os << "printable ";
627 if (printable)
628 os << *printable;
629 else
630 os << "-- void3 --\n";
631 break;
632
633 } // end of switch
634 #endif /* NDEBUG */
635 } // PrivateDomainName::Print
636
637 PersonalName::PersonalName()
638 {
639 given_name = NULL;
640 initials = NULL;
641 generation_qualifier = NULL;
642 }
643
644 PersonalName::PersonalName (const PersonalName &)
645 {
646 Asn1Error << "use of incompletely defined PersonalName::PersonalName (const PersonalName &)" << endl;
647 abort();
648 }
649
650 PersonalName::~PersonalName()
651 {
652 delete given_name;
653 delete initials;
654 delete generation_qualifier;
655 }
656
657 AsnType *PersonalName::Clone() const
658 {
659 return new PersonalName;
660 }
661
662 AsnType *PersonalName::Copy() const
663 {
664 return new PersonalName (*this);
665 }
666
667 #if SNACC_DEEP_COPY
668 PersonalName &PersonalName::operator = (const PersonalName &that)
669 #else // SNACC_DEEP_COPY
670 PersonalName &PersonalName::operator = (const PersonalName &)
671 #endif // SNACC_DEEP_COPY
672 {
673 #if SNACC_DEEP_COPY
674 if (this != &that)
675 {
676 surname = that.surname;
677 if (that.given_name)
678 {
679 if (!given_name)
680 given_name = new PrintableString;
681 *given_name = *that.given_name;
682 }
683 else
684 {
685 delete given_name;
686 given_name = NULL;
687 }
688 if (that.initials)
689 {
690 if (!initials)
691 initials = new PrintableString;
692 *initials = *that.initials;
693 }
694 else
695 {
696 delete initials;
697 initials = NULL;
698 }
699 if (that.generation_qualifier)
700 {
701 if (!generation_qualifier)
702 generation_qualifier = new PrintableString;
703 *generation_qualifier = *that.generation_qualifier;
704 }
705 else
706 {
707 delete generation_qualifier;
708 generation_qualifier = NULL;
709 }
710 }
711
712 return *this;
713 #else // SNACC_DEEP_COPY
714 Asn1Error << "use of incompletely defined PersonalName &PersonalName::operator = (const PersonalName &)" << endl;
715 abort();
716 // if your compiler complains here, check the -novolat option
717 #endif // SNACC_DEEP_COPY
718 }
719
720 AsnLen PersonalName::BEncContent (BUF_TYPE b)
721 {
722 AsnLen totalLen = 0;
723 AsnLen l;
724
725 AsnBuf outputBuf;
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))
732 {
733 l = generation_qualifier->BEncContent (outputBuf);
734 l += BEncDefLen (outputBuf, l);
735
736 l += BEncTag1 (outputBuf, CNTX, PRIM, 3);
737 totalLen += l;
738 SNACC_BUFRESET_READ(&outputBuf);
739 SM_ReadFromAsnBuf(tmpEnc[iii], outputBuf,outputBuf.DataLen(),NULL);
740 SNACC_BUFRESET_WRITE(&outputBuf);
741 iii++;
742 }
743
744 if (NOT_NULL (initials))
745 {
746 l = initials->BEncContent (outputBuf);
747 l += BEncDefLen (outputBuf, l);
748
749 l += BEncTag1 (outputBuf, CNTX, PRIM, 2);
750 totalLen += l;
751 SNACC_BUFRESET_READ(&outputBuf);
752 SM_ReadFromAsnBuf(tmpEnc[iii], outputBuf,outputBuf.DataLen(),NULL);
753 SNACC_BUFRESET_WRITE(&outputBuf);
754 iii++;
755 }
756
757 if (NOT_NULL (given_name))
758 {
759 l = given_name->BEncContent (outputBuf);
760 l += BEncDefLen (outputBuf, l);
761
762 l += BEncTag1 (outputBuf, CNTX, PRIM, 1);
763 totalLen += l;
764 SNACC_BUFRESET_READ(&outputBuf);
765 SM_ReadFromAsnBuf(tmpEnc[iii], outputBuf,outputBuf.DataLen(),NULL);
766 SNACC_BUFRESET_WRITE(&outputBuf);
767 iii++;
768 }
769
770 l = surname.BEncContent (outputBuf);
771 l += BEncDefLen (outputBuf, l);
772
773 l += BEncTag1 (outputBuf, CNTX, PRIM, 0);
774 totalLen += l;
775 SNACC_BUFRESET_READ(&outputBuf);
776 SM_ReadFromAsnBuf(tmpEnc[iii], outputBuf,outputBuf.DataLen(),NULL);
777 SNACC_BUFRESET_WRITE(&outputBuf);
778 iii++;
779
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];
785 free(lpszBuf);
786 return totalLen;
787 } // PersonalName::BEncContent
788
789
790 void PersonalName::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
791 {
792 AsnTag tag1;
793 AsnLen setBytesDecoded = 0;
794 unsigned int mandatoryElmtsDecoded = 0;
795 AsnLen elmtLen1;
796
797 for (; (setBytesDecoded < elmtLen0) || (elmtLen0 == INDEFINITE_LEN); )
798 {
799 tag1 = BDecTag (b, setBytesDecoded, env);
800
801 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
802 {
803 BDEC_2ND_EOC_OCTET (b, setBytesDecoded, env)
804 break; /* exit for loop */
805 }
806 elmtLen1 = BDecLen (b, setBytesDecoded, env);
807 switch (tag1)
808 {
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++;
813 break;
814
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);
819 break;
820
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);
825 break;
826
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);
831 break;
832
833 default:
834 Asn1Error << "Unexpected Tag on SET elmt." << endl;
835 longjmp (env, -105);
836 } // end switch
837 } // end for loop
838 bytesDecoded += setBytesDecoded;
839 if (mandatoryElmtsDecoded != 1)
840 {
841 Asn1Error << "ERROR - non-optional SET element missing." << endl;
842 longjmp (env, -106);
843 }
844 } // PersonalName::BDecContent
845
846 AsnLen
847 PersonalName::BEnc (BUF_TYPE b)
848 {
849 AsnLen l;
850 l = BEncContent (b);
851 l += BEncConsLen (b, l);
852 l += BEncTag1 (b, UNIV, CONS, SET_TAG_CODE);
853 return l;
854 }
855
856 void PersonalName::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
857 {
858 AsnTag tag;
859 AsnLen elmtLen1;
860
861 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SET_TAG_CODE))
862 {
863 Asn1Error << "PersonalName::BDec: ERROR - wrong tag" << endl;
864 longjmp (env, -107);
865 }
866 elmtLen1 = BDecLen (b, bytesDecoded, env);
867 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
868 }
869
870 int PersonalName::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded)
871 {
872 bytesEncoded = BEnc (b);
873 return !b.WriteError();
874 }
875
876 int PersonalName::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded)
877 {
878 ENV_TYPE env;
879 int val;
880
881 bytesDecoded = 0;
882 if ((val = setjmp (env)) == 0)
883 {
884 BDec (b, bytesDecoded, env);
885 return !b.ReadError();
886 }
887 else
888 return false;
889 }
890
891 void PersonalName::Print (ostream &os) const
892 {
893 #ifndef NDEBUG
894 os << "{ -- SET --" << endl;
895 indentG += stdIndentG;
896
897 {
898 Indent (os, indentG);
899 os << "surname ";
900 os << surname;
901 }
902
903 if (NOT_NULL (given_name))
904 {
905 os << ","<< endl;
906 Indent (os, indentG);
907 os << "given-name ";
908 os << *given_name;
909 }
910 else
911 os << "-- void2 --\n";
912
913 if (NOT_NULL (initials))
914 {
915 os << ","<< endl;
916 Indent (os, indentG);
917 os << "initials ";
918 os << *initials;
919 }
920 else
921 os << "-- void2 --\n";
922
923 if (NOT_NULL (generation_qualifier))
924 {
925 os << ","<< endl;
926 Indent (os, indentG);
927 os << "generation-qualifier ";
928 os << *generation_qualifier;
929 }
930 else
931 os << "-- void2 --\n";
932
933 os << endl;
934 indentG -= stdIndentG;
935 Indent (os, indentG);
936 os << "}";
937 #endif /* NDEBUG */
938 } // PersonalName - operator <<
939
940
941 DomainDefinedAttribute::DomainDefinedAttribute()
942 {
943 }
944
945 DomainDefinedAttribute::DomainDefinedAttribute (const DomainDefinedAttribute &)
946 {
947 Asn1Error << "use of incompletely defined DomainDefinedAttribute::DomainDefinedAttribute (const DomainDefinedAttribute &)" << endl;
948 abort();
949 }
950
951 DomainDefinedAttribute::~DomainDefinedAttribute()
952 {
953 }
954
955 AsnType *DomainDefinedAttribute::Clone() const
956 {
957 return new DomainDefinedAttribute;
958 }
959
960 AsnType *DomainDefinedAttribute::Copy() const
961 {
962 return new DomainDefinedAttribute (*this);
963 }
964
965 #if SNACC_DEEP_COPY
966 DomainDefinedAttribute &DomainDefinedAttribute::operator = (const DomainDefinedAttribute &that)
967 #else // SNACC_DEEP_COPY
968 DomainDefinedAttribute &DomainDefinedAttribute::operator = (const DomainDefinedAttribute &)
969 #endif // SNACC_DEEP_COPY
970 {
971 #if SNACC_DEEP_COPY
972 if (this != &that)
973 {
974 type = that.type;
975 value = that.value;
976 }
977
978 return *this;
979 #else // SNACC_DEEP_COPY
980 Asn1Error << "use of incompletely defined DomainDefinedAttribute &DomainDefinedAttribute::operator = (const DomainDefinedAttribute &)" << endl;
981 abort();
982 // if your compiler complains here, check the -novolat option
983 #endif // SNACC_DEEP_COPY
984 }
985
986 AsnLen
987 DomainDefinedAttribute::BEncContent (BUF_TYPE b)
988 {
989 AsnLen totalLen = 0;
990 AsnLen l;
991
992 l = value.BEncContent (b);
993 l += BEncDefLen (b, l);
994
995 l += BEncTag1 (b, UNIV, PRIM, PRINTABLESTRING_TAG_CODE);
996 totalLen += l;
997
998 l = type.BEncContent (b);
999 l += BEncDefLen (b, l);
1000
1001 l += BEncTag1 (b, UNIV, PRIM, PRINTABLESTRING_TAG_CODE);
1002 totalLen += l;
1003
1004 return totalLen;
1005 } // DomainDefinedAttribute::BEncContent
1006
1007
1008 void DomainDefinedAttribute::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
1009 {
1010 AsnTag tag1;
1011 AsnLen seqBytesDecoded = 0;
1012 AsnLen elmtLen1;
1013 tag1 = BDecTag (b, seqBytesDecoded, env);
1014
1015 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, PRINTABLESTRING_TAG_CODE))
1016 || (tag1 == MAKE_TAG_ID (UNIV, CONS, PRINTABLESTRING_TAG_CODE)))
1017 {
1018 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1019 type.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1020 tag1 = BDecTag (b, seqBytesDecoded, env);
1021 }
1022 else
1023 {
1024 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1025 longjmp (env, -108);
1026 }
1027
1028 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, PRINTABLESTRING_TAG_CODE))
1029 || (tag1 == MAKE_TAG_ID (UNIV, CONS, PRINTABLESTRING_TAG_CODE)))
1030 {
1031 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1032 value.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1033 }
1034 else
1035 {
1036 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1037 longjmp (env, -109);
1038 }
1039
1040 bytesDecoded += seqBytesDecoded;
1041 if (elmtLen0 == INDEFINITE_LEN)
1042 {
1043 BDecEoc (b, bytesDecoded, env);
1044 return;
1045 }
1046 else if (seqBytesDecoded != elmtLen0)
1047 {
1048 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
1049 longjmp (env, -110);
1050 }
1051 else
1052 return;
1053 } // DomainDefinedAttribute::BDecContent
1054
1055 AsnLen DomainDefinedAttribute::BEnc (BUF_TYPE b)
1056 {
1057 AsnLen l;
1058 l = BEncContent (b);
1059 l += BEncConsLen (b, l);
1060 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
1061 return l;
1062 }
1063
1064 void DomainDefinedAttribute::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
1065 {
1066 AsnTag tag;
1067 AsnLen elmtLen1;
1068
1069 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
1070 {
1071 Asn1Error << "DomainDefinedAttribute::BDec: ERROR - wrong tag" << endl;
1072 longjmp (env, -111);
1073 }
1074 elmtLen1 = BDecLen (b, bytesDecoded, env);
1075 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
1076 }
1077
1078 int DomainDefinedAttribute::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded)
1079 {
1080 bytesEncoded = BEnc (b);
1081 return !b.WriteError();
1082 }
1083
1084 int DomainDefinedAttribute::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded)
1085 {
1086 ENV_TYPE env;
1087 int val;
1088
1089 bytesDecoded = 0;
1090 if ((val = setjmp (env)) == 0)
1091 {
1092 BDec (b, bytesDecoded, env);
1093 return !b.ReadError();
1094 }
1095 else
1096 return false;
1097 }
1098
1099 void DomainDefinedAttribute::Print (ostream &os) const
1100 {
1101 #ifndef NDEBUG
1102 os << "{ -- SEQUENCE --" << endl;
1103 indentG += stdIndentG;
1104
1105 {
1106 Indent (os, indentG);
1107 os << "type ";
1108 os << type;
1109 os << "," << endl;
1110 }
1111
1112 {
1113 Indent (os, indentG);
1114 os << "value ";
1115 os << value;
1116 }
1117
1118 os << endl;
1119 indentG -= stdIndentG;
1120 Indent (os, indentG);
1121 os << "}";
1122 #endif /* NDEBUG */
1123 } // DomainDefinedAttribute::Print
1124
1125
1126 ExtensionAttribute::ExtensionAttribute()
1127 {
1128 }
1129
1130 ExtensionAttribute::ExtensionAttribute (const ExtensionAttribute &)
1131 {
1132 Asn1Error << "use of incompletely defined ExtensionAttribute::ExtensionAttribute (const ExtensionAttribute &)" << endl;
1133 abort();
1134 }
1135
1136 ExtensionAttribute::~ExtensionAttribute()
1137 {
1138 }
1139
1140 AsnType *ExtensionAttribute::Clone() const
1141 {
1142 return new ExtensionAttribute;
1143 }
1144
1145 AsnType *ExtensionAttribute::Copy() const
1146 {
1147 return new ExtensionAttribute (*this);
1148 }
1149
1150 #if SNACC_DEEP_COPY
1151 ExtensionAttribute &ExtensionAttribute::operator = (const ExtensionAttribute &that)
1152 #else // SNACC_DEEP_COPY
1153 ExtensionAttribute &ExtensionAttribute::operator = (const ExtensionAttribute &)
1154 #endif // SNACC_DEEP_COPY
1155 {
1156 #if SNACC_DEEP_COPY
1157 if (this != &that)
1158 {
1159 extension_attribute_type = that.extension_attribute_type;
1160 extension_attribute_value = that.extension_attribute_value;
1161 }
1162
1163 return *this;
1164 #else // SNACC_DEEP_COPY
1165 Asn1Error << "use of incompletely defined ExtensionAttribute &ExtensionAttribute::operator = (const ExtensionAttribute &)" << endl;
1166 abort();
1167 // if your compiler complains here, check the -novolat option
1168 #endif // SNACC_DEEP_COPY
1169 }
1170
1171 AsnLen
1172 ExtensionAttribute::BEncContent (BUF_TYPE b)
1173 {
1174 AsnLen totalLen = 0;
1175 AsnLen l;
1176
1177 BEncEocIfNec (b);
1178 ENC_LOAD_ANYBUF(&extension_attribute_value, b, l);
1179 l += BEncConsLen (b, l);
1180
1181 l += BEncTag1 (b, CNTX, CONS, 1);
1182 totalLen += l;
1183
1184 l = extension_attribute_type.BEncContent (b);
1185 BEncDefLenTo127 (b, l);
1186 l++;
1187
1188 l += BEncTag1 (b, CNTX, PRIM, 0);
1189 totalLen += l;
1190
1191 return totalLen;
1192 } // ExtensionAttribute::BEncContent
1193
1194
1195 void ExtensionAttribute::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
1196 {
1197 AsnTag tag1;
1198 AsnLen seqBytesDecoded = 0;
1199 AsnLen elmtLen1;
1200 tag1 = BDecTag (b, seqBytesDecoded, env);
1201
1202 if ((tag1 == MAKE_TAG_ID (CNTX, PRIM, 0)))
1203 {
1204 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1205 extension_attribute_type.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1206 tag1 = BDecTag (b, seqBytesDecoded, env);
1207 }
1208 else
1209 {
1210 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1211 longjmp (env, -112);
1212 }
1213
1214 if ((tag1 == MAKE_TAG_ID (CNTX, CONS, 1)))
1215 {
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);
1220
1221 }
1222 else
1223 {
1224 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1225 longjmp (env, -113);
1226 }
1227
1228 bytesDecoded += seqBytesDecoded;
1229 if (elmtLen0 == INDEFINITE_LEN)
1230 {
1231 BDecEoc (b, bytesDecoded, env);
1232 return;
1233 }
1234 else if (seqBytesDecoded != elmtLen0)
1235 {
1236 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
1237 longjmp (env, -114);
1238 }
1239 else
1240 return;
1241 } // ExtensionAttribute::BDecContent
1242
1243 AsnLen ExtensionAttribute::BEnc (BUF_TYPE b)
1244 {
1245 AsnLen l;
1246 l = BEncContent (b);
1247 l += BEncConsLen (b, l);
1248 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
1249 return l;
1250 }
1251
1252 void ExtensionAttribute::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
1253 {
1254 AsnTag tag;
1255 AsnLen elmtLen1;
1256
1257 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
1258 {
1259 Asn1Error << "ExtensionAttribute::BDec: ERROR - wrong tag" << endl;
1260 longjmp (env, -115);
1261 }
1262 elmtLen1 = BDecLen (b, bytesDecoded, env);
1263 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
1264 }
1265
1266 int ExtensionAttribute::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded)
1267 {
1268 bytesEncoded = BEnc (b);
1269 return !b.WriteError();
1270 }
1271
1272 int ExtensionAttribute::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded)
1273 {
1274 ENV_TYPE env;
1275 int val;
1276
1277 bytesDecoded = 0;
1278 if ((val = setjmp (env)) == 0)
1279 {
1280 BDec (b, bytesDecoded, env);
1281 return !b.ReadError();
1282 }
1283 else
1284 return false;
1285 }
1286
1287 void ExtensionAttribute::Print (ostream &os) const
1288 {
1289 #ifndef NDEBUG
1290 os << "{ -- SEQUENCE --" << endl;
1291 indentG += stdIndentG;
1292
1293 {
1294 Indent (os, indentG);
1295 os << "extension-attribute-type ";
1296 os << extension_attribute_type;
1297 os << "," << endl;
1298 }
1299
1300 {
1301 Indent (os, indentG);
1302 os << "extension-attribute-value ";
1303 os << extension_attribute_value;
1304 }
1305
1306 os << endl;
1307 indentG -= stdIndentG;
1308 Indent (os, indentG);
1309 os << "}";
1310 #endif /* NDEBUG */
1311 } // ExtensionAttribute::Print
1312
1313
1314 TeletexDomainDefinedAttribute::TeletexDomainDefinedAttribute()
1315 {
1316 }
1317
1318 TeletexDomainDefinedAttribute::TeletexDomainDefinedAttribute (const TeletexDomainDefinedAttribute &)
1319 {
1320 Asn1Error << "use of incompletely defined TeletexDomainDefinedAttribute::TeletexDomainDefinedAttribute (const TeletexDomainDefinedAttribute &)" << endl;
1321 abort();
1322 }
1323
1324 TeletexDomainDefinedAttribute::~TeletexDomainDefinedAttribute()
1325 {
1326 }
1327
1328 AsnType *TeletexDomainDefinedAttribute::Clone() const
1329 {
1330 return new TeletexDomainDefinedAttribute;
1331 }
1332
1333 AsnType *TeletexDomainDefinedAttribute::Copy() const
1334 {
1335 return new TeletexDomainDefinedAttribute (*this);
1336 }
1337
1338 #if SNACC_DEEP_COPY
1339 TeletexDomainDefinedAttribute &TeletexDomainDefinedAttribute::operator = (const TeletexDomainDefinedAttribute &that)
1340 #else // SNACC_DEEP_COPY
1341 TeletexDomainDefinedAttribute &TeletexDomainDefinedAttribute::operator = (const TeletexDomainDefinedAttribute &)
1342 #endif // SNACC_DEEP_COPY
1343 {
1344 #if SNACC_DEEP_COPY
1345 if (this != &that)
1346 {
1347 type = that.type;
1348 value = that.value;
1349 }
1350
1351 return *this;
1352 #else // SNACC_DEEP_COPY
1353 Asn1Error << "use of incompletely defined TeletexDomainDefinedAttribute &TeletexDomainDefinedAttribute::operator = (const TeletexDomainDefinedAttribute &)" << endl;
1354 abort();
1355 // if your compiler complains here, check the -novolat option
1356 #endif // SNACC_DEEP_COPY
1357 }
1358
1359 AsnLen
1360 TeletexDomainDefinedAttribute::BEncContent (BUF_TYPE b)
1361 {
1362 AsnLen totalLen = 0;
1363 AsnLen l;
1364
1365 l = value.BEncContent (b);
1366 l += BEncDefLen (b, l);
1367
1368 l += BEncTag1 (b, UNIV, PRIM, TELETEXSTRING_TAG_CODE);
1369 totalLen += l;
1370
1371 l = type.BEncContent (b);
1372 l += BEncDefLen (b, l);
1373
1374 l += BEncTag1 (b, UNIV, PRIM, TELETEXSTRING_TAG_CODE);
1375 totalLen += l;
1376
1377 return totalLen;
1378 } // TeletexDomainDefinedAttribute::BEncContent
1379
1380
1381 void TeletexDomainDefinedAttribute::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
1382 {
1383 AsnTag tag1;
1384 AsnLen seqBytesDecoded = 0;
1385 AsnLen elmtLen1;
1386 tag1 = BDecTag (b, seqBytesDecoded, env);
1387
1388 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, TELETEXSTRING_TAG_CODE))
1389 || (tag1 == MAKE_TAG_ID (UNIV, CONS, TELETEXSTRING_TAG_CODE)))
1390 {
1391 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1392 type.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1393 tag1 = BDecTag (b, seqBytesDecoded, env);
1394 }
1395 else
1396 {
1397 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1398 longjmp (env, -116);
1399 }
1400
1401 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, TELETEXSTRING_TAG_CODE))
1402 || (tag1 == MAKE_TAG_ID (UNIV, CONS, TELETEXSTRING_TAG_CODE)))
1403 {
1404 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1405 value.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1406 }
1407 else
1408 {
1409 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1410 longjmp (env, -117);
1411 }
1412
1413 bytesDecoded += seqBytesDecoded;
1414 if (elmtLen0 == INDEFINITE_LEN)
1415 {
1416 BDecEoc (b, bytesDecoded, env);
1417 return;
1418 }
1419 else if (seqBytesDecoded != elmtLen0)
1420 {
1421 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
1422 longjmp (env, -118);
1423 }
1424 else
1425 return;
1426 } // TeletexDomainDefinedAttribute::BDecContent
1427
1428 AsnLen TeletexDomainDefinedAttribute::BEnc (BUF_TYPE b)
1429 {
1430 AsnLen l;
1431 l = BEncContent (b);
1432 l += BEncConsLen (b, l);
1433 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
1434 return l;
1435 }
1436
1437 void TeletexDomainDefinedAttribute::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
1438 {
1439 AsnTag tag;
1440 AsnLen elmtLen1;
1441
1442 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
1443 {
1444 Asn1Error << "TeletexDomainDefinedAttribute::BDec: ERROR - wrong tag" << endl;
1445 longjmp (env, -119);
1446 }
1447 elmtLen1 = BDecLen (b, bytesDecoded, env);
1448 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
1449 }
1450
1451 int TeletexDomainDefinedAttribute::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded)
1452 {
1453 bytesEncoded = BEnc (b);
1454 return !b.WriteError();
1455 }
1456
1457 int TeletexDomainDefinedAttribute::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded)
1458 {
1459 ENV_TYPE env;
1460 int val;
1461
1462 bytesDecoded = 0;
1463 if ((val = setjmp (env)) == 0)
1464 {
1465 BDec (b, bytesDecoded, env);
1466 return !b.ReadError();
1467 }
1468 else
1469 return false;
1470 }
1471
1472 void TeletexDomainDefinedAttribute::Print (ostream &os) const
1473 {
1474 #ifndef NDEBUG
1475 os << "{ -- SEQUENCE --" << endl;
1476 indentG += stdIndentG;
1477
1478 {
1479 Indent (os, indentG);
1480 os << "type ";
1481 os << type;
1482 os << "," << endl;
1483 }
1484
1485 {
1486 Indent (os, indentG);
1487 os << "value ";
1488 os << value;
1489 }
1490
1491 os << endl;
1492 indentG -= stdIndentG;
1493 Indent (os, indentG);
1494 os << "}";
1495 #endif /* NDEBUG */
1496 } // TeletexDomainDefinedAttribute::Print
1497
1498
1499 AsnType *OrganizationUnitNames::Clone() const
1500 {
1501 return new OrganizationUnitNames;
1502 }
1503
1504 AsnType *OrganizationUnitNames::Copy() const
1505 {
1506 return new OrganizationUnitNames (*this);
1507 }
1508
1509 AsnLen OrganizationUnitNames::BEnc (BUF_TYPE b)
1510 {
1511 AsnLen l;
1512 l = BEncContent (b);
1513 l += BEncConsLen (b, l);
1514 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
1515 return l;
1516 }
1517
1518 void OrganizationUnitNames::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
1519 {
1520 AsnTag tag;
1521 AsnLen elmtLen1;
1522
1523 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
1524 {
1525 Asn1Error << "OrganizationUnitNames::BDec: ERROR - wrong tag" << endl;
1526 longjmp (env, -120);
1527 }
1528 elmtLen1 = BDecLen (b, bytesDecoded, env);
1529 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
1530 }
1531
1532 OrganizationUnitNames::OrganizationUnitNames (const OrganizationUnitNames &)
1533 {
1534 Asn1Error << "use of incompletely defined OrganizationUnitNames::OrganizationUnitNames (const OrganizationUnitNames &)" << endl;
1535 abort();
1536 }
1537
1538 OrganizationUnitNames::~OrganizationUnitNames()
1539 {
1540 SetCurrToFirst();
1541 for (; Curr() != NULL; RemoveCurrFromList())
1542 ;
1543 } // end of destructor
1544
1545 #if SNACC_DEEP_COPY
1546 OrganizationUnitNames &OrganizationUnitNames::operator = (const OrganizationUnitNames &that)
1547 #else // SNACC_DEEP_COPY
1548 OrganizationUnitNames &OrganizationUnitNames::operator = (const OrganizationUnitNames &)
1549 #endif // SNACC_DEEP_COPY
1550 {
1551 #if SNACC_DEEP_COPY
1552 if (this != &that)
1553 {
1554 SetCurrToFirst();
1555 for (; Curr(); RemoveCurrFromList())
1556 ;
1557
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);
1563 }
1564
1565 return *this;
1566 #else // SNACC_DEEP_COPY
1567 Asn1Error << "use of incompletely defined OrganizationUnitNames &OrganizationUnitNames::operator = (const OrganizationUnitNames &)" << endl;
1568 abort();
1569 // if your compiler complains here, check the -novolat option
1570 #endif // SNACC_DEEP_COPY
1571 }
1572
1573 void OrganizationUnitNames::Print (ostream &os) const
1574 {
1575 #ifndef NDEBUG
1576 os << "{ -- SEQUENCE/SET OF -- " << endl;
1577 indentG += stdIndentG;
1578 //SetCurrToFirst();
1579 //for (; Curr() != NULL; GoNext())
1580 for (const AsnListElmt *run=first; run; run=run->next)
1581 {
1582 Indent (os, indentG);
1583 //os << *Curr();
1584 os << *run->elmt;
1585 //if (Curr() != Last())
1586 if (run != last)
1587 os << ",";
1588 os << endl;
1589 }
1590 indentG -= stdIndentG;
1591 Indent (os, indentG);
1592 os << "}\n";
1593 #endif /* NDEBUG */
1594
1595
1596 } // Print
1597
1598
1599 void OrganizationUnitNames::SetCurrElmt (unsigned long int index)
1600 {
1601 unsigned long int i;
1602 curr = first;
1603 if (count)
1604 for (i = 0; (i < (count-1)) && (i < index); i++)
1605 curr = curr->next;
1606 } // OrganizationUnitNames::SetCurrElmt
1607
1608
1609 unsigned long int OrganizationUnitNames::GetCurrElmtIndex()
1610 {
1611 unsigned long int i;
1612 AsnListElmt *tmp;
1613 if (curr != NULL)
1614 {
1615 for (i = 0, tmp = first; tmp != NULL; i++)
1616 {
1617 if (tmp == curr)
1618 return i;
1619 else
1620 tmp = tmp->next;
1621 }
1622 }
1623 return count;
1624 } // OrganizationUnitNames::GetCurrElmtIndex
1625
1626
1627 // alloc new list elmt, put at end of list
1628 // and return the component type
1629 OrganizationUnitName *OrganizationUnitNames::Append()
1630 {
1631 AsnListElmt *newElmt;
1632 newElmt = new AsnListElmt;
1633 newElmt->elmt = new OrganizationUnitName;
1634 newElmt->next = NULL;
1635 if (last == NULL)
1636 {
1637 newElmt->prev = NULL;
1638 first = last = newElmt;
1639 }
1640 else
1641 {
1642 newElmt->prev = last;
1643 last->next = newElmt;
1644 last = newElmt;
1645 }
1646 count++;
1647 return (curr = newElmt)->elmt;
1648 } // OrganizationUnitNames::Append
1649
1650
1651 // alloc new list elmt, put at begining of list
1652 // and return the component type
1653 OrganizationUnitName *OrganizationUnitNames::Prepend()
1654 {
1655 AsnListElmt *newElmt;
1656 newElmt = new AsnListElmt;
1657 newElmt->elmt = new OrganizationUnitName;
1658 newElmt->prev = NULL;
1659 if (first == NULL)
1660 {
1661 newElmt->next = NULL;
1662 first = last = newElmt;
1663 }
1664 else
1665 {
1666 newElmt->next = first;
1667 first->prev = newElmt;
1668 first = newElmt;
1669 }
1670 count++;
1671 return (curr = newElmt)->elmt;
1672 } // OrganizationUnitNames::Prepend
1673
1674
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()
1680 {
1681 AsnListElmt *newElmt;
1682 newElmt = new AsnListElmt;
1683 newElmt->elmt = new OrganizationUnitName;
1684 if (curr == NULL)
1685 {
1686 newElmt->next = first;
1687 newElmt->prev = NULL;
1688 first = newElmt;
1689 if (last == NULL)
1690 last = newElmt;
1691 }
1692 else
1693 {
1694 newElmt->next = curr;
1695 newElmt->prev = curr->prev;
1696 curr->prev = newElmt;
1697 if (curr == first)
1698 first = newElmt;
1699 else
1700 newElmt->prev->next = newElmt;
1701 }
1702 count++;
1703 return (curr = newElmt)->elmt;
1704 } // OrganizationUnitNames::InsertBefore
1705
1706
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()
1712 {
1713 AsnListElmt *newElmt;
1714 newElmt = new AsnListElmt;
1715 newElmt->elmt = new OrganizationUnitName;
1716 if (curr == NULL)
1717 {
1718 newElmt->prev = last;
1719 newElmt->next = NULL;
1720 last = newElmt;
1721 if (first == NULL)
1722 first = newElmt;
1723 }
1724 else
1725 {
1726 newElmt->prev = curr;
1727 newElmt->next = curr->next;
1728 curr->next = newElmt;
1729 if (curr == last)
1730 last = newElmt;
1731 else
1732 newElmt->next->prev = newElmt;
1733 }
1734 count++;
1735 return (curr = newElmt)->elmt;
1736 } // OrganizationUnitNames::InsertAfter
1737
1738
1739 OrganizationUnitNames &OrganizationUnitNames::AppendCopy (OrganizationUnitName &elmt)
1740 {
1741 AsnListElmt *newElmt;
1742 newElmt = new AsnListElmt;
1743 newElmt->elmt = new OrganizationUnitName;
1744 *newElmt->elmt = elmt;
1745 newElmt->next = NULL;
1746 if (last == NULL)
1747 {
1748 newElmt->prev = NULL;
1749 first = last = newElmt;
1750 }
1751 else
1752 {
1753 newElmt->prev = last;
1754 last->next = newElmt;
1755 last = newElmt;
1756 }
1757 count++;
1758 return *this;
1759 } // AppendCopy
1760
1761
1762 OrganizationUnitNames &OrganizationUnitNames::PrependCopy (OrganizationUnitName &elmt)
1763 {
1764 AsnListElmt *newElmt;
1765 newElmt = new AsnListElmt;
1766 newElmt->elmt = new OrganizationUnitName;
1767 *newElmt->elmt = elmt;
1768 newElmt->prev = NULL;
1769 if (first == NULL)
1770 {
1771 newElmt->next = NULL;
1772 first = last = newElmt;
1773 }
1774 else
1775 {
1776 newElmt->next = first;
1777 first->prev = newElmt;
1778 first = newElmt;
1779 }
1780 count++;
1781 return *this;
1782 } // OrganizationUnitNames::PrependCopy
1783
1784
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)
1791 {
1792 AsnListElmt *newElmt;
1793
1794 newElmt = new AsnListElmt;
1795 newElmt->elmt = new OrganizationUnitName;
1796 *newElmt->elmt = elmt;
1797
1798 if (curr == NULL)
1799 {
1800 newElmt->next = first;
1801 newElmt->prev = NULL;
1802 first = newElmt;
1803 if (last == NULL)
1804 last = newElmt;
1805 }
1806 else
1807 {
1808 newElmt->next = curr;
1809 newElmt->prev = curr->prev;
1810 curr->prev = newElmt;
1811 if (curr == first)
1812 first = newElmt;
1813 else
1814 newElmt->prev->next = newElmt;
1815 }
1816 count++;
1817 return *this;
1818 } // OrganizationUnitNames::InsertBeforeAndCopy
1819
1820
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)
1827 {
1828 AsnListElmt *newElmt;
1829
1830 newElmt = new AsnListElmt;
1831 newElmt->elmt = new OrganizationUnitName;
1832 *newElmt->elmt = elmt;
1833 if (curr == NULL)
1834 {
1835 newElmt->prev = last;
1836 newElmt->next = NULL;
1837 last = newElmt;
1838 if (first == NULL)
1839 first = newElmt;
1840 }
1841 else
1842 {
1843 newElmt->prev = curr;
1844 newElmt->next = curr->next;
1845 curr->next = newElmt;
1846 if (curr == last)
1847 last = newElmt;
1848 else
1849 newElmt->next->prev = newElmt;
1850 }
1851 count++;
1852 return *this;
1853 } // OrganizationUnitNames::InsertAfterAndCopy
1854
1855
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()
1861 {
1862 AsnListElmt *del_elmt;
1863
1864 if (curr != NULL)
1865 {
1866 del_elmt = curr;
1867 count--;
1868
1869 if (count == 0)
1870 first = last = curr = NULL;
1871 else if (curr == first)
1872 {
1873 curr = first= first->next;
1874 first->prev = NULL;
1875 }
1876 else if (curr == last)
1877 {
1878 curr = last = last->prev;
1879 last->next = NULL;
1880 }
1881 else
1882 {
1883 curr->prev->next = curr->next;
1884 curr->next->prev = curr->prev;
1885 }
1886
1887 delete del_elmt->elmt;
1888 delete del_elmt;
1889 }
1890 }
1891
1892
1893 AsnLen OrganizationUnitNames::BEncContent (BUF_TYPE b)
1894 {
1895 AsnListElmt *currElmt;
1896 AsnLen elmtLen;
1897 AsnLen totalLen = 0;
1898 for (currElmt = last; currElmt != NULL; currElmt = currElmt->prev)
1899 {
1900 elmtLen = currElmt->elmt->BEncContent (b);
1901 elmtLen += BEncDefLen (b, elmtLen);
1902
1903 elmtLen += BEncTag1 (b, UNIV, PRIM, PRINTABLESTRING_TAG_CODE);
1904 totalLen += elmtLen;
1905 }
1906 return totalLen;
1907 } // OrganizationUnitNames::BEncContent
1908
1909
1910 void OrganizationUnitNames::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0,
1911 AsnLen &bytesDecoded, ENV_TYPE env)
1912 {
1913 OrganizationUnitName *listElmt;
1914 AsnTag tag1;
1915 AsnLen listBytesDecoded = 0;
1916 AsnLen elmtLen1;
1917
1918 while ((listBytesDecoded < elmtLen0) || (elmtLen0 == INDEFINITE_LEN))
1919 {
1920 tag1 = BDecTag (b, listBytesDecoded, env);
1921 if ((tag1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
1922 {
1923 BDEC_2ND_EOC_OCTET (b, listBytesDecoded, env);
1924 break;
1925 }
1926 if ((tag1 != MAKE_TAG_ID (UNIV, PRIM, PRINTABLESTRING_TAG_CODE))
1927 && (tag1 != MAKE_TAG_ID (UNIV, CONS, PRINTABLESTRING_TAG_CODE)))
1928 {
1929 Asn1Error << "Unexpected Tag" << endl;
1930 longjmp (env, -121);
1931 }
1932
1933 elmtLen1 = BDecLen (b, listBytesDecoded, env);
1934 listElmt = Append();
1935 listElmt->BDecContent (b, tag1, elmtLen1, listBytesDecoded, env);
1936 }
1937
1938 bytesDecoded += listBytesDecoded;
1939 } // OrganizationUnitNames::BDecContent
1940
1941
1942 AsnType *DomainDefinedAttributes::Clone() const
1943 {
1944 return new DomainDefinedAttributes;
1945 }
1946
1947 AsnType *DomainDefinedAttributes::Copy() const
1948 {
1949 return new DomainDefinedAttributes (*this);
1950 }
1951
1952 AsnLen DomainDefinedAttributes::BEnc (BUF_TYPE b)
1953 {
1954 AsnLen l;
1955 l = BEncContent (b);
1956 l += BEncConsLen (b, l);
1957 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
1958 return l;
1959 }
1960
1961 void DomainDefinedAttributes::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
1962 {
1963 AsnTag tag;
1964 AsnLen elmtLen1;
1965
1966 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
1967 {
1968 Asn1Error << "DomainDefinedAttributes::BDec: ERROR - wrong tag" << endl;
1969 longjmp (env, -122);
1970 }
1971 elmtLen1 = BDecLen (b, bytesDecoded, env);
1972 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
1973 }
1974
1975 DomainDefinedAttributes::DomainDefinedAttributes (const DomainDefinedAttributes &)
1976 {
1977 Asn1Error << "use of incompletely defined DomainDefinedAttributes::DomainDefinedAttributes (const DomainDefinedAttributes &)" << endl;
1978 abort();
1979 }
1980
1981 DomainDefinedAttributes::~DomainDefinedAttributes()
1982 {
1983 SetCurrToFirst();
1984 for (; Curr() != NULL; RemoveCurrFromList())
1985 ;
1986 } // end of destructor
1987
1988 #if SNACC_DEEP_COPY
1989 DomainDefinedAttributes &DomainDefinedAttributes::operator = (const DomainDefinedAttributes &that)
1990 #else // SNACC_DEEP_COPY
1991 DomainDefinedAttributes &DomainDefinedAttributes::operator = (const DomainDefinedAttributes &)
1992 #endif // SNACC_DEEP_COPY
1993 {
1994 #if SNACC_DEEP_COPY
1995 if (this != &that)
1996 {
1997 SetCurrToFirst();
1998 for (; Curr(); RemoveCurrFromList())
1999 ;
2000
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);
2006 }
2007
2008 return *this;
2009 #else // SNACC_DEEP_COPY
2010 Asn1Error << "use of incompletely defined DomainDefinedAttributes &DomainDefinedAttributes::operator = (const DomainDefinedAttributes &)" << endl;
2011 abort();
2012 // if your compiler complains here, check the -novolat option
2013 #endif // SNACC_DEEP_COPY
2014 }
2015
2016 void DomainDefinedAttributes::Print (ostream &os) const
2017 {
2018 #ifndef NDEBUG
2019 os << "{ -- SEQUENCE/SET OF -- " << endl;
2020 indentG += stdIndentG;
2021 //SetCurrToFirst();
2022 //for (; Curr() != NULL; GoNext())
2023 for (const AsnListElmt *run=first; run; run=run->next)
2024 {
2025 Indent (os, indentG);
2026 //os << *Curr();
2027 os << *run->elmt;
2028 //if (Curr() != Last())
2029 if (run != last)
2030 os << ",";
2031 os << endl;
2032 }
2033 indentG -= stdIndentG;
2034 Indent (os, indentG);
2035 os << "}\n";
2036 #endif /* NDEBUG */
2037
2038
2039 } // Print
2040
2041
2042 void DomainDefinedAttributes::SetCurrElmt (unsigned long int index)
2043 {
2044 unsigned long int i;
2045 curr = first;
2046 if (count)
2047 for (i = 0; (i < (count-1)) && (i < index); i++)
2048 curr = curr->next;
2049 } // DomainDefinedAttributes::SetCurrElmt
2050
2051
2052 unsigned long int DomainDefinedAttributes::GetCurrElmtIndex()
2053 {
2054 unsigned long int i;
2055 AsnListElmt *tmp;
2056 if (curr != NULL)
2057 {
2058 for (i = 0, tmp = first; tmp != NULL; i++)
2059 {
2060 if (tmp == curr)
2061 return i;
2062 else
2063 tmp = tmp->next;
2064 }
2065 }
2066 return count;
2067 } // DomainDefinedAttributes::GetCurrElmtIndex
2068
2069
2070 // alloc new list elmt, put at end of list
2071 // and return the component type
2072 DomainDefinedAttribute *DomainDefinedAttributes::Append()
2073 {
2074 AsnListElmt *newElmt;
2075 newElmt = new AsnListElmt;
2076 newElmt->elmt = new DomainDefinedAttribute;
2077 newElmt->next = NULL;
2078 if (last == NULL)
2079 {
2080 newElmt->prev = NULL;
2081 first = last = newElmt;
2082 }
2083 else
2084 {
2085 newElmt->prev = last;
2086 last->next = newElmt;
2087 last = newElmt;
2088 }
2089 count++;
2090 return (curr = newElmt)->elmt;
2091 } // DomainDefinedAttributes::Append
2092
2093
2094 // alloc new list elmt, put at begining of list
2095 // and return the component type
2096 DomainDefinedAttribute *DomainDefinedAttributes::Prepend()
2097 {
2098 AsnListElmt *newElmt;
2099 newElmt = new AsnListElmt;
2100 newElmt->elmt = new DomainDefinedAttribute;
2101 newElmt->prev = NULL;
2102 if (first == NULL)
2103 {
2104 newElmt->next = NULL;
2105 first = last = newElmt;
2106 }
2107 else
2108 {
2109 newElmt->next = first;
2110 first->prev = newElmt;
2111 first = newElmt;
2112 }
2113 count++;
2114 return (curr = newElmt)->elmt;
2115 } // DomainDefinedAttributes::Prepend
2116
2117
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()
2123 {
2124 AsnListElmt *newElmt;
2125 newElmt = new AsnListElmt;
2126 newElmt->elmt = new DomainDefinedAttribute;
2127 if (curr == NULL)
2128 {
2129 newElmt->next = first;
2130 newElmt->prev = NULL;
2131 first = newElmt;
2132 if (last == NULL)
2133 last = newElmt;
2134 }
2135 else
2136 {
2137 newElmt->next = curr;
2138 newElmt->prev = curr->prev;
2139 curr->prev = newElmt;
2140 if (curr == first)
2141 first = newElmt;
2142 else
2143 newElmt->prev->next = newElmt;
2144 }
2145 count++;
2146 return (curr = newElmt)->elmt;
2147 } // DomainDefinedAttributes::InsertBefore
2148
2149
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()
2155 {
2156 AsnListElmt *newElmt;
2157 newElmt = new AsnListElmt;
2158 newElmt->elmt = new DomainDefinedAttribute;
2159 if (curr == NULL)
2160 {
2161 newElmt->prev = last;
2162 newElmt->next = NULL;
2163 last = newElmt;
2164 if (first == NULL)
2165 first = newElmt;
2166 }
2167 else
2168 {
2169 newElmt->prev = curr;
2170 newElmt->next = curr->next;
2171 curr->next = newElmt;
2172 if (curr == last)
2173 last = newElmt;
2174 else
2175 newElmt->next->prev = newElmt;
2176 }
2177 count++;
2178 return (curr = newElmt)->elmt;
2179 } // DomainDefinedAttributes::InsertAfter
2180
2181
2182 DomainDefinedAttributes &DomainDefinedAttributes::AppendCopy (DomainDefinedAttribute &elmt)
2183 {
2184 AsnListElmt *newElmt;
2185 newElmt = new AsnListElmt;
2186 newElmt->elmt = new DomainDefinedAttribute;
2187 *newElmt->elmt = elmt;
2188 newElmt->next = NULL;
2189 if (last == NULL)
2190 {
2191 newElmt->prev = NULL;
2192 first = last = newElmt;
2193 }
2194 else
2195 {
2196 newElmt->prev = last;
2197 last->next = newElmt;
2198 last = newElmt;
2199 }
2200 count++;
2201 return *this;
2202 } // AppendCopy
2203
2204
2205 DomainDefinedAttributes &DomainDefinedAttributes::PrependCopy (DomainDefinedAttribute &elmt)
2206 {
2207 AsnListElmt *newElmt;
2208 newElmt = new AsnListElmt;
2209 newElmt->elmt = new DomainDefinedAttribute;
2210 *newElmt->elmt = elmt;
2211 newElmt->prev = NULL;
2212 if (first == NULL)
2213 {
2214 newElmt->next = NULL;
2215 first = last = newElmt;
2216 }
2217 else
2218 {
2219 newElmt->next = first;
2220 first->prev = newElmt;
2221 first = newElmt;
2222 }
2223 count++;
2224 return *this;
2225 } // DomainDefinedAttributes::PrependCopy
2226
2227
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)
2234 {
2235 AsnListElmt *newElmt;
2236
2237 newElmt = new AsnListElmt;
2238 newElmt->elmt = new DomainDefinedAttribute;
2239 *newElmt->elmt = elmt;
2240
2241 if (curr == NULL)
2242 {
2243 newElmt->next = first;
2244 newElmt->prev = NULL;
2245 first = newElmt;
2246 if (last == NULL)
2247 last = newElmt;
2248 }
2249 else
2250 {
2251 newElmt->next = curr;
2252 newElmt->prev = curr->prev;
2253 curr->prev = newElmt;
2254 if (curr == first)
2255 first = newElmt;
2256 else
2257 newElmt->prev->next = newElmt;
2258 }
2259 count++;
2260 return *this;
2261 } // DomainDefinedAttributes::InsertBeforeAndCopy
2262
2263
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)
2270 {
2271 AsnListElmt *newElmt;
2272
2273 newElmt = new AsnListElmt;
2274 newElmt->elmt = new DomainDefinedAttribute;
2275 *newElmt->elmt = elmt;
2276 if (curr == NULL)
2277 {
2278 newElmt->prev = last;
2279 newElmt->next = NULL;
2280 last = newElmt;
2281 if (first == NULL)
2282 first = newElmt;
2283 }
2284 else
2285 {
2286 newElmt->prev = curr;
2287 newElmt->next = curr->next;
2288 curr->next = newElmt;
2289 if (curr == last)
2290 last = newElmt;
2291 else
2292 newElmt->next->prev = newElmt;
2293 }
2294 count++;
2295 return *this;
2296 } // DomainDefinedAttributes::InsertAfterAndCopy
2297
2298
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()
2304 {
2305 AsnListElmt *del_elmt;
2306
2307 if (curr != NULL)
2308 {
2309 del_elmt = curr;
2310 count--;
2311
2312 if (count == 0)
2313 first = last = curr = NULL;
2314 else if (curr == first)
2315 {
2316 curr = first= first->next;
2317 first->prev = NULL;
2318 }
2319 else if (curr == last)
2320 {
2321 curr = last = last->prev;
2322 last->next = NULL;
2323 }
2324 else
2325 {
2326 curr->prev->next = curr->next;
2327 curr->next->prev = curr->prev;
2328 }
2329
2330 delete del_elmt->elmt;
2331 delete del_elmt;
2332 }
2333 }
2334
2335
2336 AsnLen DomainDefinedAttributes::BEncContent (BUF_TYPE b)
2337 {
2338 AsnListElmt *currElmt;
2339 AsnLen elmtLen;
2340 AsnLen totalLen = 0;
2341 for (currElmt = last; currElmt != NULL; currElmt = currElmt->prev)
2342 {
2343 BEncEocIfNec (b);
2344 elmtLen = currElmt->elmt->BEncContent (b);
2345 elmtLen += BEncConsLen (b, elmtLen);
2346
2347 elmtLen += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
2348 totalLen += elmtLen;
2349 }
2350 return totalLen;
2351 } // DomainDefinedAttributes::BEncContent
2352
2353
2354 void DomainDefinedAttributes::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0,
2355 AsnLen &bytesDecoded, ENV_TYPE env)
2356 {
2357 DomainDefinedAttribute *listElmt;
2358 AsnTag tag1;
2359 AsnLen listBytesDecoded = 0;
2360 AsnLen elmtLen1;
2361
2362 while ((listBytesDecoded < elmtLen0) || (elmtLen0 == INDEFINITE_LEN))
2363 {
2364 tag1 = BDecTag (b, listBytesDecoded, env);
2365 if ((tag1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
2366 {
2367 BDEC_2ND_EOC_OCTET (b, listBytesDecoded, env);
2368 break;
2369 }
2370 if ((tag1 != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
2371 {
2372 Asn1Error << "Unexpected Tag" << endl;
2373 longjmp (env, -123);
2374 }
2375
2376 elmtLen1 = BDecLen (b, listBytesDecoded, env);
2377 listElmt = Append();
2378 listElmt->BDecContent (b, tag1, elmtLen1, listBytesDecoded, env);
2379 }
2380
2381 bytesDecoded += listBytesDecoded;
2382 } // DomainDefinedAttributes::BDecContent
2383
2384
2385 AsnType *ExtensionAttributes::Clone() const
2386 {
2387 return new ExtensionAttributes;
2388 }
2389
2390 AsnType *ExtensionAttributes::Copy() const
2391 {
2392 return new ExtensionAttributes (*this);
2393 }
2394
2395 AsnLen ExtensionAttributes::BEnc (BUF_TYPE b)
2396 {
2397 AsnLen l;
2398 l = BEncContent (b);
2399 l += BEncConsLen (b, l);
2400 l += BEncTag1 (b, UNIV, CONS, SET_TAG_CODE);
2401 return l;
2402 }
2403
2404 void ExtensionAttributes::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
2405 {
2406 AsnTag tag;
2407 AsnLen elmtLen1;
2408
2409 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SET_TAG_CODE))
2410 {
2411 Asn1Error << "ExtensionAttributes::BDec: ERROR - wrong tag" << endl;
2412 longjmp (env, -124);
2413 }
2414 elmtLen1 = BDecLen (b, bytesDecoded, env);
2415 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
2416 }
2417
2418 ExtensionAttributes::ExtensionAttributes (const ExtensionAttributes &)
2419 {
2420 Asn1Error << "use of incompletely defined ExtensionAttributes::ExtensionAttributes (const ExtensionAttributes &)" << endl;
2421 abort();
2422 }
2423
2424 ExtensionAttributes::~ExtensionAttributes()
2425 {
2426 SetCurrToFirst();
2427 for (; Curr() != NULL; RemoveCurrFromList())
2428 ;
2429 } // end of destructor
2430
2431 #if SNACC_DEEP_COPY
2432 ExtensionAttributes &ExtensionAttributes::operator = (const ExtensionAttributes &that)
2433 #else // SNACC_DEEP_COPY
2434 ExtensionAttributes &ExtensionAttributes::operator = (const ExtensionAttributes &)
2435 #endif // SNACC_DEEP_COPY
2436 {
2437 #if SNACC_DEEP_COPY
2438 if (this != &that)
2439 {
2440 SetCurrToFirst();
2441 for (; Curr(); RemoveCurrFromList())
2442 ;
2443
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);
2449 }
2450
2451 return *this;
2452 #else // SNACC_DEEP_COPY
2453 Asn1Error << "use of incompletely defined ExtensionAttributes &ExtensionAttributes::operator = (const ExtensionAttributes &)" << endl;
2454 abort();
2455 // if your compiler complains here, check the -novolat option
2456 #endif // SNACC_DEEP_COPY
2457 }
2458
2459 void ExtensionAttributes::Print (ostream &os) const
2460 {
2461 #ifndef NDEBUG
2462 os << "{ -- SEQUENCE/SET OF -- " << endl;
2463 indentG += stdIndentG;
2464 //SetCurrToFirst();
2465 //for (; Curr() != NULL; GoNext())
2466 for (const AsnListElmt *run=first; run; run=run->next)
2467 {
2468 Indent (os, indentG);
2469 //os << *Curr();
2470 os << *run->elmt;
2471 //if (Curr() != Last())
2472 if (run != last)
2473 os << ",";
2474 os << endl;
2475 }
2476 indentG -= stdIndentG;
2477 Indent (os, indentG);
2478 os << "}\n";
2479 #endif /* NDEBUG */
2480
2481
2482 } // Print
2483
2484
2485 void ExtensionAttributes::SetCurrElmt (unsigned long int index)
2486 {
2487 unsigned long int i;
2488 curr = first;
2489 if (count)
2490 for (i = 0; (i < (count-1)) && (i < index); i++)
2491 curr = curr->next;
2492 } // ExtensionAttributes::SetCurrElmt
2493
2494
2495 unsigned long int ExtensionAttributes::GetCurrElmtIndex()
2496 {
2497 unsigned long int i;
2498 AsnListElmt *tmp;
2499 if (curr != NULL)
2500 {
2501 for (i = 0, tmp = first; tmp != NULL; i++)
2502 {
2503 if (tmp == curr)
2504 return i;
2505 else
2506 tmp = tmp->next;
2507 }
2508 }
2509 return count;
2510 } // ExtensionAttributes::GetCurrElmtIndex
2511
2512
2513 // alloc new list elmt, put at end of list
2514 // and return the component type
2515 ExtensionAttribute *ExtensionAttributes::Append()
2516 {
2517 AsnListElmt *newElmt;
2518 newElmt = new AsnListElmt;
2519 newElmt->elmt = new ExtensionAttribute;
2520 newElmt->next = NULL;
2521 if (last == NULL)
2522 {
2523 newElmt->prev = NULL;
2524 first = last = newElmt;
2525 }
2526 else
2527 {
2528 newElmt->prev = last;
2529 last->next = newElmt;
2530 last = newElmt;
2531 }
2532 count++;
2533 return (curr = newElmt)->elmt;
2534 } // ExtensionAttributes::Append
2535
2536
2537 // alloc new list elmt, put at begining of list
2538 // and return the component type
2539 ExtensionAttribute *ExtensionAttributes::Prepend()
2540 {
2541 AsnListElmt *newElmt;
2542 newElmt = new AsnListElmt;
2543 newElmt->elmt = new ExtensionAttribute;
2544 newElmt->prev = NULL;
2545 if (first == NULL)
2546 {
2547 newElmt->next = NULL;
2548 first = last = newElmt;
2549 }
2550 else
2551 {
2552 newElmt->next = first;
2553 first->prev = newElmt;
2554 first = newElmt;
2555 }
2556 count++;
2557 return (curr = newElmt)->elmt;
2558 } // ExtensionAttributes::Prepend
2559
2560
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()
2566 {
2567 AsnListElmt *newElmt;
2568 newElmt = new AsnListElmt;
2569 newElmt->elmt = new ExtensionAttribute;
2570 if (curr == NULL)
2571 {
2572 newElmt->next = first;
2573 newElmt->prev = NULL;
2574 first = newElmt;
2575 if (last == NULL)
2576 last = newElmt;
2577 }
2578 else
2579 {
2580 newElmt->next = curr;
2581 newElmt->prev = curr->prev;
2582 curr->prev = newElmt;
2583 if (curr == first)
2584 first = newElmt;
2585 else
2586 newElmt->prev->next = newElmt;
2587 }
2588 count++;
2589 return (curr = newElmt)->elmt;
2590 } // ExtensionAttributes::InsertBefore
2591
2592
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()
2598 {
2599 AsnListElmt *newElmt;
2600 newElmt = new AsnListElmt;
2601 newElmt->elmt = new ExtensionAttribute;
2602 if (curr == NULL)
2603 {
2604 newElmt->prev = last;
2605 newElmt->next = NULL;
2606 last = newElmt;
2607 if (first == NULL)
2608 first = newElmt;
2609 }
2610 else
2611 {
2612 newElmt->prev = curr;
2613 newElmt->next = curr->next;
2614 curr->next = newElmt;
2615 if (curr == last)
2616 last = newElmt;
2617 else
2618 newElmt->next->prev = newElmt;
2619 }
2620 count++;
2621 return (curr = newElmt)->elmt;
2622 } // ExtensionAttributes::InsertAfter
2623
2624
2625 ExtensionAttributes &ExtensionAttributes::AppendCopy (ExtensionAttribute &elmt)
2626 {
2627 AsnListElmt *newElmt;
2628 newElmt = new AsnListElmt;
2629 newElmt->elmt = new ExtensionAttribute;
2630 *newElmt->elmt = elmt;
2631 newElmt->next = NULL;
2632 if (last == NULL)
2633 {
2634 newElmt->prev = NULL;
2635 first = last = newElmt;
2636 }
2637 else
2638 {
2639 newElmt->prev = last;
2640 last->next = newElmt;
2641 last = newElmt;
2642 }
2643 count++;
2644 return *this;
2645 } // AppendCopy
2646
2647
2648 ExtensionAttributes &ExtensionAttributes::PrependCopy (ExtensionAttribute &elmt)
2649 {
2650 AsnListElmt *newElmt;
2651 newElmt = new AsnListElmt;
2652 newElmt->elmt = new ExtensionAttribute;
2653 *newElmt->elmt = elmt;
2654 newElmt->prev = NULL;
2655 if (first == NULL)
2656 {
2657 newElmt->next = NULL;
2658 first = last = newElmt;
2659 }
2660 else
2661 {
2662 newElmt->next = first;
2663 first->prev = newElmt;
2664 first = newElmt;
2665 }
2666 count++;
2667 return *this;
2668 } // ExtensionAttributes::PrependCopy
2669
2670
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)
2677 {
2678 AsnListElmt *newElmt;
2679
2680 newElmt = new AsnListElmt;
2681 newElmt->elmt = new ExtensionAttribute;
2682 *newElmt->elmt = elmt;
2683
2684 if (curr == NULL)
2685 {
2686 newElmt->next = first;
2687 newElmt->prev = NULL;
2688 first = newElmt;
2689 if (last == NULL)
2690 last = newElmt;
2691 }
2692 else
2693 {
2694 newElmt->next = curr;
2695 newElmt->prev = curr->prev;
2696 curr->prev = newElmt;
2697 if (curr == first)
2698 first = newElmt;
2699 else
2700 newElmt->prev->next = newElmt;
2701 }
2702 count++;
2703 return *this;
2704 } // ExtensionAttributes::InsertBeforeAndCopy
2705
2706
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)
2713 {
2714 AsnListElmt *newElmt;
2715
2716 newElmt = new AsnListElmt;
2717 newElmt->elmt = new ExtensionAttribute;
2718 *newElmt->elmt = elmt;
2719 if (curr == NULL)
2720 {
2721 newElmt->prev = last;
2722 newElmt->next = NULL;
2723 last = newElmt;
2724 if (first == NULL)
2725 first = newElmt;
2726 }
2727 else
2728 {
2729 newElmt->prev = curr;
2730 newElmt->next = curr->next;
2731 curr->next = newElmt;
2732 if (curr == last)
2733 last = newElmt;
2734 else
2735 newElmt->next->prev = newElmt;
2736 }
2737 count++;
2738 return *this;
2739 } // ExtensionAttributes::InsertAfterAndCopy
2740
2741
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()
2747 {
2748 AsnListElmt *del_elmt;
2749
2750 if (curr != NULL)
2751 {
2752 del_elmt = curr;
2753 count--;
2754
2755 if (count == 0)
2756 first = last = curr = NULL;
2757 else if (curr == first)
2758 {
2759 curr = first= first->next;
2760 first->prev = NULL;
2761 }
2762 else if (curr == last)
2763 {
2764 curr = last = last->prev;
2765 last->next = NULL;
2766 }
2767 else
2768 {
2769 curr->prev->next = curr->next;
2770 curr->next->prev = curr->prev;
2771 }
2772
2773 delete del_elmt->elmt;
2774 delete del_elmt;
2775 }
2776 }
2777
2778
2779 AsnLen ExtensionAttributes::BEncContent (BUF_TYPE b)
2780 {
2781 AsnListElmt *currElmt;
2782 AsnLen elmtLen;
2783 AsnLen totalLen = 0;
2784 {
2785 int iii,icount;
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)
2790 {
2791 BEncEocIfNec (b);
2792 ENCODE_BUF1(currElmt->elmt->BEncContent, elmtLen);
2793 elmtLen += BEncConsLen (outputBuf, elmtLen);
2794
2795 elmtLen += BEncTag1 (outputBuf, UNIV, CONS, SEQ_TAG_CODE);
2796 ENCODE_BUF2(tmpEnc[iii]);
2797 }
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];
2802 free(tmpEnc);
2803 }
2804 totalLen += elmtLen;
2805 return totalLen;
2806 } // ExtensionAttributes::BEncContent
2807
2808
2809 void ExtensionAttributes::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0,
2810 AsnLen &bytesDecoded, ENV_TYPE env)
2811 {
2812 ExtensionAttribute *listElmt;
2813 AsnTag tag1;
2814 AsnLen listBytesDecoded = 0;
2815 AsnLen elmtLen1;
2816
2817 while ((listBytesDecoded < elmtLen0) || (elmtLen0 == INDEFINITE_LEN))
2818 {
2819 tag1 = BDecTag (b, listBytesDecoded, env);
2820 if ((tag1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
2821 {
2822 BDEC_2ND_EOC_OCTET (b, listBytesDecoded, env);
2823 break;
2824 }
2825 if ((tag1 != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
2826 {
2827 Asn1Error << "Unexpected Tag" << endl;
2828 longjmp (env, -125);
2829 }
2830
2831 elmtLen1 = BDecLen (b, listBytesDecoded, env);
2832 listElmt = Append();
2833 listElmt->BDecContent (b, tag1, elmtLen1, listBytesDecoded, env);
2834 }
2835
2836 bytesDecoded += listBytesDecoded;
2837 } // ExtensionAttributes::BDecContent
2838
2839
2840 StandardAttributes::StandardAttributes()
2841 {
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;
2851 }
2852
2853 StandardAttributes::StandardAttributes (const StandardAttributes &)
2854 {
2855 Asn1Error << "use of incompletely defined StandardAttributes::StandardAttributes (const StandardAttributes &)" << endl;
2856 abort();
2857 }
2858
2859 StandardAttributes::~StandardAttributes()
2860 {
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;
2870 }
2871
2872 AsnType *StandardAttributes::Clone() const
2873 {
2874 return new StandardAttributes;
2875 }
2876
2877 AsnType *StandardAttributes::Copy() const
2878 {
2879 return new StandardAttributes (*this);
2880 }
2881
2882 #if SNACC_DEEP_COPY
2883 StandardAttributes &StandardAttributes::operator = (const StandardAttributes &that)
2884 #else // SNACC_DEEP_COPY
2885 StandardAttributes &StandardAttributes::operator = (const StandardAttributes &)
2886 #endif // SNACC_DEEP_COPY
2887 {
2888 #if SNACC_DEEP_COPY
2889 if (this != &that)
2890 {
2891 if (that.country_name)
2892 {
2893 if (!country_name)
2894 country_name = new CountryName;
2895 *country_name = *that.country_name;
2896 }
2897 else
2898 {
2899 delete country_name;
2900 country_name = NULL;
2901 }
2902 if (that.administration_domain_name)
2903 {
2904 if (!administration_domain_name)
2905 administration_domain_name = new AdministrationDomainName;
2906 *administration_domain_name = *that.administration_domain_name;
2907 }
2908 else
2909 {
2910 delete administration_domain_name;
2911 administration_domain_name = NULL;
2912 }
2913 if (that.network_address)
2914 {
2915 if (!network_address)
2916 network_address = new NetworkAddress;
2917 *network_address = *that.network_address;
2918 }
2919 else
2920 {
2921 delete network_address;
2922 network_address = NULL;
2923 }
2924 if (that.terminal_identifier)
2925 {
2926 if (!terminal_identifier)
2927 terminal_identifier = new TerminalIdentifier;
2928 *terminal_identifier = *that.terminal_identifier;
2929 }
2930 else
2931 {
2932 delete terminal_identifier;
2933 terminal_identifier = NULL;
2934 }
2935 if (that.private_domain_name)
2936 {
2937 if (!private_domain_name)
2938 private_domain_name = new PrivateDomainName;
2939 *private_domain_name = *that.private_domain_name;
2940 }
2941 else
2942 {
2943 delete private_domain_name;
2944 private_domain_name = NULL;
2945 }
2946 if (that.organization_name)
2947 {
2948 if (!organization_name)
2949 organization_name = new OrganizationName;
2950 *organization_name = *that.organization_name;
2951 }
2952 else
2953 {
2954 delete organization_name;
2955 organization_name = NULL;
2956 }
2957 if (that.numeric_user_identifier)
2958 {
2959 if (!numeric_user_identifier)
2960 numeric_user_identifier = new NumericUserIdentifier;
2961 *numeric_user_identifier = *that.numeric_user_identifier;
2962 }
2963 else
2964 {
2965 delete numeric_user_identifier;
2966 numeric_user_identifier = NULL;
2967 }
2968 if (that.personal_name)
2969 {
2970 if (!personal_name)
2971 personal_name = new PersonalName;
2972 *personal_name = *that.personal_name;
2973 }
2974 else
2975 {
2976 delete personal_name;
2977 personal_name = NULL;
2978 }
2979 if (that.organizational_unit_names)
2980 {
2981 if (!organizational_unit_names)
2982 organizational_unit_names = new OrganizationUnitNames;
2983 *organizational_unit_names = *that.organizational_unit_names;
2984 }
2985 else
2986 {
2987 delete organizational_unit_names;
2988 organizational_unit_names = NULL;
2989 }
2990 }
2991
2992 return *this;
2993 #else // SNACC_DEEP_COPY
2994 Asn1Error << "use of incompletely defined StandardAttributes &StandardAttributes::operator = (const StandardAttributes &)" << endl;
2995 abort();
2996 // if your compiler complains here, check the -novolat option
2997 #endif // SNACC_DEEP_COPY
2998 }
2999
3000 AsnLen
3001 StandardAttributes::BEncContent (BUF_TYPE b)
3002 {
3003 AsnLen totalLen = 0;
3004 AsnLen l;
3005
3006 if (NOT_NULL (organizational_unit_names))
3007 {
3008 BEncEocIfNec (b);
3009 l = organizational_unit_names->BEncContent (b);
3010 l += BEncConsLen (b, l);
3011
3012 l += BEncTag1 (b, CNTX, CONS, 6);
3013 totalLen += l;
3014 }
3015
3016 if (NOT_NULL (personal_name))
3017 {
3018 BEncEocIfNec (b);
3019 l = personal_name->BEncContent (b);
3020 l += BEncConsLen (b, l);
3021
3022 l += BEncTag1 (b, CNTX, CONS, 5);
3023 totalLen += l;
3024 }
3025
3026 if (NOT_NULL (numeric_user_identifier))
3027 {
3028 l = numeric_user_identifier->BEncContent (b);
3029 l += BEncDefLen (b, l);
3030
3031 l += BEncTag1 (b, CNTX, PRIM, 4);
3032 totalLen += l;
3033 }
3034
3035 if (NOT_NULL (organization_name))
3036 {
3037 l = organization_name->BEncContent (b);
3038 l += BEncDefLen (b, l);
3039
3040 l += BEncTag1 (b, CNTX, PRIM, 3);
3041 totalLen += l;
3042 }
3043
3044 if (NOT_NULL (private_domain_name))
3045 {
3046 BEncEocIfNec (b);
3047 l = private_domain_name->BEncContent (b);
3048 l += BEncConsLen (b, l);
3049
3050 l += BEncTag1 (b, CNTX, CONS, 2);
3051 totalLen += l;
3052 }
3053
3054 if (NOT_NULL (terminal_identifier))
3055 {
3056 l = terminal_identifier->BEncContent (b);
3057 l += BEncDefLen (b, l);
3058
3059 l += BEncTag1 (b, CNTX, PRIM, 1);
3060 totalLen += l;
3061 }
3062
3063 if (NOT_NULL (network_address))
3064 {
3065 l = network_address->BEncContent (b);
3066 l += BEncDefLen (b, l);
3067
3068 l += BEncTag1 (b, CNTX, PRIM, 0);
3069 totalLen += l;
3070 }
3071
3072 if (NOT_NULL (administration_domain_name))
3073 {
3074 BEncEocIfNec (b);
3075 l = administration_domain_name->BEncContent (b);
3076 l += BEncConsLen (b, l);
3077
3078 l += BEncTag1 (b, APPL, CONS, 2);
3079 totalLen += l;
3080 }
3081
3082 if (NOT_NULL (country_name))
3083 {
3084 BEncEocIfNec (b);
3085 l = country_name->BEncContent (b);
3086 l += BEncConsLen (b, l);
3087
3088 l += BEncTag1 (b, APPL, CONS, 1);
3089 totalLen += l;
3090 }
3091
3092 return totalLen;
3093 } // StandardAttributes::BEncContent
3094
3095
3096 void StandardAttributes::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
3097 {
3098 AsnTag tag1;
3099 AsnLen seqBytesDecoded = 0;
3100 AsnLen elmtLen1;
3101 AsnLen elmtLen2;
3102 if (elmtLen0 == 0)
3103 return;
3104 else
3105 {
3106 tag1 = BDecTag (b, seqBytesDecoded, env);
3107
3108 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
3109 {
3110 BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env)
3111 bytesDecoded += seqBytesDecoded;
3112 return;
3113 }
3114 }
3115
3116 if ((tag1 == MAKE_TAG_ID (APPL, CONS, 1)))
3117 {
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);
3125
3126 if (seqBytesDecoded == elmtLen0)
3127 {
3128 bytesDecoded += seqBytesDecoded;
3129 return;
3130 }
3131 else
3132 {
3133 tag1 = BDecTag (b, seqBytesDecoded, env);
3134
3135 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
3136 {
3137 BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env)
3138 bytesDecoded += seqBytesDecoded;
3139 return;
3140 }
3141 }
3142 }
3143
3144 if ((tag1 == MAKE_TAG_ID (APPL, CONS, 2)))
3145 {
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);
3153
3154 if (seqBytesDecoded == elmtLen0)
3155 {
3156 bytesDecoded += seqBytesDecoded;
3157 return;
3158 }
3159 else
3160 {
3161 tag1 = BDecTag (b, seqBytesDecoded, env);
3162
3163 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
3164 {
3165 BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env)
3166 bytesDecoded += seqBytesDecoded;
3167 return;
3168 }
3169 }
3170 }
3171
3172 if ((tag1 == MAKE_TAG_ID (CNTX, PRIM, 0))
3173 || (tag1 == MAKE_TAG_ID (CNTX, CONS, 0)))
3174 {
3175 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
3176 network_address = new NetworkAddress;
3177 network_address->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
3178 if (seqBytesDecoded == elmtLen0)
3179 {
3180 bytesDecoded += seqBytesDecoded;
3181 return;
3182 }
3183 else
3184 {
3185 tag1 = BDecTag (b, seqBytesDecoded, env);
3186
3187 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
3188 {
3189 BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env)
3190 bytesDecoded += seqBytesDecoded;
3191 return;
3192 }
3193 }
3194 }
3195
3196 if ((tag1 == MAKE_TAG_ID (CNTX, PRIM, 1))
3197 || (tag1 == MAKE_TAG_ID (CNTX, CONS, 1)))
3198 {
3199 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
3200 terminal_identifier = new TerminalIdentifier;
3201 terminal_identifier->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
3202 if (seqBytesDecoded == elmtLen0)
3203 {
3204 bytesDecoded += seqBytesDecoded;
3205 return;
3206 }
3207 else
3208 {
3209 tag1 = BDecTag (b, seqBytesDecoded, env);
3210
3211 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
3212 {
3213 BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env)
3214 bytesDecoded += seqBytesDecoded;
3215 return;
3216 }
3217 }
3218 }
3219
3220 if ((tag1 == MAKE_TAG_ID (CNTX, CONS, 2)))
3221 {
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);
3229
3230 if (seqBytesDecoded == elmtLen0)
3231 {
3232 bytesDecoded += seqBytesDecoded;
3233 return;
3234 }
3235 else
3236 {
3237 tag1 = BDecTag (b, seqBytesDecoded, env);
3238
3239 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
3240 {
3241 BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env)
3242 bytesDecoded += seqBytesDecoded;
3243 return;
3244 }
3245 }
3246 }
3247
3248 if ((tag1 == MAKE_TAG_ID (CNTX, PRIM, 3))
3249 || (tag1 == MAKE_TAG_ID (CNTX, CONS, 3)))
3250 {
3251 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
3252 organization_name = new OrganizationName;
3253 organization_name->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
3254 if (seqBytesDecoded == elmtLen0)
3255 {
3256 bytesDecoded += seqBytesDecoded;
3257 return;
3258 }
3259 else
3260 {
3261 tag1 = BDecTag (b, seqBytesDecoded, env);
3262
3263 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
3264 {
3265 BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env)
3266 bytesDecoded += seqBytesDecoded;
3267 return;
3268 }
3269 }
3270 }
3271
3272 if ((tag1 == MAKE_TAG_ID (CNTX, PRIM, 4))
3273 || (tag1 == MAKE_TAG_ID (CNTX, CONS, 4)))
3274 {
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)
3279 {
3280 bytesDecoded += seqBytesDecoded;
3281 return;
3282 }
3283 else
3284 {
3285 tag1 = BDecTag (b, seqBytesDecoded, env);
3286
3287 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
3288 {
3289 BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env)
3290 bytesDecoded += seqBytesDecoded;
3291 return;
3292 }
3293 }
3294 }
3295
3296 if ((tag1 == MAKE_TAG_ID (CNTX, CONS, 5)))
3297 {
3298 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
3299 personal_name = new PersonalName;
3300 personal_name->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
3301 if (seqBytesDecoded == elmtLen0)
3302 {
3303 bytesDecoded += seqBytesDecoded;
3304 return;
3305 }
3306 else
3307 {
3308 tag1 = BDecTag (b, seqBytesDecoded, env);
3309
3310 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
3311 {
3312 BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env)
3313 bytesDecoded += seqBytesDecoded;
3314 return;
3315 }
3316 }
3317 }
3318
3319 if ((tag1 == MAKE_TAG_ID (CNTX, CONS, 6)))
3320 {
3321 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
3322 organizational_unit_names = new OrganizationUnitNames;
3323 organizational_unit_names->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
3324 }
3325
3326 bytesDecoded += seqBytesDecoded;
3327 if (elmtLen0 == INDEFINITE_LEN)
3328 {
3329 BDecEoc (b, bytesDecoded, env);
3330 return;
3331 }
3332 else if (seqBytesDecoded != elmtLen0)
3333 {
3334 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
3335 longjmp (env, -126);
3336 }
3337 else
3338 return;
3339 } // StandardAttributes::BDecContent
3340
3341 AsnLen StandardAttributes::BEnc (BUF_TYPE b)
3342 {
3343 AsnLen l;
3344 l = BEncContent (b);
3345 l += BEncConsLen (b, l);
3346 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
3347 return l;
3348 }
3349
3350 void StandardAttributes::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
3351 {
3352 AsnTag tag;
3353 AsnLen elmtLen1;
3354
3355 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
3356 {
3357 Asn1Error << "StandardAttributes::BDec: ERROR - wrong tag" << endl;
3358 longjmp (env, -127);
3359 }
3360 elmtLen1 = BDecLen (b, bytesDecoded, env);
3361 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
3362 }
3363
3364 int StandardAttributes::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded)
3365 {
3366 bytesEncoded = BEnc (b);
3367 return !b.WriteError();
3368 }
3369
3370 int StandardAttributes::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded)
3371 {
3372 ENV_TYPE env;
3373 int val;
3374
3375 bytesDecoded = 0;
3376 if ((val = setjmp (env)) == 0)
3377 {
3378 BDec (b, bytesDecoded, env);
3379 return !b.ReadError();
3380 }
3381 else
3382 return false;
3383 }
3384
3385 void StandardAttributes::Print (ostream &os) const
3386 {
3387 #ifndef NDEBUG
3388 int nonePrinted = true;
3389 os << "{ -- SEQUENCE --" << endl;
3390 indentG += stdIndentG;
3391
3392 if (NOT_NULL (country_name))
3393 {
3394 nonePrinted = false;
3395 Indent (os, indentG);
3396 os << "country-name ";
3397 os << *country_name;
3398 }
3399 else
3400 {
3401 Indent (os, indentG);
3402 os << "country-name ";
3403 os << "-- void --";
3404 os << "," << endl;
3405 }
3406
3407 if (NOT_NULL (administration_domain_name))
3408 {
3409 if (!nonePrinted)
3410 os << "," << endl;
3411 nonePrinted = false;
3412 Indent (os, indentG);
3413 os << "administration-domain-name ";
3414 os << *administration_domain_name;
3415 }
3416 else
3417 {
3418 Indent (os, indentG);
3419 os << "administration-domain-name ";
3420 os << "-- void --";
3421 os << "," << endl;
3422 }
3423
3424 if (NOT_NULL (network_address))
3425 {
3426 if (!nonePrinted)
3427 os << "," << endl;
3428 nonePrinted = false;
3429 Indent (os, indentG);
3430 os << "network-address ";
3431 os << *network_address;
3432 }
3433 else
3434 {
3435 Indent (os, indentG);
3436 os << "network-address ";
3437 os << "-- void --";
3438 os << "," << endl;
3439 }
3440
3441 if (NOT_NULL (terminal_identifier))
3442 {
3443 if (!nonePrinted)
3444 os << "," << endl;
3445 nonePrinted = false;
3446 Indent (os, indentG);
3447 os << "terminal-identifier ";
3448 os << *terminal_identifier;
3449 }
3450 else
3451 {
3452 Indent (os, indentG);
3453 os << "terminal-identifier ";
3454 os << "-- void --";
3455 os << "," << endl;
3456 }
3457
3458 if (NOT_NULL (private_domain_name))
3459 {
3460 if (!nonePrinted)
3461 os << "," << endl;
3462 nonePrinted = false;
3463 Indent (os, indentG);
3464 os << "private-domain-name ";
3465 os << *private_domain_name;
3466 }
3467 else
3468 {
3469 Indent (os, indentG);
3470 os << "private-domain-name ";
3471 os << "-- void --";
3472 os << "," << endl;
3473 }
3474
3475 if (NOT_NULL (organization_name))
3476 {
3477 if (!nonePrinted)
3478 os << "," << endl;
3479 nonePrinted = false;
3480 Indent (os, indentG);
3481 os << "organization-name ";
3482 os << *organization_name;
3483 }
3484 else
3485 {
3486 Indent (os, indentG);
3487 os << "organization-name ";
3488 os << "-- void --";
3489 os << "," << endl;
3490 }
3491
3492 if (NOT_NULL (numeric_user_identifier))
3493 {
3494 if (!nonePrinted)
3495 os << "," << endl;
3496 nonePrinted = false;
3497 Indent (os, indentG);
3498 os << "numeric-user-identifier ";
3499 os << *numeric_user_identifier;
3500 }
3501 else
3502 {
3503 Indent (os, indentG);
3504 os << "numeric-user-identifier ";
3505 os << "-- void --";
3506 os << "," << endl;
3507 }
3508
3509 if (NOT_NULL (personal_name))
3510 {
3511 if (!nonePrinted)
3512 os << "," << endl;
3513 nonePrinted = false;
3514 Indent (os, indentG);
3515 os << "personal-name ";
3516 os << *personal_name;
3517 }
3518 else
3519 {
3520 Indent (os, indentG);
3521 os << "personal-name ";
3522 os << "-- void --";
3523 os << "," << endl;
3524 }
3525
3526 if (NOT_NULL (organizational_unit_names))
3527 {
3528 if (!nonePrinted)
3529 os << "," << endl;
3530 nonePrinted = false;
3531 Indent (os, indentG);
3532 os << "organizational-unit-names ";
3533 os << *organizational_unit_names;
3534 }
3535 else
3536 {
3537 Indent (os, indentG);
3538 os << "organizational-unit-names ";
3539 os << "-- void --";
3540 os << endl;
3541 }
3542
3543 os << endl;
3544 indentG -= stdIndentG;
3545 Indent (os, indentG);
3546 os << "}";
3547 #endif /* NDEBUG */
3548 } // StandardAttributes::Print
3549
3550
3551 ORAddress::ORAddress()
3552 {
3553 #if TCL
3554 standard_attributes = new StandardAttributes;
3555 #else
3556 standard_attributes = NULL; // incomplete initialization of mandatory element!
3557 #endif // TCL
3558 domain_defined_attributes = NULL;
3559 extension_attributes = NULL;
3560 }
3561
3562 ORAddress::ORAddress (const ORAddress &)
3563 {
3564 Asn1Error << "use of incompletely defined ORAddress::ORAddress (const ORAddress &)" << endl;
3565 abort();
3566 }
3567
3568 ORAddress::~ORAddress()
3569 {
3570 delete standard_attributes;
3571 delete domain_defined_attributes;
3572 delete extension_attributes;
3573 }
3574
3575 AsnType *ORAddress::Clone() const
3576 {
3577 return new ORAddress;
3578 }
3579
3580 AsnType *ORAddress::Copy() const
3581 {
3582 return new ORAddress (*this);
3583 }
3584
3585 #if SNACC_DEEP_COPY
3586 ORAddress &ORAddress::operator = (const ORAddress &that)
3587 #else // SNACC_DEEP_COPY
3588 ORAddress &ORAddress::operator = (const ORAddress &)
3589 #endif // SNACC_DEEP_COPY
3590 {
3591 #if SNACC_DEEP_COPY
3592 if (this != &that)
3593 {
3594 if (that.standard_attributes)
3595 {
3596 if (!standard_attributes)
3597 standard_attributes = new StandardAttributes;
3598 *standard_attributes = *that.standard_attributes;
3599 }
3600 else
3601 {
3602 delete standard_attributes;
3603 standard_attributes = NULL;
3604 }
3605 if (that.domain_defined_attributes)
3606 {
3607 if (!domain_defined_attributes)
3608 domain_defined_attributes = new DomainDefinedAttributes;
3609 *domain_defined_attributes = *that.domain_defined_attributes;
3610 }
3611 else
3612 {
3613 delete domain_defined_attributes;
3614 domain_defined_attributes = NULL;
3615 }
3616 if (that.extension_attributes)
3617 {
3618 if (!extension_attributes)
3619 extension_attributes = new ExtensionAttributes;
3620 *extension_attributes = *that.extension_attributes;
3621 }
3622 else
3623 {
3624 delete extension_attributes;
3625 extension_attributes = NULL;
3626 }
3627 }
3628
3629 return *this;
3630 #else // SNACC_DEEP_COPY
3631 Asn1Error << "use of incompletely defined ORAddress &ORAddress::operator = (const ORAddress &)" << endl;
3632 abort();
3633 // if your compiler complains here, check the -novolat option
3634 #endif // SNACC_DEEP_COPY
3635 }
3636
3637 AsnLen
3638 ORAddress::BEncContent (BUF_TYPE b)
3639 {
3640 AsnLen totalLen = 0;
3641 AsnLen l;
3642
3643 if (NOT_NULL (extension_attributes))
3644 {
3645 BEncEocIfNec (b);
3646 l = extension_attributes->BEncContent (b);
3647 l += BEncConsLen (b, l);
3648
3649 l += BEncTag1 (b, UNIV, CONS, SET_TAG_CODE);
3650 totalLen += l;
3651 }
3652
3653 if (NOT_NULL (domain_defined_attributes))
3654 {
3655 BEncEocIfNec (b);
3656 l = domain_defined_attributes->BEncContent (b);
3657 l += BEncConsLen (b, l);
3658
3659 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
3660 totalLen += l;
3661 }
3662
3663 BEncEocIfNec (b);
3664 l = standard_attributes->BEncContent (b);
3665 l += BEncConsLen (b, l);
3666
3667 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
3668 totalLen += l;
3669
3670 return totalLen;
3671 } // ORAddress::BEncContent
3672
3673
3674 void ORAddress::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
3675 {
3676 AsnTag tag1;
3677 AsnLen seqBytesDecoded = 0;
3678 AsnLen elmtLen1;
3679 tag1 = BDecTag (b, seqBytesDecoded, env);
3680
3681 if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
3682 {
3683 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
3684 standard_attributes = new StandardAttributes;
3685 standard_attributes->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
3686 if (seqBytesDecoded == elmtLen0)
3687 {
3688 bytesDecoded += seqBytesDecoded;
3689 return;
3690 }
3691 else
3692 {
3693 tag1 = BDecTag (b, seqBytesDecoded, env);
3694
3695 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
3696 {
3697 BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env)
3698 bytesDecoded += seqBytesDecoded;
3699 return;
3700 }
3701 }
3702 }
3703 else
3704 {
3705 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
3706 longjmp (env, -128);
3707 }
3708
3709 if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
3710 {
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)
3715 {
3716 bytesDecoded += seqBytesDecoded;
3717 return;
3718 }
3719 else
3720 {
3721 tag1 = BDecTag (b, seqBytesDecoded, env);
3722
3723 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
3724 {
3725 BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env)
3726 bytesDecoded += seqBytesDecoded;
3727 return;
3728 }
3729 }
3730 }
3731
3732 if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SET_TAG_CODE)))
3733 {
3734 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
3735 extension_attributes = new ExtensionAttributes;
3736 extension_attributes->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
3737 }
3738
3739 bytesDecoded += seqBytesDecoded;
3740 if (elmtLen0 == INDEFINITE_LEN)
3741 {
3742 BDecEoc (b, bytesDecoded, env);
3743 return;
3744 }
3745 else if (seqBytesDecoded != elmtLen0)
3746 {
3747 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
3748 longjmp (env, -129);
3749 }
3750 else
3751 return;
3752 } // ORAddress::BDecContent
3753
3754 AsnLen ORAddress::BEnc (BUF_TYPE b)
3755 {
3756 AsnLen l;
3757 l = BEncContent (b);
3758 l += BEncConsLen (b, l);
3759 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
3760 return l;
3761 }
3762
3763 void ORAddress::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
3764 {
3765 AsnTag tag;
3766 AsnLen elmtLen1;
3767
3768 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
3769 {
3770 Asn1Error << "ORAddress::BDec: ERROR - wrong tag" << endl;
3771 longjmp (env, -130);
3772 }
3773 elmtLen1 = BDecLen (b, bytesDecoded, env);
3774 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
3775 }
3776
3777 int ORAddress::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded)
3778 {
3779 bytesEncoded = BEnc (b);
3780 return !b.WriteError();
3781 }
3782
3783 int ORAddress::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded)
3784 {
3785 ENV_TYPE env;
3786 int val;
3787
3788 bytesDecoded = 0;
3789 if ((val = setjmp (env)) == 0)
3790 {
3791 BDec (b, bytesDecoded, env);
3792 return !b.ReadError();
3793 }
3794 else
3795 return false;
3796 }
3797
3798 void ORAddress::Print (ostream &os) const
3799 {
3800 #ifndef NDEBUG
3801 os << "{ -- SEQUENCE --" << endl;
3802 indentG += stdIndentG;
3803
3804 if (NOT_NULL (standard_attributes))
3805 {
3806 Indent (os, indentG);
3807 os << "standard-attributes ";
3808 os << *standard_attributes;
3809 }
3810 else
3811 {
3812 Indent (os, indentG);
3813 os << "standard-attributes ";
3814 os << "-- void --";
3815 os << "," << endl;
3816 }
3817
3818 if (NOT_NULL (domain_defined_attributes))
3819 {
3820 os << ","<< endl;
3821 Indent (os, indentG);
3822 os << "domain-defined-attributes ";
3823 os << *domain_defined_attributes;
3824 }
3825 else
3826 {
3827 Indent (os, indentG);
3828 os << "domain-defined-attributes ";
3829 os << "-- void --";
3830 os << "," << endl;
3831 }
3832
3833 if (NOT_NULL (extension_attributes))
3834 {
3835 os << ","<< endl;
3836 Indent (os, indentG);
3837 os << "extension-attributes ";
3838 os << *extension_attributes;
3839 }
3840 else
3841 {
3842 Indent (os, indentG);
3843 os << "extension-attributes ";
3844 os << "-- void --";
3845 os << endl;
3846 }
3847
3848 os << endl;
3849 indentG -= stdIndentG;
3850 Indent (os, indentG);
3851 os << "}";
3852 #endif /* NDEBUG */
3853 } // ORAddress::Print
3854
3855
3856 TeletexPersonalName::TeletexPersonalName()
3857 {
3858 given_name = NULL;
3859 initials = NULL;
3860 generation_qualifier = NULL;
3861 }
3862
3863 TeletexPersonalName::TeletexPersonalName (const TeletexPersonalName &)
3864 {
3865 Asn1Error << "use of incompletely defined TeletexPersonalName::TeletexPersonalName (const TeletexPersonalName &)" << endl;
3866 abort();
3867 }
3868
3869 TeletexPersonalName::~TeletexPersonalName()
3870 {
3871 delete given_name;
3872 delete initials;
3873 delete generation_qualifier;
3874 }
3875
3876 AsnType *TeletexPersonalName::Clone() const
3877 {
3878 return new TeletexPersonalName;
3879 }
3880
3881 AsnType *TeletexPersonalName::Copy() const
3882 {
3883 return new TeletexPersonalName (*this);
3884 }
3885
3886 #if SNACC_DEEP_COPY
3887 TeletexPersonalName &TeletexPersonalName::operator = (const TeletexPersonalName &that)
3888 #else // SNACC_DEEP_COPY
3889 TeletexPersonalName &TeletexPersonalName::operator = (const TeletexPersonalName &)
3890 #endif // SNACC_DEEP_COPY
3891 {
3892 #if SNACC_DEEP_COPY
3893 if (this != &that)
3894 {
3895 surname = that.surname;
3896 if (that.given_name)
3897 {
3898 if (!given_name)
3899 given_name = new TeletexString;
3900 *given_name = *that.given_name;
3901 }
3902 else
3903 {
3904 delete given_name;
3905 given_name = NULL;
3906 }
3907 if (that.initials)
3908 {
3909 if (!initials)
3910 initials = new TeletexString;
3911 *initials = *that.initials;
3912 }
3913 else
3914 {
3915 delete initials;
3916 initials = NULL;
3917 }
3918 if (that.generation_qualifier)
3919 {
3920 if (!generation_qualifier)
3921 generation_qualifier = new TeletexString;
3922 *generation_qualifier = *that.generation_qualifier;
3923 }
3924 else
3925 {
3926 delete generation_qualifier;
3927 generation_qualifier = NULL;
3928 }
3929 }
3930
3931 return *this;
3932 #else // SNACC_DEEP_COPY
3933 Asn1Error << "use of incompletely defined TeletexPersonalName &TeletexPersonalName::operator = (const TeletexPersonalName &)" << endl;
3934 abort();
3935 // if your compiler complains here, check the -novolat option
3936 #endif // SNACC_DEEP_COPY
3937 }
3938
3939 AsnLen TeletexPersonalName::BEncContent (BUF_TYPE b)
3940 {
3941 AsnLen totalLen = 0;
3942 AsnLen l;
3943
3944 AsnBuf outputBuf;
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))
3951 {
3952 l = generation_qualifier->BEncContent (outputBuf);
3953 l += BEncDefLen (outputBuf, l);
3954
3955 l += BEncTag1 (outputBuf, CNTX, PRIM, 3);
3956 totalLen += l;
3957 SNACC_BUFRESET_READ(&outputBuf);
3958 SM_ReadFromAsnBuf(tmpEnc[iii], outputBuf,outputBuf.DataLen(),NULL);
3959 SNACC_BUFRESET_WRITE(&outputBuf);
3960 iii++;
3961 }
3962
3963 if (NOT_NULL (initials))
3964 {
3965 l = initials->BEncContent (outputBuf);
3966 l += BEncDefLen (outputBuf, l);
3967
3968 l += BEncTag1 (outputBuf, CNTX, PRIM, 2);
3969 totalLen += l;
3970 SNACC_BUFRESET_READ(&outputBuf);
3971 SM_ReadFromAsnBuf(tmpEnc[iii], outputBuf,outputBuf.DataLen(),NULL);
3972 SNACC_BUFRESET_WRITE(&outputBuf);
3973 iii++;
3974 }
3975
3976 if (NOT_NULL (given_name))
3977 {
3978 l = given_name->BEncContent (outputBuf);
3979 l += BEncDefLen (outputBuf, l);
3980
3981 l += BEncTag1 (outputBuf, CNTX, PRIM, 1);
3982 totalLen += l;
3983 SNACC_BUFRESET_READ(&outputBuf);
3984 SM_ReadFromAsnBuf(tmpEnc[iii], outputBuf,outputBuf.DataLen(),NULL);
3985 SNACC_BUFRESET_WRITE(&outputBuf);
3986 iii++;
3987 }
3988
3989 l = surname.BEncContent (outputBuf);
3990 l += BEncDefLen (outputBuf, l);
3991
3992 l += BEncTag1 (outputBuf, CNTX, PRIM, 0);
3993 totalLen += l;
3994 SNACC_BUFRESET_READ(&outputBuf);
3995 SM_ReadFromAsnBuf(tmpEnc[iii], outputBuf,outputBuf.DataLen(),NULL);
3996 SNACC_BUFRESET_WRITE(&outputBuf);
3997 iii++;
3998
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];
4004 free(lpszBuf);
4005 return totalLen;
4006 } // TeletexPersonalName::BEncContent
4007
4008
4009 void TeletexPersonalName::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
4010 {
4011 AsnTag tag1;
4012 AsnLen setBytesDecoded = 0;
4013 unsigned int mandatoryElmtsDecoded = 0;
4014 AsnLen elmtLen1;
4015
4016 for (; (setBytesDecoded < elmtLen0) || (elmtLen0 == INDEFINITE_LEN); )
4017 {
4018 tag1 = BDecTag (b, setBytesDecoded, env);
4019
4020 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
4021 {
4022 BDEC_2ND_EOC_OCTET (b, setBytesDecoded, env)
4023 break; /* exit for loop */
4024 }
4025 elmtLen1 = BDecLen (b, setBytesDecoded, env);
4026 switch (tag1)
4027 {
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++;
4032 break;
4033
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);
4038 break;
4039
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);
4044 break;
4045
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);
4050 break;
4051
4052 default:
4053 Asn1Error << "Unexpected Tag on SET elmt." << endl;
4054 longjmp (env, -131);
4055 } // end switch
4056 } // end for loop
4057 bytesDecoded += setBytesDecoded;
4058 if (mandatoryElmtsDecoded != 1)
4059 {
4060 Asn1Error << "ERROR - non-optional SET element missing." << endl;
4061 longjmp (env, -132);
4062 }
4063 } // TeletexPersonalName::BDecContent
4064
4065 AsnLen
4066 TeletexPersonalName::BEnc (BUF_TYPE b)
4067 {
4068 AsnLen l;
4069 l = BEncContent (b);
4070 l += BEncConsLen (b, l);
4071 l += BEncTag1 (b, UNIV, CONS, SET_TAG_CODE);
4072 return l;
4073 }
4074
4075 void TeletexPersonalName::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
4076 {
4077 AsnTag tag;
4078 AsnLen elmtLen1;
4079
4080 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SET_TAG_CODE))
4081 {
4082 Asn1Error << "TeletexPersonalName::BDec: ERROR - wrong tag" << endl;
4083 longjmp (env, -133);
4084 }
4085 elmtLen1 = BDecLen (b, bytesDecoded, env);
4086 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
4087 }
4088
4089 int TeletexPersonalName::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded)
4090 {
4091 bytesEncoded = BEnc (b);
4092 return !b.WriteError();
4093 }
4094
4095 int TeletexPersonalName::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded)
4096 {
4097 ENV_TYPE env;
4098 int val;
4099
4100 bytesDecoded = 0;
4101 if ((val = setjmp (env)) == 0)
4102 {
4103 BDec (b, bytesDecoded, env);
4104 return !b.ReadError();
4105 }
4106 else
4107 return false;
4108 }
4109
4110 void TeletexPersonalName::Print (ostream &os) const
4111 {
4112 #ifndef NDEBUG
4113 os << "{ -- SET --" << endl;
4114 indentG += stdIndentG;
4115
4116 {
4117 Indent (os, indentG);
4118 os << "surname ";
4119 os << surname;
4120 }
4121
4122 if (NOT_NULL (given_name))
4123 {
4124 os << ","<< endl;
4125 Indent (os, indentG);
4126 os << "given-name ";
4127 os << *given_name;
4128 }
4129 else
4130 os << "-- void2 --\n";
4131
4132 if (NOT_NULL (initials))
4133 {
4134 os << ","<< endl;
4135 Indent (os, indentG);
4136 os << "initials ";
4137 os << *initials;
4138 }
4139 else
4140 os << "-- void2 --\n";
4141
4142 if (NOT_NULL (generation_qualifier))
4143 {
4144 os << ","<< endl;
4145 Indent (os, indentG);
4146 os << "generation-qualifier ";
4147 os << *generation_qualifier;
4148 }
4149 else
4150 os << "-- void2 --\n";
4151
4152 os << endl;
4153 indentG -= stdIndentG;
4154 Indent (os, indentG);
4155 os << "}";
4156 #endif /* NDEBUG */
4157 } // TeletexPersonalName - operator <<
4158
4159
4160 AsnType *TeletexOrganizationUnitNames::Clone() const
4161 {
4162 return new TeletexOrganizationUnitNames;
4163 }
4164
4165 AsnType *TeletexOrganizationUnitNames::Copy() const
4166 {
4167 return new TeletexOrganizationUnitNames (*this);
4168 }
4169
4170 AsnLen TeletexOrganizationUnitNames::BEnc (BUF_TYPE b)
4171 {
4172 AsnLen l;
4173 l = BEncContent (b);
4174 l += BEncConsLen (b, l);
4175 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
4176 return l;
4177 }
4178
4179 void TeletexOrganizationUnitNames::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
4180 {
4181 AsnTag tag;
4182 AsnLen elmtLen1;
4183
4184 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
4185 {
4186 Asn1Error << "TeletexOrganizationUnitNames::BDec: ERROR - wrong tag" << endl;
4187 longjmp (env, -134);
4188 }
4189 elmtLen1 = BDecLen (b, bytesDecoded, env);
4190 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
4191 }
4192
4193 TeletexOrganizationUnitNames::TeletexOrganizationUnitNames (const TeletexOrganizationUnitNames &)
4194 {
4195 Asn1Error << "use of incompletely defined TeletexOrganizationUnitNames::TeletexOrganizationUnitNames (const TeletexOrganizationUnitNames &)" << endl;
4196 abort();
4197 }
4198
4199 TeletexOrganizationUnitNames::~TeletexOrganizationUnitNames()
4200 {
4201 SetCurrToFirst();
4202 for (; Curr() != NULL; RemoveCurrFromList())
4203 ;
4204 } // end of destructor
4205
4206 #if SNACC_DEEP_COPY
4207 TeletexOrganizationUnitNames &TeletexOrganizationUnitNames::operator = (const TeletexOrganizationUnitNames &that)
4208 #else // SNACC_DEEP_COPY
4209 TeletexOrganizationUnitNames &TeletexOrganizationUnitNames::operator = (const TeletexOrganizationUnitNames &)
4210 #endif // SNACC_DEEP_COPY
4211 {
4212 #if SNACC_DEEP_COPY
4213 if (this != &that)
4214 {
4215 SetCurrToFirst();
4216 for (; Curr(); RemoveCurrFromList())
4217 ;
4218
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);
4224 }
4225
4226 return *this;
4227 #else // SNACC_DEEP_COPY
4228 Asn1Error << "use of incompletely defined TeletexOrganizationUnitNames &TeletexOrganizationUnitNames::operator = (const TeletexOrganizationUnitNames &)" << endl;
4229 abort();
4230 // if your compiler complains here, check the -novolat option
4231 #endif // SNACC_DEEP_COPY
4232 }
4233
4234 void TeletexOrganizationUnitNames::Print (ostream &os) const
4235 {
4236 #ifndef NDEBUG
4237 os << "{ -- SEQUENCE/SET OF -- " << endl;
4238 indentG += stdIndentG;
4239 //SetCurrToFirst();
4240 //for (; Curr() != NULL; GoNext())
4241 for (const AsnListElmt *run=first; run; run=run->next)
4242 {
4243 Indent (os, indentG);
4244 //os << *Curr();
4245 os << *run->elmt;
4246 //if (Curr() != Last())
4247 if (run != last)
4248 os << ",";
4249 os << endl;
4250 }
4251 indentG -= stdIndentG;
4252 Indent (os, indentG);
4253 os << "}\n";
4254 #endif /* NDEBUG */
4255
4256
4257 } // Print
4258
4259
4260 void TeletexOrganizationUnitNames::SetCurrElmt (unsigned long int index)
4261 {
4262 unsigned long int i;
4263 curr = first;
4264 if (count)
4265 for (i = 0; (i < (count-1)) && (i < index); i++)
4266 curr = curr->next;
4267 } // TeletexOrganizationUnitNames::SetCurrElmt
4268
4269
4270 unsigned long int TeletexOrganizationUnitNames::GetCurrElmtIndex()
4271 {
4272 unsigned long int i;
4273 AsnListElmt *tmp;
4274 if (curr != NULL)
4275 {
4276 for (i = 0, tmp = first; tmp != NULL; i++)
4277 {
4278 if (tmp == curr)
4279 return i;
4280 else
4281 tmp = tmp->next;
4282 }
4283 }
4284 return count;
4285 } // TeletexOrganizationUnitNames::GetCurrElmtIndex
4286
4287
4288 // alloc new list elmt, put at end of list
4289 // and return the component type
4290 TeletexOrganizationalUnitName *TeletexOrganizationUnitNames::Append()
4291 {
4292 AsnListElmt *newElmt;
4293 newElmt = new AsnListElmt;
4294 newElmt->elmt = new TeletexOrganizationalUnitName;
4295 newElmt->next = NULL;
4296 if (last == NULL)
4297 {
4298 newElmt->prev = NULL;
4299 first = last = newElmt;
4300 }
4301 else
4302 {
4303 newElmt->prev = last;
4304 last->next = newElmt;
4305 last = newElmt;
4306 }
4307 count++;
4308 return (curr = newElmt)->elmt;
4309 } // TeletexOrganizationUnitNames::Append
4310
4311
4312 // alloc new list elmt, put at begining of list
4313 // and return the component type
4314 TeletexOrganizationalUnitName *TeletexOrganizationUnitNames::Prepend()
4315 {
4316 AsnListElmt *newElmt;
4317 newElmt = new AsnListElmt;
4318 newElmt->elmt = new TeletexOrganizationalUnitName;
4319 newElmt->prev = NULL;
4320 if (first == NULL)
4321 {
4322 newElmt->next = NULL;
4323 first = last = newElmt;
4324 }
4325 else
4326 {
4327 newElmt->next = first;
4328 first->prev = newElmt;
4329 first = newElmt;
4330 }
4331 count++;
4332 return (curr = newElmt)->elmt;
4333 } // TeletexOrganizationUnitNames::Prepend
4334
4335
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()
4341 {
4342 AsnListElmt *newElmt;
4343 newElmt = new AsnListElmt;
4344 newElmt->elmt = new TeletexOrganizationalUnitName;
4345 if (curr == NULL)
4346 {
4347 newElmt->next = first;
4348 newElmt->prev = NULL;
4349 first = newElmt;
4350 if (last == NULL)
4351 last = newElmt;
4352 }
4353 else
4354 {
4355 newElmt->next = curr;
4356 newElmt->prev = curr->prev;
4357 curr->prev = newElmt;
4358 if (curr == first)
4359 first = newElmt;
4360 else
4361 newElmt->prev->next = newElmt;
4362 }
4363 count++;
4364 return (curr = newElmt)->elmt;
4365 } // TeletexOrganizationUnitNames::InsertBefore
4366
4367
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()
4373 {
4374 AsnListElmt *newElmt;
4375 newElmt = new AsnListElmt;
4376 newElmt->elmt = new TeletexOrganizationalUnitName;
4377 if (curr == NULL)
4378 {
4379 newElmt->prev = last;
4380 newElmt->next = NULL;
4381 last = newElmt;
4382 if (first == NULL)
4383 first = newElmt;
4384 }
4385 else
4386 {
4387 newElmt->prev = curr;
4388 newElmt->next = curr->next;
4389 curr->next = newElmt;
4390 if (curr == last)
4391 last = newElmt;
4392 else
4393 newElmt->next->prev = newElmt;
4394 }
4395 count++;
4396 return (curr = newElmt)->elmt;
4397 } // TeletexOrganizationUnitNames::InsertAfter
4398
4399
4400 TeletexOrganizationUnitNames &TeletexOrganizationUnitNames::AppendCopy (TeletexOrganizationalUnitName &elmt)
4401 {
4402 AsnListElmt *newElmt;
4403 newElmt = new AsnListElmt;
4404 newElmt->elmt = new TeletexOrganizationalUnitName;
4405 *newElmt->elmt = elmt;
4406 newElmt->next = NULL;
4407 if (last == NULL)
4408 {
4409 newElmt->prev = NULL;
4410 first = last = newElmt;
4411 }
4412 else
4413 {
4414 newElmt->prev = last;
4415 last->next = newElmt;
4416 last = newElmt;
4417 }
4418 count++;
4419 return *this;
4420 } // AppendCopy
4421
4422
4423 TeletexOrganizationUnitNames &TeletexOrganizationUnitNames::PrependCopy (TeletexOrganizationalUnitName &elmt)
4424 {
4425 AsnListElmt *newElmt;
4426 newElmt = new AsnListElmt;
4427 newElmt->elmt = new TeletexOrganizationalUnitName;
4428 *newElmt->elmt = elmt;
4429 newElmt->prev = NULL;
4430 if (first == NULL)
4431 {
4432 newElmt->next = NULL;
4433 first = last = newElmt;
4434 }
4435 else
4436 {
4437 newElmt->next = first;
4438 first->prev = newElmt;
4439 first = newElmt;
4440 }
4441 count++;
4442 return *this;
4443 } // TeletexOrganizationUnitNames::PrependCopy
4444
4445
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)
4452 {
4453 AsnListElmt *newElmt;
4454
4455 newElmt = new AsnListElmt;
4456 newElmt->elmt = new TeletexOrganizationalUnitName;
4457 *newElmt->elmt = elmt;
4458
4459 if (curr == NULL)
4460 {
4461 newElmt->next = first;
4462 newElmt->prev = NULL;
4463 first = newElmt;
4464 if (last == NULL)
4465 last = newElmt;
4466 }
4467 else
4468 {
4469 newElmt->next = curr;
4470 newElmt->prev = curr->prev;
4471 curr->prev = newElmt;
4472 if (curr == first)
4473 first = newElmt;
4474 else
4475 newElmt->prev->next = newElmt;
4476 }
4477 count++;
4478 return *this;
4479 } // TeletexOrganizationUnitNames::InsertBeforeAndCopy
4480
4481
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)
4488 {
4489 AsnListElmt *newElmt;
4490
4491 newElmt = new AsnListElmt;
4492 newElmt->elmt = new TeletexOrganizationalUnitName;
4493 *newElmt->elmt = elmt;
4494 if (curr == NULL)
4495 {
4496 newElmt->prev = last;
4497 newElmt->next = NULL;
4498 last = newElmt;
4499 if (first == NULL)
4500 first = newElmt;
4501 }
4502 else
4503 {
4504 newElmt->prev = curr;
4505 newElmt->next = curr->next;
4506 curr->next = newElmt;
4507 if (curr == last)
4508 last = newElmt;
4509 else
4510 newElmt->next->prev = newElmt;
4511 }
4512 count++;
4513 return *this;
4514 } // TeletexOrganizationUnitNames::InsertAfterAndCopy
4515
4516
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()
4522 {
4523 AsnListElmt *del_elmt;
4524
4525 if (curr != NULL)
4526 {
4527 del_elmt = curr;
4528 count--;
4529
4530 if (count == 0)
4531 first = last = curr = NULL;
4532 else if (curr == first)
4533 {
4534 curr = first= first->next;
4535 first->prev = NULL;
4536 }
4537 else if (curr == last)
4538 {
4539 curr = last = last->prev;
4540 last->next = NULL;
4541 }
4542 else
4543 {
4544 curr->prev->next = curr->next;
4545 curr->next->prev = curr->prev;
4546 }
4547
4548 delete del_elmt->elmt;
4549 delete del_elmt;
4550 }
4551 }
4552
4553
4554 AsnLen TeletexOrganizationUnitNames::BEncContent (BUF_TYPE b)
4555 {
4556 AsnListElmt *currElmt;
4557 AsnLen elmtLen;
4558 AsnLen totalLen = 0;
4559 for (currElmt = last; currElmt != NULL; currElmt = currElmt->prev)
4560 {
4561 elmtLen = currElmt->elmt->BEncContent (b);
4562 elmtLen += BEncDefLen (b, elmtLen);
4563
4564 elmtLen += BEncTag1 (b, UNIV, PRIM, TELETEXSTRING_TAG_CODE);
4565 totalLen += elmtLen;
4566 }
4567 return totalLen;
4568 } // TeletexOrganizationUnitNames::BEncContent
4569
4570
4571 void TeletexOrganizationUnitNames::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0,
4572 AsnLen &bytesDecoded, ENV_TYPE env)
4573 {
4574 TeletexOrganizationalUnitName *listElmt;
4575 AsnTag tag1;
4576 AsnLen listBytesDecoded = 0;
4577 AsnLen elmtLen1;
4578
4579 while ((listBytesDecoded < elmtLen0) || (elmtLen0 == INDEFINITE_LEN))
4580 {
4581 tag1 = BDecTag (b, listBytesDecoded, env);
4582 if ((tag1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
4583 {
4584 BDEC_2ND_EOC_OCTET (b, listBytesDecoded, env);
4585 break;
4586 }
4587 if ((tag1 != MAKE_TAG_ID (UNIV, PRIM, TELETEXSTRING_TAG_CODE))
4588 && (tag1 != MAKE_TAG_ID (UNIV, CONS, TELETEXSTRING_TAG_CODE)))
4589 {
4590 Asn1Error << "Unexpected Tag" << endl;
4591 longjmp (env, -135);
4592 }
4593
4594 elmtLen1 = BDecLen (b, listBytesDecoded, env);
4595 listElmt = Append();
4596 listElmt->BDecContent (b, tag1, elmtLen1, listBytesDecoded, env);
4597 }
4598
4599 bytesDecoded += listBytesDecoded;
4600 } // TeletexOrganizationUnitNames::BDecContent
4601
4602
4603 AsnType *TeletexDomainDefinedAttributes::Clone() const
4604 {
4605 return new TeletexDomainDefinedAttributes;
4606 }
4607
4608 AsnType *TeletexDomainDefinedAttributes::Copy() const
4609 {
4610 return new TeletexDomainDefinedAttributes (*this);
4611 }
4612
4613 AsnLen TeletexDomainDefinedAttributes::BEnc (BUF_TYPE b)
4614 {
4615 AsnLen l;
4616 l = BEncContent (b);
4617 l += BEncConsLen (b, l);
4618 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
4619 return l;
4620 }
4621
4622 void TeletexDomainDefinedAttributes::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
4623 {
4624 AsnTag tag;
4625 AsnLen elmtLen1;
4626
4627 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
4628 {
4629 Asn1Error << "TeletexDomainDefinedAttributes::BDec: ERROR - wrong tag" << endl;
4630 longjmp (env, -136);
4631 }
4632 elmtLen1 = BDecLen (b, bytesDecoded, env);
4633 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
4634 }
4635
4636 TeletexDomainDefinedAttributes::TeletexDomainDefinedAttributes (const TeletexDomainDefinedAttributes &)
4637 {
4638 Asn1Error << "use of incompletely defined TeletexDomainDefinedAttributes::TeletexDomainDefinedAttributes (const TeletexDomainDefinedAttributes &)" << endl;
4639 abort();
4640 }
4641
4642 TeletexDomainDefinedAttributes::~TeletexDomainDefinedAttributes()
4643 {
4644 SetCurrToFirst();
4645 for (; Curr() != NULL; RemoveCurrFromList())
4646 ;
4647 } // end of destructor
4648
4649 #if SNACC_DEEP_COPY
4650 TeletexDomainDefinedAttributes &TeletexDomainDefinedAttributes::operator = (const TeletexDomainDefinedAttributes &that)
4651 #else // SNACC_DEEP_COPY
4652 TeletexDomainDefinedAttributes &TeletexDomainDefinedAttributes::operator = (const TeletexDomainDefinedAttributes &)
4653 #endif // SNACC_DEEP_COPY
4654 {
4655 #if SNACC_DEEP_COPY
4656 if (this != &that)
4657 {
4658 SetCurrToFirst();
4659 for (; Curr(); RemoveCurrFromList())
4660 ;
4661
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);
4667 }
4668
4669 return *this;
4670 #else // SNACC_DEEP_COPY
4671 Asn1Error << "use of incompletely defined TeletexDomainDefinedAttributes &TeletexDomainDefinedAttributes::operator = (const TeletexDomainDefinedAttributes &)" << endl;
4672 abort();
4673 // if your compiler complains here, check the -novolat option
4674 #endif // SNACC_DEEP_COPY
4675 }
4676
4677 void TeletexDomainDefinedAttributes::Print (ostream &os) const
4678 {
4679 #ifndef NDEBUG
4680 os << "{ -- SEQUENCE/SET OF -- " << endl;
4681 indentG += stdIndentG;
4682 //SetCurrToFirst();
4683 //for (; Curr() != NULL; GoNext())
4684 for (const AsnListElmt *run=first; run; run=run->next)
4685 {
4686 Indent (os, indentG);
4687 //os << *Curr();
4688 os << *run->elmt;
4689 //if (Curr() != Last())
4690 if (run != last)
4691 os << ",";
4692 os << endl;
4693 }
4694 indentG -= stdIndentG;
4695 Indent (os, indentG);
4696 os << "}\n";
4697 #endif /* NDEBUG */
4698
4699
4700 } // Print
4701
4702
4703 void TeletexDomainDefinedAttributes::SetCurrElmt (unsigned long int index)
4704 {
4705 unsigned long int i;
4706 curr = first;
4707 if (count)
4708 for (i = 0; (i < (count-1)) && (i < index); i++)
4709 curr = curr->next;
4710 } // TeletexDomainDefinedAttributes::SetCurrElmt
4711
4712
4713 unsigned long int TeletexDomainDefinedAttributes::GetCurrElmtIndex()
4714 {
4715 unsigned long int i;
4716 AsnListElmt *tmp;
4717 if (curr != NULL)
4718 {
4719 for (i = 0, tmp = first; tmp != NULL; i++)
4720 {
4721 if (tmp == curr)
4722 return i;
4723 else
4724 tmp = tmp->next;
4725 }
4726 }
4727 return count;
4728 } // TeletexDomainDefinedAttributes::GetCurrElmtIndex
4729
4730
4731 // alloc new list elmt, put at end of list
4732 // and return the component type
4733 TeletexDomainDefinedAttribute *TeletexDomainDefinedAttributes::Append()
4734 {
4735 AsnListElmt *newElmt;
4736 newElmt = new AsnListElmt;
4737 newElmt->elmt = new TeletexDomainDefinedAttribute;
4738 newElmt->next = NULL;
4739 if (last == NULL)
4740 {
4741 newElmt->prev = NULL;
4742 first = last = newElmt;
4743 }
4744 else
4745 {
4746 newElmt->prev = last;
4747 last->next = newElmt;
4748 last = newElmt;
4749 }
4750 count++;
4751 return (curr = newElmt)->elmt;
4752 } // TeletexDomainDefinedAttributes::Append
4753
4754
4755 // alloc new list elmt, put at begining of list
4756 // and return the component type
4757 TeletexDomainDefinedAttribute *TeletexDomainDefinedAttributes::Prepend()
4758 {
4759 AsnListElmt *newElmt;
4760 newElmt = new AsnListElmt;
4761 newElmt->elmt = new TeletexDomainDefinedAttribute;
4762 newElmt->prev = NULL;
4763 if (first == NULL)
4764 {
4765 newElmt->next = NULL;
4766 first = last = newElmt;
4767 }
4768 else
4769 {
4770 newElmt->next = first;
4771 first->prev = newElmt;
4772 first = newElmt;
4773 }
4774 count++;
4775 return (curr = newElmt)->elmt;
4776 } // TeletexDomainDefinedAttributes::Prepend
4777
4778
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()
4784 {
4785 AsnListElmt *newElmt;
4786 newElmt = new AsnListElmt;
4787 newElmt->elmt = new TeletexDomainDefinedAttribute;
4788 if (curr == NULL)
4789 {
4790 newElmt->next = first;
4791 newElmt->prev = NULL;
4792 first = newElmt;
4793 if (last == NULL)
4794 last = newElmt;
4795 }
4796 else
4797 {
4798 newElmt->next = curr;
4799 newElmt->prev = curr->prev;
4800 curr->prev = newElmt;
4801 if (curr == first)
4802 first = newElmt;
4803 else
4804 newElmt->prev->next = newElmt;
4805 }
4806 count++;
4807 return (curr = newElmt)->elmt;
4808 } // TeletexDomainDefinedAttributes::InsertBefore
4809
4810
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()
4816 {
4817 AsnListElmt *newElmt;
4818 newElmt = new AsnListElmt;
4819 newElmt->elmt = new TeletexDomainDefinedAttribute;
4820 if (curr == NULL)
4821 {
4822 newElmt->prev = last;
4823 newElmt->next = NULL;
4824 last = newElmt;
4825 if (first == NULL)
4826 first = newElmt;
4827 }
4828 else
4829 {
4830 newElmt->prev = curr;
4831 newElmt->next = curr->next;
4832 curr->next = newElmt;
4833 if (curr == last)
4834 last = newElmt;
4835 else
4836 newElmt->next->prev = newElmt;
4837 }
4838 count++;
4839 return (curr = newElmt)->elmt;
4840 } // TeletexDomainDefinedAttributes::InsertAfter
4841
4842
4843 TeletexDomainDefinedAttributes &TeletexDomainDefinedAttributes::AppendCopy (TeletexDomainDefinedAttribute &elmt)
4844 {
4845 AsnListElmt *newElmt;
4846 newElmt = new AsnListElmt;
4847 newElmt->elmt = new TeletexDomainDefinedAttribute;
4848 *newElmt->elmt = elmt;
4849 newElmt->next = NULL;
4850 if (last == NULL)
4851 {
4852 newElmt->prev = NULL;
4853 first = last = newElmt;
4854 }
4855 else
4856 {
4857 newElmt->prev = last;
4858 last->next = newElmt;
4859 last = newElmt;
4860 }
4861 count++;
4862 return *this;
4863 } // AppendCopy
4864
4865
4866 TeletexDomainDefinedAttributes &TeletexDomainDefinedAttributes::PrependCopy (TeletexDomainDefinedAttribute &elmt)
4867 {
4868 AsnListElmt *newElmt;
4869 newElmt = new AsnListElmt;
4870 newElmt->elmt = new TeletexDomainDefinedAttribute;
4871 *newElmt->elmt = elmt;
4872 newElmt->prev = NULL;
4873 if (first == NULL)
4874 {
4875 newElmt->next = NULL;
4876 first = last = newElmt;
4877 }
4878 else
4879 {
4880 newElmt->next = first;
4881 first->prev = newElmt;
4882 first = newElmt;
4883 }
4884 count++;
4885 return *this;
4886 } // TeletexDomainDefinedAttributes::PrependCopy
4887
4888
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)
4895 {
4896 AsnListElmt *newElmt;
4897
4898 newElmt = new AsnListElmt;
4899 newElmt->elmt = new TeletexDomainDefinedAttribute;
4900 *newElmt->elmt = elmt;
4901
4902 if (curr == NULL)
4903 {
4904 newElmt->next = first;
4905 newElmt->prev = NULL;
4906 first = newElmt;
4907 if (last == NULL)
4908 last = newElmt;
4909 }
4910 else
4911 {
4912 newElmt->next = curr;
4913 newElmt->prev = curr->prev;
4914 curr->prev = newElmt;
4915 if (curr == first)
4916 first = newElmt;
4917 else
4918 newElmt->prev->next = newElmt;
4919 }
4920 count++;
4921 return *this;
4922 } // TeletexDomainDefinedAttributes::InsertBeforeAndCopy
4923
4924
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)
4931 {
4932 AsnListElmt *newElmt;
4933
4934 newElmt = new AsnListElmt;
4935 newElmt->elmt = new TeletexDomainDefinedAttribute;
4936 *newElmt->elmt = elmt;
4937 if (curr == NULL)
4938 {
4939 newElmt->prev = last;
4940 newElmt->next = NULL;
4941 last = newElmt;
4942 if (first == NULL)
4943 first = newElmt;
4944 }
4945 else
4946 {
4947 newElmt->prev = curr;
4948 newElmt->next = curr->next;
4949 curr->next = newElmt;
4950 if (curr == last)
4951 last = newElmt;
4952 else
4953 newElmt->next->prev = newElmt;
4954 }
4955 count++;
4956 return *this;
4957 } // TeletexDomainDefinedAttributes::InsertAfterAndCopy
4958
4959
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()
4965 {
4966 AsnListElmt *del_elmt;
4967
4968 if (curr != NULL)
4969 {
4970 del_elmt = curr;
4971 count--;
4972
4973 if (count == 0)
4974 first = last = curr = NULL;
4975 else if (curr == first)
4976 {
4977 curr = first= first->next;
4978 first->prev = NULL;
4979 }
4980 else if (curr == last)
4981 {
4982 curr = last = last->prev;
4983 last->next = NULL;
4984 }
4985 else
4986 {
4987 curr->prev->next = curr->next;
4988 curr->next->prev = curr->prev;
4989 }
4990
4991 delete del_elmt->elmt;
4992 delete del_elmt;
4993 }
4994 }
4995
4996
4997 AsnLen TeletexDomainDefinedAttributes::BEncContent (BUF_TYPE b)
4998 {
4999 AsnListElmt *currElmt;
5000 AsnLen elmtLen;
5001 AsnLen totalLen = 0;
5002 for (currElmt = last; currElmt != NULL; currElmt = currElmt->prev)
5003 {
5004 BEncEocIfNec (b);
5005 elmtLen = currElmt->elmt->BEncContent (b);
5006 elmtLen += BEncConsLen (b, elmtLen);
5007
5008 elmtLen += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
5009 totalLen += elmtLen;
5010 }
5011 return totalLen;
5012 } // TeletexDomainDefinedAttributes::BEncContent
5013
5014
5015 void TeletexDomainDefinedAttributes::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0,
5016 AsnLen &bytesDecoded, ENV_TYPE env)
5017 {
5018 TeletexDomainDefinedAttribute *listElmt;
5019 AsnTag tag1;
5020 AsnLen listBytesDecoded = 0;
5021 AsnLen elmtLen1;
5022
5023 while ((listBytesDecoded < elmtLen0) || (elmtLen0 == INDEFINITE_LEN))
5024 {
5025 tag1 = BDecTag (b, listBytesDecoded, env);
5026 if ((tag1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
5027 {
5028 BDEC_2ND_EOC_OCTET (b, listBytesDecoded, env);
5029 break;
5030 }
5031 if ((tag1 != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
5032 {
5033 Asn1Error << "Unexpected Tag" << endl;
5034 longjmp (env, -137);
5035 }
5036
5037 elmtLen1 = BDecLen (b, listBytesDecoded, env);
5038 listElmt = Append();
5039 listElmt->BDecContent (b, tag1, elmtLen1, listBytesDecoded, env);
5040 }
5041
5042 bytesDecoded += listBytesDecoded;
5043 } // TeletexDomainDefinedAttributes::BDecContent
5044
5045