1
2
3
4 package javax.jmdns.impl.constants;
5
6
7
8
9
10
11 public enum DNSOptionCode {
12
13
14
15
16 Unknown("Unknown", 65535),
17
18
19
20 LLQ("LLQ", 1),
21
22
23
24 UL("UL", 2),
25
26
27
28 NSID("NSID", 3),
29
30
31
32 Owner("Owner", 4);
33
34 private final String _externalName;
35
36 private final int _index;
37
38 DNSOptionCode(String name, int index) {
39 _externalName = name;
40 _index = index;
41 }
42
43
44
45
46
47
48 public String externalName() {
49 return _externalName;
50 }
51
52
53
54
55
56
57 public int indexValue() {
58 return _index;
59 }
60
61
62
63
64
65 public static DNSOptionCode resultCodeForFlags(int optioncode) {
66 int maskedIndex = optioncode;
67 for (DNSOptionCode aCode : DNSOptionCode.values()) {
68 if (aCode._index == maskedIndex) return aCode;
69 }
70 return Unknown;
71 }
72
73 @Override
74 public String toString() {
75 return this.name() + " index " + this.indexValue();
76 }
77
78 }