| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
package javax.jmdns.impl.tasks.resolver; |
| 6 |
|
|
| 7 |
|
import java.io.IOException; |
| 8 |
|
|
| 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.JmDNSImpl.ServiceTypeEntry; |
| 14 |
|
import javax.jmdns.impl.constants.DNSConstants; |
| 15 |
|
import javax.jmdns.impl.constants.DNSRecordClass; |
| 16 |
|
import javax.jmdns.impl.constants.DNSRecordType; |
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 6 |
Complexity Density: 0.6 |
|
| 25 |
|
public class TypeResolver extends DNSResolverTask { |
| 26 |
|
|
| 27 |
|
|
| 28 |
|
@param |
| 29 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 30 |
0
|
public TypeResolver(JmDNSImpl jmDNSImpl) {... |
| 31 |
0
|
super(jmDNSImpl); |
| 32 |
|
} |
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
@see |
| 37 |
|
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 38 |
0
|
@Override... |
| 39 |
|
public String getName() { |
| 40 |
0
|
return "TypeResolver(" + (this.getDns() != null ? this.getDns().getName() : "") + ")"; |
| 41 |
|
} |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 45 |
|
@see |
| 46 |
|
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
| 47 |
0
|
@Override... |
| 48 |
|
protected DNSOutgoing addAnswers(DNSOutgoing out) throws IOException { |
| 49 |
0
|
DNSOutgoing newOut = out; |
| 50 |
0
|
long now = System.currentTimeMillis(); |
| 51 |
0
|
for (String type : this.getDns().getServiceTypes().keySet()) { |
| 52 |
0
|
ServiceTypeEntry typeEntry = this.getDns().getServiceTypes().get(type); |
| 53 |
0
|
newOut = this.addAnswer(newOut, new DNSRecord.Pointer("_services._dns-sd._udp.local.", DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE, DNSConstants.DNS_TTL, typeEntry.getType()), now); |
| 54 |
|
} |
| 55 |
0
|
return newOut; |
| 56 |
|
} |
| 57 |
|
|
| 58 |
|
|
| 59 |
|
|
| 60 |
|
@see |
| 61 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 62 |
0
|
@Override... |
| 63 |
|
protected DNSOutgoing addQuestions(DNSOutgoing out) throws IOException { |
| 64 |
0
|
return this.addQuestion(out, DNSQuestion.newQuestion("_services._dns-sd._udp.local.", DNSRecordType.TYPE_PTR, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE)); |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
|
| 68 |
|
|
| 69 |
|
@see |
| 70 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 71 |
0
|
@Override... |
| 72 |
|
protected String description() { |
| 73 |
0
|
return "querying type"; |
| 74 |
|
} |
| 75 |
|
} |