Struct domain::bits::message_builder::AdditionalBuilder [−][src]
pub struct AdditionalBuilder { /* fields omitted */ }
A type for building the additional section of a DNS message.
This type can be constructed by calling additional()
on a
MessageBuilder
, AnswerBuilder
, or AuthorityBuilder
. See the
module documentation for details.
Methods
impl AdditionalBuilder
[src]
impl AdditionalBuilder
pub fn header(&self) -> &Header
[src]
pub fn header(&self) -> &Header
Returns a reference to the messages header.
pub fn header_mut(&mut self) -> &mut Header
[src]
pub fn header_mut(&mut self) -> &mut Header
Returns a mutable reference to the messages header.
pub fn push<N, D, R>(&mut self, record: R) -> ComposeResult<()> where
N: DName,
D: RecordData,
R: Into<Record<N, D>>,
[src]
pub fn push<N, D, R>(&mut self, record: R) -> ComposeResult<()> where
N: DName,
D: RecordData,
R: Into<Record<N, D>>,
Appends a new resource record to the additional section.
This method is generic over anything that can be converted into a
Record
. In particular, you can use four-tuples consisting of
a domain name, class, TTL, and record data or triples leaving out
the class which will then be assumed to be Class::In
.
pub fn build_opt(
self,
payload_size: u16,
rcode: OptRcode,
dnssec_ok: bool
) -> ComposeResult<OptBuilder>
[src]
pub fn build_opt(
self,
payload_size: u16,
rcode: OptRcode,
dnssec_ok: bool
) -> ComposeResult<OptBuilder>
Starts appending an OPT record to the section.
The method expects the values of the OPT record that are encoded in various fields of the record header.
The payload_size field contains the maximum size of UDP payload a requestor can assemble and process.
The rcode
argument should contain the Rcode used for a response
or OptRcode::NoError
for a message. Only the upper eight bits are
used here, the lower for bits go into the message header’s rcode
field.
The dnssec_ok
flag indicates whether a sender is prepared to
receive and process DNSSEC-related resource records in a response.
In a response it must be equal to its value in a request.
This method trades in the additional section builder for an OPT record builder. Once the record is finished, it can be traded back to continue building the additional section.
pub fn rewind(&mut self)
[src]
pub fn rewind(&mut self)
Rewinds to the beginning of the additional section.
This drops all previously assembled additonal records.
pub fn preview(&mut self) -> &[u8]
[src]
pub fn preview(&mut self) -> &[u8]
Returns a reference to the message assembled so far.
This method requires a &mut self
since it may need to update some
length values to return a valid message.
In case the builder was created from a vector with previous content, the returned reference is for the full content of this vector.
pub fn finish(self) -> Vec<u8>
[src]
pub fn finish(self) -> Vec<u8>
Finishes the message.
Trait Implementations
impl Clone for AdditionalBuilder
[src]
impl Clone for AdditionalBuilder
fn clone(&self) -> AdditionalBuilder
[src]
fn clone(&self) -> AdditionalBuilder
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for AdditionalBuilder
[src]
impl Debug for AdditionalBuilder
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl AsRef<Message> for AdditionalBuilder
[src]
impl AsRef<Message> for AdditionalBuilder
Auto Trait Implementations
impl Send for AdditionalBuilder
impl Send for AdditionalBuilder
impl Sync for AdditionalBuilder
impl Sync for AdditionalBuilder