]> git.saurik.com Git - apple/security.git/blob - SecurityASN1/inc/sm_x509cmn.h
Security-30.1.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 Wed Jun 27 16:40:55 2001
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 int BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded);
46 int BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded);
47
48 void Print (ostream &os) const;
49 };
50
51
52 class GeneralName: public AsnType
53 {
54 public:
55 enum ChoiceIdEnum
56 {
57 otherNameCid = 0,
58 rfc822NameCid = 1,
59 dNSNameCid = 2,
60 x400AddressCid = 3,
61 directoryNameCid = 4,
62 ediPartyNameCid = 5,
63 uniformResourceIdentifierCid = 6,
64 iPAddressCid = 7,
65 registeredIDCid = 8
66 };
67
68 enum ChoiceIdEnum choiceId;
69 union
70 {
71 OTHER_NAME *otherName;
72 IA5String *rfc822Name;
73 IA5String *dNSName;
74 ORAddress *x400Address;
75 Name *directoryName;
76 EDIPartyName *ediPartyName;
77 IA5String *uniformResourceIdentifier;
78 AsnOcts *iPAddress;
79 AsnOid *registeredID;
80 };
81
82
83 GeneralName();
84 GeneralName (const GeneralName &);
85 virtual ~GeneralName();
86
87 virtual AsnType *Clone() const;
88
89 virtual AsnType *Copy() const;
90
91 GeneralName &operator = (const GeneralName &);
92 AsnLen BEncContent (BUF_TYPE b);
93 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
94 AsnLen BEnc (BUF_TYPE b);
95 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
96 int BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded);
97 int BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded);
98
99 void Print (ostream &os) const;
100 };
101
102
103 class GeneralNames: public AsnType
104 {
105 protected:
106 unsigned long int count;
107 struct AsnListElmt
108 {
109 AsnListElmt *next;
110 AsnListElmt *prev;
111 GeneralName *elmt;
112 } *first, *curr, *last;
113
114 public:
115 GeneralNames() { count = 0; first = curr = last = NULL; }
116 GeneralNames (const GeneralNames &);
117 virtual ~GeneralNames();
118 virtual AsnType *Clone() const;
119
120 virtual AsnType *Copy() const;
121
122 GeneralNames &operator = (const GeneralNames &);
123 void SetCurrElmt (unsigned long int index);
124 unsigned long int GetCurrElmtIndex();
125 void SetCurrToFirst() { curr = first; }
126 void SetCurrToLast() { curr = last; }
127 // reading member fcns
128 int Count() const { return count; }
129 // NOTE: if your compiler complains about these NULLs, its definition of NULL is broken (and you better change it there!)
130 GeneralName *First() const { return count > 0 ? first->elmt : NULL; }
131 GeneralName *Last() const { return count > 0 ? last->elmt : NULL; }
132 GeneralName *Curr() const { return curr ? curr->elmt : NULL; }
133 GeneralName *Next() const { return curr && curr->next ? curr->next->elmt : NULL; }
134 GeneralName *Prev() const { return curr && curr->prev ? curr->prev->elmt : NULL; }
135
136 // routines that move the curr elmt
137 GeneralName *GoNext() { if (curr) curr = curr->next; return Curr(); }
138 GeneralName *GoPrev() { if (curr) curr = curr->prev; return Curr(); }
139
140 // write & alloc fcns - returns new elmt
141 GeneralName *Append(); // add elmt to end of list
142 GeneralName *Prepend(); // add elmt to beginning of list
143 GeneralName *InsertBefore(); //insert elmt before current elmt
144 GeneralName *InsertAfter(); //insert elmt after current elmt
145
146 // write & alloc & copy - returns list after copying elmt
147 GeneralNames &AppendCopy (GeneralName &elmt); // add elmt to end of list
148 GeneralNames &PrependCopy (GeneralName &elmt); // add elmt to beginning of list
149 GeneralNames &InsertBeforeAndCopy (GeneralName &elmt); //insert elmt before current elmt
150 GeneralNames &InsertAfterAndCopy (GeneralName &elmt); //insert elmt after current elmt
151
152 // removing the current elmt from the list
153 void RemoveCurrFromList();
154
155 // encode and decode routines
156 AsnLen BEnc (BUF_TYPE b);
157 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
158 AsnLen BEncContent (BUF_TYPE b);
159 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
160
161 PDU_MEMBER_MACROS
162 void Print (ostream &os) const;
163 };
164
165
166 //------------------------------------------------------------------------------
167 // externs for value defs
168
169 //------------------------------------------------------------------------------
170
171 #endif /* conditional include of sm_x509cmn.h */