From 2bddcc9f997e5b1e565478e99c55488c86a85e76 Mon Sep 17 00:00:00 2001 From: Rene Treffer Date: Wed, 23 Jul 2014 22:43:12 +0200 Subject: Add parsing for mdns QU records (RFC6762) --- src/main/java/de/measite/minidns/Record.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src') 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 @@ -222,6 +222,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. @@ -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); } @@ -298,6 +304,14 @@ public class Record { (q.getName().equals(name)); } + /** + * 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. -- cgit v1.2.3