00001 00004 package javax.jmdns.impl.constants; 00005 00006 import java.util.logging.Logger; 00007 00013 public enum DNSRecordType { 00017 TYPE_IGNORE("ignore", 0), 00021 TYPE_A("a", 1), 00025 TYPE_NS("ns", 2), 00029 TYPE_MD("md", 3), 00033 TYPE_MF("mf", 4), 00037 TYPE_CNAME("cname", 5), 00041 TYPE_SOA("soa", 6), 00045 TYPE_MB("mb", 7), 00049 TYPE_MG("mg", 8), 00053 TYPE_MR("mr", 9), 00057 TYPE_NULL("null", 10), 00061 TYPE_WKS("wks", 11), 00065 TYPE_PTR("ptr", 12), 00069 TYPE_HINFO("hinfo", 13), 00073 TYPE_MINFO("minfo", 14), 00077 TYPE_MX("mx", 15), 00081 TYPE_TXT("txt", 16), 00085 TYPE_RP("rp", 17), 00089 TYPE_AFSDB("afsdb", 18), 00093 TYPE_X25("x25", 19), 00097 TYPE_ISDN("isdn", 20), 00101 TYPE_RT("rt", 21), 00105 TYPE_NSAP("nsap", 22), 00109 TYPE_NSAP_PTR("nsap-otr", 23), 00113 TYPE_SIG("sig", 24), 00117 TYPE_KEY("key", 25), 00121 TYPE_PX("px", 26), 00125 TYPE_GPOS("gpos", 27), 00129 TYPE_AAAA("aaaa", 28), 00133 TYPE_LOC("loc", 29), 00137 TYPE_NXT("nxt", 30), 00141 TYPE_EID("eid", 31), 00145 TYPE_NIMLOC("nimloc", 32), 00149 TYPE_SRV("srv", 33), 00153 TYPE_ATMA("atma", 34), 00157 TYPE_NAPTR("naptr", 35), 00161 TYPE_KX("kx", 36), 00165 TYPE_CERT("cert", 37), 00169 TYPE_A6("a6", 38), 00173 TYPE_DNAME("dname", 39), 00177 TYPE_SINK("sink", 40), 00181 TYPE_OPT("opt", 41), 00185 TYPE_APL("apl", 42), 00189 TYPE_DS("ds", 43), 00193 TYPE_SSHFP("sshfp", 44), 00197 TYPE_RRSIG("rrsig", 46), 00201 TYPE_NSEC("nsec", 47), 00205 TYPE_DNSKEY("dnskey", 48), 00209 TYPE_UINFO("uinfo", 100), 00213 TYPE_UID("uid", 101), 00217 TYPE_GID("gid", 102), 00221 TYPE_UNSPEC("unspec", 103), 00225 TYPE_TKEY("tkey", 249), 00229 TYPE_TSIG("tsig", 250), 00233 TYPE_IXFR("ixfr", 251), 00237 TYPE_AXFR("axfr", 252), 00241 TYPE_MAILA("mails", 253), 00245 TYPE_MAILB("mailb", 254), 00249 TYPE_ANY("any", 255); 00250 00251 private static Logger logger = Logger.getLogger(DNSRecordType.class.getName()); 00252 00253 private final String _externalName; 00254 00255 private final int _index; 00256 00257 DNSRecordType(String name, int index) { 00258 _externalName = name; 00259 _index = index; 00260 } 00261 00267 public String externalName() { 00268 return _externalName; 00269 } 00270 00276 public int indexValue() { 00277 return _index; 00278 } 00279 00284 public static DNSRecordType typeForName(String name) { 00285 if (name != null) { 00286 String aName = name.toLowerCase(); 00287 for (DNSRecordType aType : DNSRecordType.values()) { 00288 if (aType._externalName.equals(aName)) return aType; 00289 } 00290 } 00291 logger.severe("Could not find record type for name: " + name); 00292 return TYPE_IGNORE; 00293 } 00294 00299 public static DNSRecordType typeForIndex(int index) { 00300 for (DNSRecordType aType : DNSRecordType.values()) { 00301 if (aType._index == index) return aType; 00302 } 00303 logger.severe("Could not find record type for index: " + index); 00304 return TYPE_IGNORE; 00305 } 00306 00307 @Override 00308 public String toString() { 00309 return this.name() + " index " + this.indexValue(); 00310 } 00311 00312 }