aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorRene Treffer <treffer@measite.de>2014-07-23 22:49:36 +0200
committerRene Treffer <treffer@measite.de>2014-07-23 22:49:36 +0200
commit1665f2e1b3869f89e720051843812ba691d1ee8c (patch)
tree16f74c9c90dfea232a4d17e56bdb934d6b8c1506 /src/main
parentbfcba9169d106fb082857e0ba4eaef7ee3df0782 (diff)
parent2bddcc9f997e5b1e565478e99c55488c86a85e76 (diff)
Merge branch 'v0.1'
Conflicts: src/main/java/de/measite/minidns/Record.java
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/measite/minidns/DNSMessage.java5
-rw-r--r--src/main/java/de/measite/minidns/Question.java5
-rw-r--r--src/main/java/de/measite/minidns/Record.java16
3 files changed, 24 insertions, 2 deletions
diff --git a/src/main/java/de/measite/minidns/DNSMessage.java b/src/main/java/de/measite/minidns/DNSMessage.java
index 01c09645..ab2535ce 100644
--- a/src/main/java/de/measite/minidns/DNSMessage.java
+++ b/src/main/java/de/measite/minidns/DNSMessage.java
@@ -515,7 +515,10 @@ public class DNSMessage {
public String toString() {
return "-- DNSMessage " + id + " --\n" +
- Arrays.toString(answers);
+ "Q" + Arrays.toString(questions) +
+ "NS" + Arrays.toString(nameserverRecords) +
+ "A" + Arrays.toString(answers) +
+ "ARR" + Arrays.toString(additionalResourceRecords);
}
}
diff --git a/src/main/java/de/measite/minidns/Question.java b/src/main/java/de/measite/minidns/Question.java
index 62862251..88300356 100644
--- a/src/main/java/de/measite/minidns/Question.java
+++ b/src/main/java/de/measite/minidns/Question.java
@@ -134,4 +134,9 @@ public class Question {
byte o[] = ((Question)other).toByteArray();
return Arrays.equals(t, o);
}
+
+ @Override
+ public String toString() {
+ return "Question/" + clazz + "/" + type + ": " + name;
+ }
}
diff --git a/src/main/java/de/measite/minidns/Record.java b/src/main/java/de/measite/minidns/Record.java
index 6aaf4f7d..26af4711 100644
--- a/src/main/java/de/measite/minidns/Record.java
+++ b/src/main/java/de/measite/minidns/Record.java
@@ -223,6 +223,11 @@ public class Record {
protected Data payloadData;
/**
+ * MDNS defines the highest bit of the class as the unicast query bit.
+ */
+ protected boolean unicastQuery;
+
+ /**
* Parse a given record based on the full message data and the current
* stream position.
* @param dis The DataInputStream positioned at the first record byte.
@@ -233,7 +238,8 @@ public class Record {
this.name = NameUtil.parse(dis, data);
this.type = TYPE.getType(dis.readUnsignedShort());
int clazzValue = dis.readUnsignedShort();
- this.clazz = CLASS.getClass(clazzValue);
+ this.clazz = CLASS.getClass(clazzValue & 0x7fff);
+ this.unicastQuery = (clazzValue & 0x8000) > 0;
if (this.clazz == null) {
System.out.println("Unknown class " + clazzValue);
}
@@ -299,6 +305,14 @@ public class Record {
}
/**
+ * See if this query/response was a unicast query (highest class bit set).
+ * @return True if it is a unicast query/response record.
+ */
+ public boolean isUnicastQuery() {
+ return unicastQuery;
+ }
+
+ /**
* The generic record name, e.g. "measite.de".
* @return The record name.
*/