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 */ 020 021package org.apache.directory.server.dns.messages; 022 023 024import org.apache.directory.server.dns.util.EnumConverter; 025import org.apache.directory.server.dns.util.ReverseEnumMap; 026 027 028/** 029 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 030 */ 031public enum RecordType implements EnumConverter<Short> 032{ 033 /** Host address */ 034 A(1), 035 036 /** Authoritative name server */ 037 NS(2), 038 039 /** Mail destination */ 040 MD(3), 041 042 /** Mail forwarder */ 043 MF(4), 044 045 /** Canonical name for an alias */ 046 CNAME(5), 047 048 /** Start of a zone of authority */ 049 SOA(6), 050 051 /** Mailbox domain name */ 052 MB(7), 053 054 /** Mail group member */ 055 MG(8), 056 057 /** Mail rename domain name */ 058 MR(9), 059 060 /** Null resource record */ 061 NULL(10), 062 063 /** Well know service description */ 064 WKS(11), 065 066 /** Domain name pointer */ 067 PTR(12), 068 069 /** Host information */ 070 HINFO(13), 071 072 /** Mailbox or mail list information */ 073 MINFO(14), 074 075 /** Mail exchange */ 076 MX(15), 077 078 /** Text strings */ 079 TXT(16), 080 081 /** Responsible person */ 082 RP(17), 083 084 /** AFS cell database */ 085 AFSDB(18), 086 087 /** X.25 calling address */ 088 X25(19), 089 090 /** ISDN calling address */ 091 ISDN(20), 092 093 /** Router */ 094 RT(21), 095 096 /** NSAP address */ 097 NSAP(22), 098 099 /** Reverse NSAP address (deprecated) */ 100 NSAP_PTR(23), 101 102 /** Signature */ 103 SIG(24), 104 105 /** Key */ 106 KEY(25), 107 108 /** X.400 mail mapping */ 109 PX(26), 110 111 /** Geographical position (withdrawn) */ 112 GPOS(27), 113 114 /** IPv6 address */ 115 AAAA(28), 116 117 /** Location */ 118 LOC(29), 119 120 /** Next valid name in zone */ 121 NXT(30), 122 123 /** Endpoint identifier */ 124 EID(31), 125 126 /** Nimrod locator */ 127 NIMLOC(32), 128 129 /** Server selection */ 130 SRV(33), 131 132 /** ATM address */ 133 ATMA(34), 134 135 /** Naming authority pointer */ 136 NAPTR(35), 137 138 /** Key exchange */ 139 KX(36), 140 141 /** Certificate */ 142 CERT(34), 143 144 /** IPv6 address (experimental) */ 145 A6(38), 146 147 /** Non-terminal name redirection */ 148 DNAME(39), 149 150 /** Options - contains EDNS metadata */ 151 OPT(41), 152 153 /** Address Prefix List */ 154 APL(42), 155 156 /** Delegation Signer */ 157 DS(43), 158 159 /** SSH Key Fingerprint */ 160 SSHFP(44), 161 162 /** Resource Record Signature */ 163 RRSIG(46), 164 165 /** Next Secure Name */ 166 NSEC(47), 167 168 /** DNSSEC Key */ 169 DNSKEY(48), 170 171 /** Transaction key - used to compute a shared secret or exchange a key */ 172 TKEY(249), 173 174 /** Transaction signature */ 175 TSIG(250), 176 177 /** Incremental zone transfer */ 178 IXFR(251), 179 180 /** Request for transfer of an entire zone */ 181 AXFR(252), 182 183 /** Request for mailbox-related records */ 184 MAILB(253), 185 186 /** Request for mail agent resource records */ 187 MAILA(254), 188 189 /** Request for all records */ 190 ANY(255); 191 192 private static ReverseEnumMap<Short, RecordType> map = new ReverseEnumMap<>( RecordType.class ); 193 194 private final short value; 195 196 197 RecordType( int value ) 198 { 199 this.value = ( short ) value; 200 } 201 202 203 public Short convert() 204 { 205 return this.value; 206 } 207 208 209 /** 210 * Converts an ordinal value into a {@link RecordType}. 211 * 212 * @param value 213 * @return The {@link RecordType}. 214 */ 215 public static RecordType convert( short value ) 216 { 217 return map.get( value ); 218 } 219 220 221 /** 222 * Returns whether a given {@link RecordType} is a {@link ResourceRecord}. 223 * 224 * @param resourceType 225 * @return true of the {@link RecordType} is a {@link ResourceRecord}. 226 */ 227 public static boolean isResourceRecord( RecordType resourceType ) 228 { 229 switch ( resourceType ) 230 { 231 case OPT: 232 case TKEY: 233 case TSIG: 234 case IXFR: 235 case AXFR: 236 case MAILB: 237 case MAILA: 238 case ANY: 239 return false; 240 default: 241 return true; 242 } 243 } 244}