Struct domain::base::message_builder::OptBuilder
source · pub struct OptBuilder<'a, Target: ?Sized> { /* private fields */ }
Expand description
Builds an OPT record.
A mutable reference of this type is passed to the closure given to
AdditionalBuilder::opt
allowing this closure to manipulate both the
header values of the record and push options to the record data.
Implementations§
source§impl<'a, Target: Composer + ?Sized> OptBuilder<'a, Target>
impl<'a, Target: Composer + ?Sized> OptBuilder<'a, Target>
sourcepub fn push<Opt: ComposeOptData + ?Sized>(
&mut self,
opt: &Opt,
) -> Result<(), Target::AppendError>
pub fn push<Opt: ComposeOptData + ?Sized>( &mut self, opt: &Opt, ) -> Result<(), Target::AppendError>
Appends an option to the OPT record.
sourcepub fn push_raw_option<F>(
&mut self,
code: OptionCode,
option_len: u16,
op: F,
) -> Result<(), Target::AppendError>
pub fn push_raw_option<F>( &mut self, code: OptionCode, option_len: u16, op: F, ) -> Result<(), Target::AppendError>
Appends a raw option to the OPT record.
The method will append an option with the given option code. The data
of the option will be written via the closure op
.
sourcepub fn udp_payload_size(&self) -> u16
pub fn udp_payload_size(&self) -> u16
Returns the current UDP payload size field of the OPT record.
This field contains the largest UDP datagram the sender can accept. This is not the path MTU but really what the sender can work with internally.
sourcepub fn set_udp_payload_size(&mut self, value: u16)
pub fn set_udp_payload_size(&mut self, value: u16)
Sets the UDP payload size field of the OPT record.
sourcepub fn rcode(&self) -> OptRcode
pub fn rcode(&self) -> OptRcode
Returns the extended rcode of the message.
The method assembles the rcode both from the message header and the OPT header.
sourcepub fn set_rcode(&mut self, rcode: OptRcode)
pub fn set_rcode(&mut self, rcode: OptRcode)
Sets the extended rcode of the message. The method will update both the message header and the OPT header.
sourcepub fn version(&self) -> u8
pub fn version(&self) -> u8
Returns the EDNS version of the OPT header.
Only EDNS version 0 is currently defined.
sourcepub fn set_version(&mut self, version: u8)
pub fn set_version(&mut self, version: u8)
Sets the EDNS version of the OPT header.
sourcepub fn dnssec_ok(&self) -> bool
pub fn dnssec_ok(&self) -> bool
Returns the value of the DNSSEC OK (DO) bit.
By setting this bit, a resolver indicates that it is interested in also receiving the DNSSEC-related resource records necessary to validate an answer. The bit and the related procedures are defined in RFC 3225.
sourcepub fn set_dnssec_ok(&mut self, value: bool)
pub fn set_dnssec_ok(&mut self, value: bool)
Sets the DNSSEC OK (DO) bit to the given value.
source§impl<'a, Target: Composer> OptBuilder<'a, Target>
impl<'a, Target: Composer> OptBuilder<'a, Target>
sourcepub fn dau(&mut self, algs: &impl AsRef<[SecAlg]>) -> Result<(), BuildDataError>
pub fn dau(&mut self, algs: &impl AsRef<[SecAlg]>) -> Result<(), BuildDataError>
Appends a DAU option.
The DAU option lists the DNSSEC signature algorithms the requester supports.
source§impl<'a, Target: Composer> OptBuilder<'a, Target>
impl<'a, Target: Composer> OptBuilder<'a, Target>
sourcepub fn chain(&mut self, start: impl ToDname) -> Result<(), Target::AppendError>
pub fn chain(&mut self, start: impl ToDname) -> Result<(), Target::AppendError>
Appends the CHAIN option.
The CHAIN option allows a client to request that all records that
are necessary for DNSSEC validation are included in the response.
The start
name is the longest suffix of the queried owner name
for which the client already has all necessary records.
source§impl<'a, Target: Composer> OptBuilder<'a, Target>
impl<'a, Target: Composer> OptBuilder<'a, Target>
Appends a new cookie option.
Appends a new initial client cookie.
The appened cookie will have a random client cookie portion and no
server cookie. See Cookie
for more information about cookies.
source§impl<'a, Target: Composer> OptBuilder<'a, Target>
impl<'a, Target: Composer> OptBuilder<'a, Target>
source§impl<'a, Target: Composer> OptBuilder<'a, Target>
impl<'a, Target: Composer> OptBuilder<'a, Target>
sourcepub fn extended_error<Octs: AsRef<[u8]>>(
&mut self,
code: ExtendedErrorCode,
text: Option<&Str<Octs>>,
) -> Result<(), BuildDataError>
pub fn extended_error<Octs: AsRef<[u8]>>( &mut self, code: ExtendedErrorCode, text: Option<&Str<Octs>>, ) -> Result<(), BuildDataError>
Appends an extended DNS error option.
The extended DNS error option carries additional error information in
a failed answer. The code
argument is a standardized error code
while the optional text
carries human-readable information.
The method fails if text
is too long to be part of an option or if
target runs out of space.
source§impl<'a, Target: Composer> OptBuilder<'a, Target>
impl<'a, Target: Composer> OptBuilder<'a, Target>
pub fn tcp_keepalive( &mut self, timeout: Option<IdleTimeout>, ) -> Result<(), Target::AppendError>
source§impl<'a, Target: Composer> OptBuilder<'a, Target>
impl<'a, Target: Composer> OptBuilder<'a, Target>
source§impl<'a, Target: Composer> OptBuilder<'a, Target>
impl<'a, Target: Composer> OptBuilder<'a, Target>
sourcepub fn nsid(
&mut self,
data: &(impl AsRef<[u8]> + ?Sized),
) -> Result<(), BuildDataError>
pub fn nsid( &mut self, data: &(impl AsRef<[u8]> + ?Sized), ) -> Result<(), BuildDataError>
Appends an NSID option with the given server identifier.
The NSID option contains an identifier for the name server that processed a query.
In a request, the option can be included to request the server to
include its server identifier. In this case, the data should be
empty. You can use client_nsid
to easily
append this version of the option.
sourcepub fn client_nsid(&mut self) -> Result<(), Target::AppendError>
pub fn client_nsid(&mut self) -> Result<(), Target::AppendError>
Appends the client version of an NSID option.
If included by a client, the NSID option requests that the server returns its name server identifier via the NSID option in a response. In this case, the option must be empty. This method creates such an empty NSID option.