1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
package javax.jmdns.impl.constants; |
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
@author |
10 |
|
|
|
|
| 0% |
Uncovered Elements: 25 (25) |
Complexity: 8 |
Complexity Density: 0.53 |
|
11 |
|
public enum DNSResultCode { |
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
Unknown("Unknown", 65535), |
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
NoError("No Error", 0), |
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
FormErr("Format Error", 1), |
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
ServFail("Server Failure", 2), |
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
NXDomain("Non-Existent Domain", 3), |
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
NotImp("Not Implemented", 4), |
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
Refused("Query Refused", 5), |
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
YXDomain("Name Exists when it should not", 6), |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
YXRRSet("RR Set Exists when it should not", 7), |
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
NXRRSet("RR Set that should exist does not", 8), |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
NotAuth("Server Not Authoritative for zone", 9), |
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
NotZone("NotZone Name not contained in zone", 10), |
60 |
|
|
61 |
|
; |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
final static int RCode_MASK = 0x0F; |
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
final static int ExtendedRCode_MASK = 0xFF; |
96 |
|
|
97 |
|
private final String _externalName; |
98 |
|
|
99 |
|
private final int _index; |
100 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
101 |
0
|
DNSResultCode(String name, int index) {... |
102 |
0
|
_externalName = name; |
103 |
0
|
_index = index; |
104 |
|
} |
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
@return |
110 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
111 |
0
|
public String externalName() {... |
112 |
0
|
return _externalName; |
113 |
|
} |
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
@return |
119 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
120 |
0
|
public int indexValue() {... |
121 |
0
|
return _index; |
122 |
|
} |
123 |
|
|
124 |
|
|
125 |
|
@param |
126 |
|
@return |
127 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
128 |
0
|
public static DNSResultCode resultCodeForFlags(int flags) {... |
129 |
0
|
int maskedIndex = flags & RCode_MASK; |
130 |
0
|
for (DNSResultCode aCode : DNSResultCode.values()) { |
131 |
0
|
if (aCode._index == maskedIndex) return aCode; |
132 |
|
} |
133 |
0
|
return Unknown; |
134 |
|
} |
135 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
136 |
0
|
public static DNSResultCode resultCodeForFlags(int flags, int extendedRCode) {... |
137 |
0
|
int maskedIndex = ((extendedRCode >> 28) & ExtendedRCode_MASK) | (flags & RCode_MASK); |
138 |
0
|
for (DNSResultCode aCode : DNSResultCode.values()) { |
139 |
0
|
if (aCode._index == maskedIndex) return aCode; |
140 |
|
} |
141 |
0
|
return Unknown; |
142 |
|
} |
143 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
144 |
0
|
@Override... |
145 |
|
public String toString() { |
146 |
0
|
return this.name() + " index " + this.indexValue(); |
147 |
|
} |
148 |
|
|
149 |
|
} |