Add PTR record parsing

This commit is contained in:
Rene Treffer 2014-07-22 23:22:35 +02:00
parent bc621bfcfb
commit f13813186f
3 changed files with 24 additions and 1 deletions

View file

@ -424,7 +424,7 @@ public class DNSMessage {
message.authenticData = ((header >> 5) & 1) == 1;
message.checkDisabled = ((header >> 4) & 1) == 1;
message.responseCode = RESPONSE_CODE.getResponseCode(header & 0xf);
message.receiveTimestamp = System.currentTimeMillis();
message.receiveTimestamp = System.currentTimeMillis();
int questionCount = dis.readUnsignedShort();
int answerCount = dis.readUnsignedShort();
int nameserverCount = dis.readUnsignedShort();

View file

@ -9,6 +9,7 @@ import de.measite.minidns.record.AAAA;
import de.measite.minidns.record.CNAME;
import de.measite.minidns.record.Data;
import de.measite.minidns.record.NS;
import de.measite.minidns.record.PTR;
import de.measite.minidns.record.SRV;
import de.measite.minidns.util.NameUtil;
@ -250,6 +251,9 @@ public class Record {
case CNAME:
this.payloadData = new CNAME();
break;
case PTR:
this.payloadData = new PTR();
break;
default:
System.out.println("Unparsed type " + type);
this.payloadData = null;

View file

@ -0,0 +1,19 @@
package de.measite.minidns.record;
import java.io.DataInputStream;
import java.io.IOException;
import de.measite.minidns.Record.TYPE;
import de.measite.minidns.util.NameUtil;
/**
* A PTR record is handled like a CNAME
*/
public class PTR extends CNAME {
@Override
public TYPE getType() {
return TYPE.PTR;
}
}