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>

source

pub fn clone_from<T: AsRef<[u8]>>( &mut self, source: &OptRecord<T>, ) -> Result<(), Target::AppendError>

Replaces the contents of this OptBuilder with the given OptRecord`.

source

pub fn push<Opt: ComposeOptData + ?Sized>( &mut self, opt: &Opt, ) -> Result<(), Target::AppendError>

Appends an option to the OPT record.

source

pub fn push_raw_option<F>( &mut self, code: OptionCode, option_len: u16, op: F, ) -> Result<(), Target::AppendError>
where F: FnOnce(&mut Target) -> 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.

source

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.

source

pub fn set_udp_payload_size(&mut self, value: u16)

Sets the UDP payload size field of the OPT record.

source

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.

source

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.

source

pub fn version(&self) -> u8

Returns the EDNS version of the OPT header.

Only EDNS version 0 is currently defined.

source

pub fn set_version(&mut self, version: u8)

Sets the EDNS version of the OPT header.

source

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.

source

pub fn set_dnssec_ok(&mut self, value: bool)

Sets the DNSSEC OK (DO) bit to the given value.

source

pub fn as_target(&self) -> &Target

Returns a reference to the underlying octets builder.

source§

impl<'a, Target: Composer> OptBuilder<'a, Target>

source

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

pub fn dhu(&mut self, algs: &impl AsRef<[SecAlg]>) -> Result<(), BuildDataError>

Appends a DHU option.

The DHU option lists the DS hash algorithms the requester supports.

source

pub fn n3u(&mut self, algs: &impl AsRef<[SecAlg]>) -> Result<(), BuildDataError>

Appends a N3U option.

The N3U option lists the NSEC3 hash algorithms the requester supports.

source§

impl<'a, Target: Composer> OptBuilder<'a, Target>

source

pub fn chain(&mut self, start: impl ToName) -> 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>

source

pub fn cookie(&mut self, cookie: Cookie) -> Result<(), Target::AppendError>

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>

source

pub fn expire(&mut self, expire: Option<u32>) -> Result<(), Target::AppendError>

Appends the Expire option.

The Expire option allows an authoritative server to signal its own expiry time of a zone.

source§

impl<'a, Target: Composer> OptBuilder<'a, Target>

source

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>

source

pub fn tcp_keepalive( &mut self, timeout: Option<IdleTimeout>, ) -> Result<(), Target::AppendError>

source§

impl<'a, Target: Composer> OptBuilder<'a, Target>

source

pub fn key_tag( &mut self, key_tag: &KeyTag<impl AsRef<[u8]> + ?Sized>, ) -> Result<(), Target::AppendError>

Appends a edns-key-tag option.

The option contains a list of the key tags of the trust anchor keys a validating resolver is using for DNSSEC validation.

source§

impl<'a, Target: Composer> OptBuilder<'a, Target>

source

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.

source

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.

source§

impl<'a, Target: Composer> OptBuilder<'a, Target>

source

pub fn padding(&mut self, len: u16) -> Result<(), Target::AppendError>

source

pub fn random_padding(&mut self, len: u16) -> Result<(), Target::AppendError>

source§

impl<'a, Target: Composer> OptBuilder<'a, Target>

source

pub fn client_subnet( &mut self, source_prefix_len: u8, scope_prefix_len: u8, addr: IpAddr, ) -> Result<(), Target::AppendError>

Auto Trait Implementations§

§

impl<'a, Target> Freeze for OptBuilder<'a, Target>
where Target: ?Sized,

§

impl<'a, Target> RefUnwindSafe for OptBuilder<'a, Target>
where Target: RefUnwindSafe + ?Sized,

§

impl<'a, Target> Send for OptBuilder<'a, Target>
where Target: Send + ?Sized,

§

impl<'a, Target> Sync for OptBuilder<'a, Target>
where Target: Sync + ?Sized,

§

impl<'a, Target> Unpin for OptBuilder<'a, Target>
where Target: ?Sized,

§

impl<'a, Target> !UnwindSafe for OptBuilder<'a, Target>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<Source, Target> OctetsInto<Target> for Source
where Target: OctetsFrom<Source>,

source§

type Error = <Target as OctetsFrom<Source>>::Error

source§

fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>

Performs the conversion.
source§

fn octets_into(self) -> Target
where Self::Error: Into<Infallible>,

Performs an infallible conversion.
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more