View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  package org.apache.directory.api.asn1.ber.tlv;
21  
22  
23  /**
24   * Enum for ASN.1 UNIVERSAL class tags. The tags values are constructed using
25   * the SNACC representation for tags without the primitive/constructed bit. This
26   * is done because several bit, octet and character string types can be encoded
27   * as primitives or as constructed types to chunk the value out.
28   * <p>
29   * These tags can have one of the following values:
30   * </p>
31   * <p>
32   * </p>
33   * <table border="1" cellspacing="1" width="60%">
34   * <tr>
35   * <th>Id</th>
36   * <th>Usage</th>
37   * </tr>
38   * <tr>
39   * <td>[UNIVERSAL 0]</td>
40   * <td>reserved for BER</td>
41   * </tr>
42   * <tr>
43   * <td>[UNIVERSAL 1]</td>
44   * <td>BOOLEAN</td>
45   * </tr>
46   * <tr>
47   * <td>[UNIVERSAL 2]</td>
48   * <td>INTEGER</td>
49   * </tr>
50   * <tr>
51   * <td>[UNIVERSAL 3]</td>
52   * <td>BIT STRING</td>
53   * </tr>
54   * <tr>
55   * <td>[UNIVERSAL 4]</td>
56   * <td>OCTET STRING</td>
57   * </tr>
58   * <tr>
59   * <td>[UNIVERSAL 5]</td>
60   * <td>NULL</td>
61   * </tr>
62   * <tr>
63   * <td>[UNIVERSAL 6]</td>
64   * <td>OBJECT IDENTIFIER</td>
65   * </tr>
66   * <tr>
67   * <td>[UNIVERSAL 7]</td>
68   * <td>ObjectDescriptor</td>
69   * </tr>
70   * <tr>
71   * <td>[UNIVERSAL 8]</td>
72   * <td>EXTERNAL, INSTANCE OF</td>
73   * </tr>
74   * <tr>
75   * <td>[UNIVERSAL 9]</td>
76   * <td>REAL</td>
77   * </tr>
78   * <tr>
79   * <td>[UNIVERSAL 10]</td>
80   * <td>ENUMERATED</td>
81   * </tr>
82   * <tr>
83   * <td>[UNIVERSAL 11]</td>
84   * <td>EMBEDDED PDV</td>
85   * </tr>
86   * <tr>
87   * <td>[UNIVERSAL 12]</td>
88   * <td>UTF8String</td>
89   * </tr>
90   * <tr>
91   * <td>[UNIVERSAL 13]</td>
92   * <td>RELATIVE-OID</td>
93   * </tr>
94   * <tr>
95   * <td>[UNIVERSAL 14]</td>
96   * <td>reserved for future use</td>
97   * </tr>
98   * <tr>
99   * <td>[UNIVERSAL 15]</td>
100  * <td>reserved for future use</td>
101  * </tr>
102  * <tr>
103  * <td>[UNIVERSAL 16]</td>
104  * <td>SEQUENCE, SEQUENCE OF</td>
105  * </tr>
106  * <tr>
107  * <td>[UNIVERSAL 17]</td>
108  * <td>SET, SET OF</td>
109  * </tr>
110  * <tr>
111  * <td>[UNIVERSAL 18]</td>
112  * <td>NumericString</td>
113  * </tr>
114  * <tr>
115  * <td>[UNIVERSAL 19]</td>
116  * <td>PrintableString</td>
117  * </tr>
118  * <tr>
119  * <td>[UNIVERSAL 20]</td>
120  * <td>TeletexString, T61String</td>
121  * </tr>
122  * <tr>
123  * <td>[UNIVERSAL 21]</td>
124  * <td>VideotexString</td>
125  * </tr>
126  * <tr>
127  * <td>[UNIVERSAL 22]</td>
128  * <td>IA5String</td>
129  * </tr>
130  * <tr>
131  * <td>[UNIVERSAL 23]</td>
132  * <td>UTCTime</td>
133  * </tr>
134  * <tr>
135  * <td>[UNIVERSAL 24]</td>
136  * <td>GeneralizedTime</td>
137  * </tr>
138  * <tr>
139  * <td>[UNIVERSAL 25]</td>
140  * <td>GraphicString</td>
141  * </tr>
142  * <tr>
143  * <td>[UNIVERSAL 26]</td>
144  * <td>VisibleString, ISO646String</td>
145  * </tr>
146  * <tr>
147  * <td>[UNIVERSAL 27]</td>
148  * <td>GeneralString</td>
149  * </tr>
150  * <tr>
151  * <td>[UNIVERSAL 28]</td>
152  * <td>UniversalString</td>
153  * </tr>
154  * <tr>
155  * <td>[UNIVERSAL 29]</td>
156  * <td>CHARACTER STRING</td>
157  * </tr>
158  * <tr>
159  * <td>[UNIVERSAL 30]</td>
160  * <td>BMPString</td>
161  * </tr>
162  * <tr>
163  * <td>[UNIVERSAL 31]</td>
164  * <td>reserved for future use</td>
165  * </tr>
166  * </table>
167  * 
168  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
169  */
170 public enum UniversalTag
171 {
172     /** value for the tag */
173     RESERVED_0(( byte ) 0),
174 
175     /** value for the tag */
176     BOOLEAN(( byte ) 1),
177 
178     /** value for the tag */
179     INTEGER(( byte ) 2),
180 
181     /** value for the tag */
182     BIT_STRING(( byte ) 3),
183 
184     /** value for the tag */
185     OCTET_STRING(( byte ) 4),
186 
187     /** value for the tag */
188     NULL(( byte ) 5),
189 
190     /** value for the tag */
191     OBJECT_IDENTIFIER(( byte ) 6),
192 
193     /** value for the tag */
194     OBJECT_DESCRIPTOR(( byte ) 7),
195 
196     /** value for the tag */
197     EXTERNAL_INSTANCE_OF(( byte ) 8),
198 
199     /** value for the tag */
200     REAL(( byte ) 9),
201 
202     /** value for the tag */
203     ENUMERATED(( byte ) 0x0A),
204 
205     /** value for the tag */
206     EMBEDDED_PDV(( byte ) 0x0B),
207 
208     /** value for the tag */
209     UTF8_STRING(( byte ) 0x0C),
210 
211     /** value for the tag */
212     RELATIVE_OID(( byte ) 0x0D),
213 
214     /** value for the tag */
215     RESERVED_14(( byte ) 0x0E),
216 
217     /** value for the tag */
218     RESERVED_15(( byte ) 0x0F),
219 
220     /** value for the tag */
221     SEQUENCE_SEQUENCE_OF(( byte ) 0x10),
222 
223     /** value for the tag */
224     SET_SET_OF(( byte ) 0x11),
225 
226     /** value for the tag */
227     NUMERIC_STRING(( byte ) 0x12),
228 
229     /** value for the tag */
230     PRINTABLE_STRING(( byte ) 0x13),
231 
232     /** value for the tag */
233     TELETEX_STRING(( byte ) 0x14),
234 
235     /** value for the tag */
236     VIDEOTEX_STRING(( byte ) 0x15),
237 
238     /** value for the tag */
239     IA5_STRING(( byte ) 0x16),
240 
241     /** value for the tag */
242     UTC_TIME(( byte ) 0x17),
243 
244     /** value for the tag */
245     GENERALIZED_TIME(( byte ) 0x18),
246 
247     /** value for the tag */
248     GRAPHIC_STRING(( byte ) 0x19),
249 
250     /** value for the tag */
251     VISIBLE_STRING(( byte ) 0x1A),
252 
253     /** value for the tag */
254     GENERAL_STRING(( byte ) 0x1B),
255 
256     /** value for the tag */
257     UNIVERSAL_STRING(( byte ) 0x1C),
258 
259     /** value for the tag */
260     CHARACTER_STRING(( byte ) 0x1D),
261 
262     /** value for the tag */
263     BMP_STRING(( byte ) 0x1E),
264 
265     /** value for the tag */
266     RESERVED_31(( byte ) 0x1F),
267 
268     /** SEQUENCE TAG */
269     SEQUENCE(( byte ) 0x30),
270 
271     /** SET TAG */
272     SET(( byte ) 0x31);
273 
274     /** The internal value */
275     private byte value;
276 
277 
278     /**
279      * Creates a new instance of UniversalTag.
280      *
281      * @param value The tag value
282      */
283     private UniversalTag( byte value )
284     {
285         this.value = value;
286     }
287 
288 
289     /**
290      * @return The UniversalTag value
291      */
292     public byte getValue()
293     {
294         return value;
295     }
296 }