1 |
|
|
2 |
|
package javax.jmdns.impl.tasks; |
3 |
|
|
4 |
|
import java.io.IOException; |
5 |
|
import java.util.Timer; |
6 |
|
import java.util.TimerTask; |
7 |
|
|
8 |
|
import javax.jmdns.impl.DNSIncoming; |
9 |
|
import javax.jmdns.impl.DNSOutgoing; |
10 |
|
import javax.jmdns.impl.DNSQuestion; |
11 |
|
import javax.jmdns.impl.DNSRecord; |
12 |
|
import javax.jmdns.impl.JmDNSImpl; |
13 |
|
import javax.jmdns.impl.constants.DNSConstants; |
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
@author |
19 |
|
|
|
|
| 32.5% |
Uncovered Elements: 52 (77) |
Complexity: 13 |
Complexity Density: 0.19 |
|
20 |
|
public abstract class DNSTask extends TimerTask { |
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
private final JmDNSImpl _jmDNSImpl; |
26 |
|
|
27 |
|
|
28 |
|
@param |
29 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
30 |
603
|
protected DNSTask(JmDNSImpl jmDNSImpl) {... |
31 |
589
|
super(); |
32 |
599
|
this._jmDNSImpl = jmDNSImpl; |
33 |
|
} |
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
@return |
39 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
40 |
7996
|
public JmDNSImpl getDns() {... |
41 |
7998
|
return _jmDNSImpl; |
42 |
|
} |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
@param |
48 |
|
|
49 |
|
|
50 |
|
public abstract void start(Timer timer); |
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
@return |
56 |
|
|
57 |
|
public abstract String getName(); |
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
@see |
62 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
63 |
0
|
@Override... |
64 |
|
public String toString() { |
65 |
0
|
return this.getName(); |
66 |
|
} |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
@param |
72 |
|
|
73 |
|
@param |
74 |
|
|
75 |
|
@return |
76 |
|
@exception |
77 |
|
|
|
|
| 30.8% |
Uncovered Elements: 9 (13) |
Complexity: 2 |
Complexity Density: 0.15 |
|
78 |
141
|
public DNSOutgoing addQuestion(DNSOutgoing out, DNSQuestion rec) throws IOException {... |
79 |
141
|
DNSOutgoing newOut = out; |
80 |
141
|
try { |
81 |
141
|
newOut.addQuestion(rec); |
82 |
|
} catch (final IOException e) { |
83 |
0
|
int flags = newOut.getFlags(); |
84 |
0
|
boolean multicast = newOut.isMulticast(); |
85 |
0
|
int maxUDPPayload = newOut.getMaxUDPPayload(); |
86 |
0
|
int id = newOut.getId(); |
87 |
|
|
88 |
0
|
newOut.setFlags(flags | DNSConstants.FLAGS_TC); |
89 |
0
|
newOut.setId(id); |
90 |
0
|
this._jmDNSImpl.send(newOut); |
91 |
|
|
92 |
0
|
newOut = new DNSOutgoing(flags, multicast, maxUDPPayload); |
93 |
0
|
newOut.addQuestion(rec); |
94 |
|
} |
95 |
141
|
return newOut; |
96 |
|
} |
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
@param |
102 |
|
|
103 |
|
@param |
104 |
|
|
105 |
|
@param |
106 |
|
|
107 |
|
@return |
108 |
|
@exception |
109 |
|
|
|
|
| 30.8% |
Uncovered Elements: 9 (13) |
Complexity: 2 |
Complexity Density: 0.15 |
|
110 |
506
|
public DNSOutgoing addAnswer(DNSOutgoing out, DNSIncoming in, DNSRecord rec) throws IOException {... |
111 |
506
|
DNSOutgoing newOut = out; |
112 |
505
|
try { |
113 |
505
|
newOut.addAnswer(in, rec); |
114 |
|
} catch (final IOException e) { |
115 |
0
|
int flags = newOut.getFlags(); |
116 |
0
|
boolean multicast = newOut.isMulticast(); |
117 |
0
|
int maxUDPPayload = newOut.getMaxUDPPayload(); |
118 |
0
|
int id = newOut.getId(); |
119 |
|
|
120 |
0
|
newOut.setFlags(flags | DNSConstants.FLAGS_TC); |
121 |
0
|
newOut.setId(id); |
122 |
0
|
this._jmDNSImpl.send(newOut); |
123 |
|
|
124 |
0
|
newOut = new DNSOutgoing(flags, multicast, maxUDPPayload); |
125 |
0
|
newOut.addAnswer(in, rec); |
126 |
|
} |
127 |
505
|
return newOut; |
128 |
|
} |
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
@param |
134 |
|
|
135 |
|
@param |
136 |
|
|
137 |
|
@param |
138 |
|
@return |
139 |
|
@exception |
140 |
|
|
|
|
| 30.8% |
Uncovered Elements: 9 (13) |
Complexity: 2 |
Complexity Density: 0.15 |
|
141 |
18
|
public DNSOutgoing addAnswer(DNSOutgoing out, DNSRecord rec, long now) throws IOException {... |
142 |
18
|
DNSOutgoing newOut = out; |
143 |
18
|
try { |
144 |
18
|
newOut.addAnswer(rec, now); |
145 |
|
} catch (final IOException e) { |
146 |
0
|
int flags = newOut.getFlags(); |
147 |
0
|
boolean multicast = newOut.isMulticast(); |
148 |
0
|
int maxUDPPayload = newOut.getMaxUDPPayload(); |
149 |
0
|
int id = newOut.getId(); |
150 |
|
|
151 |
0
|
newOut.setFlags(flags | DNSConstants.FLAGS_TC); |
152 |
0
|
newOut.setId(id); |
153 |
0
|
this._jmDNSImpl.send(newOut); |
154 |
|
|
155 |
0
|
newOut = new DNSOutgoing(flags, multicast, maxUDPPayload); |
156 |
0
|
newOut.addAnswer(rec, now); |
157 |
|
} |
158 |
18
|
return newOut; |
159 |
|
} |
160 |
|
|
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
@param |
165 |
|
|
166 |
|
@param |
167 |
|
|
168 |
|
@return |
169 |
|
@exception |
170 |
|
|
|
|
| 30.8% |
Uncovered Elements: 9 (13) |
Complexity: 2 |
Complexity Density: 0.15 |
|
171 |
141
|
public DNSOutgoing addAuthoritativeAnswer(DNSOutgoing out, DNSRecord rec) throws IOException {... |
172 |
141
|
DNSOutgoing newOut = out; |
173 |
141
|
try { |
174 |
141
|
newOut.addAuthorativeAnswer(rec); |
175 |
|
} catch (final IOException e) { |
176 |
0
|
int flags = newOut.getFlags(); |
177 |
0
|
boolean multicast = newOut.isMulticast(); |
178 |
0
|
int maxUDPPayload = newOut.getMaxUDPPayload(); |
179 |
0
|
int id = newOut.getId(); |
180 |
|
|
181 |
0
|
newOut.setFlags(flags | DNSConstants.FLAGS_TC); |
182 |
0
|
newOut.setId(id); |
183 |
0
|
this._jmDNSImpl.send(newOut); |
184 |
|
|
185 |
0
|
newOut = new DNSOutgoing(flags, multicast, maxUDPPayload); |
186 |
0
|
newOut.addAuthorativeAnswer(rec); |
187 |
|
} |
188 |
141
|
return newOut; |
189 |
|
} |
190 |
|
|
191 |
|
|
192 |
|
|
193 |
|
|
194 |
|
@param |
195 |
|
|
196 |
|
@param |
197 |
|
|
198 |
|
@param |
199 |
|
|
200 |
|
@return |
201 |
|
@exception |
202 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 2 |
Complexity Density: 0.15 |
|
203 |
0
|
public DNSOutgoing addAdditionalAnswer(DNSOutgoing out, DNSIncoming in, DNSRecord rec) throws IOException {... |
204 |
0
|
DNSOutgoing newOut = out; |
205 |
0
|
try { |
206 |
0
|
newOut.addAdditionalAnswer(in, rec); |
207 |
|
} catch (final IOException e) { |
208 |
0
|
int flags = newOut.getFlags(); |
209 |
0
|
boolean multicast = newOut.isMulticast(); |
210 |
0
|
int maxUDPPayload = newOut.getMaxUDPPayload(); |
211 |
0
|
int id = newOut.getId(); |
212 |
|
|
213 |
0
|
newOut.setFlags(flags | DNSConstants.FLAGS_TC); |
214 |
0
|
newOut.setId(id); |
215 |
0
|
this._jmDNSImpl.send(newOut); |
216 |
|
|
217 |
0
|
newOut = new DNSOutgoing(flags, multicast, maxUDPPayload); |
218 |
0
|
newOut.addAdditionalAnswer(in, rec); |
219 |
|
} |
220 |
0
|
return newOut; |
221 |
|
} |
222 |
|
|
223 |
|
} |