]> git.saurik.com Git - apple/security.git/blob - SecurityASN1/c++/sm_ess.cpp
f6a22666af98c78bb9a1bbe39ba0e07c0c8a02b1
[apple/security.git] / SecurityASN1 / c++ / sm_ess.cpp
1 // NOTE: this is a machine generated file--editing not recommended
2 //
3 // sm_ess.cpp - class member functions for ASN.1 module ExtendedSecurityServices
4 //
5 // This file was generated by snacc on Mon Apr 22 22:34:19 2002
6 // UBC snacc written by Mike Sample
7 // A couple of enhancements made by IBM European Networking Center
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 #include "pkcs10.h"
28
29 //------------------------------------------------------------------------------
30 // value defs
31
32
33 //------------------------------------------------------------------------------
34 // class member definitions:
35
36 AsnType *SigningCertificateSeqOf1::Clone() const
37 {
38 return new SigningCertificateSeqOf1;
39 }
40
41 AsnType *SigningCertificateSeqOf1::Copy() const
42 {
43 return new SigningCertificateSeqOf1 (*this);
44 }
45
46 AsnLen SigningCertificateSeqOf1::BEnc (BUF_TYPE b)
47 {
48 AsnLen l;
49 l = BEncContent (b);
50 l += BEncConsLen (b, l);
51 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
52 return l;
53 }
54
55 void SigningCertificateSeqOf1::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
56 {
57 AsnTag tag;
58 AsnLen elmtLen1;
59
60 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
61 {
62 Asn1Error << "SigningCertificateSeqOf1::BDec: ERROR - wrong tag" << endl;
63 SnaccExcep::throwMe(-100);
64 }
65 elmtLen1 = BDecLen (b, bytesDecoded, env);
66 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
67 }
68
69 SigningCertificateSeqOf1::SigningCertificateSeqOf1 (const SigningCertificateSeqOf1 &)
70 {
71 Asn1Error << "use of incompletely defined SigningCertificateSeqOf1::SigningCertificateSeqOf1 (const SigningCertificateSeqOf1 &)" << endl;
72 abort();
73 }
74
75 SigningCertificateSeqOf1::~SigningCertificateSeqOf1()
76 {
77 SetCurrToFirst();
78 for (; Curr() != NULL; RemoveCurrFromList())
79 ;
80 } // end of destructor
81
82 #if SNACC_DEEP_COPY
83 SigningCertificateSeqOf1 &SigningCertificateSeqOf1::operator = (const SigningCertificateSeqOf1 &that)
84 #else // SNACC_DEEP_COPY
85 SigningCertificateSeqOf1 &SigningCertificateSeqOf1::operator = (const SigningCertificateSeqOf1 &)
86 #endif // SNACC_DEEP_COPY
87 {
88 #if SNACC_DEEP_COPY
89 if (this != &that)
90 {
91 SetCurrToFirst();
92 for (; Curr(); RemoveCurrFromList())
93 ;
94
95 //that.SetCurrToFirst();
96 //for (; that.Curr(); that.GoNext())
97 // AppendCopy (*that.Curr());
98 for (const AsnListElmt *run=that.first; run; run=run->next)
99 AppendCopy (*run->elmt);
100 }
101
102 return *this;
103 #else // SNACC_DEEP_COPY
104 Asn1Error << "use of incompletely defined SigningCertificateSeqOf1 &SigningCertificateSeqOf1::operator = (const SigningCertificateSeqOf1 &)" << endl;
105 abort();
106 // if your compiler complains here, check the -novolat option
107 #endif // SNACC_DEEP_COPY
108 }
109
110 void SigningCertificateSeqOf1::Print (ostream &os) const
111 {
112 #ifndef NDEBUG
113 os << "{ -- SEQUENCE/SET OF -- " << endl;
114 indentG += stdIndentG;
115 //SetCurrToFirst();
116 //for (; Curr() != NULL; GoNext())
117 for (const AsnListElmt *run=first; run; run=run->next)
118 {
119 Indent (os, indentG);
120 //os << *Curr();
121 os << *run->elmt;
122 //if (Curr() != Last())
123 if (run != last)
124 os << ",";
125 os << endl;
126 }
127 indentG -= stdIndentG;
128 Indent (os, indentG);
129 os << "}\n";
130 #endif /* NDEBUG */
131
132
133 } // Print
134
135
136 void SigningCertificateSeqOf1::SetCurrElmt (unsigned long int index)
137 {
138 unsigned long int i;
139 curr = first;
140 if (count)
141 for (i = 0; (i < (count-1)) && (i < index); i++)
142 curr = curr->next;
143 } // SigningCertificateSeqOf1::SetCurrElmt
144
145
146 unsigned long int SigningCertificateSeqOf1::GetCurrElmtIndex()
147 {
148 unsigned long int i;
149 AsnListElmt *tmp;
150 if (curr != NULL)
151 {
152 for (i = 0, tmp = first; tmp != NULL; i++)
153 {
154 if (tmp == curr)
155 return i;
156 else
157 tmp = tmp->next;
158 }
159 }
160 return count;
161 } // SigningCertificateSeqOf1::GetCurrElmtIndex
162
163
164 // alloc new list elmt, put at end of list
165 // and return the component type
166 PolicyInformation *SigningCertificateSeqOf1::Append()
167 {
168 AsnListElmt *newElmt;
169 newElmt = new AsnListElmt;
170 newElmt->elmt = new PolicyInformation;
171 newElmt->next = NULL;
172 if (last == NULL)
173 {
174 newElmt->prev = NULL;
175 first = last = newElmt;
176 }
177 else
178 {
179 newElmt->prev = last;
180 last->next = newElmt;
181 last = newElmt;
182 }
183 count++;
184 return (curr = newElmt)->elmt;
185 } // SigningCertificateSeqOf1::Append
186
187
188 // alloc new list elmt, put at begining of list
189 // and return the component type
190 PolicyInformation *SigningCertificateSeqOf1::Prepend()
191 {
192 AsnListElmt *newElmt;
193 newElmt = new AsnListElmt;
194 newElmt->elmt = new PolicyInformation;
195 newElmt->prev = NULL;
196 if (first == NULL)
197 {
198 newElmt->next = NULL;
199 first = last = newElmt;
200 }
201 else
202 {
203 newElmt->next = first;
204 first->prev = newElmt;
205 first = newElmt;
206 }
207 count++;
208 return (curr = newElmt)->elmt;
209 } // SigningCertificateSeqOf1::Prepend
210
211
212 // alloc new list elmt, insert it before the
213 // current element and return the component type
214 // if the current element is null, the new element
215 // is placed at the beginning of the list.
216 PolicyInformation *SigningCertificateSeqOf1::InsertBefore()
217 {
218 AsnListElmt *newElmt;
219 newElmt = new AsnListElmt;
220 newElmt->elmt = new PolicyInformation;
221 if (curr == NULL)
222 {
223 newElmt->next = first;
224 newElmt->prev = NULL;
225 first = newElmt;
226 if (last == NULL)
227 last = newElmt;
228 }
229 else
230 {
231 newElmt->next = curr;
232 newElmt->prev = curr->prev;
233 curr->prev = newElmt;
234 if (curr == first)
235 first = newElmt;
236 else
237 newElmt->prev->next = newElmt;
238 }
239 count++;
240 return (curr = newElmt)->elmt;
241 } // SigningCertificateSeqOf1::InsertBefore
242
243
244 // alloc new list elmt, insert it after the
245 // current element and return the component type
246 // if the current element is null, the new element
247 // is placed at the end of the list.
248 PolicyInformation *SigningCertificateSeqOf1::InsertAfter()
249 {
250 AsnListElmt *newElmt;
251 newElmt = new AsnListElmt;
252 newElmt->elmt = new PolicyInformation;
253 if (curr == NULL)
254 {
255 newElmt->prev = last;
256 newElmt->next = NULL;
257 last = newElmt;
258 if (first == NULL)
259 first = newElmt;
260 }
261 else
262 {
263 newElmt->prev = curr;
264 newElmt->next = curr->next;
265 curr->next = newElmt;
266 if (curr == last)
267 last = newElmt;
268 else
269 newElmt->next->prev = newElmt;
270 }
271 count++;
272 return (curr = newElmt)->elmt;
273 } // SigningCertificateSeqOf1::InsertAfter
274
275
276 SigningCertificateSeqOf1 &SigningCertificateSeqOf1::AppendCopy (PolicyInformation &elmt)
277 {
278 AsnListElmt *newElmt;
279 newElmt = new AsnListElmt;
280 newElmt->elmt = new PolicyInformation;
281 *newElmt->elmt = elmt;
282 newElmt->next = NULL;
283 if (last == NULL)
284 {
285 newElmt->prev = NULL;
286 first = last = newElmt;
287 }
288 else
289 {
290 newElmt->prev = last;
291 last->next = newElmt;
292 last = newElmt;
293 }
294 count++;
295 return *this;
296 } // AppendCopy
297
298
299 SigningCertificateSeqOf1 &SigningCertificateSeqOf1::PrependCopy (PolicyInformation &elmt)
300 {
301 AsnListElmt *newElmt;
302 newElmt = new AsnListElmt;
303 newElmt->elmt = new PolicyInformation;
304 *newElmt->elmt = elmt;
305 newElmt->prev = NULL;
306 if (first == NULL)
307 {
308 newElmt->next = NULL;
309 first = last = newElmt;
310 }
311 else
312 {
313 newElmt->next = first;
314 first->prev = newElmt;
315 first = newElmt;
316 }
317 count++;
318 return *this;
319 } // SigningCertificateSeqOf1::PrependCopy
320
321
322 // alloc new list elmt, insert it before the
323 // current element, copy the given elmt into the new elmt
324 // and return the component type.
325 // if the current element is null, the new element
326 // is placed at the beginning of the list.
327 SigningCertificateSeqOf1 &SigningCertificateSeqOf1::InsertBeforeAndCopy (PolicyInformation &elmt)
328 {
329 AsnListElmt *newElmt;
330
331 newElmt = new AsnListElmt;
332 newElmt->elmt = new PolicyInformation;
333 *newElmt->elmt = elmt;
334
335 if (curr == NULL)
336 {
337 newElmt->next = first;
338 newElmt->prev = NULL;
339 first = newElmt;
340 if (last == NULL)
341 last = newElmt;
342 }
343 else
344 {
345 newElmt->next = curr;
346 newElmt->prev = curr->prev;
347 curr->prev = newElmt;
348 if (curr == first)
349 first = newElmt;
350 else
351 newElmt->prev->next = newElmt;
352 }
353 count++;
354 return *this;
355 } // SigningCertificateSeqOf1::InsertBeforeAndCopy
356
357
358 // alloc new list elmt, insert it after the
359 // current element, copy given elmt in to new elmt
360 // and return the component type
361 // if the current element is null, the new element
362 // is placed at the end of the list.
363 SigningCertificateSeqOf1 &SigningCertificateSeqOf1::InsertAfterAndCopy (PolicyInformation &elmt)
364 {
365 AsnListElmt *newElmt;
366
367 newElmt = new AsnListElmt;
368 newElmt->elmt = new PolicyInformation;
369 *newElmt->elmt = elmt;
370 if (curr == NULL)
371 {
372 newElmt->prev = last;
373 newElmt->next = NULL;
374 last = newElmt;
375 if (first == NULL)
376 first = newElmt;
377 }
378 else
379 {
380 newElmt->prev = curr;
381 newElmt->next = curr->next;
382 curr->next = newElmt;
383 if (curr == last)
384 last = newElmt;
385 else
386 newElmt->next->prev = newElmt;
387 }
388 count++;
389 return *this;
390 } // SigningCertificateSeqOf1::InsertAfterAndCopy
391
392
393 // remove current element from list if current element is not NULL
394 // The new current element will be the next element.
395 // If the current element is the last element in the list
396 // the second but last element will become the new current element.
397 void SigningCertificateSeqOf1::RemoveCurrFromList()
398 {
399 AsnListElmt *del_elmt;
400
401 if (curr != NULL)
402 {
403 del_elmt = curr;
404 count--;
405
406 if (count == 0)
407 first = last = curr = NULL;
408 else if (curr == first)
409 {
410 curr = first= first->next;
411 first->prev = NULL;
412 }
413 else if (curr == last)
414 {
415 curr = last = last->prev;
416 last->next = NULL;
417 }
418 else
419 {
420 curr->prev->next = curr->next;
421 curr->next->prev = curr->prev;
422 }
423
424 delete del_elmt->elmt;
425 delete del_elmt;
426 }
427 }
428
429
430 AsnLen SigningCertificateSeqOf1::BEncContent (BUF_TYPE b)
431 {
432 AsnListElmt *currElmt;
433 AsnLen elmtLen;
434 AsnLen totalLen = 0;
435 for (currElmt = last; currElmt != NULL; currElmt = currElmt->prev)
436 {
437 BEncEocIfNec (b);
438 elmtLen = currElmt->elmt->BEncContent (b);
439 elmtLen += BEncConsLen (b, elmtLen);
440
441 elmtLen += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
442 totalLen += elmtLen;
443 }
444 return totalLen;
445 } // SigningCertificateSeqOf1::BEncContent
446
447
448 void SigningCertificateSeqOf1::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0,
449 AsnLen &bytesDecoded, ENV_TYPE env)
450 {
451 PolicyInformation *listElmt;
452 AsnTag tag1;
453 AsnLen listBytesDecoded = 0;
454 AsnLen elmtLen1;
455
456 while ((listBytesDecoded < elmtLen0) || (elmtLen0 == INDEFINITE_LEN))
457 {
458 tag1 = BDecTag (b, listBytesDecoded, env);
459 if ((tag1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
460 {
461 BDEC_2ND_EOC_OCTET (b, listBytesDecoded, env);
462 break;
463 }
464 if ((tag1 != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
465 {
466 Asn1Error << "Unexpected Tag" << endl;
467 SnaccExcep::throwMe(-101);
468 }
469
470 elmtLen1 = BDecLen (b, listBytesDecoded, env);
471 listElmt = Append();
472 listElmt->BDecContent (b, tag1, elmtLen1, listBytesDecoded, env);
473 }
474
475 bytesDecoded += listBytesDecoded;
476 } // SigningCertificateSeqOf1::BDecContent
477
478
479 AsnType *MLReceiptPolicySeqOf1::Clone() const
480 {
481 return new MLReceiptPolicySeqOf1;
482 }
483
484 AsnType *MLReceiptPolicySeqOf1::Copy() const
485 {
486 return new MLReceiptPolicySeqOf1 (*this);
487 }
488
489 AsnLen MLReceiptPolicySeqOf1::BEnc (BUF_TYPE b)
490 {
491 AsnLen l;
492 l = BEncContent (b);
493 l += BEncConsLen (b, l);
494 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
495 return l;
496 }
497
498 void MLReceiptPolicySeqOf1::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
499 {
500 AsnTag tag;
501 AsnLen elmtLen1;
502
503 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
504 {
505 Asn1Error << "MLReceiptPolicySeqOf1::BDec: ERROR - wrong tag" << endl;
506 SnaccExcep::throwMe(-102);
507 }
508 elmtLen1 = BDecLen (b, bytesDecoded, env);
509 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
510 }
511
512 MLReceiptPolicySeqOf1::MLReceiptPolicySeqOf1 (const MLReceiptPolicySeqOf1 &)
513 {
514 Asn1Error << "use of incompletely defined MLReceiptPolicySeqOf1::MLReceiptPolicySeqOf1 (const MLReceiptPolicySeqOf1 &)" << endl;
515 abort();
516 }
517
518 MLReceiptPolicySeqOf1::~MLReceiptPolicySeqOf1()
519 {
520 SetCurrToFirst();
521 for (; Curr() != NULL; RemoveCurrFromList())
522 ;
523 } // end of destructor
524
525 #if SNACC_DEEP_COPY
526 MLReceiptPolicySeqOf1 &MLReceiptPolicySeqOf1::operator = (const MLReceiptPolicySeqOf1 &that)
527 #else // SNACC_DEEP_COPY
528 MLReceiptPolicySeqOf1 &MLReceiptPolicySeqOf1::operator = (const MLReceiptPolicySeqOf1 &)
529 #endif // SNACC_DEEP_COPY
530 {
531 #if SNACC_DEEP_COPY
532 if (this != &that)
533 {
534 SetCurrToFirst();
535 for (; Curr(); RemoveCurrFromList())
536 ;
537
538 //that.SetCurrToFirst();
539 //for (; that.Curr(); that.GoNext())
540 // AppendCopy (*that.Curr());
541 for (const AsnListElmt *run=that.first; run; run=run->next)
542 AppendCopy (*run->elmt);
543 }
544
545 return *this;
546 #else // SNACC_DEEP_COPY
547 Asn1Error << "use of incompletely defined MLReceiptPolicySeqOf1 &MLReceiptPolicySeqOf1::operator = (const MLReceiptPolicySeqOf1 &)" << endl;
548 abort();
549 // if your compiler complains here, check the -novolat option
550 #endif // SNACC_DEEP_COPY
551 }
552
553 void MLReceiptPolicySeqOf1::Print (ostream &os) const
554 {
555 #ifndef NDEBUG
556 os << "{ -- SEQUENCE/SET OF -- " << endl;
557 indentG += stdIndentG;
558 //SetCurrToFirst();
559 //for (; Curr() != NULL; GoNext())
560 for (const AsnListElmt *run=first; run; run=run->next)
561 {
562 Indent (os, indentG);
563 //os << *Curr();
564 os << *run->elmt;
565 //if (Curr() != Last())
566 if (run != last)
567 os << ",";
568 os << endl;
569 }
570 indentG -= stdIndentG;
571 Indent (os, indentG);
572 os << "}\n";
573 #endif /* NDEBUG */
574
575
576 } // Print
577
578
579 void MLReceiptPolicySeqOf1::SetCurrElmt (unsigned long int index)
580 {
581 unsigned long int i;
582 curr = first;
583 if (count)
584 for (i = 0; (i < (count-1)) && (i < index); i++)
585 curr = curr->next;
586 } // MLReceiptPolicySeqOf1::SetCurrElmt
587
588
589 unsigned long int MLReceiptPolicySeqOf1::GetCurrElmtIndex()
590 {
591 unsigned long int i;
592 AsnListElmt *tmp;
593 if (curr != NULL)
594 {
595 for (i = 0, tmp = first; tmp != NULL; i++)
596 {
597 if (tmp == curr)
598 return i;
599 else
600 tmp = tmp->next;
601 }
602 }
603 return count;
604 } // MLReceiptPolicySeqOf1::GetCurrElmtIndex
605
606
607 // alloc new list elmt, put at end of list
608 // and return the component type
609 GeneralNames *MLReceiptPolicySeqOf1::Append()
610 {
611 AsnListElmt *newElmt;
612 newElmt = new AsnListElmt;
613 newElmt->elmt = new GeneralNames;
614 newElmt->next = NULL;
615 if (last == NULL)
616 {
617 newElmt->prev = NULL;
618 first = last = newElmt;
619 }
620 else
621 {
622 newElmt->prev = last;
623 last->next = newElmt;
624 last = newElmt;
625 }
626 count++;
627 return (curr = newElmt)->elmt;
628 } // MLReceiptPolicySeqOf1::Append
629
630
631 // alloc new list elmt, put at begining of list
632 // and return the component type
633 GeneralNames *MLReceiptPolicySeqOf1::Prepend()
634 {
635 AsnListElmt *newElmt;
636 newElmt = new AsnListElmt;
637 newElmt->elmt = new GeneralNames;
638 newElmt->prev = NULL;
639 if (first == NULL)
640 {
641 newElmt->next = NULL;
642 first = last = newElmt;
643 }
644 else
645 {
646 newElmt->next = first;
647 first->prev = newElmt;
648 first = newElmt;
649 }
650 count++;
651 return (curr = newElmt)->elmt;
652 } // MLReceiptPolicySeqOf1::Prepend
653
654
655 // alloc new list elmt, insert it before the
656 // current element and return the component type
657 // if the current element is null, the new element
658 // is placed at the beginning of the list.
659 GeneralNames *MLReceiptPolicySeqOf1::InsertBefore()
660 {
661 AsnListElmt *newElmt;
662 newElmt = new AsnListElmt;
663 newElmt->elmt = new GeneralNames;
664 if (curr == NULL)
665 {
666 newElmt->next = first;
667 newElmt->prev = NULL;
668 first = newElmt;
669 if (last == NULL)
670 last = newElmt;
671 }
672 else
673 {
674 newElmt->next = curr;
675 newElmt->prev = curr->prev;
676 curr->prev = newElmt;
677 if (curr == first)
678 first = newElmt;
679 else
680 newElmt->prev->next = newElmt;
681 }
682 count++;
683 return (curr = newElmt)->elmt;
684 } // MLReceiptPolicySeqOf1::InsertBefore
685
686
687 // alloc new list elmt, insert it after the
688 // current element and return the component type
689 // if the current element is null, the new element
690 // is placed at the end of the list.
691 GeneralNames *MLReceiptPolicySeqOf1::InsertAfter()
692 {
693 AsnListElmt *newElmt;
694 newElmt = new AsnListElmt;
695 newElmt->elmt = new GeneralNames;
696 if (curr == NULL)
697 {
698 newElmt->prev = last;
699 newElmt->next = NULL;
700 last = newElmt;
701 if (first == NULL)
702 first = newElmt;
703 }
704 else
705 {
706 newElmt->prev = curr;
707 newElmt->next = curr->next;
708 curr->next = newElmt;
709 if (curr == last)
710 last = newElmt;
711 else
712 newElmt->next->prev = newElmt;
713 }
714 count++;
715 return (curr = newElmt)->elmt;
716 } // MLReceiptPolicySeqOf1::InsertAfter
717
718
719 MLReceiptPolicySeqOf1 &MLReceiptPolicySeqOf1::AppendCopy (GeneralNames &elmt)
720 {
721 AsnListElmt *newElmt;
722 newElmt = new AsnListElmt;
723 newElmt->elmt = new GeneralNames;
724 *newElmt->elmt = elmt;
725 newElmt->next = NULL;
726 if (last == NULL)
727 {
728 newElmt->prev = NULL;
729 first = last = newElmt;
730 }
731 else
732 {
733 newElmt->prev = last;
734 last->next = newElmt;
735 last = newElmt;
736 }
737 count++;
738 return *this;
739 } // AppendCopy
740
741
742 MLReceiptPolicySeqOf1 &MLReceiptPolicySeqOf1::PrependCopy (GeneralNames &elmt)
743 {
744 AsnListElmt *newElmt;
745 newElmt = new AsnListElmt;
746 newElmt->elmt = new GeneralNames;
747 *newElmt->elmt = elmt;
748 newElmt->prev = NULL;
749 if (first == NULL)
750 {
751 newElmt->next = NULL;
752 first = last = newElmt;
753 }
754 else
755 {
756 newElmt->next = first;
757 first->prev = newElmt;
758 first = newElmt;
759 }
760 count++;
761 return *this;
762 } // MLReceiptPolicySeqOf1::PrependCopy
763
764
765 // alloc new list elmt, insert it before the
766 // current element, copy the given elmt into the new elmt
767 // and return the component type.
768 // if the current element is null, the new element
769 // is placed at the beginning of the list.
770 MLReceiptPolicySeqOf1 &MLReceiptPolicySeqOf1::InsertBeforeAndCopy (GeneralNames &elmt)
771 {
772 AsnListElmt *newElmt;
773
774 newElmt = new AsnListElmt;
775 newElmt->elmt = new GeneralNames;
776 *newElmt->elmt = elmt;
777
778 if (curr == NULL)
779 {
780 newElmt->next = first;
781 newElmt->prev = NULL;
782 first = newElmt;
783 if (last == NULL)
784 last = newElmt;
785 }
786 else
787 {
788 newElmt->next = curr;
789 newElmt->prev = curr->prev;
790 curr->prev = newElmt;
791 if (curr == first)
792 first = newElmt;
793 else
794 newElmt->prev->next = newElmt;
795 }
796 count++;
797 return *this;
798 } // MLReceiptPolicySeqOf1::InsertBeforeAndCopy
799
800
801 // alloc new list elmt, insert it after the
802 // current element, copy given elmt in to new elmt
803 // and return the component type
804 // if the current element is null, the new element
805 // is placed at the end of the list.
806 MLReceiptPolicySeqOf1 &MLReceiptPolicySeqOf1::InsertAfterAndCopy (GeneralNames &elmt)
807 {
808 AsnListElmt *newElmt;
809
810 newElmt = new AsnListElmt;
811 newElmt->elmt = new GeneralNames;
812 *newElmt->elmt = elmt;
813 if (curr == NULL)
814 {
815 newElmt->prev = last;
816 newElmt->next = NULL;
817 last = newElmt;
818 if (first == NULL)
819 first = newElmt;
820 }
821 else
822 {
823 newElmt->prev = curr;
824 newElmt->next = curr->next;
825 curr->next = newElmt;
826 if (curr == last)
827 last = newElmt;
828 else
829 newElmt->next->prev = newElmt;
830 }
831 count++;
832 return *this;
833 } // MLReceiptPolicySeqOf1::InsertAfterAndCopy
834
835
836 // remove current element from list if current element is not NULL
837 // The new current element will be the next element.
838 // If the current element is the last element in the list
839 // the second but last element will become the new current element.
840 void MLReceiptPolicySeqOf1::RemoveCurrFromList()
841 {
842 AsnListElmt *del_elmt;
843
844 if (curr != NULL)
845 {
846 del_elmt = curr;
847 count--;
848
849 if (count == 0)
850 first = last = curr = NULL;
851 else if (curr == first)
852 {
853 curr = first= first->next;
854 first->prev = NULL;
855 }
856 else if (curr == last)
857 {
858 curr = last = last->prev;
859 last->next = NULL;
860 }
861 else
862 {
863 curr->prev->next = curr->next;
864 curr->next->prev = curr->prev;
865 }
866
867 delete del_elmt->elmt;
868 delete del_elmt;
869 }
870 }
871
872
873 AsnLen MLReceiptPolicySeqOf1::BEncContent (BUF_TYPE b)
874 {
875 AsnListElmt *currElmt;
876 AsnLen elmtLen;
877 AsnLen totalLen = 0;
878 for (currElmt = last; currElmt != NULL; currElmt = currElmt->prev)
879 {
880 BEncEocIfNec (b);
881 elmtLen = currElmt->elmt->BEncContent (b);
882 elmtLen += BEncConsLen (b, elmtLen);
883
884 elmtLen += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
885 totalLen += elmtLen;
886 }
887 return totalLen;
888 } // MLReceiptPolicySeqOf1::BEncContent
889
890
891 void MLReceiptPolicySeqOf1::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0,
892 AsnLen &bytesDecoded, ENV_TYPE env)
893 {
894 GeneralNames *listElmt;
895 AsnTag tag1;
896 AsnLen listBytesDecoded = 0;
897 AsnLen elmtLen1;
898
899 while ((listBytesDecoded < elmtLen0) || (elmtLen0 == INDEFINITE_LEN))
900 {
901 tag1 = BDecTag (b, listBytesDecoded, env);
902 if ((tag1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
903 {
904 BDEC_2ND_EOC_OCTET (b, listBytesDecoded, env);
905 break;
906 }
907 if ((tag1 != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
908 {
909 Asn1Error << "Unexpected Tag" << endl;
910 SnaccExcep::throwMe(-103);
911 }
912
913 elmtLen1 = BDecLen (b, listBytesDecoded, env);
914 listElmt = Append();
915 listElmt->BDecContent (b, tag1, elmtLen1, listBytesDecoded, env);
916 }
917
918 bytesDecoded += listBytesDecoded;
919 } // MLReceiptPolicySeqOf1::BDecContent
920
921
922 AsnType *MLReceiptPolicySeqOf::Clone() const
923 {
924 return new MLReceiptPolicySeqOf;
925 }
926
927 AsnType *MLReceiptPolicySeqOf::Copy() const
928 {
929 return new MLReceiptPolicySeqOf (*this);
930 }
931
932 AsnLen MLReceiptPolicySeqOf::BEnc (BUF_TYPE b)
933 {
934 AsnLen l;
935 l = BEncContent (b);
936 l += BEncConsLen (b, l);
937 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
938 return l;
939 }
940
941 void MLReceiptPolicySeqOf::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
942 {
943 AsnTag tag;
944 AsnLen elmtLen1;
945
946 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
947 {
948 Asn1Error << "MLReceiptPolicySeqOf::BDec: ERROR - wrong tag" << endl;
949 SnaccExcep::throwMe(-104);
950 }
951 elmtLen1 = BDecLen (b, bytesDecoded, env);
952 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
953 }
954
955 MLReceiptPolicySeqOf::MLReceiptPolicySeqOf (const MLReceiptPolicySeqOf &)
956 {
957 Asn1Error << "use of incompletely defined MLReceiptPolicySeqOf::MLReceiptPolicySeqOf (const MLReceiptPolicySeqOf &)" << endl;
958 abort();
959 }
960
961 MLReceiptPolicySeqOf::~MLReceiptPolicySeqOf()
962 {
963 SetCurrToFirst();
964 for (; Curr() != NULL; RemoveCurrFromList())
965 ;
966 } // end of destructor
967
968 #if SNACC_DEEP_COPY
969 MLReceiptPolicySeqOf &MLReceiptPolicySeqOf::operator = (const MLReceiptPolicySeqOf &that)
970 #else // SNACC_DEEP_COPY
971 MLReceiptPolicySeqOf &MLReceiptPolicySeqOf::operator = (const MLReceiptPolicySeqOf &)
972 #endif // SNACC_DEEP_COPY
973 {
974 #if SNACC_DEEP_COPY
975 if (this != &that)
976 {
977 SetCurrToFirst();
978 for (; Curr(); RemoveCurrFromList())
979 ;
980
981 //that.SetCurrToFirst();
982 //for (; that.Curr(); that.GoNext())
983 // AppendCopy (*that.Curr());
984 for (const AsnListElmt *run=that.first; run; run=run->next)
985 AppendCopy (*run->elmt);
986 }
987
988 return *this;
989 #else // SNACC_DEEP_COPY
990 Asn1Error << "use of incompletely defined MLReceiptPolicySeqOf &MLReceiptPolicySeqOf::operator = (const MLReceiptPolicySeqOf &)" << endl;
991 abort();
992 // if your compiler complains here, check the -novolat option
993 #endif // SNACC_DEEP_COPY
994 }
995
996 void MLReceiptPolicySeqOf::Print (ostream &os) const
997 {
998 #ifndef NDEBUG
999 os << "{ -- SEQUENCE/SET OF -- " << endl;
1000 indentG += stdIndentG;
1001 //SetCurrToFirst();
1002 //for (; Curr() != NULL; GoNext())
1003 for (const AsnListElmt *run=first; run; run=run->next)
1004 {
1005 Indent (os, indentG);
1006 //os << *Curr();
1007 os << *run->elmt;
1008 //if (Curr() != Last())
1009 if (run != last)
1010 os << ",";
1011 os << endl;
1012 }
1013 indentG -= stdIndentG;
1014 Indent (os, indentG);
1015 os << "}\n";
1016 #endif /* NDEBUG */
1017
1018
1019 } // Print
1020
1021
1022 void MLReceiptPolicySeqOf::SetCurrElmt (unsigned long int index)
1023 {
1024 unsigned long int i;
1025 curr = first;
1026 if (count)
1027 for (i = 0; (i < (count-1)) && (i < index); i++)
1028 curr = curr->next;
1029 } // MLReceiptPolicySeqOf::SetCurrElmt
1030
1031
1032 unsigned long int MLReceiptPolicySeqOf::GetCurrElmtIndex()
1033 {
1034 unsigned long int i;
1035 AsnListElmt *tmp;
1036 if (curr != NULL)
1037 {
1038 for (i = 0, tmp = first; tmp != NULL; i++)
1039 {
1040 if (tmp == curr)
1041 return i;
1042 else
1043 tmp = tmp->next;
1044 }
1045 }
1046 return count;
1047 } // MLReceiptPolicySeqOf::GetCurrElmtIndex
1048
1049
1050 // alloc new list elmt, put at end of list
1051 // and return the component type
1052 GeneralNames *MLReceiptPolicySeqOf::Append()
1053 {
1054 AsnListElmt *newElmt;
1055 newElmt = new AsnListElmt;
1056 newElmt->elmt = new GeneralNames;
1057 newElmt->next = NULL;
1058 if (last == NULL)
1059 {
1060 newElmt->prev = NULL;
1061 first = last = newElmt;
1062 }
1063 else
1064 {
1065 newElmt->prev = last;
1066 last->next = newElmt;
1067 last = newElmt;
1068 }
1069 count++;
1070 return (curr = newElmt)->elmt;
1071 } // MLReceiptPolicySeqOf::Append
1072
1073
1074 // alloc new list elmt, put at begining of list
1075 // and return the component type
1076 GeneralNames *MLReceiptPolicySeqOf::Prepend()
1077 {
1078 AsnListElmt *newElmt;
1079 newElmt = new AsnListElmt;
1080 newElmt->elmt = new GeneralNames;
1081 newElmt->prev = NULL;
1082 if (first == NULL)
1083 {
1084 newElmt->next = NULL;
1085 first = last = newElmt;
1086 }
1087 else
1088 {
1089 newElmt->next = first;
1090 first->prev = newElmt;
1091 first = newElmt;
1092 }
1093 count++;
1094 return (curr = newElmt)->elmt;
1095 } // MLReceiptPolicySeqOf::Prepend
1096
1097
1098 // alloc new list elmt, insert it before the
1099 // current element and return the component type
1100 // if the current element is null, the new element
1101 // is placed at the beginning of the list.
1102 GeneralNames *MLReceiptPolicySeqOf::InsertBefore()
1103 {
1104 AsnListElmt *newElmt;
1105 newElmt = new AsnListElmt;
1106 newElmt->elmt = new GeneralNames;
1107 if (curr == NULL)
1108 {
1109 newElmt->next = first;
1110 newElmt->prev = NULL;
1111 first = newElmt;
1112 if (last == NULL)
1113 last = newElmt;
1114 }
1115 else
1116 {
1117 newElmt->next = curr;
1118 newElmt->prev = curr->prev;
1119 curr->prev = newElmt;
1120 if (curr == first)
1121 first = newElmt;
1122 else
1123 newElmt->prev->next = newElmt;
1124 }
1125 count++;
1126 return (curr = newElmt)->elmt;
1127 } // MLReceiptPolicySeqOf::InsertBefore
1128
1129
1130 // alloc new list elmt, insert it after the
1131 // current element and return the component type
1132 // if the current element is null, the new element
1133 // is placed at the end of the list.
1134 GeneralNames *MLReceiptPolicySeqOf::InsertAfter()
1135 {
1136 AsnListElmt *newElmt;
1137 newElmt = new AsnListElmt;
1138 newElmt->elmt = new GeneralNames;
1139 if (curr == NULL)
1140 {
1141 newElmt->prev = last;
1142 newElmt->next = NULL;
1143 last = newElmt;
1144 if (first == NULL)
1145 first = newElmt;
1146 }
1147 else
1148 {
1149 newElmt->prev = curr;
1150 newElmt->next = curr->next;
1151 curr->next = newElmt;
1152 if (curr == last)
1153 last = newElmt;
1154 else
1155 newElmt->next->prev = newElmt;
1156 }
1157 count++;
1158 return (curr = newElmt)->elmt;
1159 } // MLReceiptPolicySeqOf::InsertAfter
1160
1161
1162 MLReceiptPolicySeqOf &MLReceiptPolicySeqOf::AppendCopy (GeneralNames &elmt)
1163 {
1164 AsnListElmt *newElmt;
1165 newElmt = new AsnListElmt;
1166 newElmt->elmt = new GeneralNames;
1167 *newElmt->elmt = elmt;
1168 newElmt->next = NULL;
1169 if (last == NULL)
1170 {
1171 newElmt->prev = NULL;
1172 first = last = newElmt;
1173 }
1174 else
1175 {
1176 newElmt->prev = last;
1177 last->next = newElmt;
1178 last = newElmt;
1179 }
1180 count++;
1181 return *this;
1182 } // AppendCopy
1183
1184
1185 MLReceiptPolicySeqOf &MLReceiptPolicySeqOf::PrependCopy (GeneralNames &elmt)
1186 {
1187 AsnListElmt *newElmt;
1188 newElmt = new AsnListElmt;
1189 newElmt->elmt = new GeneralNames;
1190 *newElmt->elmt = elmt;
1191 newElmt->prev = NULL;
1192 if (first == NULL)
1193 {
1194 newElmt->next = NULL;
1195 first = last = newElmt;
1196 }
1197 else
1198 {
1199 newElmt->next = first;
1200 first->prev = newElmt;
1201 first = newElmt;
1202 }
1203 count++;
1204 return *this;
1205 } // MLReceiptPolicySeqOf::PrependCopy
1206
1207
1208 // alloc new list elmt, insert it before the
1209 // current element, copy the given elmt into the new elmt
1210 // and return the component type.
1211 // if the current element is null, the new element
1212 // is placed at the beginning of the list.
1213 MLReceiptPolicySeqOf &MLReceiptPolicySeqOf::InsertBeforeAndCopy (GeneralNames &elmt)
1214 {
1215 AsnListElmt *newElmt;
1216
1217 newElmt = new AsnListElmt;
1218 newElmt->elmt = new GeneralNames;
1219 *newElmt->elmt = elmt;
1220
1221 if (curr == NULL)
1222 {
1223 newElmt->next = first;
1224 newElmt->prev = NULL;
1225 first = newElmt;
1226 if (last == NULL)
1227 last = newElmt;
1228 }
1229 else
1230 {
1231 newElmt->next = curr;
1232 newElmt->prev = curr->prev;
1233 curr->prev = newElmt;
1234 if (curr == first)
1235 first = newElmt;
1236 else
1237 newElmt->prev->next = newElmt;
1238 }
1239 count++;
1240 return *this;
1241 } // MLReceiptPolicySeqOf::InsertBeforeAndCopy
1242
1243
1244 // alloc new list elmt, insert it after the
1245 // current element, copy given elmt in to new elmt
1246 // and return the component type
1247 // if the current element is null, the new element
1248 // is placed at the end of the list.
1249 MLReceiptPolicySeqOf &MLReceiptPolicySeqOf::InsertAfterAndCopy (GeneralNames &elmt)
1250 {
1251 AsnListElmt *newElmt;
1252
1253 newElmt = new AsnListElmt;
1254 newElmt->elmt = new GeneralNames;
1255 *newElmt->elmt = elmt;
1256 if (curr == NULL)
1257 {
1258 newElmt->prev = last;
1259 newElmt->next = NULL;
1260 last = newElmt;
1261 if (first == NULL)
1262 first = newElmt;
1263 }
1264 else
1265 {
1266 newElmt->prev = curr;
1267 newElmt->next = curr->next;
1268 curr->next = newElmt;
1269 if (curr == last)
1270 last = newElmt;
1271 else
1272 newElmt->next->prev = newElmt;
1273 }
1274 count++;
1275 return *this;
1276 } // MLReceiptPolicySeqOf::InsertAfterAndCopy
1277
1278
1279 // remove current element from list if current element is not NULL
1280 // The new current element will be the next element.
1281 // If the current element is the last element in the list
1282 // the second but last element will become the new current element.
1283 void MLReceiptPolicySeqOf::RemoveCurrFromList()
1284 {
1285 AsnListElmt *del_elmt;
1286
1287 if (curr != NULL)
1288 {
1289 del_elmt = curr;
1290 count--;
1291
1292 if (count == 0)
1293 first = last = curr = NULL;
1294 else if (curr == first)
1295 {
1296 curr = first= first->next;
1297 first->prev = NULL;
1298 }
1299 else if (curr == last)
1300 {
1301 curr = last = last->prev;
1302 last->next = NULL;
1303 }
1304 else
1305 {
1306 curr->prev->next = curr->next;
1307 curr->next->prev = curr->prev;
1308 }
1309
1310 delete del_elmt->elmt;
1311 delete del_elmt;
1312 }
1313 }
1314
1315
1316 AsnLen MLReceiptPolicySeqOf::BEncContent (BUF_TYPE b)
1317 {
1318 AsnListElmt *currElmt;
1319 AsnLen elmtLen;
1320 AsnLen totalLen = 0;
1321 for (currElmt = last; currElmt != NULL; currElmt = currElmt->prev)
1322 {
1323 BEncEocIfNec (b);
1324 elmtLen = currElmt->elmt->BEncContent (b);
1325 elmtLen += BEncConsLen (b, elmtLen);
1326
1327 elmtLen += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
1328 totalLen += elmtLen;
1329 }
1330 return totalLen;
1331 } // MLReceiptPolicySeqOf::BEncContent
1332
1333
1334 void MLReceiptPolicySeqOf::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0,
1335 AsnLen &bytesDecoded, ENV_TYPE env)
1336 {
1337 GeneralNames *listElmt;
1338 AsnTag tag1;
1339 AsnLen listBytesDecoded = 0;
1340 AsnLen elmtLen1;
1341
1342 while ((listBytesDecoded < elmtLen0) || (elmtLen0 == INDEFINITE_LEN))
1343 {
1344 tag1 = BDecTag (b, listBytesDecoded, env);
1345 if ((tag1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
1346 {
1347 BDEC_2ND_EOC_OCTET (b, listBytesDecoded, env);
1348 break;
1349 }
1350 if ((tag1 != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
1351 {
1352 Asn1Error << "Unexpected Tag" << endl;
1353 SnaccExcep::throwMe(-105);
1354 }
1355
1356 elmtLen1 = BDecLen (b, listBytesDecoded, env);
1357 listElmt = Append();
1358 listElmt->BDecContent (b, tag1, elmtLen1, listBytesDecoded, env);
1359 }
1360
1361 bytesDecoded += listBytesDecoded;
1362 } // MLReceiptPolicySeqOf::BDecContent
1363
1364
1365 AsnType *ReceiptsFromSeqOf::Clone() const
1366 {
1367 return new ReceiptsFromSeqOf;
1368 }
1369
1370 AsnType *ReceiptsFromSeqOf::Copy() const
1371 {
1372 return new ReceiptsFromSeqOf (*this);
1373 }
1374
1375 AsnLen ReceiptsFromSeqOf::BEnc (BUF_TYPE b)
1376 {
1377 AsnLen l;
1378 l = BEncContent (b);
1379 l += BEncConsLen (b, l);
1380 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
1381 return l;
1382 }
1383
1384 void ReceiptsFromSeqOf::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
1385 {
1386 AsnTag tag;
1387 AsnLen elmtLen1;
1388
1389 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
1390 {
1391 Asn1Error << "ReceiptsFromSeqOf::BDec: ERROR - wrong tag" << endl;
1392 SnaccExcep::throwMe(-106);
1393 }
1394 elmtLen1 = BDecLen (b, bytesDecoded, env);
1395 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
1396 }
1397
1398 ReceiptsFromSeqOf::ReceiptsFromSeqOf (const ReceiptsFromSeqOf &)
1399 {
1400 Asn1Error << "use of incompletely defined ReceiptsFromSeqOf::ReceiptsFromSeqOf (const ReceiptsFromSeqOf &)" << endl;
1401 abort();
1402 }
1403
1404 ReceiptsFromSeqOf::~ReceiptsFromSeqOf()
1405 {
1406 SetCurrToFirst();
1407 for (; Curr() != NULL; RemoveCurrFromList())
1408 ;
1409 } // end of destructor
1410
1411 #if SNACC_DEEP_COPY
1412 ReceiptsFromSeqOf &ReceiptsFromSeqOf::operator = (const ReceiptsFromSeqOf &that)
1413 #else // SNACC_DEEP_COPY
1414 ReceiptsFromSeqOf &ReceiptsFromSeqOf::operator = (const ReceiptsFromSeqOf &)
1415 #endif // SNACC_DEEP_COPY
1416 {
1417 #if SNACC_DEEP_COPY
1418 if (this != &that)
1419 {
1420 SetCurrToFirst();
1421 for (; Curr(); RemoveCurrFromList())
1422 ;
1423
1424 //that.SetCurrToFirst();
1425 //for (; that.Curr(); that.GoNext())
1426 // AppendCopy (*that.Curr());
1427 for (const AsnListElmt *run=that.first; run; run=run->next)
1428 AppendCopy (*run->elmt);
1429 }
1430
1431 return *this;
1432 #else // SNACC_DEEP_COPY
1433 Asn1Error << "use of incompletely defined ReceiptsFromSeqOf &ReceiptsFromSeqOf::operator = (const ReceiptsFromSeqOf &)" << endl;
1434 abort();
1435 // if your compiler complains here, check the -novolat option
1436 #endif // SNACC_DEEP_COPY
1437 }
1438
1439 void ReceiptsFromSeqOf::Print (ostream &os) const
1440 {
1441 #ifndef NDEBUG
1442 os << "{ -- SEQUENCE/SET OF -- " << endl;
1443 indentG += stdIndentG;
1444 //SetCurrToFirst();
1445 //for (; Curr() != NULL; GoNext())
1446 for (const AsnListElmt *run=first; run; run=run->next)
1447 {
1448 Indent (os, indentG);
1449 //os << *Curr();
1450 os << *run->elmt;
1451 //if (Curr() != Last())
1452 if (run != last)
1453 os << ",";
1454 os << endl;
1455 }
1456 indentG -= stdIndentG;
1457 Indent (os, indentG);
1458 os << "}\n";
1459 #endif /* NDEBUG */
1460
1461
1462 } // Print
1463
1464
1465 void ReceiptsFromSeqOf::SetCurrElmt (unsigned long int index)
1466 {
1467 unsigned long int i;
1468 curr = first;
1469 if (count)
1470 for (i = 0; (i < (count-1)) && (i < index); i++)
1471 curr = curr->next;
1472 } // ReceiptsFromSeqOf::SetCurrElmt
1473
1474
1475 unsigned long int ReceiptsFromSeqOf::GetCurrElmtIndex()
1476 {
1477 unsigned long int i;
1478 AsnListElmt *tmp;
1479 if (curr != NULL)
1480 {
1481 for (i = 0, tmp = first; tmp != NULL; i++)
1482 {
1483 if (tmp == curr)
1484 return i;
1485 else
1486 tmp = tmp->next;
1487 }
1488 }
1489 return count;
1490 } // ReceiptsFromSeqOf::GetCurrElmtIndex
1491
1492
1493 // alloc new list elmt, put at end of list
1494 // and return the component type
1495 GeneralNames *ReceiptsFromSeqOf::Append()
1496 {
1497 AsnListElmt *newElmt;
1498 newElmt = new AsnListElmt;
1499 newElmt->elmt = new GeneralNames;
1500 newElmt->next = NULL;
1501 if (last == NULL)
1502 {
1503 newElmt->prev = NULL;
1504 first = last = newElmt;
1505 }
1506 else
1507 {
1508 newElmt->prev = last;
1509 last->next = newElmt;
1510 last = newElmt;
1511 }
1512 count++;
1513 return (curr = newElmt)->elmt;
1514 } // ReceiptsFromSeqOf::Append
1515
1516
1517 // alloc new list elmt, put at begining of list
1518 // and return the component type
1519 GeneralNames *ReceiptsFromSeqOf::Prepend()
1520 {
1521 AsnListElmt *newElmt;
1522 newElmt = new AsnListElmt;
1523 newElmt->elmt = new GeneralNames;
1524 newElmt->prev = NULL;
1525 if (first == NULL)
1526 {
1527 newElmt->next = NULL;
1528 first = last = newElmt;
1529 }
1530 else
1531 {
1532 newElmt->next = first;
1533 first->prev = newElmt;
1534 first = newElmt;
1535 }
1536 count++;
1537 return (curr = newElmt)->elmt;
1538 } // ReceiptsFromSeqOf::Prepend
1539
1540
1541 // alloc new list elmt, insert it before the
1542 // current element and return the component type
1543 // if the current element is null, the new element
1544 // is placed at the beginning of the list.
1545 GeneralNames *ReceiptsFromSeqOf::InsertBefore()
1546 {
1547 AsnListElmt *newElmt;
1548 newElmt = new AsnListElmt;
1549 newElmt->elmt = new GeneralNames;
1550 if (curr == NULL)
1551 {
1552 newElmt->next = first;
1553 newElmt->prev = NULL;
1554 first = newElmt;
1555 if (last == NULL)
1556 last = newElmt;
1557 }
1558 else
1559 {
1560 newElmt->next = curr;
1561 newElmt->prev = curr->prev;
1562 curr->prev = newElmt;
1563 if (curr == first)
1564 first = newElmt;
1565 else
1566 newElmt->prev->next = newElmt;
1567 }
1568 count++;
1569 return (curr = newElmt)->elmt;
1570 } // ReceiptsFromSeqOf::InsertBefore
1571
1572
1573 // alloc new list elmt, insert it after the
1574 // current element and return the component type
1575 // if the current element is null, the new element
1576 // is placed at the end of the list.
1577 GeneralNames *ReceiptsFromSeqOf::InsertAfter()
1578 {
1579 AsnListElmt *newElmt;
1580 newElmt = new AsnListElmt;
1581 newElmt->elmt = new GeneralNames;
1582 if (curr == NULL)
1583 {
1584 newElmt->prev = last;
1585 newElmt->next = NULL;
1586 last = newElmt;
1587 if (first == NULL)
1588 first = newElmt;
1589 }
1590 else
1591 {
1592 newElmt->prev = curr;
1593 newElmt->next = curr->next;
1594 curr->next = newElmt;
1595 if (curr == last)
1596 last = newElmt;
1597 else
1598 newElmt->next->prev = newElmt;
1599 }
1600 count++;
1601 return (curr = newElmt)->elmt;
1602 } // ReceiptsFromSeqOf::InsertAfter
1603
1604
1605 ReceiptsFromSeqOf &ReceiptsFromSeqOf::AppendCopy (GeneralNames &elmt)
1606 {
1607 AsnListElmt *newElmt;
1608 newElmt = new AsnListElmt;
1609 newElmt->elmt = new GeneralNames;
1610 *newElmt->elmt = elmt;
1611 newElmt->next = NULL;
1612 if (last == NULL)
1613 {
1614 newElmt->prev = NULL;
1615 first = last = newElmt;
1616 }
1617 else
1618 {
1619 newElmt->prev = last;
1620 last->next = newElmt;
1621 last = newElmt;
1622 }
1623 count++;
1624 return *this;
1625 } // AppendCopy
1626
1627
1628 ReceiptsFromSeqOf &ReceiptsFromSeqOf::PrependCopy (GeneralNames &elmt)
1629 {
1630 AsnListElmt *newElmt;
1631 newElmt = new AsnListElmt;
1632 newElmt->elmt = new GeneralNames;
1633 *newElmt->elmt = elmt;
1634 newElmt->prev = NULL;
1635 if (first == NULL)
1636 {
1637 newElmt->next = NULL;
1638 first = last = newElmt;
1639 }
1640 else
1641 {
1642 newElmt->next = first;
1643 first->prev = newElmt;
1644 first = newElmt;
1645 }
1646 count++;
1647 return *this;
1648 } // ReceiptsFromSeqOf::PrependCopy
1649
1650
1651 // alloc new list elmt, insert it before the
1652 // current element, copy the given elmt into the new elmt
1653 // and return the component type.
1654 // if the current element is null, the new element
1655 // is placed at the beginning of the list.
1656 ReceiptsFromSeqOf &ReceiptsFromSeqOf::InsertBeforeAndCopy (GeneralNames &elmt)
1657 {
1658 AsnListElmt *newElmt;
1659
1660 newElmt = new AsnListElmt;
1661 newElmt->elmt = new GeneralNames;
1662 *newElmt->elmt = elmt;
1663
1664 if (curr == NULL)
1665 {
1666 newElmt->next = first;
1667 newElmt->prev = NULL;
1668 first = newElmt;
1669 if (last == NULL)
1670 last = newElmt;
1671 }
1672 else
1673 {
1674 newElmt->next = curr;
1675 newElmt->prev = curr->prev;
1676 curr->prev = newElmt;
1677 if (curr == first)
1678 first = newElmt;
1679 else
1680 newElmt->prev->next = newElmt;
1681 }
1682 count++;
1683 return *this;
1684 } // ReceiptsFromSeqOf::InsertBeforeAndCopy
1685
1686
1687 // alloc new list elmt, insert it after the
1688 // current element, copy given elmt in to new elmt
1689 // and return the component type
1690 // if the current element is null, the new element
1691 // is placed at the end of the list.
1692 ReceiptsFromSeqOf &ReceiptsFromSeqOf::InsertAfterAndCopy (GeneralNames &elmt)
1693 {
1694 AsnListElmt *newElmt;
1695
1696 newElmt = new AsnListElmt;
1697 newElmt->elmt = new GeneralNames;
1698 *newElmt->elmt = elmt;
1699 if (curr == NULL)
1700 {
1701 newElmt->prev = last;
1702 newElmt->next = NULL;
1703 last = newElmt;
1704 if (first == NULL)
1705 first = newElmt;
1706 }
1707 else
1708 {
1709 newElmt->prev = curr;
1710 newElmt->next = curr->next;
1711 curr->next = newElmt;
1712 if (curr == last)
1713 last = newElmt;
1714 else
1715 newElmt->next->prev = newElmt;
1716 }
1717 count++;
1718 return *this;
1719 } // ReceiptsFromSeqOf::InsertAfterAndCopy
1720
1721
1722 // remove current element from list if current element is not NULL
1723 // The new current element will be the next element.
1724 // If the current element is the last element in the list
1725 // the second but last element will become the new current element.
1726 void ReceiptsFromSeqOf::RemoveCurrFromList()
1727 {
1728 AsnListElmt *del_elmt;
1729
1730 if (curr != NULL)
1731 {
1732 del_elmt = curr;
1733 count--;
1734
1735 if (count == 0)
1736 first = last = curr = NULL;
1737 else if (curr == first)
1738 {
1739 curr = first= first->next;
1740 first->prev = NULL;
1741 }
1742 else if (curr == last)
1743 {
1744 curr = last = last->prev;
1745 last->next = NULL;
1746 }
1747 else
1748 {
1749 curr->prev->next = curr->next;
1750 curr->next->prev = curr->prev;
1751 }
1752
1753 delete del_elmt->elmt;
1754 delete del_elmt;
1755 }
1756 }
1757
1758
1759 AsnLen ReceiptsFromSeqOf::BEncContent (BUF_TYPE b)
1760 {
1761 AsnListElmt *currElmt;
1762 AsnLen elmtLen;
1763 AsnLen totalLen = 0;
1764 for (currElmt = last; currElmt != NULL; currElmt = currElmt->prev)
1765 {
1766 BEncEocIfNec (b);
1767 elmtLen = currElmt->elmt->BEncContent (b);
1768 elmtLen += BEncConsLen (b, elmtLen);
1769
1770 elmtLen += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
1771 totalLen += elmtLen;
1772 }
1773 return totalLen;
1774 } // ReceiptsFromSeqOf::BEncContent
1775
1776
1777 void ReceiptsFromSeqOf::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0,
1778 AsnLen &bytesDecoded, ENV_TYPE env)
1779 {
1780 GeneralNames *listElmt;
1781 AsnTag tag1;
1782 AsnLen listBytesDecoded = 0;
1783 AsnLen elmtLen1;
1784
1785 while ((listBytesDecoded < elmtLen0) || (elmtLen0 == INDEFINITE_LEN))
1786 {
1787 tag1 = BDecTag (b, listBytesDecoded, env);
1788 if ((tag1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
1789 {
1790 BDEC_2ND_EOC_OCTET (b, listBytesDecoded, env);
1791 break;
1792 }
1793 if ((tag1 != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
1794 {
1795 Asn1Error << "Unexpected Tag" << endl;
1796 SnaccExcep::throwMe(-107);
1797 }
1798
1799 elmtLen1 = BDecLen (b, listBytesDecoded, env);
1800 listElmt = Append();
1801 listElmt->BDecContent (b, tag1, elmtLen1, listBytesDecoded, env);
1802 }
1803
1804 bytesDecoded += listBytesDecoded;
1805 } // ReceiptsFromSeqOf::BDecContent
1806
1807
1808 AsnType *ReceiptRequestSeqOf::Clone() const
1809 {
1810 return new ReceiptRequestSeqOf;
1811 }
1812
1813 AsnType *ReceiptRequestSeqOf::Copy() const
1814 {
1815 return new ReceiptRequestSeqOf (*this);
1816 }
1817
1818 AsnLen ReceiptRequestSeqOf::BEnc (BUF_TYPE b)
1819 {
1820 AsnLen l;
1821 l = BEncContent (b);
1822 l += BEncConsLen (b, l);
1823 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
1824 return l;
1825 }
1826
1827 void ReceiptRequestSeqOf::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
1828 {
1829 AsnTag tag;
1830 AsnLen elmtLen1;
1831
1832 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
1833 {
1834 Asn1Error << "ReceiptRequestSeqOf::BDec: ERROR - wrong tag" << endl;
1835 SnaccExcep::throwMe(-108);
1836 }
1837 elmtLen1 = BDecLen (b, bytesDecoded, env);
1838 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
1839 }
1840
1841 ReceiptRequestSeqOf::ReceiptRequestSeqOf (const ReceiptRequestSeqOf &)
1842 {
1843 Asn1Error << "use of incompletely defined ReceiptRequestSeqOf::ReceiptRequestSeqOf (const ReceiptRequestSeqOf &)" << endl;
1844 abort();
1845 }
1846
1847 ReceiptRequestSeqOf::~ReceiptRequestSeqOf()
1848 {
1849 SetCurrToFirst();
1850 for (; Curr() != NULL; RemoveCurrFromList())
1851 ;
1852 } // end of destructor
1853
1854 #if SNACC_DEEP_COPY
1855 ReceiptRequestSeqOf &ReceiptRequestSeqOf::operator = (const ReceiptRequestSeqOf &that)
1856 #else // SNACC_DEEP_COPY
1857 ReceiptRequestSeqOf &ReceiptRequestSeqOf::operator = (const ReceiptRequestSeqOf &)
1858 #endif // SNACC_DEEP_COPY
1859 {
1860 #if SNACC_DEEP_COPY
1861 if (this != &that)
1862 {
1863 SetCurrToFirst();
1864 for (; Curr(); RemoveCurrFromList())
1865 ;
1866
1867 //that.SetCurrToFirst();
1868 //for (; that.Curr(); that.GoNext())
1869 // AppendCopy (*that.Curr());
1870 for (const AsnListElmt *run=that.first; run; run=run->next)
1871 AppendCopy (*run->elmt);
1872 }
1873
1874 return *this;
1875 #else // SNACC_DEEP_COPY
1876 Asn1Error << "use of incompletely defined ReceiptRequestSeqOf &ReceiptRequestSeqOf::operator = (const ReceiptRequestSeqOf &)" << endl;
1877 abort();
1878 // if your compiler complains here, check the -novolat option
1879 #endif // SNACC_DEEP_COPY
1880 }
1881
1882 void ReceiptRequestSeqOf::Print (ostream &os) const
1883 {
1884 #ifndef NDEBUG
1885 os << "{ -- SEQUENCE/SET OF -- " << endl;
1886 indentG += stdIndentG;
1887 //SetCurrToFirst();
1888 //for (; Curr() != NULL; GoNext())
1889 for (const AsnListElmt *run=first; run; run=run->next)
1890 {
1891 Indent (os, indentG);
1892 //os << *Curr();
1893 os << *run->elmt;
1894 //if (Curr() != Last())
1895 if (run != last)
1896 os << ",";
1897 os << endl;
1898 }
1899 indentG -= stdIndentG;
1900 Indent (os, indentG);
1901 os << "}\n";
1902 #endif /* NDEBUG */
1903
1904
1905 } // Print
1906
1907
1908 void ReceiptRequestSeqOf::SetCurrElmt (unsigned long int index)
1909 {
1910 unsigned long int i;
1911 curr = first;
1912 if (count)
1913 for (i = 0; (i < (count-1)) && (i < index); i++)
1914 curr = curr->next;
1915 } // ReceiptRequestSeqOf::SetCurrElmt
1916
1917
1918 unsigned long int ReceiptRequestSeqOf::GetCurrElmtIndex()
1919 {
1920 unsigned long int i;
1921 AsnListElmt *tmp;
1922 if (curr != NULL)
1923 {
1924 for (i = 0, tmp = first; tmp != NULL; i++)
1925 {
1926 if (tmp == curr)
1927 return i;
1928 else
1929 tmp = tmp->next;
1930 }
1931 }
1932 return count;
1933 } // ReceiptRequestSeqOf::GetCurrElmtIndex
1934
1935
1936 // alloc new list elmt, put at end of list
1937 // and return the component type
1938 GeneralNames *ReceiptRequestSeqOf::Append()
1939 {
1940 AsnListElmt *newElmt;
1941 newElmt = new AsnListElmt;
1942 newElmt->elmt = new GeneralNames;
1943 newElmt->next = NULL;
1944 if (last == NULL)
1945 {
1946 newElmt->prev = NULL;
1947 first = last = newElmt;
1948 }
1949 else
1950 {
1951 newElmt->prev = last;
1952 last->next = newElmt;
1953 last = newElmt;
1954 }
1955 count++;
1956 return (curr = newElmt)->elmt;
1957 } // ReceiptRequestSeqOf::Append
1958
1959
1960 // alloc new list elmt, put at begining of list
1961 // and return the component type
1962 GeneralNames *ReceiptRequestSeqOf::Prepend()
1963 {
1964 AsnListElmt *newElmt;
1965 newElmt = new AsnListElmt;
1966 newElmt->elmt = new GeneralNames;
1967 newElmt->prev = NULL;
1968 if (first == NULL)
1969 {
1970 newElmt->next = NULL;
1971 first = last = newElmt;
1972 }
1973 else
1974 {
1975 newElmt->next = first;
1976 first->prev = newElmt;
1977 first = newElmt;
1978 }
1979 count++;
1980 return (curr = newElmt)->elmt;
1981 } // ReceiptRequestSeqOf::Prepend
1982
1983
1984 // alloc new list elmt, insert it before the
1985 // current element and return the component type
1986 // if the current element is null, the new element
1987 // is placed at the beginning of the list.
1988 GeneralNames *ReceiptRequestSeqOf::InsertBefore()
1989 {
1990 AsnListElmt *newElmt;
1991 newElmt = new AsnListElmt;
1992 newElmt->elmt = new GeneralNames;
1993 if (curr == NULL)
1994 {
1995 newElmt->next = first;
1996 newElmt->prev = NULL;
1997 first = newElmt;
1998 if (last == NULL)
1999 last = newElmt;
2000 }
2001 else
2002 {
2003 newElmt->next = curr;
2004 newElmt->prev = curr->prev;
2005 curr->prev = newElmt;
2006 if (curr == first)
2007 first = newElmt;
2008 else
2009 newElmt->prev->next = newElmt;
2010 }
2011 count++;
2012 return (curr = newElmt)->elmt;
2013 } // ReceiptRequestSeqOf::InsertBefore
2014
2015
2016 // alloc new list elmt, insert it after the
2017 // current element and return the component type
2018 // if the current element is null, the new element
2019 // is placed at the end of the list.
2020 GeneralNames *ReceiptRequestSeqOf::InsertAfter()
2021 {
2022 AsnListElmt *newElmt;
2023 newElmt = new AsnListElmt;
2024 newElmt->elmt = new GeneralNames;
2025 if (curr == NULL)
2026 {
2027 newElmt->prev = last;
2028 newElmt->next = NULL;
2029 last = newElmt;
2030 if (first == NULL)
2031 first = newElmt;
2032 }
2033 else
2034 {
2035 newElmt->prev = curr;
2036 newElmt->next = curr->next;
2037 curr->next = newElmt;
2038 if (curr == last)
2039 last = newElmt;
2040 else
2041 newElmt->next->prev = newElmt;
2042 }
2043 count++;
2044 return (curr = newElmt)->elmt;
2045 } // ReceiptRequestSeqOf::InsertAfter
2046
2047
2048 ReceiptRequestSeqOf &ReceiptRequestSeqOf::AppendCopy (GeneralNames &elmt)
2049 {
2050 AsnListElmt *newElmt;
2051 newElmt = new AsnListElmt;
2052 newElmt->elmt = new GeneralNames;
2053 *newElmt->elmt = elmt;
2054 newElmt->next = NULL;
2055 if (last == NULL)
2056 {
2057 newElmt->prev = NULL;
2058 first = last = newElmt;
2059 }
2060 else
2061 {
2062 newElmt->prev = last;
2063 last->next = newElmt;
2064 last = newElmt;
2065 }
2066 count++;
2067 return *this;
2068 } // AppendCopy
2069
2070
2071 ReceiptRequestSeqOf &ReceiptRequestSeqOf::PrependCopy (GeneralNames &elmt)
2072 {
2073 AsnListElmt *newElmt;
2074 newElmt = new AsnListElmt;
2075 newElmt->elmt = new GeneralNames;
2076 *newElmt->elmt = elmt;
2077 newElmt->prev = NULL;
2078 if (first == NULL)
2079 {
2080 newElmt->next = NULL;
2081 first = last = newElmt;
2082 }
2083 else
2084 {
2085 newElmt->next = first;
2086 first->prev = newElmt;
2087 first = newElmt;
2088 }
2089 count++;
2090 return *this;
2091 } // ReceiptRequestSeqOf::PrependCopy
2092
2093
2094 // alloc new list elmt, insert it before the
2095 // current element, copy the given elmt into the new elmt
2096 // and return the component type.
2097 // if the current element is null, the new element
2098 // is placed at the beginning of the list.
2099 ReceiptRequestSeqOf &ReceiptRequestSeqOf::InsertBeforeAndCopy (GeneralNames &elmt)
2100 {
2101 AsnListElmt *newElmt;
2102
2103 newElmt = new AsnListElmt;
2104 newElmt->elmt = new GeneralNames;
2105 *newElmt->elmt = elmt;
2106
2107 if (curr == NULL)
2108 {
2109 newElmt->next = first;
2110 newElmt->prev = NULL;
2111 first = newElmt;
2112 if (last == NULL)
2113 last = newElmt;
2114 }
2115 else
2116 {
2117 newElmt->next = curr;
2118 newElmt->prev = curr->prev;
2119 curr->prev = newElmt;
2120 if (curr == first)
2121 first = newElmt;
2122 else
2123 newElmt->prev->next = newElmt;
2124 }
2125 count++;
2126 return *this;
2127 } // ReceiptRequestSeqOf::InsertBeforeAndCopy
2128
2129
2130 // alloc new list elmt, insert it after the
2131 // current element, copy given elmt in to new elmt
2132 // and return the component type
2133 // if the current element is null, the new element
2134 // is placed at the end of the list.
2135 ReceiptRequestSeqOf &ReceiptRequestSeqOf::InsertAfterAndCopy (GeneralNames &elmt)
2136 {
2137 AsnListElmt *newElmt;
2138
2139 newElmt = new AsnListElmt;
2140 newElmt->elmt = new GeneralNames;
2141 *newElmt->elmt = elmt;
2142 if (curr == NULL)
2143 {
2144 newElmt->prev = last;
2145 newElmt->next = NULL;
2146 last = newElmt;
2147 if (first == NULL)
2148 first = newElmt;
2149 }
2150 else
2151 {
2152 newElmt->prev = curr;
2153 newElmt->next = curr->next;
2154 curr->next = newElmt;
2155 if (curr == last)
2156 last = newElmt;
2157 else
2158 newElmt->next->prev = newElmt;
2159 }
2160 count++;
2161 return *this;
2162 } // ReceiptRequestSeqOf::InsertAfterAndCopy
2163
2164
2165 // remove current element from list if current element is not NULL
2166 // The new current element will be the next element.
2167 // If the current element is the last element in the list
2168 // the second but last element will become the new current element.
2169 void ReceiptRequestSeqOf::RemoveCurrFromList()
2170 {
2171 AsnListElmt *del_elmt;
2172
2173 if (curr != NULL)
2174 {
2175 del_elmt = curr;
2176 count--;
2177
2178 if (count == 0)
2179 first = last = curr = NULL;
2180 else if (curr == first)
2181 {
2182 curr = first= first->next;
2183 first->prev = NULL;
2184 }
2185 else if (curr == last)
2186 {
2187 curr = last = last->prev;
2188 last->next = NULL;
2189 }
2190 else
2191 {
2192 curr->prev->next = curr->next;
2193 curr->next->prev = curr->prev;
2194 }
2195
2196 delete del_elmt->elmt;
2197 delete del_elmt;
2198 }
2199 }
2200
2201
2202 AsnLen ReceiptRequestSeqOf::BEncContent (BUF_TYPE b)
2203 {
2204 AsnListElmt *currElmt;
2205 AsnLen elmtLen;
2206 AsnLen totalLen = 0;
2207 for (currElmt = last; currElmt != NULL; currElmt = currElmt->prev)
2208 {
2209 BEncEocIfNec (b);
2210 elmtLen = currElmt->elmt->BEncContent (b);
2211 elmtLen += BEncConsLen (b, elmtLen);
2212
2213 elmtLen += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
2214 totalLen += elmtLen;
2215 }
2216 return totalLen;
2217 } // ReceiptRequestSeqOf::BEncContent
2218
2219
2220 void ReceiptRequestSeqOf::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0,
2221 AsnLen &bytesDecoded, ENV_TYPE env)
2222 {
2223 GeneralNames *listElmt;
2224 AsnTag tag1;
2225 AsnLen listBytesDecoded = 0;
2226 AsnLen elmtLen1;
2227
2228 while ((listBytesDecoded < elmtLen0) || (elmtLen0 == INDEFINITE_LEN))
2229 {
2230 tag1 = BDecTag (b, listBytesDecoded, env);
2231 if ((tag1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
2232 {
2233 BDEC_2ND_EOC_OCTET (b, listBytesDecoded, env);
2234 break;
2235 }
2236 if ((tag1 != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
2237 {
2238 Asn1Error << "Unexpected Tag" << endl;
2239 SnaccExcep::throwMe(-109);
2240 }
2241
2242 elmtLen1 = BDecLen (b, listBytesDecoded, env);
2243 listElmt = Append();
2244 listElmt->BDecContent (b, tag1, elmtLen1, listBytesDecoded, env);
2245 }
2246
2247 bytesDecoded += listBytesDecoded;
2248 } // ReceiptRequestSeqOf::BDecContent
2249
2250
2251 ESSPrivacyMark::ESSPrivacyMark()
2252 {
2253 choiceId = pStringCid;
2254 #if TCL
2255 pString = new PrintableString;
2256 #else
2257 pString = NULL; // incomplete initialization of mandatory element!
2258 #endif // TCL
2259 }
2260
2261 ESSPrivacyMark::ESSPrivacyMark (const ESSPrivacyMark &)
2262 {
2263 Asn1Error << "use of incompletely defined ESSPrivacyMark::ESSPrivacyMark (const ESSPrivacyMark &)" << endl;
2264 abort();
2265 }
2266
2267 ESSPrivacyMark::~ESSPrivacyMark()
2268 {
2269 switch (choiceId)
2270 {
2271 case pStringCid:
2272 delete pString;
2273 break;
2274 case utf8StringCid:
2275 delete utf8String;
2276 break;
2277 } // end of switch
2278 } // end of destructor
2279
2280 AsnType *ESSPrivacyMark::Clone() const
2281 {
2282 return new ESSPrivacyMark;
2283 }
2284
2285 AsnType *ESSPrivacyMark::Copy() const
2286 {
2287 return new ESSPrivacyMark (*this);
2288 }
2289
2290 #if SNACC_DEEP_COPY
2291 ESSPrivacyMark &ESSPrivacyMark::operator = (const ESSPrivacyMark &that)
2292 #else // SNACC_DEEP_COPY
2293 ESSPrivacyMark &ESSPrivacyMark::operator = (const ESSPrivacyMark &)
2294 #endif // SNACC_DEEP_COPY
2295 {
2296 #if SNACC_DEEP_COPY
2297 if (this != &that)
2298 {
2299 switch (choiceId)
2300 {
2301 case pStringCid:
2302 delete pString;
2303 break;
2304 case utf8StringCid:
2305 delete utf8String;
2306 break;
2307 }
2308 switch (choiceId = that.choiceId)
2309 {
2310 case pStringCid:
2311 pString = new PrintableString;
2312 *pString = *that.pString;
2313 break;
2314 case utf8StringCid:
2315 utf8String = new UTF8String;
2316 *utf8String = *that.utf8String;
2317 break;
2318 }
2319 }
2320
2321 return *this;
2322 #else // SNACC_DEEP_COPY
2323 Asn1Error << "use of incompletely defined ESSPrivacyMark &ESSPrivacyMark::operator = (const ESSPrivacyMark &)" << endl;
2324 abort();
2325 // if your compiler complains here, check the -novolat option
2326 #endif // SNACC_DEEP_COPY
2327 }
2328
2329 AsnLen
2330 ESSPrivacyMark::BEncContent (BUF_TYPE b)
2331 {
2332 AsnLen l;
2333 switch (choiceId)
2334 {
2335 case pStringCid:
2336 l = pString->BEncContent (b);
2337 l += BEncDefLen (b, l);
2338
2339 l += BEncTag1 (b, UNIV, PRIM, PRINTABLESTRING_TAG_CODE);
2340 break;
2341
2342 case utf8StringCid:
2343 l = utf8String->BEncContent (b);
2344 l += BEncDefLen (b, l);
2345
2346 l += BEncTag1 (b, UNIV, PRIM, 12);
2347 break;
2348
2349 } // end switch
2350 return l;
2351 } // ESSPrivacyMark::BEncContent
2352
2353
2354 void ESSPrivacyMark::BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
2355 {
2356 switch (tag)
2357 {
2358 case MAKE_TAG_ID (UNIV, PRIM, PRINTABLESTRING_TAG_CODE):
2359 case MAKE_TAG_ID (UNIV, CONS, PRINTABLESTRING_TAG_CODE):
2360 choiceId = pStringCid;
2361 pString = new PrintableString;
2362 pString->BDecContent (b, tag, elmtLen0, bytesDecoded, env);
2363 break;
2364
2365 case MAKE_TAG_ID (UNIV, PRIM, 12):
2366 case MAKE_TAG_ID (UNIV, CONS, 12):
2367 choiceId = utf8StringCid;
2368 utf8String = new UTF8String;
2369 utf8String->BDecContent (b, tag, elmtLen0, bytesDecoded, env);
2370 break;
2371
2372 default:
2373 Asn1Error << "ERROR - unexpected tag in CHOICE" << endl;
2374 SnaccExcep::throwMe(-110);
2375 break;
2376 } // end switch
2377 } // ESSPrivacyMark::BDecContent
2378
2379
2380 AsnLen ESSPrivacyMark::BEnc (BUF_TYPE b)
2381 {
2382 AsnLen l;
2383 l = BEncContent (b);
2384 return l;
2385 }
2386
2387 void ESSPrivacyMark::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
2388 {
2389 AsnLen elmtLen;
2390 AsnTag tag;
2391
2392 /* CHOICEs are a special case - grab identifying tag */
2393 /* this allows easier handling of nested CHOICEs */
2394 tag = BDecTag (b, bytesDecoded, env);
2395 elmtLen = BDecLen (b, bytesDecoded, env);
2396 BDecContent (b, tag, elmtLen, bytesDecoded, env);
2397 }
2398
2399 void ESSPrivacyMark::Print (ostream &os) const
2400 {
2401 #ifndef NDEBUG
2402 switch (choiceId)
2403 {
2404 case pStringCid:
2405 os << "pString ";
2406 if (pString)
2407 os << *pString;
2408 else
2409 os << "-- void3 --\n";
2410 break;
2411
2412 case utf8StringCid:
2413 os << "utf8String ";
2414 if (utf8String)
2415 os << *utf8String;
2416 else
2417 os << "-- void3 --\n";
2418 break;
2419
2420 } // end of switch
2421 #endif /* NDEBUG */
2422 } // ESSPrivacyMark::Print
2423
2424 SecurityCategory::SecurityCategory()
2425 {
2426 }
2427
2428 SecurityCategory::SecurityCategory (const SecurityCategory &)
2429 {
2430 Asn1Error << "use of incompletely defined SecurityCategory::SecurityCategory (const SecurityCategory &)" << endl;
2431 abort();
2432 }
2433
2434 SecurityCategory::~SecurityCategory()
2435 {
2436 }
2437
2438 AsnType *SecurityCategory::Clone() const
2439 {
2440 return new SecurityCategory;
2441 }
2442
2443 AsnType *SecurityCategory::Copy() const
2444 {
2445 return new SecurityCategory (*this);
2446 }
2447
2448 #if SNACC_DEEP_COPY
2449 SecurityCategory &SecurityCategory::operator = (const SecurityCategory &that)
2450 #else // SNACC_DEEP_COPY
2451 SecurityCategory &SecurityCategory::operator = (const SecurityCategory &)
2452 #endif // SNACC_DEEP_COPY
2453 {
2454 #if SNACC_DEEP_COPY
2455 if (this != &that)
2456 {
2457 type = that.type;
2458 value = that.value;
2459 }
2460
2461 return *this;
2462 #else // SNACC_DEEP_COPY
2463 Asn1Error << "use of incompletely defined SecurityCategory &SecurityCategory::operator = (const SecurityCategory &)" << endl;
2464 abort();
2465 // if your compiler complains here, check the -novolat option
2466 #endif // SNACC_DEEP_COPY
2467 }
2468
2469 AsnLen
2470 SecurityCategory::BEncContent (BUF_TYPE b)
2471 {
2472 AsnLen totalLen = 0;
2473 AsnLen l;
2474
2475 BEncEocIfNec (b);
2476 ENC_LOAD_ANYBUF(&value, b, l);
2477 l += BEncConsLen (b, l);
2478
2479 l += BEncTag1 (b, CNTX, CONS, 1);
2480 totalLen += l;
2481
2482 l = type.BEncContent (b);
2483 l += BEncDefLen (b, l);
2484
2485 l += BEncTag1 (b, CNTX, PRIM, 0);
2486 totalLen += l;
2487
2488 return totalLen;
2489 } // SecurityCategory::BEncContent
2490
2491
2492 void SecurityCategory::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
2493 {
2494 AsnTag tag1;
2495 AsnLen seqBytesDecoded = 0;
2496 AsnLen elmtLen1;
2497 tag1 = BDecTag (b, seqBytesDecoded, env);
2498
2499 if ((tag1 == MAKE_TAG_ID (CNTX, PRIM, 0)))
2500 {
2501 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
2502 type.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
2503 tag1 = BDecTag (b, seqBytesDecoded, env);
2504 }
2505 else
2506 {
2507 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
2508 SnaccExcep::throwMe(-111);
2509 }
2510
2511 if ((tag1 == MAKE_TAG_ID (CNTX, CONS, 1)))
2512 {
2513 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
2514 DEC_LOAD_ANYBUF(&value, b, seqBytesDecoded, env);
2515 if (elmtLen1 == INDEFINITE_LEN)
2516 BDecEoc (b, seqBytesDecoded, env);
2517
2518 }
2519 else
2520 {
2521 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
2522 SnaccExcep::throwMe(-112);
2523 }
2524
2525 bytesDecoded += seqBytesDecoded;
2526 if (elmtLen0 == INDEFINITE_LEN)
2527 {
2528 BDecEoc (b, bytesDecoded, env);
2529 return;
2530 }
2531 else if (seqBytesDecoded != elmtLen0)
2532 {
2533 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
2534 SnaccExcep::throwMe(-113);
2535 }
2536 else
2537 return;
2538 } // SecurityCategory::BDecContent
2539
2540 AsnLen SecurityCategory::BEnc (BUF_TYPE b)
2541 {
2542 AsnLen l;
2543 l = BEncContent (b);
2544 l += BEncConsLen (b, l);
2545 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
2546 return l;
2547 }
2548
2549 void SecurityCategory::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
2550 {
2551 AsnTag tag;
2552 AsnLen elmtLen1;
2553
2554 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
2555 {
2556 Asn1Error << "SecurityCategory::BDec: ERROR - wrong tag" << endl;
2557 SnaccExcep::throwMe(-114);
2558 }
2559 elmtLen1 = BDecLen (b, bytesDecoded, env);
2560 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
2561 }
2562
2563 void SecurityCategory::Print (ostream &os) const
2564 {
2565 #ifndef NDEBUG
2566 os << "{ -- SEQUENCE --" << endl;
2567 indentG += stdIndentG;
2568
2569 {
2570 Indent (os, indentG);
2571 os << "type ";
2572 os << type;
2573 os << "," << endl;
2574 }
2575
2576 {
2577 Indent (os, indentG);
2578 os << "value ";
2579 os << value;
2580 }
2581
2582 os << endl;
2583 indentG -= stdIndentG;
2584 Indent (os, indentG);
2585 os << "}";
2586 #endif /* NDEBUG */
2587 } // SecurityCategory::Print
2588
2589
2590 EntityIdentifier::EntityIdentifier()
2591 {
2592 choiceId = issuerAndSerialNumberCid;
2593 #if TCL
2594 issuerAndSerialNumber = new IssuerAndSerialNumber;
2595 #else
2596 issuerAndSerialNumber = NULL; // incomplete initialization of mandatory element!
2597 #endif // TCL
2598 }
2599
2600 EntityIdentifier::EntityIdentifier (const EntityIdentifier &)
2601 {
2602 Asn1Error << "use of incompletely defined EntityIdentifier::EntityIdentifier (const EntityIdentifier &)" << endl;
2603 abort();
2604 }
2605
2606 EntityIdentifier::~EntityIdentifier()
2607 {
2608 switch (choiceId)
2609 {
2610 case issuerAndSerialNumberCid:
2611 delete issuerAndSerialNumber;
2612 break;
2613 case subjectKeyIdentifierCid:
2614 delete subjectKeyIdentifier;
2615 break;
2616 } // end of switch
2617 } // end of destructor
2618
2619 AsnType *EntityIdentifier::Clone() const
2620 {
2621 return new EntityIdentifier;
2622 }
2623
2624 AsnType *EntityIdentifier::Copy() const
2625 {
2626 return new EntityIdentifier (*this);
2627 }
2628
2629 #if SNACC_DEEP_COPY
2630 EntityIdentifier &EntityIdentifier::operator = (const EntityIdentifier &that)
2631 #else // SNACC_DEEP_COPY
2632 EntityIdentifier &EntityIdentifier::operator = (const EntityIdentifier &)
2633 #endif // SNACC_DEEP_COPY
2634 {
2635 #if SNACC_DEEP_COPY
2636 if (this != &that)
2637 {
2638 switch (choiceId)
2639 {
2640 case issuerAndSerialNumberCid:
2641 delete issuerAndSerialNumber;
2642 break;
2643 case subjectKeyIdentifierCid:
2644 delete subjectKeyIdentifier;
2645 break;
2646 }
2647 switch (choiceId = that.choiceId)
2648 {
2649 case issuerAndSerialNumberCid:
2650 issuerAndSerialNumber = new IssuerAndSerialNumber;
2651 *issuerAndSerialNumber = *that.issuerAndSerialNumber;
2652 break;
2653 case subjectKeyIdentifierCid:
2654 subjectKeyIdentifier = new KeyIdentifier;
2655 *subjectKeyIdentifier = *that.subjectKeyIdentifier;
2656 break;
2657 }
2658 }
2659
2660 return *this;
2661 #else // SNACC_DEEP_COPY
2662 Asn1Error << "use of incompletely defined EntityIdentifier &EntityIdentifier::operator = (const EntityIdentifier &)" << endl;
2663 abort();
2664 // if your compiler complains here, check the -novolat option
2665 #endif // SNACC_DEEP_COPY
2666 }
2667
2668 AsnLen
2669 EntityIdentifier::BEncContent (BUF_TYPE b)
2670 {
2671 AsnLen l;
2672 switch (choiceId)
2673 {
2674 case issuerAndSerialNumberCid:
2675 BEncEocIfNec (b);
2676 l = issuerAndSerialNumber->BEncContent (b);
2677 l += BEncConsLen (b, l);
2678
2679 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
2680 break;
2681
2682 case subjectKeyIdentifierCid:
2683 l = subjectKeyIdentifier->BEncContent (b);
2684 l += BEncDefLen (b, l);
2685
2686 l += BEncTag1 (b, UNIV, PRIM, OCTETSTRING_TAG_CODE);
2687 break;
2688
2689 } // end switch
2690 return l;
2691 } // EntityIdentifier::BEncContent
2692
2693
2694 void EntityIdentifier::BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
2695 {
2696 switch (tag)
2697 {
2698 case MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE):
2699 choiceId = issuerAndSerialNumberCid;
2700 issuerAndSerialNumber = new IssuerAndSerialNumber;
2701 issuerAndSerialNumber->BDecContent (b, tag, elmtLen0, bytesDecoded, env);
2702 break;
2703
2704 case MAKE_TAG_ID (UNIV, PRIM, OCTETSTRING_TAG_CODE):
2705 case MAKE_TAG_ID (UNIV, CONS, OCTETSTRING_TAG_CODE):
2706 choiceId = subjectKeyIdentifierCid;
2707 subjectKeyIdentifier = new KeyIdentifier;
2708 subjectKeyIdentifier->BDecContent (b, tag, elmtLen0, bytesDecoded, env);
2709 break;
2710
2711 default:
2712 Asn1Error << "ERROR - unexpected tag in CHOICE" << endl;
2713 SnaccExcep::throwMe(-115);
2714 break;
2715 } // end switch
2716 } // EntityIdentifier::BDecContent
2717
2718
2719 AsnLen EntityIdentifier::BEnc (BUF_TYPE b)
2720 {
2721 AsnLen l;
2722 l = BEncContent (b);
2723 return l;
2724 }
2725
2726 void EntityIdentifier::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
2727 {
2728 AsnLen elmtLen;
2729 AsnTag tag;
2730
2731 /* CHOICEs are a special case - grab identifying tag */
2732 /* this allows easier handling of nested CHOICEs */
2733 tag = BDecTag (b, bytesDecoded, env);
2734 elmtLen = BDecLen (b, bytesDecoded, env);
2735 BDecContent (b, tag, elmtLen, bytesDecoded, env);
2736 }
2737
2738 void EntityIdentifier::Print (ostream &os) const
2739 {
2740 #ifndef NDEBUG
2741 switch (choiceId)
2742 {
2743 case issuerAndSerialNumberCid:
2744 os << "issuerAndSerialNumber ";
2745 if (issuerAndSerialNumber)
2746 os << *issuerAndSerialNumber;
2747 else
2748 os << "-- void3 --\n";
2749 break;
2750
2751 case subjectKeyIdentifierCid:
2752 os << "subjectKeyIdentifier ";
2753 if (subjectKeyIdentifier)
2754 os << *subjectKeyIdentifier;
2755 else
2756 os << "-- void3 --\n";
2757 break;
2758
2759 } // end of switch
2760 #endif /* NDEBUG */
2761 } // EntityIdentifier::Print
2762
2763 ReceiptsFrom::ReceiptsFrom()
2764 {
2765 choiceId = allOrFirstTierCid;
2766 #if TCL
2767 allOrFirstTier = new AllOrFirstTier;
2768 #else
2769 allOrFirstTier = NULL; // incomplete initialization of mandatory element!
2770 #endif // TCL
2771 }
2772
2773 ReceiptsFrom::ReceiptsFrom (const ReceiptsFrom &)
2774 {
2775 Asn1Error << "use of incompletely defined ReceiptsFrom::ReceiptsFrom (const ReceiptsFrom &)" << endl;
2776 abort();
2777 }
2778
2779 ReceiptsFrom::~ReceiptsFrom()
2780 {
2781 switch (choiceId)
2782 {
2783 case allOrFirstTierCid:
2784 delete allOrFirstTier;
2785 break;
2786 case receiptListCid:
2787 delete receiptList;
2788 break;
2789 } // end of switch
2790 } // end of destructor
2791
2792 AsnType *ReceiptsFrom::Clone() const
2793 {
2794 return new ReceiptsFrom;
2795 }
2796
2797 AsnType *ReceiptsFrom::Copy() const
2798 {
2799 return new ReceiptsFrom (*this);
2800 }
2801
2802 #if SNACC_DEEP_COPY
2803 ReceiptsFrom &ReceiptsFrom::operator = (const ReceiptsFrom &that)
2804 #else // SNACC_DEEP_COPY
2805 ReceiptsFrom &ReceiptsFrom::operator = (const ReceiptsFrom &)
2806 #endif // SNACC_DEEP_COPY
2807 {
2808 #if SNACC_DEEP_COPY
2809 if (this != &that)
2810 {
2811 switch (choiceId)
2812 {
2813 case allOrFirstTierCid:
2814 delete allOrFirstTier;
2815 break;
2816 case receiptListCid:
2817 delete receiptList;
2818 break;
2819 }
2820 switch (choiceId = that.choiceId)
2821 {
2822 case allOrFirstTierCid:
2823 allOrFirstTier = new AllOrFirstTier;
2824 *allOrFirstTier = *that.allOrFirstTier;
2825 break;
2826 case receiptListCid:
2827 receiptList = new ReceiptsFromSeqOf;
2828 *receiptList = *that.receiptList;
2829 break;
2830 }
2831 }
2832
2833 return *this;
2834 #else // SNACC_DEEP_COPY
2835 Asn1Error << "use of incompletely defined ReceiptsFrom &ReceiptsFrom::operator = (const ReceiptsFrom &)" << endl;
2836 abort();
2837 // if your compiler complains here, check the -novolat option
2838 #endif // SNACC_DEEP_COPY
2839 }
2840
2841 AsnLen
2842 ReceiptsFrom::BEncContent (BUF_TYPE b)
2843 {
2844 AsnLen l;
2845 switch (choiceId)
2846 {
2847 case allOrFirstTierCid:
2848 l = allOrFirstTier->BEncContent (b);
2849 BEncDefLenTo127 (b, l);
2850 l++;
2851
2852 l += BEncTag1 (b, CNTX, PRIM, 0);
2853 break;
2854
2855 case receiptListCid:
2856 BEncEocIfNec (b);
2857 l = receiptList->BEncContent (b);
2858 l += BEncConsLen (b, l);
2859
2860 l += BEncTag1 (b, CNTX, CONS, 1);
2861 break;
2862
2863 } // end switch
2864 return l;
2865 } // ReceiptsFrom::BEncContent
2866
2867
2868 void ReceiptsFrom::BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
2869 {
2870 switch (tag)
2871 {
2872 case MAKE_TAG_ID (CNTX, PRIM, 0):
2873 choiceId = allOrFirstTierCid;
2874 allOrFirstTier = new AllOrFirstTier;
2875 allOrFirstTier->BDecContent (b, tag, elmtLen0, bytesDecoded, env);
2876 break;
2877
2878 case MAKE_TAG_ID (CNTX, CONS, 1):
2879 choiceId = receiptListCid;
2880 receiptList = new ReceiptsFromSeqOf;
2881 receiptList->BDecContent (b, tag, elmtLen0, bytesDecoded, env);
2882 break;
2883
2884 default:
2885 Asn1Error << "ERROR - unexpected tag in CHOICE" << endl;
2886 SnaccExcep::throwMe(-116);
2887 break;
2888 } // end switch
2889 } // ReceiptsFrom::BDecContent
2890
2891
2892 AsnLen ReceiptsFrom::BEnc (BUF_TYPE b)
2893 {
2894 AsnLen l;
2895 l = BEncContent (b);
2896 return l;
2897 }
2898
2899 void ReceiptsFrom::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
2900 {
2901 AsnLen elmtLen;
2902 AsnTag tag;
2903
2904 /* CHOICEs are a special case - grab identifying tag */
2905 /* this allows easier handling of nested CHOICEs */
2906 tag = BDecTag (b, bytesDecoded, env);
2907 elmtLen = BDecLen (b, bytesDecoded, env);
2908 BDecContent (b, tag, elmtLen, bytesDecoded, env);
2909 }
2910
2911 void ReceiptsFrom::Print (ostream &os) const
2912 {
2913 #ifndef NDEBUG
2914 switch (choiceId)
2915 {
2916 case allOrFirstTierCid:
2917 os << "allOrFirstTier ";
2918 if (allOrFirstTier)
2919 os << *allOrFirstTier;
2920 else
2921 os << "-- void3 --\n";
2922 break;
2923
2924 case receiptListCid:
2925 os << "receiptList ";
2926 if (receiptList)
2927 os << *receiptList;
2928 else
2929 os << "-- void3 --\n";
2930 break;
2931
2932 } // end of switch
2933 #endif /* NDEBUG */
2934 } // ReceiptsFrom::Print
2935
2936 AsnType *SecurityCategories::Clone() const
2937 {
2938 return new SecurityCategories;
2939 }
2940
2941 AsnType *SecurityCategories::Copy() const
2942 {
2943 return new SecurityCategories (*this);
2944 }
2945
2946 AsnLen SecurityCategories::BEnc (BUF_TYPE b)
2947 {
2948 AsnLen l;
2949 l = BEncContent (b);
2950 l += BEncConsLen (b, l);
2951 l += BEncTag1 (b, UNIV, CONS, SET_TAG_CODE);
2952 return l;
2953 }
2954
2955 void SecurityCategories::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
2956 {
2957 AsnTag tag;
2958 AsnLen elmtLen1;
2959
2960 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SET_TAG_CODE))
2961 {
2962 Asn1Error << "SecurityCategories::BDec: ERROR - wrong tag" << endl;
2963 SnaccExcep::throwMe(-117);
2964 }
2965 elmtLen1 = BDecLen (b, bytesDecoded, env);
2966 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
2967 }
2968
2969 SecurityCategories::SecurityCategories (const SecurityCategories &)
2970 {
2971 Asn1Error << "use of incompletely defined SecurityCategories::SecurityCategories (const SecurityCategories &)" << endl;
2972 abort();
2973 }
2974
2975 SecurityCategories::~SecurityCategories()
2976 {
2977 SetCurrToFirst();
2978 for (; Curr() != NULL; RemoveCurrFromList())
2979 ;
2980 } // end of destructor
2981
2982 #if SNACC_DEEP_COPY
2983 SecurityCategories &SecurityCategories::operator = (const SecurityCategories &that)
2984 #else // SNACC_DEEP_COPY
2985 SecurityCategories &SecurityCategories::operator = (const SecurityCategories &)
2986 #endif // SNACC_DEEP_COPY
2987 {
2988 #if SNACC_DEEP_COPY
2989 if (this != &that)
2990 {
2991 SetCurrToFirst();
2992 for (; Curr(); RemoveCurrFromList())
2993 ;
2994
2995 //that.SetCurrToFirst();
2996 //for (; that.Curr(); that.GoNext())
2997 // AppendCopy (*that.Curr());
2998 for (const AsnListElmt *run=that.first; run; run=run->next)
2999 AppendCopy (*run->elmt);
3000 }
3001
3002 return *this;
3003 #else // SNACC_DEEP_COPY
3004 Asn1Error << "use of incompletely defined SecurityCategories &SecurityCategories::operator = (const SecurityCategories &)" << endl;
3005 abort();
3006 // if your compiler complains here, check the -novolat option
3007 #endif // SNACC_DEEP_COPY
3008 }
3009
3010 void SecurityCategories::Print (ostream &os) const
3011 {
3012 #ifndef NDEBUG
3013 os << "{ -- SEQUENCE/SET OF -- " << endl;
3014 indentG += stdIndentG;
3015 //SetCurrToFirst();
3016 //for (; Curr() != NULL; GoNext())
3017 for (const AsnListElmt *run=first; run; run=run->next)
3018 {
3019 Indent (os, indentG);
3020 //os << *Curr();
3021 os << *run->elmt;
3022 //if (Curr() != Last())
3023 if (run != last)
3024 os << ",";
3025 os << endl;
3026 }
3027 indentG -= stdIndentG;
3028 Indent (os, indentG);
3029 os << "}\n";
3030 #endif /* NDEBUG */
3031
3032
3033 } // Print
3034
3035
3036 void SecurityCategories::SetCurrElmt (unsigned long int index)
3037 {
3038 unsigned long int i;
3039 curr = first;
3040 if (count)
3041 for (i = 0; (i < (count-1)) && (i < index); i++)
3042 curr = curr->next;
3043 } // SecurityCategories::SetCurrElmt
3044
3045
3046 unsigned long int SecurityCategories::GetCurrElmtIndex()
3047 {
3048 unsigned long int i;
3049 AsnListElmt *tmp;
3050 if (curr != NULL)
3051 {
3052 for (i = 0, tmp = first; tmp != NULL; i++)
3053 {
3054 if (tmp == curr)
3055 return i;
3056 else
3057 tmp = tmp->next;
3058 }
3059 }
3060 return count;
3061 } // SecurityCategories::GetCurrElmtIndex
3062
3063
3064 // alloc new list elmt, put at end of list
3065 // and return the component type
3066 SecurityCategory *SecurityCategories::Append()
3067 {
3068 AsnListElmt *newElmt;
3069 newElmt = new AsnListElmt;
3070 newElmt->elmt = new SecurityCategory;
3071 newElmt->next = NULL;
3072 if (last == NULL)
3073 {
3074 newElmt->prev = NULL;
3075 first = last = newElmt;
3076 }
3077 else
3078 {
3079 newElmt->prev = last;
3080 last->next = newElmt;
3081 last = newElmt;
3082 }
3083 count++;
3084 return (curr = newElmt)->elmt;
3085 } // SecurityCategories::Append
3086
3087
3088 // alloc new list elmt, put at begining of list
3089 // and return the component type
3090 SecurityCategory *SecurityCategories::Prepend()
3091 {
3092 AsnListElmt *newElmt;
3093 newElmt = new AsnListElmt;
3094 newElmt->elmt = new SecurityCategory;
3095 newElmt->prev = NULL;
3096 if (first == NULL)
3097 {
3098 newElmt->next = NULL;
3099 first = last = newElmt;
3100 }
3101 else
3102 {
3103 newElmt->next = first;
3104 first->prev = newElmt;
3105 first = newElmt;
3106 }
3107 count++;
3108 return (curr = newElmt)->elmt;
3109 } // SecurityCategories::Prepend
3110
3111
3112 // alloc new list elmt, insert it before the
3113 // current element and return the component type
3114 // if the current element is null, the new element
3115 // is placed at the beginning of the list.
3116 SecurityCategory *SecurityCategories::InsertBefore()
3117 {
3118 AsnListElmt *newElmt;
3119 newElmt = new AsnListElmt;
3120 newElmt->elmt = new SecurityCategory;
3121 if (curr == NULL)
3122 {
3123 newElmt->next = first;
3124 newElmt->prev = NULL;
3125 first = newElmt;
3126 if (last == NULL)
3127 last = newElmt;
3128 }
3129 else
3130 {
3131 newElmt->next = curr;
3132 newElmt->prev = curr->prev;
3133 curr->prev = newElmt;
3134 if (curr == first)
3135 first = newElmt;
3136 else
3137 newElmt->prev->next = newElmt;
3138 }
3139 count++;
3140 return (curr = newElmt)->elmt;
3141 } // SecurityCategories::InsertBefore
3142
3143
3144 // alloc new list elmt, insert it after the
3145 // current element and return the component type
3146 // if the current element is null, the new element
3147 // is placed at the end of the list.
3148 SecurityCategory *SecurityCategories::InsertAfter()
3149 {
3150 AsnListElmt *newElmt;
3151 newElmt = new AsnListElmt;
3152 newElmt->elmt = new SecurityCategory;
3153 if (curr == NULL)
3154 {
3155 newElmt->prev = last;
3156 newElmt->next = NULL;
3157 last = newElmt;
3158 if (first == NULL)
3159 first = newElmt;
3160 }
3161 else
3162 {
3163 newElmt->prev = curr;
3164 newElmt->next = curr->next;
3165 curr->next = newElmt;
3166 if (curr == last)
3167 last = newElmt;
3168 else
3169 newElmt->next->prev = newElmt;
3170 }
3171 count++;
3172 return (curr = newElmt)->elmt;
3173 } // SecurityCategories::InsertAfter
3174
3175
3176 SecurityCategories &SecurityCategories::AppendCopy (SecurityCategory &elmt)
3177 {
3178 AsnListElmt *newElmt;
3179 newElmt = new AsnListElmt;
3180 newElmt->elmt = new SecurityCategory;
3181 *newElmt->elmt = elmt;
3182 newElmt->next = NULL;
3183 if (last == NULL)
3184 {
3185 newElmt->prev = NULL;
3186 first = last = newElmt;
3187 }
3188 else
3189 {
3190 newElmt->prev = last;
3191 last->next = newElmt;
3192 last = newElmt;
3193 }
3194 count++;
3195 return *this;
3196 } // AppendCopy
3197
3198
3199 SecurityCategories &SecurityCategories::PrependCopy (SecurityCategory &elmt)
3200 {
3201 AsnListElmt *newElmt;
3202 newElmt = new AsnListElmt;
3203 newElmt->elmt = new SecurityCategory;
3204 *newElmt->elmt = elmt;
3205 newElmt->prev = NULL;
3206 if (first == NULL)
3207 {
3208 newElmt->next = NULL;
3209 first = last = newElmt;
3210 }
3211 else
3212 {
3213 newElmt->next = first;
3214 first->prev = newElmt;
3215 first = newElmt;
3216 }
3217 count++;
3218 return *this;
3219 } // SecurityCategories::PrependCopy
3220
3221
3222 // alloc new list elmt, insert it before the
3223 // current element, copy the given elmt into the new elmt
3224 // and return the component type.
3225 // if the current element is null, the new element
3226 // is placed at the beginning of the list.
3227 SecurityCategories &SecurityCategories::InsertBeforeAndCopy (SecurityCategory &elmt)
3228 {
3229 AsnListElmt *newElmt;
3230
3231 newElmt = new AsnListElmt;
3232 newElmt->elmt = new SecurityCategory;
3233 *newElmt->elmt = elmt;
3234
3235 if (curr == NULL)
3236 {
3237 newElmt->next = first;
3238 newElmt->prev = NULL;
3239 first = newElmt;
3240 if (last == NULL)
3241 last = newElmt;
3242 }
3243 else
3244 {
3245 newElmt->next = curr;
3246 newElmt->prev = curr->prev;
3247 curr->prev = newElmt;
3248 if (curr == first)
3249 first = newElmt;
3250 else
3251 newElmt->prev->next = newElmt;
3252 }
3253 count++;
3254 return *this;
3255 } // SecurityCategories::InsertBeforeAndCopy
3256
3257
3258 // alloc new list elmt, insert it after the
3259 // current element, copy given elmt in to new elmt
3260 // and return the component type
3261 // if the current element is null, the new element
3262 // is placed at the end of the list.
3263 SecurityCategories &SecurityCategories::InsertAfterAndCopy (SecurityCategory &elmt)
3264 {
3265 AsnListElmt *newElmt;
3266
3267 newElmt = new AsnListElmt;
3268 newElmt->elmt = new SecurityCategory;
3269 *newElmt->elmt = elmt;
3270 if (curr == NULL)
3271 {
3272 newElmt->prev = last;
3273 newElmt->next = NULL;
3274 last = newElmt;
3275 if (first == NULL)
3276 first = newElmt;
3277 }
3278 else
3279 {
3280 newElmt->prev = curr;
3281 newElmt->next = curr->next;
3282 curr->next = newElmt;
3283 if (curr == last)
3284 last = newElmt;
3285 else
3286 newElmt->next->prev = newElmt;
3287 }
3288 count++;
3289 return *this;
3290 } // SecurityCategories::InsertAfterAndCopy
3291
3292
3293 // remove current element from list if current element is not NULL
3294 // The new current element will be the next element.
3295 // If the current element is the last element in the list
3296 // the second but last element will become the new current element.
3297 void SecurityCategories::RemoveCurrFromList()
3298 {
3299 AsnListElmt *del_elmt;
3300
3301 if (curr != NULL)
3302 {
3303 del_elmt = curr;
3304 count--;
3305
3306 if (count == 0)
3307 first = last = curr = NULL;
3308 else if (curr == first)
3309 {
3310 curr = first= first->next;
3311 first->prev = NULL;
3312 }
3313 else if (curr == last)
3314 {
3315 curr = last = last->prev;
3316 last->next = NULL;
3317 }
3318 else
3319 {
3320 curr->prev->next = curr->next;
3321 curr->next->prev = curr->prev;
3322 }
3323
3324 delete del_elmt->elmt;
3325 delete del_elmt;
3326 }
3327 }
3328
3329
3330 AsnLen SecurityCategories::BEncContent (BUF_TYPE b)
3331 {
3332 AsnListElmt *currElmt;
3333 AsnLen elmtLen;
3334 AsnLen totalLen = 0;
3335 {
3336 int iii,icount;
3337 CSM_Buffer **tmpEnc=NULL;
3338 for (currElmt = last,icount=0; currElmt != NULL; currElmt = currElmt->prev, icount++);
3339 tmpEnc = (CSM_Buffer **) calloc(sizeof(CSM_Buffer *), icount);
3340 for (currElmt = last, iii=0; currElmt != NULL; currElmt = currElmt->prev,iii++,elmtLen=0)
3341 {
3342 BEncEocIfNec (b);
3343 ENCODE_BUF1(currElmt->elmt->BEncContent, elmtLen);
3344 elmtLen += BEncConsLen (outputBuf, elmtLen);
3345
3346 elmtLen += BEncTag1 (outputBuf, UNIV, CONS, SEQ_TAG_CODE);
3347 ENCODE_BUF2(tmpEnc[iii]);
3348 }
3349 vdasnacc_sortSetOf(tmpEnc, icount);
3350 for (iii=0,elmtLen=0; iii < icount; elmtLen+=tmpEnc[iii++]->Length())
3351 SM_WriteToAsnBuf(tmpEnc[iii], b);
3352 for (iii=0; iii < icount; iii++) delete tmpEnc[iii];
3353 free(tmpEnc);
3354 }
3355 totalLen += elmtLen;
3356 return totalLen;
3357 } // SecurityCategories::BEncContent
3358
3359
3360 void SecurityCategories::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0,
3361 AsnLen &bytesDecoded, ENV_TYPE env)
3362 {
3363 SecurityCategory *listElmt;
3364 AsnTag tag1;
3365 AsnLen listBytesDecoded = 0;
3366 AsnLen elmtLen1;
3367
3368 while ((listBytesDecoded < elmtLen0) || (elmtLen0 == INDEFINITE_LEN))
3369 {
3370 tag1 = BDecTag (b, listBytesDecoded, env);
3371 if ((tag1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
3372 {
3373 BDEC_2ND_EOC_OCTET (b, listBytesDecoded, env);
3374 break;
3375 }
3376 if ((tag1 != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
3377 {
3378 Asn1Error << "Unexpected Tag" << endl;
3379 SnaccExcep::throwMe(-118);
3380 }
3381
3382 elmtLen1 = BDecLen (b, listBytesDecoded, env);
3383 listElmt = Append();
3384 listElmt->BDecContent (b, tag1, elmtLen1, listBytesDecoded, env);
3385 }
3386
3387 bytesDecoded += listBytesDecoded;
3388 } // SecurityCategories::BDecContent
3389
3390
3391 MLReceiptPolicy::MLReceiptPolicy()
3392 {
3393 choiceId = noneCid;
3394 #if TCL
3395 none = new AsnNull;
3396 #else
3397 none = NULL; // incomplete initialization of mandatory element!
3398 #endif // TCL
3399 }
3400
3401 MLReceiptPolicy::MLReceiptPolicy (const MLReceiptPolicy &)
3402 {
3403 Asn1Error << "use of incompletely defined MLReceiptPolicy::MLReceiptPolicy (const MLReceiptPolicy &)" << endl;
3404 abort();
3405 }
3406
3407 MLReceiptPolicy::~MLReceiptPolicy()
3408 {
3409 switch (choiceId)
3410 {
3411 case noneCid:
3412 delete none;
3413 break;
3414 case insteadOfCid:
3415 delete insteadOf;
3416 break;
3417 case inAdditionToCid:
3418 delete inAdditionTo;
3419 break;
3420 } // end of switch
3421 } // end of destructor
3422
3423 AsnType *MLReceiptPolicy::Clone() const
3424 {
3425 return new MLReceiptPolicy;
3426 }
3427
3428 AsnType *MLReceiptPolicy::Copy() const
3429 {
3430 return new MLReceiptPolicy (*this);
3431 }
3432
3433 #if SNACC_DEEP_COPY
3434 MLReceiptPolicy &MLReceiptPolicy::operator = (const MLReceiptPolicy &that)
3435 #else // SNACC_DEEP_COPY
3436 MLReceiptPolicy &MLReceiptPolicy::operator = (const MLReceiptPolicy &)
3437 #endif // SNACC_DEEP_COPY
3438 {
3439 #if SNACC_DEEP_COPY
3440 if (this != &that)
3441 {
3442 switch (choiceId)
3443 {
3444 case noneCid:
3445 delete none;
3446 break;
3447 case insteadOfCid:
3448 delete insteadOf;
3449 break;
3450 case inAdditionToCid:
3451 delete inAdditionTo;
3452 break;
3453 }
3454 switch (choiceId = that.choiceId)
3455 {
3456 case noneCid:
3457 none = new AsnNull;
3458 *none = *that.none;
3459 break;
3460 case insteadOfCid:
3461 insteadOf = new MLReceiptPolicySeqOf;
3462 *insteadOf = *that.insteadOf;
3463 break;
3464 case inAdditionToCid:
3465 inAdditionTo = new MLReceiptPolicySeqOf1;
3466 *inAdditionTo = *that.inAdditionTo;
3467 break;
3468 }
3469 }
3470
3471 return *this;
3472 #else // SNACC_DEEP_COPY
3473 Asn1Error << "use of incompletely defined MLReceiptPolicy &MLReceiptPolicy::operator = (const MLReceiptPolicy &)" << endl;
3474 abort();
3475 // if your compiler complains here, check the -novolat option
3476 #endif // SNACC_DEEP_COPY
3477 }
3478
3479 AsnLen
3480 MLReceiptPolicy::BEncContent (BUF_TYPE b)
3481 {
3482 AsnLen l;
3483 switch (choiceId)
3484 {
3485 case noneCid:
3486 l = none->BEncContent (b);
3487 BEncDefLenTo127 (b, l);
3488 l++;
3489
3490 l += BEncTag1 (b, CNTX, PRIM, 0);
3491 break;
3492
3493 case insteadOfCid:
3494 BEncEocIfNec (b);
3495 l = insteadOf->BEncContent (b);
3496 l += BEncConsLen (b, l);
3497
3498 l += BEncTag1 (b, CNTX, CONS, 1);
3499 break;
3500
3501 case inAdditionToCid:
3502 BEncEocIfNec (b);
3503 l = inAdditionTo->BEncContent (b);
3504 l += BEncConsLen (b, l);
3505
3506 l += BEncTag1 (b, CNTX, CONS, 2);
3507 break;
3508
3509 } // end switch
3510 return l;
3511 } // MLReceiptPolicy::BEncContent
3512
3513
3514 void MLReceiptPolicy::BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
3515 {
3516 switch (tag)
3517 {
3518 case MAKE_TAG_ID (CNTX, PRIM, 0):
3519 choiceId = noneCid;
3520 none = new AsnNull;
3521 none->BDecContent (b, tag, elmtLen0, bytesDecoded, env);
3522 break;
3523
3524 case MAKE_TAG_ID (CNTX, CONS, 1):
3525 choiceId = insteadOfCid;
3526 insteadOf = new MLReceiptPolicySeqOf;
3527 insteadOf->BDecContent (b, tag, elmtLen0, bytesDecoded, env);
3528 break;
3529
3530 case MAKE_TAG_ID (CNTX, CONS, 2):
3531 choiceId = inAdditionToCid;
3532 inAdditionTo = new MLReceiptPolicySeqOf1;
3533 inAdditionTo->BDecContent (b, tag, elmtLen0, bytesDecoded, env);
3534 break;
3535
3536 default:
3537 Asn1Error << "ERROR - unexpected tag in CHOICE" << endl;
3538 SnaccExcep::throwMe(-119);
3539 break;
3540 } // end switch
3541 } // MLReceiptPolicy::BDecContent
3542
3543
3544 AsnLen MLReceiptPolicy::BEnc (BUF_TYPE b)
3545 {
3546 AsnLen l;
3547 l = BEncContent (b);
3548 return l;
3549 }
3550
3551 void MLReceiptPolicy::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
3552 {
3553 AsnLen elmtLen;
3554 AsnTag tag;
3555
3556 /* CHOICEs are a special case - grab identifying tag */
3557 /* this allows easier handling of nested CHOICEs */
3558 tag = BDecTag (b, bytesDecoded, env);
3559 elmtLen = BDecLen (b, bytesDecoded, env);
3560 BDecContent (b, tag, elmtLen, bytesDecoded, env);
3561 }
3562
3563 void MLReceiptPolicy::Print (ostream &os) const
3564 {
3565 #ifndef NDEBUG
3566 switch (choiceId)
3567 {
3568 case noneCid:
3569 os << "none ";
3570 if (none)
3571 os << *none;
3572 else
3573 os << "-- void3 --\n";
3574 break;
3575
3576 case insteadOfCid:
3577 os << "insteadOf ";
3578 if (insteadOf)
3579 os << *insteadOf;
3580 else
3581 os << "-- void3 --\n";
3582 break;
3583
3584 case inAdditionToCid:
3585 os << "inAdditionTo ";
3586 if (inAdditionTo)
3587 os << *inAdditionTo;
3588 else
3589 os << "-- void3 --\n";
3590 break;
3591
3592 } // end of switch
3593 #endif /* NDEBUG */
3594 } // MLReceiptPolicy::Print
3595
3596 ESSCertID::ESSCertID()
3597 {
3598 issuerSerial = NULL;
3599 }
3600
3601 ESSCertID::ESSCertID (const ESSCertID &)
3602 {
3603 Asn1Error << "use of incompletely defined ESSCertID::ESSCertID (const ESSCertID &)" << endl;
3604 abort();
3605 }
3606
3607 ESSCertID::~ESSCertID()
3608 {
3609 delete issuerSerial;
3610 }
3611
3612 AsnType *ESSCertID::Clone() const
3613 {
3614 return new ESSCertID;
3615 }
3616
3617 AsnType *ESSCertID::Copy() const
3618 {
3619 return new ESSCertID (*this);
3620 }
3621
3622 #if SNACC_DEEP_COPY
3623 ESSCertID &ESSCertID::operator = (const ESSCertID &that)
3624 #else // SNACC_DEEP_COPY
3625 ESSCertID &ESSCertID::operator = (const ESSCertID &)
3626 #endif // SNACC_DEEP_COPY
3627 {
3628 #if SNACC_DEEP_COPY
3629 if (this != &that)
3630 {
3631 certHash = that.certHash;
3632 if (that.issuerSerial)
3633 {
3634 if (!issuerSerial)
3635 issuerSerial = new IssuerSerial;
3636 *issuerSerial = *that.issuerSerial;
3637 }
3638 else
3639 {
3640 delete issuerSerial;
3641 issuerSerial = NULL;
3642 }
3643 }
3644
3645 return *this;
3646 #else // SNACC_DEEP_COPY
3647 Asn1Error << "use of incompletely defined ESSCertID &ESSCertID::operator = (const ESSCertID &)" << endl;
3648 abort();
3649 // if your compiler complains here, check the -novolat option
3650 #endif // SNACC_DEEP_COPY
3651 }
3652
3653 AsnLen
3654 ESSCertID::BEncContent (BUF_TYPE b)
3655 {
3656 AsnLen totalLen = 0;
3657 AsnLen l;
3658
3659 if (NOT_NULL (issuerSerial))
3660 {
3661 BEncEocIfNec (b);
3662 l = issuerSerial->BEncContent (b);
3663 l += BEncConsLen (b, l);
3664
3665 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
3666 totalLen += l;
3667 }
3668
3669 l = certHash.BEncContent (b);
3670 l += BEncDefLen (b, l);
3671
3672 l += BEncTag1 (b, UNIV, PRIM, OCTETSTRING_TAG_CODE);
3673 totalLen += l;
3674
3675 return totalLen;
3676 } // ESSCertID::BEncContent
3677
3678
3679 void ESSCertID::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
3680 {
3681 AsnTag tag1;
3682 AsnLen seqBytesDecoded = 0;
3683 AsnLen elmtLen1;
3684 tag1 = BDecTag (b, seqBytesDecoded, env);
3685
3686 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, OCTETSTRING_TAG_CODE))
3687 || (tag1 == MAKE_TAG_ID (UNIV, CONS, OCTETSTRING_TAG_CODE)))
3688 {
3689 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
3690 certHash.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
3691 if (seqBytesDecoded == elmtLen0)
3692 {
3693 bytesDecoded += seqBytesDecoded;
3694 return;
3695 }
3696 else
3697 {
3698 tag1 = BDecTag (b, seqBytesDecoded, env);
3699
3700 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
3701 {
3702 BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env)
3703 bytesDecoded += seqBytesDecoded;
3704 return;
3705 }
3706 }
3707 }
3708 else
3709 {
3710 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
3711 SnaccExcep::throwMe(-120);
3712 }
3713
3714 if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
3715 {
3716 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
3717 issuerSerial = new IssuerSerial;
3718 issuerSerial->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
3719 }
3720
3721 bytesDecoded += seqBytesDecoded;
3722 if (elmtLen0 == INDEFINITE_LEN)
3723 {
3724 BDecEoc (b, bytesDecoded, env);
3725 return;
3726 }
3727 else if (seqBytesDecoded != elmtLen0)
3728 {
3729 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
3730 SnaccExcep::throwMe(-121);
3731 }
3732 else
3733 return;
3734 } // ESSCertID::BDecContent
3735
3736 AsnLen ESSCertID::BEnc (BUF_TYPE b)
3737 {
3738 AsnLen l;
3739 l = BEncContent (b);
3740 l += BEncConsLen (b, l);
3741 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
3742 return l;
3743 }
3744
3745 void ESSCertID::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
3746 {
3747 AsnTag tag;
3748 AsnLen elmtLen1;
3749
3750 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
3751 {
3752 Asn1Error << "ESSCertID::BDec: ERROR - wrong tag" << endl;
3753 SnaccExcep::throwMe(-122);
3754 }
3755 elmtLen1 = BDecLen (b, bytesDecoded, env);
3756 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
3757 }
3758
3759 void ESSCertID::Print (ostream &os) const
3760 {
3761 #ifndef NDEBUG
3762 os << "{ -- SEQUENCE --" << endl;
3763 indentG += stdIndentG;
3764
3765 {
3766 Indent (os, indentG);
3767 os << "certHash ";
3768 os << certHash;
3769 os << "," << endl;
3770 }
3771
3772 if (NOT_NULL (issuerSerial))
3773 {
3774 os << ","<< endl;
3775 Indent (os, indentG);
3776 os << "issuerSerial ";
3777 os << *issuerSerial;
3778 }
3779 else
3780 {
3781 Indent (os, indentG);
3782 os << "issuerSerial ";
3783 os << "-- void --";
3784 os << endl;
3785 }
3786
3787 os << endl;
3788 indentG -= stdIndentG;
3789 Indent (os, indentG);
3790 os << "}";
3791 #endif /* NDEBUG */
3792 } // ESSCertID::Print
3793
3794
3795 AsnType *SigningCertificateSeqOf::Clone() const
3796 {
3797 return new SigningCertificateSeqOf;
3798 }
3799
3800 AsnType *SigningCertificateSeqOf::Copy() const
3801 {
3802 return new SigningCertificateSeqOf (*this);
3803 }
3804
3805 AsnLen SigningCertificateSeqOf::BEnc (BUF_TYPE b)
3806 {
3807 AsnLen l;
3808 l = BEncContent (b);
3809 l += BEncConsLen (b, l);
3810 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
3811 return l;
3812 }
3813
3814 void SigningCertificateSeqOf::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
3815 {
3816 AsnTag tag;
3817 AsnLen elmtLen1;
3818
3819 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
3820 {
3821 Asn1Error << "SigningCertificateSeqOf::BDec: ERROR - wrong tag" << endl;
3822 SnaccExcep::throwMe(-123);
3823 }
3824 elmtLen1 = BDecLen (b, bytesDecoded, env);
3825 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
3826 }
3827
3828 SigningCertificateSeqOf::SigningCertificateSeqOf (const SigningCertificateSeqOf &)
3829 {
3830 Asn1Error << "use of incompletely defined SigningCertificateSeqOf::SigningCertificateSeqOf (const SigningCertificateSeqOf &)" << endl;
3831 abort();
3832 }
3833
3834 SigningCertificateSeqOf::~SigningCertificateSeqOf()
3835 {
3836 SetCurrToFirst();
3837 for (; Curr() != NULL; RemoveCurrFromList())
3838 ;
3839 } // end of destructor
3840
3841 #if SNACC_DEEP_COPY
3842 SigningCertificateSeqOf &SigningCertificateSeqOf::operator = (const SigningCertificateSeqOf &that)
3843 #else // SNACC_DEEP_COPY
3844 SigningCertificateSeqOf &SigningCertificateSeqOf::operator = (const SigningCertificateSeqOf &)
3845 #endif // SNACC_DEEP_COPY
3846 {
3847 #if SNACC_DEEP_COPY
3848 if (this != &that)
3849 {
3850 SetCurrToFirst();
3851 for (; Curr(); RemoveCurrFromList())
3852 ;
3853
3854 //that.SetCurrToFirst();
3855 //for (; that.Curr(); that.GoNext())
3856 // AppendCopy (*that.Curr());
3857 for (const AsnListElmt *run=that.first; run; run=run->next)
3858 AppendCopy (*run->elmt);
3859 }
3860
3861 return *this;
3862 #else // SNACC_DEEP_COPY
3863 Asn1Error << "use of incompletely defined SigningCertificateSeqOf &SigningCertificateSeqOf::operator = (const SigningCertificateSeqOf &)" << endl;
3864 abort();
3865 // if your compiler complains here, check the -novolat option
3866 #endif // SNACC_DEEP_COPY
3867 }
3868
3869 void SigningCertificateSeqOf::Print (ostream &os) const
3870 {
3871 #ifndef NDEBUG
3872 os << "{ -- SEQUENCE/SET OF -- " << endl;
3873 indentG += stdIndentG;
3874 //SetCurrToFirst();
3875 //for (; Curr() != NULL; GoNext())
3876 for (const AsnListElmt *run=first; run; run=run->next)
3877 {
3878 Indent (os, indentG);
3879 //os << *Curr();
3880 os << *run->elmt;
3881 //if (Curr() != Last())
3882 if (run != last)
3883 os << ",";
3884 os << endl;
3885 }
3886 indentG -= stdIndentG;
3887 Indent (os, indentG);
3888 os << "}\n";
3889 #endif /* NDEBUG */
3890
3891
3892 } // Print
3893
3894
3895 void SigningCertificateSeqOf::SetCurrElmt (unsigned long int index)
3896 {
3897 unsigned long int i;
3898 curr = first;
3899 if (count)
3900 for (i = 0; (i < (count-1)) && (i < index); i++)
3901 curr = curr->next;
3902 } // SigningCertificateSeqOf::SetCurrElmt
3903
3904
3905 unsigned long int SigningCertificateSeqOf::GetCurrElmtIndex()
3906 {
3907 unsigned long int i;
3908 AsnListElmt *tmp;
3909 if (curr != NULL)
3910 {
3911 for (i = 0, tmp = first; tmp != NULL; i++)
3912 {
3913 if (tmp == curr)
3914 return i;
3915 else
3916 tmp = tmp->next;
3917 }
3918 }
3919 return count;
3920 } // SigningCertificateSeqOf::GetCurrElmtIndex
3921
3922
3923 // alloc new list elmt, put at end of list
3924 // and return the component type
3925 ESSCertID *SigningCertificateSeqOf::Append()
3926 {
3927 AsnListElmt *newElmt;
3928 newElmt = new AsnListElmt;
3929 newElmt->elmt = new ESSCertID;
3930 newElmt->next = NULL;
3931 if (last == NULL)
3932 {
3933 newElmt->prev = NULL;
3934 first = last = newElmt;
3935 }
3936 else
3937 {
3938 newElmt->prev = last;
3939 last->next = newElmt;
3940 last = newElmt;
3941 }
3942 count++;
3943 return (curr = newElmt)->elmt;
3944 } // SigningCertificateSeqOf::Append
3945
3946
3947 // alloc new list elmt, put at begining of list
3948 // and return the component type
3949 ESSCertID *SigningCertificateSeqOf::Prepend()
3950 {
3951 AsnListElmt *newElmt;
3952 newElmt = new AsnListElmt;
3953 newElmt->elmt = new ESSCertID;
3954 newElmt->prev = NULL;
3955 if (first == NULL)
3956 {
3957 newElmt->next = NULL;
3958 first = last = newElmt;
3959 }
3960 else
3961 {
3962 newElmt->next = first;
3963 first->prev = newElmt;
3964 first = newElmt;
3965 }
3966 count++;
3967 return (curr = newElmt)->elmt;
3968 } // SigningCertificateSeqOf::Prepend
3969
3970
3971 // alloc new list elmt, insert it before the
3972 // current element and return the component type
3973 // if the current element is null, the new element
3974 // is placed at the beginning of the list.
3975 ESSCertID *SigningCertificateSeqOf::InsertBefore()
3976 {
3977 AsnListElmt *newElmt;
3978 newElmt = new AsnListElmt;
3979 newElmt->elmt = new ESSCertID;
3980 if (curr == NULL)
3981 {
3982 newElmt->next = first;
3983 newElmt->prev = NULL;
3984 first = newElmt;
3985 if (last == NULL)
3986 last = newElmt;
3987 }
3988 else
3989 {
3990 newElmt->next = curr;
3991 newElmt->prev = curr->prev;
3992 curr->prev = newElmt;
3993 if (curr == first)
3994 first = newElmt;
3995 else
3996 newElmt->prev->next = newElmt;
3997 }
3998 count++;
3999 return (curr = newElmt)->elmt;
4000 } // SigningCertificateSeqOf::InsertBefore
4001
4002
4003 // alloc new list elmt, insert it after the
4004 // current element and return the component type
4005 // if the current element is null, the new element
4006 // is placed at the end of the list.
4007 ESSCertID *SigningCertificateSeqOf::InsertAfter()
4008 {
4009 AsnListElmt *newElmt;
4010 newElmt = new AsnListElmt;
4011 newElmt->elmt = new ESSCertID;
4012 if (curr == NULL)
4013 {
4014 newElmt->prev = last;
4015 newElmt->next = NULL;
4016 last = newElmt;
4017 if (first == NULL)
4018 first = newElmt;
4019 }
4020 else
4021 {
4022 newElmt->prev = curr;
4023 newElmt->next = curr->next;
4024 curr->next = newElmt;
4025 if (curr == last)
4026 last = newElmt;
4027 else
4028 newElmt->next->prev = newElmt;
4029 }
4030 count++;
4031 return (curr = newElmt)->elmt;
4032 } // SigningCertificateSeqOf::InsertAfter
4033
4034
4035 SigningCertificateSeqOf &SigningCertificateSeqOf::AppendCopy (ESSCertID &elmt)
4036 {
4037 AsnListElmt *newElmt;
4038 newElmt = new AsnListElmt;
4039 newElmt->elmt = new ESSCertID;
4040 *newElmt->elmt = elmt;
4041 newElmt->next = NULL;
4042 if (last == NULL)
4043 {
4044 newElmt->prev = NULL;
4045 first = last = newElmt;
4046 }
4047 else
4048 {
4049 newElmt->prev = last;
4050 last->next = newElmt;
4051 last = newElmt;
4052 }
4053 count++;
4054 return *this;
4055 } // AppendCopy
4056
4057
4058 SigningCertificateSeqOf &SigningCertificateSeqOf::PrependCopy (ESSCertID &elmt)
4059 {
4060 AsnListElmt *newElmt;
4061 newElmt = new AsnListElmt;
4062 newElmt->elmt = new ESSCertID;
4063 *newElmt->elmt = elmt;
4064 newElmt->prev = NULL;
4065 if (first == NULL)
4066 {
4067 newElmt->next = NULL;
4068 first = last = newElmt;
4069 }
4070 else
4071 {
4072 newElmt->next = first;
4073 first->prev = newElmt;
4074 first = newElmt;
4075 }
4076 count++;
4077 return *this;
4078 } // SigningCertificateSeqOf::PrependCopy
4079
4080
4081 // alloc new list elmt, insert it before the
4082 // current element, copy the given elmt into the new elmt
4083 // and return the component type.
4084 // if the current element is null, the new element
4085 // is placed at the beginning of the list.
4086 SigningCertificateSeqOf &SigningCertificateSeqOf::InsertBeforeAndCopy (ESSCertID &elmt)
4087 {
4088 AsnListElmt *newElmt;
4089
4090 newElmt = new AsnListElmt;
4091 newElmt->elmt = new ESSCertID;
4092 *newElmt->elmt = elmt;
4093
4094 if (curr == NULL)
4095 {
4096 newElmt->next = first;
4097 newElmt->prev = NULL;
4098 first = newElmt;
4099 if (last == NULL)
4100 last = newElmt;
4101 }
4102 else
4103 {
4104 newElmt->next = curr;
4105 newElmt->prev = curr->prev;
4106 curr->prev = newElmt;
4107 if (curr == first)
4108 first = newElmt;
4109 else
4110 newElmt->prev->next = newElmt;
4111 }
4112 count++;
4113 return *this;
4114 } // SigningCertificateSeqOf::InsertBeforeAndCopy
4115
4116
4117 // alloc new list elmt, insert it after the
4118 // current element, copy given elmt in to new elmt
4119 // and return the component type
4120 // if the current element is null, the new element
4121 // is placed at the end of the list.
4122 SigningCertificateSeqOf &SigningCertificateSeqOf::InsertAfterAndCopy (ESSCertID &elmt)
4123 {
4124 AsnListElmt *newElmt;
4125
4126 newElmt = new AsnListElmt;
4127 newElmt->elmt = new ESSCertID;
4128 *newElmt->elmt = elmt;
4129 if (curr == NULL)
4130 {
4131 newElmt->prev = last;
4132 newElmt->next = NULL;
4133 last = newElmt;
4134 if (first == NULL)
4135 first = newElmt;
4136 }
4137 else
4138 {
4139 newElmt->prev = curr;
4140 newElmt->next = curr->next;
4141 curr->next = newElmt;
4142 if (curr == last)
4143 last = newElmt;
4144 else
4145 newElmt->next->prev = newElmt;
4146 }
4147 count++;
4148 return *this;
4149 } // SigningCertificateSeqOf::InsertAfterAndCopy
4150
4151
4152 // remove current element from list if current element is not NULL
4153 // The new current element will be the next element.
4154 // If the current element is the last element in the list
4155 // the second but last element will become the new current element.
4156 void SigningCertificateSeqOf::RemoveCurrFromList()
4157 {
4158 AsnListElmt *del_elmt;
4159
4160 if (curr != NULL)
4161 {
4162 del_elmt = curr;
4163 count--;
4164
4165 if (count == 0)
4166 first = last = curr = NULL;
4167 else if (curr == first)
4168 {
4169 curr = first= first->next;
4170 first->prev = NULL;
4171 }
4172 else if (curr == last)
4173 {
4174 curr = last = last->prev;
4175 last->next = NULL;
4176 }
4177 else
4178 {
4179 curr->prev->next = curr->next;
4180 curr->next->prev = curr->prev;
4181 }
4182
4183 delete del_elmt->elmt;
4184 delete del_elmt;
4185 }
4186 }
4187
4188
4189 AsnLen SigningCertificateSeqOf::BEncContent (BUF_TYPE b)
4190 {
4191 AsnListElmt *currElmt;
4192 AsnLen elmtLen;
4193 AsnLen totalLen = 0;
4194 for (currElmt = last; currElmt != NULL; currElmt = currElmt->prev)
4195 {
4196 BEncEocIfNec (b);
4197 elmtLen = currElmt->elmt->BEncContent (b);
4198 elmtLen += BEncConsLen (b, elmtLen);
4199
4200 elmtLen += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
4201 totalLen += elmtLen;
4202 }
4203 return totalLen;
4204 } // SigningCertificateSeqOf::BEncContent
4205
4206
4207 void SigningCertificateSeqOf::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0,
4208 AsnLen &bytesDecoded, ENV_TYPE env)
4209 {
4210 ESSCertID *listElmt;
4211 AsnTag tag1;
4212 AsnLen listBytesDecoded = 0;
4213 AsnLen elmtLen1;
4214
4215 while ((listBytesDecoded < elmtLen0) || (elmtLen0 == INDEFINITE_LEN))
4216 {
4217 tag1 = BDecTag (b, listBytesDecoded, env);
4218 if ((tag1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
4219 {
4220 BDEC_2ND_EOC_OCTET (b, listBytesDecoded, env);
4221 break;
4222 }
4223 if ((tag1 != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
4224 {
4225 Asn1Error << "Unexpected Tag" << endl;
4226 SnaccExcep::throwMe(-124);
4227 }
4228
4229 elmtLen1 = BDecLen (b, listBytesDecoded, env);
4230 listElmt = Append();
4231 listElmt->BDecContent (b, tag1, elmtLen1, listBytesDecoded, env);
4232 }
4233
4234 bytesDecoded += listBytesDecoded;
4235 } // SigningCertificateSeqOf::BDecContent
4236
4237
4238 ESSSecurityLabel::ESSSecurityLabel()
4239 {
4240 security_classification = NULL;
4241 privacy_mark = NULL;
4242 security_categories = NULL;
4243 }
4244
4245 ESSSecurityLabel::ESSSecurityLabel (const ESSSecurityLabel &)
4246 {
4247 Asn1Error << "use of incompletely defined ESSSecurityLabel::ESSSecurityLabel (const ESSSecurityLabel &)" << endl;
4248 abort();
4249 }
4250
4251 ESSSecurityLabel::~ESSSecurityLabel()
4252 {
4253 delete security_classification;
4254 delete privacy_mark;
4255 delete security_categories;
4256 }
4257
4258 AsnType *ESSSecurityLabel::Clone() const
4259 {
4260 return new ESSSecurityLabel;
4261 }
4262
4263 AsnType *ESSSecurityLabel::Copy() const
4264 {
4265 return new ESSSecurityLabel (*this);
4266 }
4267
4268 #if SNACC_DEEP_COPY
4269 ESSSecurityLabel &ESSSecurityLabel::operator = (const ESSSecurityLabel &that)
4270 #else // SNACC_DEEP_COPY
4271 ESSSecurityLabel &ESSSecurityLabel::operator = (const ESSSecurityLabel &)
4272 #endif // SNACC_DEEP_COPY
4273 {
4274 #if SNACC_DEEP_COPY
4275 if (this != &that)
4276 {
4277 security_policy_identifier = that.security_policy_identifier;
4278 if (that.security_classification)
4279 {
4280 if (!security_classification)
4281 security_classification = new SecurityClassification;
4282 *security_classification = *that.security_classification;
4283 }
4284 else
4285 {
4286 delete security_classification;
4287 security_classification = NULL;
4288 }
4289 if (that.privacy_mark)
4290 {
4291 if (!privacy_mark)
4292 privacy_mark = new ESSPrivacyMark;
4293 *privacy_mark = *that.privacy_mark;
4294 }
4295 else
4296 {
4297 delete privacy_mark;
4298 privacy_mark = NULL;
4299 }
4300 if (that.security_categories)
4301 {
4302 if (!security_categories)
4303 security_categories = new SecurityCategories;
4304 *security_categories = *that.security_categories;
4305 }
4306 else
4307 {
4308 delete security_categories;
4309 security_categories = NULL;
4310 }
4311 }
4312
4313 return *this;
4314 #else // SNACC_DEEP_COPY
4315 Asn1Error << "use of incompletely defined ESSSecurityLabel &ESSSecurityLabel::operator = (const ESSSecurityLabel &)" << endl;
4316 abort();
4317 // if your compiler complains here, check the -novolat option
4318 #endif // SNACC_DEEP_COPY
4319 }
4320
4321 AsnLen ESSSecurityLabel::BEncContent (BUF_TYPE b)
4322 {
4323 AsnLen totalLen = 0;
4324 AsnLen l;
4325
4326 AsnBuf outputBuf;
4327 int iii=0, tmpCount=0;
4328 char *lpszBuf = (char *)calloc(1, 1024);
4329 outputBuf.Init(lpszBuf, 1024);
4330 outputBuf.ResetInWriteRvsMode();
4331 CSM_Buffer *tmpEnc[4];
4332 if (NOT_NULL (security_categories))
4333 {
4334 BEncEocIfNec (b);
4335 l = security_categories->BEncContent (outputBuf);
4336 l += BEncConsLen (outputBuf, l);
4337
4338 l += BEncTag1 (outputBuf, UNIV, CONS, SET_TAG_CODE);
4339 totalLen += l;
4340 SNACC_BUFRESET_READ(&outputBuf);
4341 SM_ReadFromAsnBuf(tmpEnc[iii], outputBuf,outputBuf.DataLen(),NULL);
4342 SNACC_BUFRESET_WRITE(&outputBuf);
4343 iii++;
4344 }
4345
4346 if (NOT_NULL (privacy_mark))
4347 {
4348 l = privacy_mark->BEncContent (outputBuf);
4349 totalLen += l;
4350 SNACC_BUFRESET_READ(&outputBuf);
4351 SM_ReadFromAsnBuf(tmpEnc[iii], outputBuf,outputBuf.DataLen(),NULL);
4352 SNACC_BUFRESET_WRITE(&outputBuf);
4353 iii++;
4354 }
4355
4356 if (NOT_NULL (security_classification))
4357 {
4358 l = security_classification->BEncContent (outputBuf);
4359 BEncDefLenTo127 (outputBuf, l);
4360 l++;
4361
4362 l += BEncTag1 (outputBuf, UNIV, PRIM, INTEGER_TAG_CODE);
4363 totalLen += l;
4364 SNACC_BUFRESET_READ(&outputBuf);
4365 SM_ReadFromAsnBuf(tmpEnc[iii], outputBuf,outputBuf.DataLen(),NULL);
4366 SNACC_BUFRESET_WRITE(&outputBuf);
4367 iii++;
4368 }
4369
4370 l = security_policy_identifier.BEncContent (outputBuf);
4371 l += BEncDefLen (outputBuf, l);
4372
4373 l += BEncTag1 (outputBuf, UNIV, PRIM, OID_TAG_CODE);
4374 totalLen += l;
4375 SNACC_BUFRESET_READ(&outputBuf);
4376 SM_ReadFromAsnBuf(tmpEnc[iii], outputBuf,outputBuf.DataLen(),NULL);
4377 SNACC_BUFRESET_WRITE(&outputBuf);
4378 iii++;
4379
4380 vdasnacc_sortSet(tmpEnc, iii);
4381 tmpCount = iii; /** REMEMBER how many we have**/
4382 for (iii=0; iii < tmpCount; iii++)
4383 SM_WriteToAsnBuf(tmpEnc[iii], b);
4384 for (iii=0; iii < tmpCount; iii++) delete tmpEnc[iii];
4385 free(lpszBuf);
4386 return totalLen;
4387 } // ESSSecurityLabel::BEncContent
4388
4389
4390 void ESSSecurityLabel::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
4391 {
4392 AsnTag tag1;
4393 AsnLen setBytesDecoded = 0;
4394 unsigned int mandatoryElmtsDecoded = 0;
4395 AsnLen elmtLen1;
4396
4397 for (; (setBytesDecoded < elmtLen0) || (elmtLen0 == INDEFINITE_LEN); )
4398 {
4399 tag1 = BDecTag (b, setBytesDecoded, env);
4400
4401 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
4402 {
4403 BDEC_2ND_EOC_OCTET (b, setBytesDecoded, env)
4404 break; /* exit for loop */
4405 }
4406 elmtLen1 = BDecLen (b, setBytesDecoded, env);
4407 switch (tag1)
4408 {
4409 case MAKE_TAG_ID (UNIV, PRIM, OID_TAG_CODE):
4410 security_policy_identifier.BDecContent (b, tag1, elmtLen1, setBytesDecoded, env);
4411 mandatoryElmtsDecoded++;
4412 break;
4413
4414 case MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE):
4415 security_classification = new SecurityClassification;
4416 security_classification->BDecContent (b, tag1, elmtLen1, setBytesDecoded, env);
4417 break;
4418
4419 case MAKE_TAG_ID (UNIV, PRIM, PRINTABLESTRING_TAG_CODE):
4420 case MAKE_TAG_ID (UNIV, CONS, PRINTABLESTRING_TAG_CODE):
4421 case MAKE_TAG_ID (UNIV, PRIM, 12):
4422 case MAKE_TAG_ID (UNIV, CONS, 12):
4423 privacy_mark = new ESSPrivacyMark;
4424 privacy_mark->BDecContent (b, tag1, elmtLen1, setBytesDecoded, env);
4425 break;
4426
4427 case MAKE_TAG_ID (UNIV, CONS, SET_TAG_CODE):
4428 security_categories = new SecurityCategories;
4429 security_categories->BDecContent (b, tag1, elmtLen1, setBytesDecoded, env);
4430 break;
4431
4432 default:
4433 Asn1Error << "Unexpected Tag on SET elmt." << endl;
4434 SnaccExcep::throwMe(-125);
4435 } // end switch
4436 } // end for loop
4437 bytesDecoded += setBytesDecoded;
4438 if (mandatoryElmtsDecoded != 1)
4439 {
4440 Asn1Error << "ERROR - non-optional SET element missing." << endl;
4441 SnaccExcep::throwMe(-126);
4442 }
4443 } // ESSSecurityLabel::BDecContent
4444
4445 AsnLen
4446 ESSSecurityLabel::BEnc (BUF_TYPE b)
4447 {
4448 AsnLen l;
4449 l = BEncContent (b);
4450 l += BEncConsLen (b, l);
4451 l += BEncTag1 (b, UNIV, CONS, SET_TAG_CODE);
4452 return l;
4453 }
4454
4455 void ESSSecurityLabel::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
4456 {
4457 AsnTag tag;
4458 AsnLen elmtLen1;
4459
4460 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SET_TAG_CODE))
4461 {
4462 Asn1Error << "ESSSecurityLabel::BDec: ERROR - wrong tag" << endl;
4463 SnaccExcep::throwMe(-127);
4464 }
4465 elmtLen1 = BDecLen (b, bytesDecoded, env);
4466 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
4467 }
4468
4469 void ESSSecurityLabel::Print (ostream &os) const
4470 {
4471 #ifndef NDEBUG
4472 os << "{ -- SET --" << endl;
4473 indentG += stdIndentG;
4474
4475 {
4476 Indent (os, indentG);
4477 os << "security-policy-identifier ";
4478 os << security_policy_identifier;
4479 }
4480
4481 if (NOT_NULL (security_classification))
4482 {
4483 os << ","<< endl;
4484 Indent (os, indentG);
4485 os << "security-classification ";
4486 os << *security_classification;
4487 }
4488 else
4489 os << "-- void2 --\n";
4490
4491 if (NOT_NULL (privacy_mark))
4492 {
4493 os << ","<< endl;
4494 Indent (os, indentG);
4495 os << "privacy-mark ";
4496 os << *privacy_mark;
4497 }
4498 else
4499 os << "-- void2 --\n";
4500
4501 if (NOT_NULL (security_categories))
4502 {
4503 os << ","<< endl;
4504 Indent (os, indentG);
4505 os << "security-categories ";
4506 os << *security_categories;
4507 }
4508 else
4509 os << "-- void2 --\n";
4510
4511 os << endl;
4512 indentG -= stdIndentG;
4513 Indent (os, indentG);
4514 os << "}";
4515 #endif /* NDEBUG */
4516 } // ESSSecurityLabel - operator <<
4517
4518
4519 MLData::MLData()
4520 {
4521 #if TCL
4522 mailListIdentifier = new EntityIdentifier;
4523 #else
4524 mailListIdentifier = NULL; // incomplete initialization of mandatory element!
4525 #endif // TCL
4526 mlReceiptPolicy = NULL;
4527 }
4528
4529 MLData::MLData (const MLData &)
4530 {
4531 Asn1Error << "use of incompletely defined MLData::MLData (const MLData &)" << endl;
4532 abort();
4533 }
4534
4535 MLData::~MLData()
4536 {
4537 delete mailListIdentifier;
4538 delete mlReceiptPolicy;
4539 }
4540
4541 AsnType *MLData::Clone() const
4542 {
4543 return new MLData;
4544 }
4545
4546 AsnType *MLData::Copy() const
4547 {
4548 return new MLData (*this);
4549 }
4550
4551 #if SNACC_DEEP_COPY
4552 MLData &MLData::operator = (const MLData &that)
4553 #else // SNACC_DEEP_COPY
4554 MLData &MLData::operator = (const MLData &)
4555 #endif // SNACC_DEEP_COPY
4556 {
4557 #if SNACC_DEEP_COPY
4558 if (this != &that)
4559 {
4560 if (that.mailListIdentifier)
4561 {
4562 if (!mailListIdentifier)
4563 mailListIdentifier = new EntityIdentifier;
4564 *mailListIdentifier = *that.mailListIdentifier;
4565 }
4566 else
4567 {
4568 delete mailListIdentifier;
4569 mailListIdentifier = NULL;
4570 }
4571 expansionTime = that.expansionTime;
4572 if (that.mlReceiptPolicy)
4573 {
4574 if (!mlReceiptPolicy)
4575 mlReceiptPolicy = new MLReceiptPolicy;
4576 *mlReceiptPolicy = *that.mlReceiptPolicy;
4577 }
4578 else
4579 {
4580 delete mlReceiptPolicy;
4581 mlReceiptPolicy = NULL;
4582 }
4583 }
4584
4585 return *this;
4586 #else // SNACC_DEEP_COPY
4587 Asn1Error << "use of incompletely defined MLData &MLData::operator = (const MLData &)" << endl;
4588 abort();
4589 // if your compiler complains here, check the -novolat option
4590 #endif // SNACC_DEEP_COPY
4591 }
4592
4593 AsnLen
4594 MLData::BEncContent (BUF_TYPE b)
4595 {
4596 AsnLen totalLen = 0;
4597 AsnLen l;
4598
4599 if (NOT_NULL (mlReceiptPolicy))
4600 {
4601 l = mlReceiptPolicy->BEncContent (b);
4602 totalLen += l;
4603 }
4604
4605 l = expansionTime.BEncContent (b);
4606 l += BEncDefLen (b, l);
4607
4608 l += BEncTag1 (b, UNIV, PRIM, GENERALIZEDTIME_TAG_CODE);
4609 totalLen += l;
4610
4611 l = mailListIdentifier->BEncContent (b);
4612 totalLen += l;
4613
4614 return totalLen;
4615 } // MLData::BEncContent
4616
4617
4618 void MLData::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
4619 {
4620 AsnTag tag1;
4621 AsnLen seqBytesDecoded = 0;
4622 AsnLen elmtLen1;
4623 tag1 = BDecTag (b, seqBytesDecoded, env);
4624
4625 if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
4626 || (tag1 == MAKE_TAG_ID (UNIV, PRIM, OCTETSTRING_TAG_CODE))
4627 || (tag1 == MAKE_TAG_ID (UNIV, CONS, OCTETSTRING_TAG_CODE)))
4628 {
4629 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
4630 mailListIdentifier = new EntityIdentifier;
4631 mailListIdentifier->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
4632 tag1 = BDecTag (b, seqBytesDecoded, env);
4633 }
4634 else
4635 {
4636 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
4637 SnaccExcep::throwMe(-128);
4638 }
4639
4640 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, GENERALIZEDTIME_TAG_CODE))
4641 || (tag1 == MAKE_TAG_ID (UNIV, CONS, GENERALIZEDTIME_TAG_CODE)))
4642 {
4643 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
4644 expansionTime.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
4645 if (seqBytesDecoded == elmtLen0)
4646 {
4647 bytesDecoded += seqBytesDecoded;
4648 return;
4649 }
4650 else
4651 {
4652 tag1 = BDecTag (b, seqBytesDecoded, env);
4653
4654 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
4655 {
4656 BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env)
4657 bytesDecoded += seqBytesDecoded;
4658 return;
4659 }
4660 }
4661 }
4662 else
4663 {
4664 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
4665 SnaccExcep::throwMe(-129);
4666 }
4667
4668 if ((tag1 == MAKE_TAG_ID (CNTX, PRIM, 0))
4669 || (tag1 == MAKE_TAG_ID (CNTX, CONS, 1))
4670 || (tag1 == MAKE_TAG_ID (CNTX, CONS, 2)))
4671 {
4672 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
4673 mlReceiptPolicy = new MLReceiptPolicy;
4674 mlReceiptPolicy->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
4675 }
4676
4677 bytesDecoded += seqBytesDecoded;
4678 if (elmtLen0 == INDEFINITE_LEN)
4679 {
4680 BDecEoc (b, bytesDecoded, env);
4681 return;
4682 }
4683 else if (seqBytesDecoded != elmtLen0)
4684 {
4685 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
4686 SnaccExcep::throwMe(-130);
4687 }
4688 else
4689 return;
4690 } // MLData::BDecContent
4691
4692 AsnLen MLData::BEnc (BUF_TYPE b)
4693 {
4694 AsnLen l;
4695 l = BEncContent (b);
4696 l += BEncConsLen (b, l);
4697 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
4698 return l;
4699 }
4700
4701 void MLData::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
4702 {
4703 AsnTag tag;
4704 AsnLen elmtLen1;
4705
4706 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
4707 {
4708 Asn1Error << "MLData::BDec: ERROR - wrong tag" << endl;
4709 SnaccExcep::throwMe(-131);
4710 }
4711 elmtLen1 = BDecLen (b, bytesDecoded, env);
4712 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
4713 }
4714
4715 void MLData::Print (ostream &os) const
4716 {
4717 #ifndef NDEBUG
4718 os << "{ -- SEQUENCE --" << endl;
4719 indentG += stdIndentG;
4720
4721 if (NOT_NULL (mailListIdentifier))
4722 {
4723 Indent (os, indentG);
4724 os << "mailListIdentifier ";
4725 os << *mailListIdentifier;
4726 }
4727 else
4728 {
4729 Indent (os, indentG);
4730 os << "mailListIdentifier ";
4731 os << "-- void --";
4732 os << "," << endl;
4733 }
4734
4735 {
4736 Indent (os, indentG);
4737 os << "expansionTime ";
4738 os << expansionTime;
4739 os << "," << endl;
4740 }
4741
4742 if (NOT_NULL (mlReceiptPolicy))
4743 {
4744 os << ","<< endl;
4745 Indent (os, indentG);
4746 os << "mlReceiptPolicy ";
4747 os << *mlReceiptPolicy;
4748 }
4749 else
4750 {
4751 Indent (os, indentG);
4752 os << "mlReceiptPolicy ";
4753 os << "-- void --";
4754 os << endl;
4755 }
4756
4757 os << endl;
4758 indentG -= stdIndentG;
4759 Indent (os, indentG);
4760 os << "}";
4761 #endif /* NDEBUG */
4762 } // MLData::Print
4763
4764
4765 ReceiptRequest::ReceiptRequest()
4766 {
4767 #if TCL
4768 receiptsFrom = new ReceiptsFrom;
4769 #else
4770 receiptsFrom = NULL; // incomplete initialization of mandatory element!
4771 #endif // TCL
4772 }
4773
4774 ReceiptRequest::ReceiptRequest (const ReceiptRequest &)
4775 {
4776 Asn1Error << "use of incompletely defined ReceiptRequest::ReceiptRequest (const ReceiptRequest &)" << endl;
4777 abort();
4778 }
4779
4780 ReceiptRequest::~ReceiptRequest()
4781 {
4782 delete receiptsFrom;
4783 }
4784
4785 AsnType *ReceiptRequest::Clone() const
4786 {
4787 return new ReceiptRequest;
4788 }
4789
4790 AsnType *ReceiptRequest::Copy() const
4791 {
4792 return new ReceiptRequest (*this);
4793 }
4794
4795 #if SNACC_DEEP_COPY
4796 ReceiptRequest &ReceiptRequest::operator = (const ReceiptRequest &that)
4797 #else // SNACC_DEEP_COPY
4798 ReceiptRequest &ReceiptRequest::operator = (const ReceiptRequest &)
4799 #endif // SNACC_DEEP_COPY
4800 {
4801 #if SNACC_DEEP_COPY
4802 if (this != &that)
4803 {
4804 signedContentIdentifier = that.signedContentIdentifier;
4805 if (that.receiptsFrom)
4806 {
4807 if (!receiptsFrom)
4808 receiptsFrom = new ReceiptsFrom;
4809 *receiptsFrom = *that.receiptsFrom;
4810 }
4811 else
4812 {
4813 delete receiptsFrom;
4814 receiptsFrom = NULL;
4815 }
4816 receiptsTo = that.receiptsTo;
4817 }
4818
4819 return *this;
4820 #else // SNACC_DEEP_COPY
4821 Asn1Error << "use of incompletely defined ReceiptRequest &ReceiptRequest::operator = (const ReceiptRequest &)" << endl;
4822 abort();
4823 // if your compiler complains here, check the -novolat option
4824 #endif // SNACC_DEEP_COPY
4825 }
4826
4827 AsnLen
4828 ReceiptRequest::BEncContent (BUF_TYPE b)
4829 {
4830 AsnLen totalLen = 0;
4831 AsnLen l;
4832
4833 BEncEocIfNec (b);
4834 l = receiptsTo.BEncContent (b);
4835 l += BEncConsLen (b, l);
4836
4837 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
4838 totalLen += l;
4839
4840 l = receiptsFrom->BEncContent (b);
4841 totalLen += l;
4842
4843 l = signedContentIdentifier.BEncContent (b);
4844 l += BEncDefLen (b, l);
4845
4846 l += BEncTag1 (b, UNIV, PRIM, OCTETSTRING_TAG_CODE);
4847 totalLen += l;
4848
4849 return totalLen;
4850 } // ReceiptRequest::BEncContent
4851
4852
4853 void ReceiptRequest::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
4854 {
4855 AsnTag tag1;
4856 AsnLen seqBytesDecoded = 0;
4857 AsnLen elmtLen1;
4858 tag1 = BDecTag (b, seqBytesDecoded, env);
4859
4860 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, OCTETSTRING_TAG_CODE))
4861 || (tag1 == MAKE_TAG_ID (UNIV, CONS, OCTETSTRING_TAG_CODE)))
4862 {
4863 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
4864 signedContentIdentifier.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
4865 tag1 = BDecTag (b, seqBytesDecoded, env);
4866 }
4867 else
4868 {
4869 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
4870 SnaccExcep::throwMe(-132);
4871 }
4872
4873 if ((tag1 == MAKE_TAG_ID (CNTX, PRIM, 0))
4874 || (tag1 == MAKE_TAG_ID (CNTX, CONS, 1)))
4875 {
4876 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
4877 receiptsFrom = new ReceiptsFrom;
4878 receiptsFrom->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
4879 tag1 = BDecTag (b, seqBytesDecoded, env);
4880 }
4881 else
4882 {
4883 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
4884 SnaccExcep::throwMe(-133);
4885 }
4886
4887 if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
4888 {
4889 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
4890 receiptsTo.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
4891 }
4892 else
4893 {
4894 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
4895 SnaccExcep::throwMe(-134);
4896 }
4897
4898 bytesDecoded += seqBytesDecoded;
4899 if (elmtLen0 == INDEFINITE_LEN)
4900 {
4901 BDecEoc (b, bytesDecoded, env);
4902 return;
4903 }
4904 else if (seqBytesDecoded != elmtLen0)
4905 {
4906 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
4907 SnaccExcep::throwMe(-135);
4908 }
4909 else
4910 return;
4911 } // ReceiptRequest::BDecContent
4912
4913 AsnLen ReceiptRequest::BEnc (BUF_TYPE b)
4914 {
4915 AsnLen l;
4916 l = BEncContent (b);
4917 l += BEncConsLen (b, l);
4918 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
4919 return l;
4920 }
4921
4922 void ReceiptRequest::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
4923 {
4924 AsnTag tag;
4925 AsnLen elmtLen1;
4926
4927 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
4928 {
4929 Asn1Error << "ReceiptRequest::BDec: ERROR - wrong tag" << endl;
4930 SnaccExcep::throwMe(-136);
4931 }
4932 elmtLen1 = BDecLen (b, bytesDecoded, env);
4933 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
4934 }
4935
4936 void ReceiptRequest::Print (ostream &os) const
4937 {
4938 #ifndef NDEBUG
4939 os << "{ -- SEQUENCE --" << endl;
4940 indentG += stdIndentG;
4941
4942 {
4943 Indent (os, indentG);
4944 os << "signedContentIdentifier ";
4945 os << signedContentIdentifier;
4946 os << "," << endl;
4947 }
4948
4949 if (NOT_NULL (receiptsFrom))
4950 {
4951 Indent (os, indentG);
4952 os << "receiptsFrom ";
4953 os << *receiptsFrom;
4954 }
4955 else
4956 {
4957 Indent (os, indentG);
4958 os << "receiptsFrom ";
4959 os << "-- void --";
4960 os << "," << endl;
4961 }
4962
4963 {
4964 Indent (os, indentG);
4965 os << "receiptsTo ";
4966 os << receiptsTo;
4967 }
4968
4969 os << endl;
4970 indentG -= stdIndentG;
4971 Indent (os, indentG);
4972 os << "}";
4973 #endif /* NDEBUG */
4974 } // ReceiptRequest::Print
4975
4976
4977 Receipt::Receipt()
4978 {
4979 }
4980
4981 Receipt::Receipt (const Receipt &)
4982 {
4983 Asn1Error << "use of incompletely defined Receipt::Receipt (const Receipt &)" << endl;
4984 abort();
4985 }
4986
4987 Receipt::~Receipt()
4988 {
4989 }
4990
4991 AsnType *Receipt::Clone() const
4992 {
4993 return new Receipt;
4994 }
4995
4996 AsnType *Receipt::Copy() const
4997 {
4998 return new Receipt (*this);
4999 }
5000
5001 #if SNACC_DEEP_COPY
5002 Receipt &Receipt::operator = (const Receipt &that)
5003 #else // SNACC_DEEP_COPY
5004 Receipt &Receipt::operator = (const Receipt &)
5005 #endif // SNACC_DEEP_COPY
5006 {
5007 #if SNACC_DEEP_COPY
5008 if (this != &that)
5009 {
5010 version = that.version;
5011 contentType = that.contentType;
5012 signedContentIdentifier = that.signedContentIdentifier;
5013 originatorSignatureValue = that.originatorSignatureValue;
5014 }
5015
5016 return *this;
5017 #else // SNACC_DEEP_COPY
5018 Asn1Error << "use of incompletely defined Receipt &Receipt::operator = (const Receipt &)" << endl;
5019 abort();
5020 // if your compiler complains here, check the -novolat option
5021 #endif // SNACC_DEEP_COPY
5022 }
5023
5024 AsnLen
5025 Receipt::BEncContent (BUF_TYPE b)
5026 {
5027 AsnLen totalLen = 0;
5028 AsnLen l;
5029
5030 l = originatorSignatureValue.BEncContent (b);
5031 l += BEncDefLen (b, l);
5032
5033 l += BEncTag1 (b, UNIV, PRIM, OCTETSTRING_TAG_CODE);
5034 totalLen += l;
5035
5036 l = signedContentIdentifier.BEncContent (b);
5037 l += BEncDefLen (b, l);
5038
5039 l += BEncTag1 (b, UNIV, PRIM, OCTETSTRING_TAG_CODE);
5040 totalLen += l;
5041
5042 l = contentType.BEncContent (b);
5043 l += BEncDefLen (b, l);
5044
5045 l += BEncTag1 (b, UNIV, PRIM, OID_TAG_CODE);
5046 totalLen += l;
5047
5048 l = version.BEncContent (b);
5049 BEncDefLenTo127 (b, l);
5050 l++;
5051
5052 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
5053 totalLen += l;
5054
5055 return totalLen;
5056 } // Receipt::BEncContent
5057
5058
5059 void Receipt::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
5060 {
5061 AsnTag tag1;
5062 AsnLen seqBytesDecoded = 0;
5063 AsnLen elmtLen1;
5064 tag1 = BDecTag (b, seqBytesDecoded, env);
5065
5066 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))
5067 {
5068 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
5069 version.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
5070 tag1 = BDecTag (b, seqBytesDecoded, env);
5071 }
5072 else
5073 {
5074 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
5075 SnaccExcep::throwMe(-137);
5076 }
5077
5078 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, OID_TAG_CODE)))
5079 {
5080 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
5081 contentType.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
5082 tag1 = BDecTag (b, seqBytesDecoded, env);
5083 }
5084 else
5085 {
5086 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
5087 SnaccExcep::throwMe(-138);
5088 }
5089
5090 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, OCTETSTRING_TAG_CODE))
5091 || (tag1 == MAKE_TAG_ID (UNIV, CONS, OCTETSTRING_TAG_CODE)))
5092 {
5093 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
5094 signedContentIdentifier.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
5095 tag1 = BDecTag (b, seqBytesDecoded, env);
5096 }
5097 else
5098 {
5099 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
5100 SnaccExcep::throwMe(-139);
5101 }
5102
5103 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, OCTETSTRING_TAG_CODE))
5104 || (tag1 == MAKE_TAG_ID (UNIV, CONS, OCTETSTRING_TAG_CODE)))
5105 {
5106 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
5107 originatorSignatureValue.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
5108 }
5109 else
5110 {
5111 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
5112 SnaccExcep::throwMe(-140);
5113 }
5114
5115 bytesDecoded += seqBytesDecoded;
5116 if (elmtLen0 == INDEFINITE_LEN)
5117 {
5118 BDecEoc (b, bytesDecoded, env);
5119 return;
5120 }
5121 else if (seqBytesDecoded != elmtLen0)
5122 {
5123 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
5124 SnaccExcep::throwMe(-141);
5125 }
5126 else
5127 return;
5128 } // Receipt::BDecContent
5129
5130 AsnLen Receipt::BEnc (BUF_TYPE b)
5131 {
5132 AsnLen l;
5133 l = BEncContent (b);
5134 l += BEncConsLen (b, l);
5135 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
5136 return l;
5137 }
5138
5139 void Receipt::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
5140 {
5141 AsnTag tag;
5142 AsnLen elmtLen1;
5143
5144 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
5145 {
5146 Asn1Error << "Receipt::BDec: ERROR - wrong tag" << endl;
5147 SnaccExcep::throwMe(-142);
5148 }
5149 elmtLen1 = BDecLen (b, bytesDecoded, env);
5150 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
5151 }
5152
5153 void Receipt::Print (ostream &os) const
5154 {
5155 #ifndef NDEBUG
5156 os << "{ -- SEQUENCE --" << endl;
5157 indentG += stdIndentG;
5158
5159 {
5160 Indent (os, indentG);
5161 os << "version ";
5162 os << version;
5163 os << "," << endl;
5164 }
5165
5166 {
5167 Indent (os, indentG);
5168 os << "contentType ";
5169 os << contentType;
5170 os << "," << endl;
5171 }
5172
5173 {
5174 Indent (os, indentG);
5175 os << "signedContentIdentifier ";
5176 os << signedContentIdentifier;
5177 os << "," << endl;
5178 }
5179
5180 {
5181 Indent (os, indentG);
5182 os << "originatorSignatureValue ";
5183 os << originatorSignatureValue;
5184 }
5185
5186 os << endl;
5187 indentG -= stdIndentG;
5188 Indent (os, indentG);
5189 os << "}";
5190 #endif /* NDEBUG */
5191 } // Receipt::Print
5192
5193
5194 ContentHints::ContentHints()
5195 {
5196 contentDescription = NULL;
5197 }
5198
5199 ContentHints::ContentHints (const ContentHints &)
5200 {
5201 Asn1Error << "use of incompletely defined ContentHints::ContentHints (const ContentHints &)" << endl;
5202 abort();
5203 }
5204
5205 ContentHints::~ContentHints()
5206 {
5207 delete contentDescription;
5208 }
5209
5210 AsnType *ContentHints::Clone() const
5211 {
5212 return new ContentHints;
5213 }
5214
5215 AsnType *ContentHints::Copy() const
5216 {
5217 return new ContentHints (*this);
5218 }
5219
5220 #if SNACC_DEEP_COPY
5221 ContentHints &ContentHints::operator = (const ContentHints &that)
5222 #else // SNACC_DEEP_COPY
5223 ContentHints &ContentHints::operator = (const ContentHints &)
5224 #endif // SNACC_DEEP_COPY
5225 {
5226 #if SNACC_DEEP_COPY
5227 if (this != &that)
5228 {
5229 if (that.contentDescription)
5230 {
5231 if (!contentDescription)
5232 contentDescription = new UTF8String;
5233 *contentDescription = *that.contentDescription;
5234 }
5235 else
5236 {
5237 delete contentDescription;
5238 contentDescription = NULL;
5239 }
5240 contentType = that.contentType;
5241 }
5242
5243 return *this;
5244 #else // SNACC_DEEP_COPY
5245 Asn1Error << "use of incompletely defined ContentHints &ContentHints::operator = (const ContentHints &)" << endl;
5246 abort();
5247 // if your compiler complains here, check the -novolat option
5248 #endif // SNACC_DEEP_COPY
5249 }
5250
5251 AsnLen
5252 ContentHints::BEncContent (BUF_TYPE b)
5253 {
5254 AsnLen totalLen = 0;
5255 AsnLen l;
5256
5257 l = contentType.BEncContent (b);
5258 l += BEncDefLen (b, l);
5259
5260 l += BEncTag1 (b, UNIV, PRIM, OID_TAG_CODE);
5261 totalLen += l;
5262
5263 if (NOT_NULL (contentDescription))
5264 {
5265 l = contentDescription->BEncContent (b);
5266 l += BEncDefLen (b, l);
5267
5268 l += BEncTag1 (b, UNIV, PRIM, 12);
5269 totalLen += l;
5270 }
5271
5272 return totalLen;
5273 } // ContentHints::BEncContent
5274
5275
5276 void ContentHints::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
5277 {
5278 AsnTag tag1;
5279 AsnLen seqBytesDecoded = 0;
5280 AsnLen elmtLen1;
5281 tag1 = BDecTag (b, seqBytesDecoded, env);
5282
5283 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, 12))
5284 || (tag1 == MAKE_TAG_ID (UNIV, CONS, 12)))
5285 {
5286 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
5287 contentDescription = new UTF8String;
5288 contentDescription->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
5289 tag1 = BDecTag (b, seqBytesDecoded, env);
5290 }
5291
5292 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, OID_TAG_CODE)))
5293 {
5294 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
5295 contentType.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
5296 }
5297 else
5298 {
5299 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
5300 SnaccExcep::throwMe(-143);
5301 }
5302
5303 bytesDecoded += seqBytesDecoded;
5304 if (elmtLen0 == INDEFINITE_LEN)
5305 {
5306 BDecEoc (b, bytesDecoded, env);
5307 return;
5308 }
5309 else if (seqBytesDecoded != elmtLen0)
5310 {
5311 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
5312 SnaccExcep::throwMe(-144);
5313 }
5314 else
5315 return;
5316 } // ContentHints::BDecContent
5317
5318 AsnLen ContentHints::BEnc (BUF_TYPE b)
5319 {
5320 AsnLen l;
5321 l = BEncContent (b);
5322 l += BEncConsLen (b, l);
5323 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
5324 return l;
5325 }
5326
5327 void ContentHints::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
5328 {
5329 AsnTag tag;
5330 AsnLen elmtLen1;
5331
5332 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
5333 {
5334 Asn1Error << "ContentHints::BDec: ERROR - wrong tag" << endl;
5335 SnaccExcep::throwMe(-145);
5336 }
5337 elmtLen1 = BDecLen (b, bytesDecoded, env);
5338 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
5339 }
5340
5341 void ContentHints::Print (ostream &os) const
5342 {
5343 #ifndef NDEBUG
5344 os << "{ -- SEQUENCE --" << endl;
5345 indentG += stdIndentG;
5346
5347 if (NOT_NULL (contentDescription))
5348 {
5349 Indent (os, indentG);
5350 os << "contentDescription ";
5351 os << *contentDescription;
5352 }
5353 else
5354 {
5355 Indent (os, indentG);
5356 os << "contentDescription ";
5357 os << "-- void --";
5358 os << "," << endl;
5359 }
5360
5361 {
5362 Indent (os, indentG);
5363 os << "contentType ";
5364 os << contentType;
5365 }
5366
5367 os << endl;
5368 indentG -= stdIndentG;
5369 Indent (os, indentG);
5370 os << "}";
5371 #endif /* NDEBUG */
5372 } // ContentHints::Print
5373
5374
5375 ContentReference::ContentReference()
5376 {
5377 }
5378
5379 ContentReference::ContentReference (const ContentReference &)
5380 {
5381 Asn1Error << "use of incompletely defined ContentReference::ContentReference (const ContentReference &)" << endl;
5382 abort();
5383 }
5384
5385 ContentReference::~ContentReference()
5386 {
5387 }
5388
5389 AsnType *ContentReference::Clone() const
5390 {
5391 return new ContentReference;
5392 }
5393
5394 AsnType *ContentReference::Copy() const
5395 {
5396 return new ContentReference (*this);
5397 }
5398
5399 #if SNACC_DEEP_COPY
5400 ContentReference &ContentReference::operator = (const ContentReference &that)
5401 #else // SNACC_DEEP_COPY
5402 ContentReference &ContentReference::operator = (const ContentReference &)
5403 #endif // SNACC_DEEP_COPY
5404 {
5405 #if SNACC_DEEP_COPY
5406 if (this != &that)
5407 {
5408 contentType = that.contentType;
5409 signedContentIdentifier = that.signedContentIdentifier;
5410 originatorSignatureValue = that.originatorSignatureValue;
5411 }
5412
5413 return *this;
5414 #else // SNACC_DEEP_COPY
5415 Asn1Error << "use of incompletely defined ContentReference &ContentReference::operator = (const ContentReference &)" << endl;
5416 abort();
5417 // if your compiler complains here, check the -novolat option
5418 #endif // SNACC_DEEP_COPY
5419 }
5420
5421 AsnLen
5422 ContentReference::BEncContent (BUF_TYPE b)
5423 {
5424 AsnLen totalLen = 0;
5425 AsnLen l;
5426
5427 l = originatorSignatureValue.BEncContent (b);
5428 l += BEncDefLen (b, l);
5429
5430 l += BEncTag1 (b, UNIV, PRIM, OCTETSTRING_TAG_CODE);
5431 totalLen += l;
5432
5433 l = signedContentIdentifier.BEncContent (b);
5434 l += BEncDefLen (b, l);
5435
5436 l += BEncTag1 (b, UNIV, PRIM, OCTETSTRING_TAG_CODE);
5437 totalLen += l;
5438
5439 l = contentType.BEncContent (b);
5440 l += BEncDefLen (b, l);
5441
5442 l += BEncTag1 (b, UNIV, PRIM, OID_TAG_CODE);
5443 totalLen += l;
5444
5445 return totalLen;
5446 } // ContentReference::BEncContent
5447
5448
5449 void ContentReference::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
5450 {
5451 AsnTag tag1;
5452 AsnLen seqBytesDecoded = 0;
5453 AsnLen elmtLen1;
5454 tag1 = BDecTag (b, seqBytesDecoded, env);
5455
5456 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, OID_TAG_CODE)))
5457 {
5458 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
5459 contentType.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
5460 tag1 = BDecTag (b, seqBytesDecoded, env);
5461 }
5462 else
5463 {
5464 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
5465 SnaccExcep::throwMe(-146);
5466 }
5467
5468 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, OCTETSTRING_TAG_CODE))
5469 || (tag1 == MAKE_TAG_ID (UNIV, CONS, OCTETSTRING_TAG_CODE)))
5470 {
5471 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
5472 signedContentIdentifier.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
5473 tag1 = BDecTag (b, seqBytesDecoded, env);
5474 }
5475 else
5476 {
5477 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
5478 SnaccExcep::throwMe(-147);
5479 }
5480
5481 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, OCTETSTRING_TAG_CODE))
5482 || (tag1 == MAKE_TAG_ID (UNIV, CONS, OCTETSTRING_TAG_CODE)))
5483 {
5484 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
5485 originatorSignatureValue.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
5486 }
5487 else
5488 {
5489 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
5490 SnaccExcep::throwMe(-148);
5491 }
5492
5493 bytesDecoded += seqBytesDecoded;
5494 if (elmtLen0 == INDEFINITE_LEN)
5495 {
5496 BDecEoc (b, bytesDecoded, env);
5497 return;
5498 }
5499 else if (seqBytesDecoded != elmtLen0)
5500 {
5501 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
5502 SnaccExcep::throwMe(-149);
5503 }
5504 else
5505 return;
5506 } // ContentReference::BDecContent
5507
5508 AsnLen ContentReference::BEnc (BUF_TYPE b)
5509 {
5510 AsnLen l;
5511 l = BEncContent (b);
5512 l += BEncConsLen (b, l);
5513 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
5514 return l;
5515 }
5516
5517 void ContentReference::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
5518 {
5519 AsnTag tag;
5520 AsnLen elmtLen1;
5521
5522 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
5523 {
5524 Asn1Error << "ContentReference::BDec: ERROR - wrong tag" << endl;
5525 SnaccExcep::throwMe(-150);
5526 }
5527 elmtLen1 = BDecLen (b, bytesDecoded, env);
5528 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
5529 }
5530
5531 void ContentReference::Print (ostream &os) const
5532 {
5533 #ifndef NDEBUG
5534 os << "{ -- SEQUENCE --" << endl;
5535 indentG += stdIndentG;
5536
5537 {
5538 Indent (os, indentG);
5539 os << "contentType ";
5540 os << contentType;
5541 os << "," << endl;
5542 }
5543
5544 {
5545 Indent (os, indentG);
5546 os << "signedContentIdentifier ";
5547 os << signedContentIdentifier;
5548 os << "," << endl;
5549 }
5550
5551 {
5552 Indent (os, indentG);
5553 os << "originatorSignatureValue ";
5554 os << originatorSignatureValue;
5555 }
5556
5557 os << endl;
5558 indentG -= stdIndentG;
5559 Indent (os, indentG);
5560 os << "}";
5561 #endif /* NDEBUG */
5562 } // ContentReference::Print
5563
5564
5565 AsnType *EquivalentLabels::Clone() const
5566 {
5567 return new EquivalentLabels;
5568 }
5569
5570 AsnType *EquivalentLabels::Copy() const
5571 {
5572 return new EquivalentLabels (*this);
5573 }
5574
5575 AsnLen EquivalentLabels::BEnc (BUF_TYPE b)
5576 {
5577 AsnLen l;
5578 l = BEncContent (b);
5579 l += BEncConsLen (b, l);
5580 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
5581 return l;
5582 }
5583
5584 void EquivalentLabels::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
5585 {
5586 AsnTag tag;
5587 AsnLen elmtLen1;
5588
5589 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
5590 {
5591 Asn1Error << "EquivalentLabels::BDec: ERROR - wrong tag" << endl;
5592 SnaccExcep::throwMe(-151);
5593 }
5594 elmtLen1 = BDecLen (b, bytesDecoded, env);
5595 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
5596 }
5597
5598 EquivalentLabels::EquivalentLabels (const EquivalentLabels &)
5599 {
5600 Asn1Error << "use of incompletely defined EquivalentLabels::EquivalentLabels (const EquivalentLabels &)" << endl;
5601 abort();
5602 }
5603
5604 EquivalentLabels::~EquivalentLabels()
5605 {
5606 SetCurrToFirst();
5607 for (; Curr() != NULL; RemoveCurrFromList())
5608 ;
5609 } // end of destructor
5610
5611 #if SNACC_DEEP_COPY
5612 EquivalentLabels &EquivalentLabels::operator = (const EquivalentLabels &that)
5613 #else // SNACC_DEEP_COPY
5614 EquivalentLabels &EquivalentLabels::operator = (const EquivalentLabels &)
5615 #endif // SNACC_DEEP_COPY
5616 {
5617 #if SNACC_DEEP_COPY
5618 if (this != &that)
5619 {
5620 SetCurrToFirst();
5621 for (; Curr(); RemoveCurrFromList())
5622 ;
5623
5624 //that.SetCurrToFirst();
5625 //for (; that.Curr(); that.GoNext())
5626 // AppendCopy (*that.Curr());
5627 for (const AsnListElmt *run=that.first; run; run=run->next)
5628 AppendCopy (*run->elmt);
5629 }
5630
5631 return *this;
5632 #else // SNACC_DEEP_COPY
5633 Asn1Error << "use of incompletely defined EquivalentLabels &EquivalentLabels::operator = (const EquivalentLabels &)" << endl;
5634 abort();
5635 // if your compiler complains here, check the -novolat option
5636 #endif // SNACC_DEEP_COPY
5637 }
5638
5639 void EquivalentLabels::Print (ostream &os) const
5640 {
5641 #ifndef NDEBUG
5642 os << "{ -- SEQUENCE/SET OF -- " << endl;
5643 indentG += stdIndentG;
5644 //SetCurrToFirst();
5645 //for (; Curr() != NULL; GoNext())
5646 for (const AsnListElmt *run=first; run; run=run->next)
5647 {
5648 Indent (os, indentG);
5649 //os << *Curr();
5650 os << *run->elmt;
5651 //if (Curr() != Last())
5652 if (run != last)
5653 os << ",";
5654 os << endl;
5655 }
5656 indentG -= stdIndentG;
5657 Indent (os, indentG);
5658 os << "}\n";
5659 #endif /* NDEBUG */
5660
5661
5662 } // Print
5663
5664
5665 void EquivalentLabels::SetCurrElmt (unsigned long int index)
5666 {
5667 unsigned long int i;
5668 curr = first;
5669 if (count)
5670 for (i = 0; (i < (count-1)) && (i < index); i++)
5671 curr = curr->next;
5672 } // EquivalentLabels::SetCurrElmt
5673
5674
5675 unsigned long int EquivalentLabels::GetCurrElmtIndex()
5676 {
5677 unsigned long int i;
5678 AsnListElmt *tmp;
5679 if (curr != NULL)
5680 {
5681 for (i = 0, tmp = first; tmp != NULL; i++)
5682 {
5683 if (tmp == curr)
5684 return i;
5685 else
5686 tmp = tmp->next;
5687 }
5688 }
5689 return count;
5690 } // EquivalentLabels::GetCurrElmtIndex
5691
5692
5693 // alloc new list elmt, put at end of list
5694 // and return the component type
5695 ESSSecurityLabel *EquivalentLabels::Append()
5696 {
5697 AsnListElmt *newElmt;
5698 newElmt = new AsnListElmt;
5699 newElmt->elmt = new ESSSecurityLabel;
5700 newElmt->next = NULL;
5701 if (last == NULL)
5702 {
5703 newElmt->prev = NULL;
5704 first = last = newElmt;
5705 }
5706 else
5707 {
5708 newElmt->prev = last;
5709 last->next = newElmt;
5710 last = newElmt;
5711 }
5712 count++;
5713 return (curr = newElmt)->elmt;
5714 } // EquivalentLabels::Append
5715
5716
5717 // alloc new list elmt, put at begining of list
5718 // and return the component type
5719 ESSSecurityLabel *EquivalentLabels::Prepend()
5720 {
5721 AsnListElmt *newElmt;
5722 newElmt = new AsnListElmt;
5723 newElmt->elmt = new ESSSecurityLabel;
5724 newElmt->prev = NULL;
5725 if (first == NULL)
5726 {
5727 newElmt->next = NULL;
5728 first = last = newElmt;
5729 }
5730 else
5731 {
5732 newElmt->next = first;
5733 first->prev = newElmt;
5734 first = newElmt;
5735 }
5736 count++;
5737 return (curr = newElmt)->elmt;
5738 } // EquivalentLabels::Prepend
5739
5740
5741 // alloc new list elmt, insert it before the
5742 // current element and return the component type
5743 // if the current element is null, the new element
5744 // is placed at the beginning of the list.
5745 ESSSecurityLabel *EquivalentLabels::InsertBefore()
5746 {
5747 AsnListElmt *newElmt;
5748 newElmt = new AsnListElmt;
5749 newElmt->elmt = new ESSSecurityLabel;
5750 if (curr == NULL)
5751 {
5752 newElmt->next = first;
5753 newElmt->prev = NULL;
5754 first = newElmt;
5755 if (last == NULL)
5756 last = newElmt;
5757 }
5758 else
5759 {
5760 newElmt->next = curr;
5761 newElmt->prev = curr->prev;
5762 curr->prev = newElmt;
5763 if (curr == first)
5764 first = newElmt;
5765 else
5766 newElmt->prev->next = newElmt;
5767 }
5768 count++;
5769 return (curr = newElmt)->elmt;
5770 } // EquivalentLabels::InsertBefore
5771
5772
5773 // alloc new list elmt, insert it after the
5774 // current element and return the component type
5775 // if the current element is null, the new element
5776 // is placed at the end of the list.
5777 ESSSecurityLabel *EquivalentLabels::InsertAfter()
5778 {
5779 AsnListElmt *newElmt;
5780 newElmt = new AsnListElmt;
5781 newElmt->elmt = new ESSSecurityLabel;
5782 if (curr == NULL)
5783 {
5784 newElmt->prev = last;
5785 newElmt->next = NULL;
5786 last = newElmt;
5787 if (first == NULL)
5788 first = newElmt;
5789 }
5790 else
5791 {
5792 newElmt->prev = curr;
5793 newElmt->next = curr->next;
5794 curr->next = newElmt;
5795 if (curr == last)
5796 last = newElmt;
5797 else
5798 newElmt->next->prev = newElmt;
5799 }
5800 count++;
5801 return (curr = newElmt)->elmt;
5802 } // EquivalentLabels::InsertAfter
5803
5804
5805 EquivalentLabels &EquivalentLabels::AppendCopy (ESSSecurityLabel &elmt)
5806 {
5807 AsnListElmt *newElmt;
5808 newElmt = new AsnListElmt;
5809 newElmt->elmt = new ESSSecurityLabel;
5810 *newElmt->elmt = elmt;
5811 newElmt->next = NULL;
5812 if (last == NULL)
5813 {
5814 newElmt->prev = NULL;
5815 first = last = newElmt;
5816 }
5817 else
5818 {
5819 newElmt->prev = last;
5820 last->next = newElmt;
5821 last = newElmt;
5822 }
5823 count++;
5824 return *this;
5825 } // AppendCopy
5826
5827
5828 EquivalentLabels &EquivalentLabels::PrependCopy (ESSSecurityLabel &elmt)
5829 {
5830 AsnListElmt *newElmt;
5831 newElmt = new AsnListElmt;
5832 newElmt->elmt = new ESSSecurityLabel;
5833 *newElmt->elmt = elmt;
5834 newElmt->prev = NULL;
5835 if (first == NULL)
5836 {
5837 newElmt->next = NULL;
5838 first = last = newElmt;
5839 }
5840 else
5841 {
5842 newElmt->next = first;
5843 first->prev = newElmt;
5844 first = newElmt;
5845 }
5846 count++;
5847 return *this;
5848 } // EquivalentLabels::PrependCopy
5849
5850
5851 // alloc new list elmt, insert it before the
5852 // current element, copy the given elmt into the new elmt
5853 // and return the component type.
5854 // if the current element is null, the new element
5855 // is placed at the beginning of the list.
5856 EquivalentLabels &EquivalentLabels::InsertBeforeAndCopy (ESSSecurityLabel &elmt)
5857 {
5858 AsnListElmt *newElmt;
5859
5860 newElmt = new AsnListElmt;
5861 newElmt->elmt = new ESSSecurityLabel;
5862 *newElmt->elmt = elmt;
5863
5864 if (curr == NULL)
5865 {
5866 newElmt->next = first;
5867 newElmt->prev = NULL;
5868 first = newElmt;
5869 if (last == NULL)
5870 last = newElmt;
5871 }
5872 else
5873 {
5874 newElmt->next = curr;
5875 newElmt->prev = curr->prev;
5876 curr->prev = newElmt;
5877 if (curr == first)
5878 first = newElmt;
5879 else
5880 newElmt->prev->next = newElmt;
5881 }
5882 count++;
5883 return *this;
5884 } // EquivalentLabels::InsertBeforeAndCopy
5885
5886
5887 // alloc new list elmt, insert it after the
5888 // current element, copy given elmt in to new elmt
5889 // and return the component type
5890 // if the current element is null, the new element
5891 // is placed at the end of the list.
5892 EquivalentLabels &EquivalentLabels::InsertAfterAndCopy (ESSSecurityLabel &elmt)
5893 {
5894 AsnListElmt *newElmt;
5895
5896 newElmt = new AsnListElmt;
5897 newElmt->elmt = new ESSSecurityLabel;
5898 *newElmt->elmt = elmt;
5899 if (curr == NULL)
5900 {
5901 newElmt->prev = last;
5902 newElmt->next = NULL;
5903 last = newElmt;
5904 if (first == NULL)
5905 first = newElmt;
5906 }
5907 else
5908 {
5909 newElmt->prev = curr;
5910 newElmt->next = curr->next;
5911 curr->next = newElmt;
5912 if (curr == last)
5913 last = newElmt;
5914 else
5915 newElmt->next->prev = newElmt;
5916 }
5917 count++;
5918 return *this;
5919 } // EquivalentLabels::InsertAfterAndCopy
5920
5921
5922 // remove current element from list if current element is not NULL
5923 // The new current element will be the next element.
5924 // If the current element is the last element in the list
5925 // the second but last element will become the new current element.
5926 void EquivalentLabels::RemoveCurrFromList()
5927 {
5928 AsnListElmt *del_elmt;
5929
5930 if (curr != NULL)
5931 {
5932 del_elmt = curr;
5933 count--;
5934
5935 if (count == 0)
5936 first = last = curr = NULL;
5937 else if (curr == first)
5938 {
5939 curr = first= first->next;
5940 first->prev = NULL;
5941 }
5942 else if (curr == last)
5943 {
5944 curr = last = last->prev;
5945 last->next = NULL;
5946 }
5947 else
5948 {
5949 curr->prev->next = curr->next;
5950 curr->next->prev = curr->prev;
5951 }
5952
5953 delete del_elmt->elmt;
5954 delete del_elmt;
5955 }
5956 }
5957
5958
5959 AsnLen EquivalentLabels::BEncContent (BUF_TYPE b)
5960 {
5961 AsnListElmt *currElmt;
5962 AsnLen elmtLen;
5963 AsnLen totalLen = 0;
5964 for (currElmt = last; currElmt != NULL; currElmt = currElmt->prev)
5965 {
5966 BEncEocIfNec (b);
5967 elmtLen = currElmt->elmt->BEncContent (b);
5968 elmtLen += BEncConsLen (b, elmtLen);
5969
5970 elmtLen += BEncTag1 (b, UNIV, CONS, SET_TAG_CODE);
5971 totalLen += elmtLen;
5972 }
5973 return totalLen;
5974 } // EquivalentLabels::BEncContent
5975
5976
5977 void EquivalentLabels::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0,
5978 AsnLen &bytesDecoded, ENV_TYPE env)
5979 {
5980 ESSSecurityLabel *listElmt;
5981 AsnTag tag1;
5982 AsnLen listBytesDecoded = 0;
5983 AsnLen elmtLen1;
5984
5985 while ((listBytesDecoded < elmtLen0) || (elmtLen0 == INDEFINITE_LEN))
5986 {
5987 tag1 = BDecTag (b, listBytesDecoded, env);
5988 if ((tag1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
5989 {
5990 BDEC_2ND_EOC_OCTET (b, listBytesDecoded, env);
5991 break;
5992 }
5993 if ((tag1 != MAKE_TAG_ID (UNIV, CONS, SET_TAG_CODE)))
5994 {
5995 Asn1Error << "Unexpected Tag" << endl;
5996 SnaccExcep::throwMe(-152);
5997 }
5998
5999 elmtLen1 = BDecLen (b, listBytesDecoded, env);
6000 listElmt = Append();
6001 listElmt->BDecContent (b, tag1, elmtLen1, listBytesDecoded, env);
6002 }
6003
6004 bytesDecoded += listBytesDecoded;
6005 } // EquivalentLabels::BDecContent
6006
6007
6008 AsnType *MLExpansionHistory::Clone() const
6009 {
6010 return new MLExpansionHistory;
6011 }
6012
6013 AsnType *MLExpansionHistory::Copy() const
6014 {
6015 return new MLExpansionHistory (*this);
6016 }
6017
6018 AsnLen MLExpansionHistory::BEnc (BUF_TYPE b)
6019 {
6020 AsnLen l;
6021 l = BEncContent (b);
6022 l += BEncConsLen (b, l);
6023 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
6024 return l;
6025 }
6026
6027 void MLExpansionHistory::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
6028 {
6029 AsnTag tag;
6030 AsnLen elmtLen1;
6031
6032 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
6033 {
6034 Asn1Error << "MLExpansionHistory::BDec: ERROR - wrong tag" << endl;
6035 SnaccExcep::throwMe(-153);
6036 }
6037 elmtLen1 = BDecLen (b, bytesDecoded, env);
6038 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
6039 }
6040
6041 MLExpansionHistory::MLExpansionHistory (const MLExpansionHistory &)
6042 {
6043 Asn1Error << "use of incompletely defined MLExpansionHistory::MLExpansionHistory (const MLExpansionHistory &)" << endl;
6044 abort();
6045 }
6046
6047 MLExpansionHistory::~MLExpansionHistory()
6048 {
6049 SetCurrToFirst();
6050 for (; Curr() != NULL; RemoveCurrFromList())
6051 ;
6052 } // end of destructor
6053
6054 #if SNACC_DEEP_COPY
6055 MLExpansionHistory &MLExpansionHistory::operator = (const MLExpansionHistory &that)
6056 #else // SNACC_DEEP_COPY
6057 MLExpansionHistory &MLExpansionHistory::operator = (const MLExpansionHistory &)
6058 #endif // SNACC_DEEP_COPY
6059 {
6060 #if SNACC_DEEP_COPY
6061 if (this != &that)
6062 {
6063 SetCurrToFirst();
6064 for (; Curr(); RemoveCurrFromList())
6065 ;
6066
6067 //that.SetCurrToFirst();
6068 //for (; that.Curr(); that.GoNext())
6069 // AppendCopy (*that.Curr());
6070 for (const AsnListElmt *run=that.first; run; run=run->next)
6071 AppendCopy (*run->elmt);
6072 }
6073
6074 return *this;
6075 #else // SNACC_DEEP_COPY
6076 Asn1Error << "use of incompletely defined MLExpansionHistory &MLExpansionHistory::operator = (const MLExpansionHistory &)" << endl;
6077 abort();
6078 // if your compiler complains here, check the -novolat option
6079 #endif // SNACC_DEEP_COPY
6080 }
6081
6082 void MLExpansionHistory::Print (ostream &os) const
6083 {
6084 #ifndef NDEBUG
6085 os << "{ -- SEQUENCE/SET OF -- " << endl;
6086 indentG += stdIndentG;
6087 //SetCurrToFirst();
6088 //for (; Curr() != NULL; GoNext())
6089 for (const AsnListElmt *run=first; run; run=run->next)
6090 {
6091 Indent (os, indentG);
6092 //os << *Curr();
6093 os << *run->elmt;
6094 //if (Curr() != Last())
6095 if (run != last)
6096 os << ",";
6097 os << endl;
6098 }
6099 indentG -= stdIndentG;
6100 Indent (os, indentG);
6101 os << "}\n";
6102 #endif /* NDEBUG */
6103
6104
6105 } // Print
6106
6107
6108 void MLExpansionHistory::SetCurrElmt (unsigned long int index)
6109 {
6110 unsigned long int i;
6111 curr = first;
6112 if (count)
6113 for (i = 0; (i < (count-1)) && (i < index); i++)
6114 curr = curr->next;
6115 } // MLExpansionHistory::SetCurrElmt
6116
6117
6118 unsigned long int MLExpansionHistory::GetCurrElmtIndex()
6119 {
6120 unsigned long int i;
6121 AsnListElmt *tmp;
6122 if (curr != NULL)
6123 {
6124 for (i = 0, tmp = first; tmp != NULL; i++)
6125 {
6126 if (tmp == curr)
6127 return i;
6128 else
6129 tmp = tmp->next;
6130 }
6131 }
6132 return count;
6133 } // MLExpansionHistory::GetCurrElmtIndex
6134
6135
6136 // alloc new list elmt, put at end of list
6137 // and return the component type
6138 MLData *MLExpansionHistory::Append()
6139 {
6140 AsnListElmt *newElmt;
6141 newElmt = new AsnListElmt;
6142 newElmt->elmt = new MLData;
6143 newElmt->next = NULL;
6144 if (last == NULL)
6145 {
6146 newElmt->prev = NULL;
6147 first = last = newElmt;
6148 }
6149 else
6150 {
6151 newElmt->prev = last;
6152 last->next = newElmt;
6153 last = newElmt;
6154 }
6155 count++;
6156 return (curr = newElmt)->elmt;
6157 } // MLExpansionHistory::Append
6158
6159
6160 // alloc new list elmt, put at begining of list
6161 // and return the component type
6162 MLData *MLExpansionHistory::Prepend()
6163 {
6164 AsnListElmt *newElmt;
6165 newElmt = new AsnListElmt;
6166 newElmt->elmt = new MLData;
6167 newElmt->prev = NULL;
6168 if (first == NULL)
6169 {
6170 newElmt->next = NULL;
6171 first = last = newElmt;
6172 }
6173 else
6174 {
6175 newElmt->next = first;
6176 first->prev = newElmt;
6177 first = newElmt;
6178 }
6179 count++;
6180 return (curr = newElmt)->elmt;
6181 } // MLExpansionHistory::Prepend
6182
6183
6184 // alloc new list elmt, insert it before the
6185 // current element and return the component type
6186 // if the current element is null, the new element
6187 // is placed at the beginning of the list.
6188 MLData *MLExpansionHistory::InsertBefore()
6189 {
6190 AsnListElmt *newElmt;
6191 newElmt = new AsnListElmt;
6192 newElmt->elmt = new MLData;
6193 if (curr == NULL)
6194 {
6195 newElmt->next = first;
6196 newElmt->prev = NULL;
6197 first = newElmt;
6198 if (last == NULL)
6199 last = newElmt;
6200 }
6201 else
6202 {
6203 newElmt->next = curr;
6204 newElmt->prev = curr->prev;
6205 curr->prev = newElmt;
6206 if (curr == first)
6207 first = newElmt;
6208 else
6209 newElmt->prev->next = newElmt;
6210 }
6211 count++;
6212 return (curr = newElmt)->elmt;
6213 } // MLExpansionHistory::InsertBefore
6214
6215
6216 // alloc new list elmt, insert it after the
6217 // current element and return the component type
6218 // if the current element is null, the new element
6219 // is placed at the end of the list.
6220 MLData *MLExpansionHistory::InsertAfter()
6221 {
6222 AsnListElmt *newElmt;
6223 newElmt = new AsnListElmt;
6224 newElmt->elmt = new MLData;
6225 if (curr == NULL)
6226 {
6227 newElmt->prev = last;
6228 newElmt->next = NULL;
6229 last = newElmt;
6230 if (first == NULL)
6231 first = newElmt;
6232 }
6233 else
6234 {
6235 newElmt->prev = curr;
6236 newElmt->next = curr->next;
6237 curr->next = newElmt;
6238 if (curr == last)
6239 last = newElmt;
6240 else
6241 newElmt->next->prev = newElmt;
6242 }
6243 count++;
6244 return (curr = newElmt)->elmt;
6245 } // MLExpansionHistory::InsertAfter
6246
6247
6248 MLExpansionHistory &MLExpansionHistory::AppendCopy (MLData &elmt)
6249 {
6250 AsnListElmt *newElmt;
6251 newElmt = new AsnListElmt;
6252 newElmt->elmt = new MLData;
6253 *newElmt->elmt = elmt;
6254 newElmt->next = NULL;
6255 if (last == NULL)
6256 {
6257 newElmt->prev = NULL;
6258 first = last = newElmt;
6259 }
6260 else
6261 {
6262 newElmt->prev = last;
6263 last->next = newElmt;
6264 last = newElmt;
6265 }
6266 count++;
6267 return *this;
6268 } // AppendCopy
6269
6270
6271 MLExpansionHistory &MLExpansionHistory::PrependCopy (MLData &elmt)
6272 {
6273 AsnListElmt *newElmt;
6274 newElmt = new AsnListElmt;
6275 newElmt->elmt = new MLData;
6276 *newElmt->elmt = elmt;
6277 newElmt->prev = NULL;
6278 if (first == NULL)
6279 {
6280 newElmt->next = NULL;
6281 first = last = newElmt;
6282 }
6283 else
6284 {
6285 newElmt->next = first;
6286 first->prev = newElmt;
6287 first = newElmt;
6288 }
6289 count++;
6290 return *this;
6291 } // MLExpansionHistory::PrependCopy
6292
6293
6294 // alloc new list elmt, insert it before the
6295 // current element, copy the given elmt into the new elmt
6296 // and return the component type.
6297 // if the current element is null, the new element
6298 // is placed at the beginning of the list.
6299 MLExpansionHistory &MLExpansionHistory::InsertBeforeAndCopy (MLData &elmt)
6300 {
6301 AsnListElmt *newElmt;
6302
6303 newElmt = new AsnListElmt;
6304 newElmt->elmt = new MLData;
6305 *newElmt->elmt = elmt;
6306
6307 if (curr == NULL)
6308 {
6309 newElmt->next = first;
6310 newElmt->prev = NULL;
6311 first = newElmt;
6312 if (last == NULL)
6313 last = newElmt;
6314 }
6315 else
6316 {
6317 newElmt->next = curr;
6318 newElmt->prev = curr->prev;
6319 curr->prev = newElmt;
6320 if (curr == first)
6321 first = newElmt;
6322 else
6323 newElmt->prev->next = newElmt;
6324 }
6325 count++;
6326 return *this;
6327 } // MLExpansionHistory::InsertBeforeAndCopy
6328
6329
6330 // alloc new list elmt, insert it after the
6331 // current element, copy given elmt in to new elmt
6332 // and return the component type
6333 // if the current element is null, the new element
6334 // is placed at the end of the list.
6335 MLExpansionHistory &MLExpansionHistory::InsertAfterAndCopy (MLData &elmt)
6336 {
6337 AsnListElmt *newElmt;
6338
6339 newElmt = new AsnListElmt;
6340 newElmt->elmt = new MLData;
6341 *newElmt->elmt = elmt;
6342 if (curr == NULL)
6343 {
6344 newElmt->prev = last;
6345 newElmt->next = NULL;
6346 last = newElmt;
6347 if (first == NULL)
6348 first = newElmt;
6349 }
6350 else
6351 {
6352 newElmt->prev = curr;
6353 newElmt->next = curr->next;
6354 curr->next = newElmt;
6355 if (curr == last)
6356 last = newElmt;
6357 else
6358 newElmt->next->prev = newElmt;
6359 }
6360 count++;
6361 return *this;
6362 } // MLExpansionHistory::InsertAfterAndCopy
6363
6364
6365 // remove current element from list if current element is not NULL
6366 // The new current element will be the next element.
6367 // If the current element is the last element in the list
6368 // the second but last element will become the new current element.
6369 void MLExpansionHistory::RemoveCurrFromList()
6370 {
6371 AsnListElmt *del_elmt;
6372
6373 if (curr != NULL)
6374 {
6375 del_elmt = curr;
6376 count--;
6377
6378 if (count == 0)
6379 first = last = curr = NULL;
6380 else if (curr == first)
6381 {
6382 curr = first= first->next;
6383 first->prev = NULL;
6384 }
6385 else if (curr == last)
6386 {
6387 curr = last = last->prev;
6388 last->next = NULL;
6389 }
6390 else
6391 {
6392 curr->prev->next = curr->next;
6393 curr->next->prev = curr->prev;
6394 }
6395
6396 delete del_elmt->elmt;
6397 delete del_elmt;
6398 }
6399 }
6400
6401
6402 AsnLen MLExpansionHistory::BEncContent (BUF_TYPE b)
6403 {
6404 AsnListElmt *currElmt;
6405 AsnLen elmtLen;
6406 AsnLen totalLen = 0;
6407 for (currElmt = last; currElmt != NULL; currElmt = currElmt->prev)
6408 {
6409 BEncEocIfNec (b);
6410 elmtLen = currElmt->elmt->BEncContent (b);
6411 elmtLen += BEncConsLen (b, elmtLen);
6412
6413 elmtLen += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
6414 totalLen += elmtLen;
6415 }
6416 return totalLen;
6417 } // MLExpansionHistory::BEncContent
6418
6419
6420 void MLExpansionHistory::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0,
6421 AsnLen &bytesDecoded, ENV_TYPE env)
6422 {
6423 MLData *listElmt;
6424 AsnTag tag1;
6425 AsnLen listBytesDecoded = 0;
6426 AsnLen elmtLen1;
6427
6428 while ((listBytesDecoded < elmtLen0) || (elmtLen0 == INDEFINITE_LEN))
6429 {
6430 tag1 = BDecTag (b, listBytesDecoded, env);
6431 if ((tag1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
6432 {
6433 BDEC_2ND_EOC_OCTET (b, listBytesDecoded, env);
6434 break;
6435 }
6436 if ((tag1 != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
6437 {
6438 Asn1Error << "Unexpected Tag" << endl;
6439 SnaccExcep::throwMe(-154);
6440 }
6441
6442 elmtLen1 = BDecLen (b, listBytesDecoded, env);
6443 listElmt = Append();
6444 listElmt->BDecContent (b, tag1, elmtLen1, listBytesDecoded, env);
6445 }
6446
6447 bytesDecoded += listBytesDecoded;
6448 } // MLExpansionHistory::BDecContent
6449
6450
6451 SigningCertificate::SigningCertificate()
6452 {
6453 policies = NULL;
6454 }
6455
6456 SigningCertificate::SigningCertificate (const SigningCertificate &)
6457 {
6458 Asn1Error << "use of incompletely defined SigningCertificate::SigningCertificate (const SigningCertificate &)" << endl;
6459 abort();
6460 }
6461
6462 SigningCertificate::~SigningCertificate()
6463 {
6464 delete policies;
6465 }
6466
6467 AsnType *SigningCertificate::Clone() const
6468 {
6469 return new SigningCertificate;
6470 }
6471
6472 AsnType *SigningCertificate::Copy() const
6473 {
6474 return new SigningCertificate (*this);
6475 }
6476
6477 #if SNACC_DEEP_COPY
6478 SigningCertificate &SigningCertificate::operator = (const SigningCertificate &that)
6479 #else // SNACC_DEEP_COPY
6480 SigningCertificate &SigningCertificate::operator = (const SigningCertificate &)
6481 #endif // SNACC_DEEP_COPY
6482 {
6483 #if SNACC_DEEP_COPY
6484 if (this != &that)
6485 {
6486 certs = that.certs;
6487 if (that.policies)
6488 {
6489 if (!policies)
6490 policies = new SigningCertificateSeqOf1;
6491 *policies = *that.policies;
6492 }
6493 else
6494 {
6495 delete policies;
6496 policies = NULL;
6497 }
6498 }
6499
6500 return *this;
6501 #else // SNACC_DEEP_COPY
6502 Asn1Error << "use of incompletely defined SigningCertificate &SigningCertificate::operator = (const SigningCertificate &)" << endl;
6503 abort();
6504 // if your compiler complains here, check the -novolat option
6505 #endif // SNACC_DEEP_COPY
6506 }
6507
6508 AsnLen
6509 SigningCertificate::BEncContent (BUF_TYPE b)
6510 {
6511 AsnLen totalLen = 0;
6512 AsnLen l;
6513
6514 if (NOT_NULL (policies))
6515 {
6516 BEncEocIfNec (b);
6517 l = policies->BEncContent (b);
6518 l += BEncConsLen (b, l);
6519
6520 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
6521 totalLen += l;
6522 }
6523
6524 BEncEocIfNec (b);
6525 l = certs.BEncContent (b);
6526 l += BEncConsLen (b, l);
6527
6528 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
6529 totalLen += l;
6530
6531 return totalLen;
6532 } // SigningCertificate::BEncContent
6533
6534
6535 void SigningCertificate::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
6536 {
6537 AsnTag tag1;
6538 AsnLen seqBytesDecoded = 0;
6539 AsnLen elmtLen1;
6540 tag1 = BDecTag (b, seqBytesDecoded, env);
6541
6542 if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
6543 {
6544 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
6545 certs.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
6546 if (seqBytesDecoded == elmtLen0)
6547 {
6548 bytesDecoded += seqBytesDecoded;
6549 return;
6550 }
6551 else
6552 {
6553 tag1 = BDecTag (b, seqBytesDecoded, env);
6554
6555 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
6556 {
6557 BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env)
6558 bytesDecoded += seqBytesDecoded;
6559 return;
6560 }
6561 }
6562 }
6563 else
6564 {
6565 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
6566 SnaccExcep::throwMe(-155);
6567 }
6568
6569 if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
6570 {
6571 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
6572 policies = new SigningCertificateSeqOf1;
6573 policies->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
6574 }
6575
6576 bytesDecoded += seqBytesDecoded;
6577 if (elmtLen0 == INDEFINITE_LEN)
6578 {
6579 BDecEoc (b, bytesDecoded, env);
6580 return;
6581 }
6582 else if (seqBytesDecoded != elmtLen0)
6583 {
6584 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
6585 SnaccExcep::throwMe(-156);
6586 }
6587 else
6588 return;
6589 } // SigningCertificate::BDecContent
6590
6591 AsnLen SigningCertificate::BEnc (BUF_TYPE b)
6592 {
6593 AsnLen l;
6594 l = BEncContent (b);
6595 l += BEncConsLen (b, l);
6596 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
6597 return l;
6598 }
6599
6600 void SigningCertificate::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
6601 {
6602 AsnTag tag;
6603 AsnLen elmtLen1;
6604
6605 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
6606 {
6607 Asn1Error << "SigningCertificate::BDec: ERROR - wrong tag" << endl;
6608 SnaccExcep::throwMe(-157);
6609 }
6610 elmtLen1 = BDecLen (b, bytesDecoded, env);
6611 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
6612 }
6613
6614 void SigningCertificate::Print (ostream &os) const
6615 {
6616 #ifndef NDEBUG
6617 os << "{ -- SEQUENCE --" << endl;
6618 indentG += stdIndentG;
6619
6620 {
6621 Indent (os, indentG);
6622 os << "certs ";
6623 os << certs;
6624 os << "," << endl;
6625 }
6626
6627 if (NOT_NULL (policies))
6628 {
6629 os << ","<< endl;
6630 Indent (os, indentG);
6631 os << "policies ";
6632 os << *policies;
6633 }
6634 else
6635 {
6636 Indent (os, indentG);
6637 os << "policies ";
6638 os << "-- void --";
6639 os << endl;
6640 }
6641
6642 os << endl;
6643 indentG -= stdIndentG;
6644 Indent (os, indentG);
6645 os << "}";
6646 #endif /* NDEBUG */
6647 } // SigningCertificate::Print
6648
6649