Package org.minidns.dnsmessage
Class DnsMessage.Builder
java.lang.Object
org.minidns.dnsmessage.DnsMessage.Builder
- Enclosing class:
DnsMessage
-
Method Summary
Modifier and TypeMethodDescriptionaddAdditionalResourceRecord
(Record<? extends Data> record) addAdditionalResourceRecords
(List<Record<? extends Data>> records) addAnswers
(Collection<Record<? extends Data>> records) addNameserverRecords
(Record<? extends Data> record) addQuestion
(Question question) build()
void
copyFlagsFrom
(DnsMessage dnsMessage) Get theEdns
builder.setAdditionalResourceRecords
(Collection<Record<? extends Data>> records) setAnswers
(Collection<Record<? extends Data>> records) setAuthenticData
(boolean authenticData) Set the authentic data flag on this DNS message.setAuthoritativeAnswer
(boolean authoritativeAnswer) Set the authoritative answer flag.setCheckDisabled
(boolean checkingDisabled) Deprecated.setCheckingDisabled
(boolean checkingDisabled) Change the check status of this packet.setId
(int id) Set the current DNS message id.setNameserverRecords
(Collection<Record<? extends Data>> records) setOpcode
(DnsMessage.OPCODE opcode) setQrFlag
(boolean query) Set the QR flag.setQuestion
(Question question) Set the question part of this message.setQuestions
(List<Question> questions) Set the question part of this message.setReceiveTimestamp
(long receiveTimestamp) setRecursionAvailable
(boolean recursionAvailable) Set the recursion available flog from this DNS message.setRecursionDesired
(boolean recursionDesired) Set the recursion desired flag on this message.setResponseCode
(DnsMessage.RESPONSE_CODE responseCode) setTruncated
(boolean truncated) Set the truncation bit on this DNS message.toString()
-
Method Details
-
setId
Set the current DNS message id.- Parameters:
id
- The new DNS message id.- Returns:
- a reference to this builder.
-
setOpcode
-
setResponseCode
-
setQrFlag
Set the QR flag. Note that this will betrue
if the message is a response andfalse
if it is a query.- Parameters:
query
- The new QR flag status.- Returns:
- a reference to this builder.
-
setAuthoritativeAnswer
Set the authoritative answer flag.- Parameters:
authoritativeAnswer
- Tge new authoritative answer value.- Returns:
- a reference to this builder.
-
setTruncated
Set the truncation bit on this DNS message.- Parameters:
truncated
- The new truncated bit status.- Returns:
- a reference to this builder.
-
setRecursionDesired
Set the recursion desired flag on this message.- Parameters:
recursionDesired
- The new recusrion setting.- Returns:
- a reference to this builder.
-
setRecursionAvailable
Set the recursion available flog from this DNS message.- Parameters:
recursionAvailable
- The new recursion available status.- Returns:
- a reference to this builder.
-
setAuthenticData
Set the authentic data flag on this DNS message.- Parameters:
authenticData
- The new authentic data flag value.- Returns:
- a reference to this builder.
-
setCheckDisabled
Deprecated.Change the check status of this packet.- Parameters:
checkingDisabled
- The new check disabled value.- Returns:
- a reference to this builder.
-
setCheckingDisabled
Change the check status of this packet.- Parameters:
checkingDisabled
- The new check disabled value.- Returns:
- a reference to this builder.
-
copyFlagsFrom
-
setReceiveTimestamp
-
addQuestion
-
setQuestions
Set the question part of this message.- Parameters:
questions
- The questions.- Returns:
- a reference to this builder.
-
setQuestion
Set the question part of this message.- Parameters:
question
- The question.- Returns:
- a reference to this builder.
-
addAnswer
-
addAnswers
-
setAnswers
-
getAnswers
-
addNameserverRecords
-
setNameserverRecords
-
setAdditionalResourceRecords
-
addAdditionalResourceRecord
-
addAdditionalResourceRecords
-
getAdditionalResourceRecords
-
getEdnsBuilder
Get theEdns
builder. If no builder has been set so far, then a new one will be created.The EDNS record can be used to announce the supported size of UDP payload as well as additional flags.
Note that some networks and firewalls are known to block big UDP payloads. 1280 should be a reasonable value, everything below 512 is treated as 512 and should work on all networks.
- Returns:
- a EDNS builder.
-
build
-
toString
-