#[repr(C)]pub struct DnsHeader {
pub id: u16,
pub flags: u16,
pub qdcount: u16,
pub ancount: u16,
pub nscount: u16,
pub arcount: u16,
}Expand description
Fixed 12-byte DNS message header (RFC 1035 §4.1.1).
Fields§
§id: u16§flags: u16§qdcount: u16§ancount: u16§nscount: u16§arcount: u16Implementations§
Source§impl DnsHeader
impl DnsHeader
pub const SIZE: usize = 12
Sourcepub fn new_query(id: u16, recursion_desired: bool) -> Self
pub fn new_query(id: u16, recursion_desired: bool) -> Self
Builds a query header with id and RD flag.
Sourcepub fn encode(&self, out: &mut [u8]) -> Result<usize, &'static str>
pub fn encode(&self, out: &mut [u8]) -> Result<usize, &'static str>
Encodes the 12-byte header into out; error on short buffer.
Sourcepub fn decode(src: &[u8]) -> Result<Self, &'static str>
pub fn decode(src: &[u8]) -> Result<Self, &'static str>
Decodes a 12-byte header; error on truncation.
Sourcepub fn is_response(&self) -> bool
pub fn is_response(&self) -> bool
QR flag — true for responses.
Sourcepub fn is_authenticated_data(&self) -> bool
pub fn is_authenticated_data(&self) -> bool
AD flag.
Trait Implementations§
impl Copy for DnsHeader
impl Eq for DnsHeader
impl StructuralPartialEq for DnsHeader
Auto Trait Implementations§
impl Freeze for DnsHeader
impl RefUnwindSafe for DnsHeader
impl Send for DnsHeader
impl Sync for DnsHeader
impl Unpin for DnsHeader
impl UnsafeUnpin for DnsHeader
impl UnwindSafe for DnsHeader
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more