clarify documentation on dnsmessagewriter

This commit is contained in:
bert hubert
2018-04-13 18:08:49 +02:00
parent 90e51417f0
commit b1cfe3a36a

View File

@ -671,14 +671,12 @@ to do pointer arithmetic. For security purposes, `DNSMessageReader` uses
bounds checking access methods exclusively. bounds checking access methods exclusively.
## DNSMessageWriter ## DNSMessageWriter
This class creates DNS messages. It has a method for setting the `qname` and This class creates DNS messages, and in its constructor it needs to know the
`qtype` of the message. If called, this also resets the message to its name and type it is creating a message for.
original state. Packets are only written in order. So it is not possible to
change the `qname` after adding a resource record. This is why the state
resets on calling `setQuestion()`.
Note: this should probably move to the constructor so it becomes impossible Packets are only written in order. So it is not possible to
to do it wrong. change the `qname` after adding a resource record. Resource records must
also be added together as RRSets, and in 'section order'.
Internally `DNSMessageWriter` again only uses bounds checked methods for Internally `DNSMessageWriter` again only uses bounds checked methods for
modifying its state. modifying its state.