pub struct Flags {
pub qr: bool,
pub aa: bool,
pub tc: bool,
pub rd: bool,
pub ra: bool,
pub ad: bool,
pub cd: bool,
}
Expand description
The flags contained in the DNS message header.
This is a utility type that makes it easier to work with flags. It contains
only standard DNS message flags that are part of the Header
, i.e., EDNS
flags are not included.
This type has a text notation and can be created from it as well. Each flags that is set is represented by a two-letter token, which is the uppercase version of the flag name. If mutliple flags are set, the tokens are separated by space.
use core::str::FromStr;
use domain::base::header::Flags;
let flags = Flags::from_str("QR AA").unwrap();
assert!(flags.qr && flags.aa);
assert_eq!(format!("{}", flags), "QR AA");
Fields§
§qr: bool
The QR
bit specifies whether a message is a query (false
) or a
response (true
). In other words, this bit is actually stating whether
the message is not a query. So, perhaps it might be good to read ‘QR’
as ‘query response.’
aa: bool
Using the AA
bit, a name server generating a response states whether
it is authoritative for the requested domain name, ie., whether this
response is an authoritative answer. The field has no meaning in a
query.
tc: bool
The truncation (TC
) bit is set if there was more data available then
fit into the message. This is typically used when employing datagram
transports such as UDP to signal that the answer didn’t fit into a
response and the query should be tried again using a stream transport
such as TCP.
rd: bool
The recursion desired (RD
) bit may be set in a query to ask the name
server to try and recursively gather a response if it doesn’t have the
data available locally. The bit’s value is copied into the response.
ra: bool
In a response, the recursion available (RA
) bit denotes whether the
responding name server supports recursion. It has no meaning in a query.
ad: bool
The authentic data (AD
) bit is used by security-aware recursive name
servers to indicate that it considers all RRsets in its response are
authentic, i.e., have successfully passed DNSSEC validation.
cd: bool
The checking disabled (CD
) bit is used by a security-aware resolver
to indicate that it does not want upstream name servers to perform
verification but rather would like to verify everything itself.
Implementations§
Trait Implementations§
impl Copy for Flags
impl Eq for Flags
impl StructuralPartialEq for Flags
Auto Trait Implementations§
impl Freeze for Flags
impl RefUnwindSafe for Flags
impl Send for Flags
impl Sync for Flags
impl Unpin for Flags
impl UnwindSafe for Flags
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)