Add PTR record parsing
This commit is contained in:
parent
bc621bfcfb
commit
6eda21b416
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
19
src/main/java/de/measite/minidns/record/PTR.java
Normal file
19
src/main/java/de/measite/minidns/record/PTR.java
Normal 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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue