public class DnsMessage extends Object
DnsMessage(byte[])
) or serialized
(toArray()
).Modifier and Type | Class and Description |
---|---|
static class |
DnsMessage.Builder |
static class |
DnsMessage.OPCODE
Symbolic DNS Opcode values.
|
static class |
DnsMessage.RESPONSE_CODE
Possible DNS response codes.
|
Modifier and Type | Field and Description |
---|---|
List<Record<? extends Data>> |
additionalSection
The additional section.
|
List<Record<? extends Data>> |
answerSection
The answers section records.
|
boolean |
authenticData
True if the server regarded the response as authentic.
|
boolean |
authoritativeAnswer
True if this is a authorative response.
|
List<Record<? extends Data>> |
authoritySection
The Authority Section.
|
boolean |
checkingDisabled
True if the server should not perform DNSSEC validation before returning the result.
|
int |
id
The DNS message id.
|
DnsMessage.OPCODE |
opcode
The DNS message opcode.
|
int |
optRrPosition |
boolean |
qr
The QR flag of the DNS message header.
|
List<Question> |
questions
The question section content.
|
long |
receiveTimestamp
The receive timestamp.
|
boolean |
recursionAvailable
True if recursion is possible.
|
boolean |
recursionDesired
True if the server should recurse.
|
DnsMessage.RESPONSE_CODE |
responseCode
The response code of this dns message.
|
boolean |
truncated
True if message is truncated.
|
Modifier | Constructor and Description |
---|---|
|
DnsMessage(byte[] data)
Build a DNS Message based on a binary DNS message.
|
protected |
DnsMessage(DnsMessage.Builder builder) |
Modifier and Type | Method and Description |
---|---|
DnsMessage.Builder |
asBuilder() |
DatagramPacket |
asDatagram(InetAddress address,
int port) |
DnsMessage |
asNormalizedVersion() |
String |
asTerminalOutput()
Format the DnsMessage object in a way suitable for terminal output.
|
static DnsMessage.Builder |
builder() |
List<Record<? extends Data>> |
copyAnswers()
Copy the records found in the answer section into a new list.
|
List<Record<? extends Data>> |
copyAuthority()
Copy the records found in the authority section into a new list.
|
List<Question> |
copyQuestions()
Copy the questions found in the question section.
|
boolean |
equals(Object other) |
<D extends Data> |
getAnswersFor(Question q) |
Edns |
getEdns() |
ByteBuffer |
getInByteBuffer() |
Record<OPT> |
getOptPseudoRecord() |
Question |
getQuestion() |
int |
hashCode() |
boolean |
isDnssecOk()
Check if the EDNS DO (DNSSEC OK) flag is set.
|
byte[] |
toArray()
Generate a binary dns packet out of this message.
|
String |
toString() |
void |
writeTo(DataOutputStream dataOutputStream) |
public final int id
public final DnsMessage.OPCODE opcode
public final DnsMessage.RESPONSE_CODE responseCode
public final boolean qr
true
if the message is a
response and false
if it is a query.public final boolean authoritativeAnswer
public final boolean truncated
public final boolean recursionDesired
public final boolean recursionAvailable
public final boolean authenticData
public final boolean checkingDisabled
public final List<Question> questions
This list is unmodifiable.
public final List<Record<? extends Data>> answerSection
This list is unmodifiable.
public final List<Record<? extends Data>> authoritySection
This list is unmodifiable.
public final List<Record<? extends Data>> additionalSection
This list is unmodifiable.
public final int optRrPosition
public final long receiveTimestamp
protected DnsMessage(DnsMessage.Builder builder)
public DnsMessage(byte[] data) throws IOException
data
- The DNS message data.IOException
- On read errors.public byte[] toArray()
public DatagramPacket asDatagram(InetAddress address, int port)
public void writeTo(DataOutputStream dataOutputStream) throws IOException
IOException
public ByteBuffer getInByteBuffer()
public Question getQuestion()
public List<Question> copyQuestions()
questions
public List<Record<? extends Data>> copyAnswers()
answerSection
public List<Record<? extends Data>> copyAuthority()
authoritySection
public Record<OPT> getOptPseudoRecord()
public boolean isDnssecOk()
public String asTerminalOutput()
dig
.public <D extends Data> Set<D> getAnswersFor(Question q)
public DnsMessage.Builder asBuilder()
public DnsMessage asNormalizedVersion()
public static DnsMessage.Builder builder()