Skip to main content

MessageRequest

Struct MessageRequest 

Source
pub struct MessageRequest {
    pub metadata: Metadata,
    pub queries: Queries,
    pub answers: Vec<Record>,
    pub authorities: Vec<Record>,
    pub additionals: Vec<Record>,
    pub signature: Option<Box<Record<TSIG>>>,
    pub edns: Option<Edns>,
}
Expand description

A Message which captures the data from an inbound request

Fields§

§metadata: Metadata

Metadata from the message header

§queries: Queries

Query name and other query parameters

§answers: Vec<Record>

Records which directly answer the query

§authorities: Vec<Record>

Records with describe other authoritative servers

May optionally carry the SOA record for the authoritative data in the answer section.

§additionals: Vec<Record>

Records which may be helpful in using the records in the other sections

§signature: Option<Box<Record<TSIG>>>

TSIG signature for the message, if any

§edns: Option<Edns>

RFC 6891, EDNS(0) Extensions, April 2013

6.1.1.  Basic Elements

 An OPT pseudo-RR (sometimes called a meta-RR) MAY be added to the
 additional data section of a request.

 The OPT RR has RR type 41.

 If an OPT record is present in a received request, compliant
 responders MUST include an OPT record in their respective responses.

 An OPT record does not carry any DNS data.  It is used only to
 contain control information pertaining to the question-and-answer
 sequence of a specific transaction.  OPT RRs MUST NOT be cached,
 forwarded, or stored in or loaded from Zone Files.

 The OPT RR MAY be placed anywhere within the additional data section.
 When an OPT RR is included within any DNS message, it MUST be the
 only OPT RR in that message.  If a query message with more than one
 OPT RR is received, a FORMERR (RCODE=1) MUST be returned.  The
 placement flexibility for the OPT RR does not override the need for
 the TSIG or SIG(0) RRs to be the last in the additional section
 whenever they are present.

§Return value

Optionally returns a reference to EDNS OPT pseudo-RR

Implementations§

Source§

impl MessageRequest

Source

pub fn mock(metadata: Metadata, query: impl Into<LowerQuery>) -> Self

Available on crate features testing only.

Construct a mock MessageRequest for testing purposes

The unspecified fields are left empty.

Source

pub fn max_payload(&self) -> u16

§Return value

the max payload value as it’s defined in the EDNS OPT pseudo-RR.

Source

pub fn version(&self) -> u8

§Return value

the version as defined in the EDNS record

Trait Implementations§

Source§

impl BinEncodable for MessageRequest

Source§

fn emit(&self, encoder: &mut BinEncoder<'_>) -> Result<(), ProtoError>

Write the type to the stream
Source§

fn to_bytes(&self) -> Result<Vec<u8>, ProtoError>

Returns the object in binary form
Source§

impl Debug for MessageRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for MessageRequest

Source§

fn eq(&self, other: &MessageRequest) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl UpdateRequest for MessageRequest

Source§

fn id(&self) -> u16

Id of the Message
Source§

fn zone(&self) -> Result<&LowerQuery, LookupError>

Zone being updated, this should be the query of a Message
Source§

fn prerequisites(&self) -> &[Record]

Prerequisites map to the Answer section of a Message
Source§

fn updates(&self) -> &[Record]

Records to update map to the Authority section of a Message
Source§

fn additionals(&self) -> &[Record]

Additional records
Source§

fn signature(&self) -> Option<&Record<TSIG>>

Signature for verifying the Message
Source§

impl StructuralPartialEq for MessageRequest

Auto Trait Implementations§

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<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
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