]> git.saurik.com Git - apple/security.git/blob - SecurityASN1/inc/sm_x509cmn.h
Security-54.1.3.tar.gz
[apple/security.git] / SecurityASN1 / inc / sm_x509cmn.h
1 // NOTE: this is a machine generated file--editing not recommended
2 //
3 // sm_x509cmn.h - class definitions for ASN.1 module CommonX509Definitions
4 //
5 // This file was generated by snacc on Mon Apr 22 22:34:19 2002
6 // UBC snacc by Mike Sample
7 // A couple of enhancements made by IBM European Networking Center
8
9 #ifndef _sm_x509cmn_h_
10 #define _sm_x509cmn_h_
11
12
13 //------------------------------------------------------------------------------
14 // class declarations:
15
16 class EDIPartyName;
17 class GeneralName;
18 class GeneralNames;
19
20 //------------------------------------------------------------------------------
21 // class definitions:
22
23 /* OBJECT IDENTIFIER */
24 typedef AsnOid OTHER_NAME;
25
26 class EDIPartyName: public AsnType
27 {
28 public:
29 DirectoryString *nameAssigner;
30 DirectoryString *partyName;
31
32 EDIPartyName();
33 EDIPartyName (const EDIPartyName &);
34 virtual ~EDIPartyName();
35 virtual AsnType *Clone() const;
36
37 virtual AsnType *Copy() const;
38
39 EDIPartyName &operator = (const EDIPartyName &);
40 AsnLen BEncContent (BUF_TYPE b);
41 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
42
43 AsnLen BEnc (BUF_TYPE b);
44 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
45 void Print (ostream &os) const;
46 };
47
48
49 class GeneralName: public AsnType
50 {
51 public:
52 enum ChoiceIdEnum
53 {
54 otherNameCid = 0,
55 rfc822NameCid = 1,
56 dNSNameCid = 2,
57 x400AddressCid = 3,
58 directoryNameCid = 4,
59 ediPartyNameCid = 5,
60 uniformResourceIdentifierCid = 6,
61 iPAddressCid = 7,
62 registeredIDCid = 8
63 };
64
65 enum ChoiceIdEnum choiceId;
66 union
67 {
68 OTHER_NAME *otherName;
69 IA5String *rfc822Name;
70 IA5String *dNSName;
71 ORAddress *x400Address;
72 Name *directoryName;
73 EDIPartyName *ediPartyName;
74 IA5String *uniformResourceIdentifier;
75 AsnOcts *iPAddress;
76 AsnOid *registeredID;
77 };
78
79
80 GeneralName();
81 GeneralName (const GeneralName &);
82 virtual ~GeneralName();
83
84 virtual AsnType *Clone() const;
85
86 virtual AsnType *Copy() const;
87
88 GeneralName &operator = (const GeneralName &);
89 AsnLen BEncContent (BUF_TYPE b);
90 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
91 AsnLen BEnc (BUF_TYPE b);
92 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
93 void Print (ostream &os) const;
94 };
95
96
97 class GeneralNames: public AsnType
98 {
99 protected:
100 unsigned long int count;
101 struct AsnListElmt
102 {
103 AsnListElmt *next;
104 AsnListElmt *prev;
105 GeneralName *elmt;
106 } *first, *curr, *last;
107
108 public:
109 GeneralNames() { count = 0; first = curr = last = NULL; }
110 GeneralNames (const GeneralNames &);
111 virtual ~GeneralNames();
112 virtual AsnType *Clone() const;
113
114 virtual AsnType *Copy() const;
115
116 GeneralNames &operator = (const GeneralNames &);
117 void SetCurrElmt (unsigned long int index);
118 unsigned long int GetCurrElmtIndex();
119 void SetCurrToFirst() { curr = first; }
120 void SetCurrToLast() { curr = last; }
121 // reading member fcns
122 int Count() const { return count; }
123 // NOTE: if your compiler complains about these NULLs, its definition of NULL is broken (and you better change it there!)
124 GeneralName *First() const { return count > 0 ? first->elmt : NULL; }
125 GeneralName *Last() const { return count > 0 ? last->elmt : NULL; }
126 GeneralName *Curr() const { return curr ? curr->elmt : NULL; }
127 GeneralName *Next() const { return curr && curr->next ? curr->next->elmt : NULL; }
128 GeneralName *Prev() const { return curr && curr->prev ? curr->prev->elmt : NULL; }
129
130 // routines that move the curr elmt
131 GeneralName *GoNext() { if (curr) curr = curr->next; return Curr(); }
132 GeneralName *GoPrev() { if (curr) curr = curr->prev; return Curr(); }
133
134 // write & alloc fcns - returns new elmt
135 GeneralName *Append(); // add elmt to end of list
136 GeneralName *Prepend(); // add elmt to beginning of list
137 GeneralName *InsertBefore(); //insert elmt before current elmt
138 GeneralName *InsertAfter(); //insert elmt after current elmt
139
140 // write & alloc & copy - returns list after copying elmt
141 GeneralNames &AppendCopy (GeneralName &elmt); // add elmt to end of list
142 GeneralNames &PrependCopy (GeneralName &elmt); // add elmt to beginning of list
143 GeneralNames &InsertBeforeAndCopy (GeneralName &elmt); //insert elmt before current elmt
144 GeneralNames &InsertAfterAndCopy (GeneralName &elmt); //insert elmt after current elmt
145
146 // removing the current elmt from the list
147 void RemoveCurrFromList();
148
149 // encode and decode routines
150 AsnLen BEnc (BUF_TYPE b);
151 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
152 AsnLen BEncContent (BUF_TYPE b);
153 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
154
155 PDU_MEMBER_MACROS
156 void Print (ostream &os) const;
157 };
158
159
160 //------------------------------------------------------------------------------
161 // externs for value defs
162
163 //------------------------------------------------------------------------------
164
165 #endif /* conditional include of sm_x509cmn.h */