001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020package org.apache.directory.api.asn1.ber.tlv; 021 022 023/** 024 * Enum for ASN.1 UNIVERSAL class tags. The tags values are constructed using 025 * the SNACC representation for tags without the primitive/constructed bit. This 026 * is done because several bit, octet and character string types can be encoded 027 * as primitives or as constructed types to chunk the value out. 028 * <p> 029 * These tags can have one of the following values: 030 * </p> 031 * <p> 032 * </p> 033 * <table border="1" cellspacing="1" width="60%"> 034 * <tr> 035 * <th>Id</th> 036 * <th>Usage</th> 037 * </tr> 038 * <tr> 039 * <td>[UNIVERSAL 0]</td> 040 * <td>reserved for BER</td> 041 * </tr> 042 * <tr> 043 * <td>[UNIVERSAL 1]</td> 044 * <td>BOOLEAN</td> 045 * </tr> 046 * <tr> 047 * <td>[UNIVERSAL 2]</td> 048 * <td>INTEGER</td> 049 * </tr> 050 * <tr> 051 * <td>[UNIVERSAL 3]</td> 052 * <td>BIT STRING</td> 053 * </tr> 054 * <tr> 055 * <td>[UNIVERSAL 4]</td> 056 * <td>OCTET STRING</td> 057 * </tr> 058 * <tr> 059 * <td>[UNIVERSAL 5]</td> 060 * <td>NULL</td> 061 * </tr> 062 * <tr> 063 * <td>[UNIVERSAL 6]</td> 064 * <td>OBJECT IDENTIFIER</td> 065 * </tr> 066 * <tr> 067 * <td>[UNIVERSAL 7]</td> 068 * <td>ObjectDescriptor</td> 069 * </tr> 070 * <tr> 071 * <td>[UNIVERSAL 8]</td> 072 * <td>EXTERNAL, INSTANCE OF</td> 073 * </tr> 074 * <tr> 075 * <td>[UNIVERSAL 9]</td> 076 * <td>REAL</td> 077 * </tr> 078 * <tr> 079 * <td>[UNIVERSAL 10]</td> 080 * <td>ENUMERATED</td> 081 * </tr> 082 * <tr> 083 * <td>[UNIVERSAL 11]</td> 084 * <td>EMBEDDED PDV</td> 085 * </tr> 086 * <tr> 087 * <td>[UNIVERSAL 12]</td> 088 * <td>UTF8String</td> 089 * </tr> 090 * <tr> 091 * <td>[UNIVERSAL 13]</td> 092 * <td>RELATIVE-OID</td> 093 * </tr> 094 * <tr> 095 * <td>[UNIVERSAL 14]</td> 096 * <td>reserved for future use</td> 097 * </tr> 098 * <tr> 099 * <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 */ 170public 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}