Updated Eclipse project and added a new qtype for MDNS
This commit is contained in:
parent
db7ca23660
commit
f34ac6f961
5 changed files with 18 additions and 13 deletions
18
.classpath
18
.classpath
|
|
@ -1,17 +1,19 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry exported="true" kind="lib" path="libs/dom4j-1.6.1.jar" sourcepath="C:/Users/Ziver/Documents/Programmering/Java/libs/dom4j-1.6.1/src"/>
|
<classpathentry kind="src" path="test"/>
|
||||||
<classpathentry exported="true" kind="lib" path="libs/javassist.jar" sourcepath="C:/Users/Ziver/Documents/Programmering/Java/libs/javassist-3.12.GA"/>
|
|
||||||
<classpathentry kind="lib" path="libs/junit-benchmarks-0.7.0.jar"/>
|
|
||||||
<classpathentry kind="lib" path="libs/mysql-connector-java-5.1.36-bin.jar"/>
|
|
||||||
<classpathentry kind="lib" path="libs/servlet-api.jar"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
|
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
|
||||||
<classpathentry exported="true" kind="lib" path="libs/commons-fileupload-1.2.1.jar" sourcepath="C:/Users/Ziver/Documents/Programmering/Java/libs/commons/commons-fileupload-1.2.1-sources.jar"/>
|
|
||||||
<classpathentry exported="true" kind="lib" path="libs/commons-io-1.4.jar"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0"/>
|
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="lib" path="libs/sqlite-jdbc-3.7.2.jar"/>
|
<classpathentry kind="lib" path="lib/commons-fileupload-1.2.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/commons-io-2.5.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/dom4j-1.6.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/hamcrest-core-1.3.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/junit-4.12.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/junit-benchmarks-0.7.2.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/mysql-connector-java-5.1.36-bin.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/servlet-api.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/sqlite-jdbc-3.8.11.2.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
||||||
Zutil.jar
|
Zutil.jar
|
||||||
/build/
|
/build/
|
||||||
|
/bin/
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,8 @@ public class DnsPacketQuestion implements BinaryStruct {
|
||||||
public static final int QTYPE_MX = 15;
|
public static final int QTYPE_MX = 15;
|
||||||
/** text strings */
|
/** text strings */
|
||||||
public static final int QTYPE_TXT = 16;
|
public static final int QTYPE_TXT = 16;
|
||||||
|
/** service location record */
|
||||||
|
public static final int QTYPE_SRV = 33;
|
||||||
/** A request for a transfer of an entire zone */
|
/** A request for a transfer of an entire zone */
|
||||||
public static final int QTYPE_AXFR = 252;
|
public static final int QTYPE_AXFR = 252;
|
||||||
/** A request for mailbox-related records (MB, MG or MR) */
|
/** A request for mailbox-related records (MB, MG or MR) */
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ public class MulticastDnsClient extends ThreadedUDPNetwork implements ThreadedUD
|
||||||
|
|
||||||
|
|
||||||
public void sendProbe(String domain) throws IOException {
|
public void sendProbe(String domain) throws IOException {
|
||||||
int id = (int)(Math.random() * 0xFFFF);
|
int id = 0;//(int)(Math.random() * 0xFFFF);
|
||||||
activeProbes.add(id);
|
activeProbes.add(id);
|
||||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||||
BinaryStructOutputStream out = new BinaryStructOutputStream(buffer);
|
BinaryStructOutputStream out = new BinaryStructOutputStream(buffer);
|
||||||
|
|
@ -80,7 +80,7 @@ public class MulticastDnsClient extends ThreadedUDPNetwork implements ThreadedUD
|
||||||
dnsPacket.getHeader().setDefaultQueryData();
|
dnsPacket.getHeader().setDefaultQueryData();
|
||||||
dnsPacket.addQuestion(new DnsPacketQuestion(
|
dnsPacket.addQuestion(new DnsPacketQuestion(
|
||||||
domain,
|
domain,
|
||||||
DnsPacketQuestion.QTYPE_A,
|
DnsPacketQuestion.QTYPE_SRV,
|
||||||
DnsPacketQuestion.QCLASS_IN));
|
DnsPacketQuestion.QCLASS_IN));
|
||||||
dnsPacket.write(out);
|
dnsPacket.write(out);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public class MulticastDnsClientTest {
|
||||||
mdns.start();
|
mdns.start();
|
||||||
//mdns.sendProbe("appletv.local");
|
//mdns.sendProbe("appletv.local");
|
||||||
//mdns.sendProbe("_services._dns-sd._udp.local");
|
//mdns.sendProbe("_services._dns-sd._udp.local");
|
||||||
mdns.sendProbe("_googlecast._tcp.local");
|
mdns.sendProbe("ziver-VirtualBox._afpovertcp._tcp.local");
|
||||||
mdns.setListener(new DnsResolutionListener() {
|
mdns.setListener(new DnsResolutionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void receivedResponse(DnsPacket packet) {
|
public void receivedResponse(DnsPacket packet) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue