pub struct OptRecord<Octs> { /* private fields */ }
Expand description
An entire OPT record.
Because the EDNS specificiation uses parts of the header of the OPT record
to convey some information, a special record type is necessary for OPT
records. You can convert a normal record with Opt
record data into
an OptRecord
via the from_record
function.
Implementations§
source§impl<Octs> OptRecord<Octs>
impl<Octs> OptRecord<Octs>
sourcepub fn from_record<N: ToName>(record: Record<N, Opt<Octs>>) -> Self
pub fn from_record<N: ToName>(record: Record<N, Opt<Octs>>) -> Self
Converts a regular record into an OPT record
sourcepub fn as_record(&self) -> Record<&'static Name<[u8]>, Opt<&[u8]>>
pub fn as_record(&self) -> Record<&'static Name<[u8]>, Opt<&[u8]>>
Converts the OPT record into a regular record.
sourcepub fn udp_payload_size(&self) -> u16
pub fn udp_payload_size(&self) -> u16
Returns the UDP payload size.
Through this field a sender of a message can signal the maximum size of UDP payload the sender is able to handle when receiving messages. This value refers to the abilities of the sender’s DNS implementation, not such things as network MTUs. Which means that the largest UDP payload that can actually be sent back to the sender may be smaller.
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.
sourcepub fn rcode(&self, header: Header) -> OptRcode
pub fn rcode(&self, header: Header) -> OptRcode
Returns the extended rcode.
Some of the bits of the rcode are stored in the regular message header. Such a header needs to be passed to the method.
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 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.
pub fn set_dnssec_ok(&mut self, value: bool)
source§impl<Octs: Composer> OptRecord<Octs>
impl<Octs: Composer> OptRecord<Octs>
sourcepub fn push<Opt: ComposeOptData + ?Sized>(
&mut self,
option: &Opt,
) -> Result<(), BuildDataError>
pub fn push<Opt: ComposeOptData + ?Sized>( &mut self, option: &Opt, ) -> Result<(), BuildDataError>
Appends a new option to the OPT data.
sourcepub fn push_raw_option<F>(
&mut self,
code: OptionCode,
option_len: u16,
op: F,
) -> Result<(), BuildDataError>
pub fn push_raw_option<F>( &mut self, code: OptionCode, option_len: u16, op: F, ) -> Result<(), BuildDataError>
Appends a raw option to the OPT data.
The method will append an option with the given option code. The data
of the option will be written via the closure op
.
Trait Implementations§
source§impl<Octs: EmptyBuilder> Default for OptRecord<Octs>
impl<Octs: EmptyBuilder> Default for OptRecord<Octs>
source§impl<Octs, SrcOcts> OctetsFrom<OptRecord<SrcOcts>> for OptRecord<Octs>where
Octs: OctetsFrom<SrcOcts>,
impl<Octs, SrcOcts> OctetsFrom<OptRecord<SrcOcts>> for OptRecord<Octs>where
Octs: OctetsFrom<SrcOcts>,
Auto Trait Implementations§
impl<Octs> Freeze for OptRecord<Octs>where
Octs: Freeze,
impl<Octs> RefUnwindSafe for OptRecord<Octs>where
Octs: RefUnwindSafe,
impl<Octs> Send for OptRecord<Octs>where
Octs: Send,
impl<Octs> Sync for OptRecord<Octs>where
Octs: Sync,
impl<Octs> Unpin for OptRecord<Octs>where
Octs: Unpin,
impl<Octs> UnwindSafe for OptRecord<Octs>where
Octs: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)