Go to the documentation of this file.00001
00004 package javax.jmdns.impl.constants;
00005
00011 public enum DNSOptionCode {
00012
00016 Unknown("Unknown", 65535),
00020 LLQ("LLQ", 1),
00024 UL("UL", 2),
00028 NSID("NSID", 3),
00032 Owner("Owner", 4);
00033
00034 private final String _externalName;
00035
00036 private final int _index;
00037
00038 DNSOptionCode(String name, int index) {
00039 _externalName = name;
00040 _index = index;
00041 }
00042
00048 public String externalName() {
00049 return _externalName;
00050 }
00051
00057 public int indexValue() {
00058 return _index;
00059 }
00060
00065 public static DNSOptionCode resultCodeForFlags(int optioncode) {
00066 int maskedIndex = optioncode;
00067 for (DNSOptionCode aCode : DNSOptionCode.values()) {
00068 if (aCode._index == maskedIndex) return aCode;
00069 }
00070 return Unknown;
00071 }
00072
00073 @Override
00074 public String toString() {
00075 return this.name() + " index " + this.indexValue();
00076 }
00077
00078 }