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 21 package org.apache.directory.server.dns.messages; 22 23 24 import org.apache.directory.server.dns.util.EnumConverter; 25 import org.apache.directory.server.dns.util.ReverseEnumMap; 26 27 28 /** 29 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 30 * @version $Rev: 547524 $, $Date: 2007-06-15 06:42:26 +0200 (Fr, 15 Jun 2007) $ 31 */ 32 public enum RecordType implements EnumConverter<Short> 33 { 34 /** Host address */ 35 A(1), 36 37 /** Authoritative name server */ 38 NS(2), 39 40 /** Mail destination */ 41 MD(3), 42 43 /** Mail forwarder */ 44 MF(4), 45 46 /** Canonical name for an alias */ 47 CNAME(5), 48 49 /** Start of a zone of authority */ 50 SOA(6), 51 52 /** Mailbox domain name */ 53 MB(7), 54 55 /** Mail group member */ 56 MG(8), 57 58 /** Mail rename domain name */ 59 MR(9), 60 61 /** Null resource record */ 62 NULL(10), 63 64 /** Well know service description */ 65 WKS(11), 66 67 /** Domain name pointer */ 68 PTR(12), 69 70 /** Host information */ 71 HINFO(13), 72 73 /** Mailbox or mail list information */ 74 MINFO(14), 75 76 /** Mail exchange */ 77 MX(15), 78 79 /** Text strings */ 80 TXT(16), 81 82 /** Responsible person */ 83 RP(17), 84 85 /** AFS cell database */ 86 AFSDB(18), 87 88 /** X.25 calling address */ 89 X25(19), 90 91 /** ISDN calling address */ 92 ISDN(20), 93 94 /** Router */ 95 RT(21), 96 97 /** NSAP address */ 98 NSAP(22), 99 100 /** Reverse NSAP address (deprecated) */ 101 NSAP_PTR(23), 102 103 /** Signature */ 104 SIG(24), 105 106 /** Key */ 107 KEY(25), 108 109 /** X.400 mail mapping */ 110 PX(26), 111 112 /** Geographical position (withdrawn) */ 113 GPOS(27), 114 115 /** IPv6 address */ 116 AAAA(28), 117 118 /** Location */ 119 LOC(29), 120 121 /** Next valid name in zone */ 122 NXT(30), 123 124 /** Endpoint identifier */ 125 EID(31), 126 127 /** Nimrod locator */ 128 NIMLOC(32), 129 130 /** Server selection */ 131 SRV(33), 132 133 /** ATM address */ 134 ATMA(34), 135 136 /** Naming authority pointer */ 137 NAPTR(35), 138 139 /** Key exchange */ 140 KX(36), 141 142 /** Certificate */ 143 CERT(34), 144 145 /** IPv6 address (experimental) */ 146 A6(38), 147 148 /** Non-terminal name redirection */ 149 DNAME(39), 150 151 /** Options - contains EDNS metadata */ 152 OPT(41), 153 154 /** Address Prefix List */ 155 APL(42), 156 157 /** Delegation Signer */ 158 DS(43), 159 160 /** SSH Key Fingerprint */ 161 SSHFP(44), 162 163 /** Resource Record Signature */ 164 RRSIG(46), 165 166 /** Next Secure Name */ 167 NSEC(47), 168 169 /** DNSSEC Key */ 170 DNSKEY(48), 171 172 /** Transaction key - used to compute a shared secret or exchange a key */ 173 TKEY(249), 174 175 /** Transaction signature */ 176 TSIG(250), 177 178 /** Incremental zone transfer */ 179 IXFR(251), 180 181 /** Request for transfer of an entire zone */ 182 AXFR(252), 183 184 /** Request for mailbox-related records */ 185 MAILB(253), 186 187 /** Request for mail agent resource records */ 188 MAILA(254), 189 190 /** Request for all records */ 191 ANY(255); 192 193 private static ReverseEnumMap<Short, RecordType> map = new ReverseEnumMap<Short, RecordType>( RecordType.class ); 194 195 private final short value; 196 197 198 private RecordType( int value ) 199 { 200 this.value = ( short ) value; 201 } 202 203 204 public Short convert() 205 { 206 return this.value; 207 } 208 209 210 /** 211 * Converts an ordinal value into a {@link RecordType}. 212 * 213 * @param value 214 * @return The {@link RecordType}. 215 */ 216 public static RecordType convert( short value ) 217 { 218 return map.get( value ); 219 } 220 221 222 /** 223 * Returns whether a given {@link RecordType} is a {@link ResourceRecord}. 224 * 225 * @param resourceType 226 * @return true of the {@link RecordType} is a {@link ResourceRecord}. 227 */ 228 public static boolean isResourceRecord( RecordType resourceType ) 229 { 230 switch ( resourceType ) 231 { 232 case OPT: 233 case TKEY: 234 case TSIG: 235 case IXFR: 236 case AXFR: 237 case MAILB: 238 case MAILA: 239 case ANY: 240 return false; 241 default: 242 return true; 243 } 244 } 245 }