Message

Struct Message 

Source
pub struct Message {
Show 15 fields pub type: i32, pub socket_family: Option<i32>, pub socket_protocol: Option<i32>, pub query_address: Option<Vec<u8>>, pub response_address: Option<Vec<u8>>, pub query_port: Option<u32>, pub response_port: Option<u32>, pub query_time_sec: Option<u64>, pub query_time_nsec: Option<u32>, pub query_message: Option<Vec<u8>>, pub query_zone: Option<Vec<u8>>, pub response_time_sec: Option<u64>, pub response_time_nsec: Option<u32>, pub response_message: Option<Vec<u8>>, pub policy: Option<Policy>,
}
Expand description

Message: a wire-format (RFC 1035 section 4) DNS message and associated metadata. Applications generating “Message” payloads should follow certain requirements based on the MessageType, see below.

Fields§

§type: i32

One of the Type values described above.

§socket_family: Option<i32>

One of the SocketFamily values described above.

§socket_protocol: Option<i32>

One of the SocketProtocol values described above.

§query_address: Option<Vec<u8>>

The network address of the message initiator. For SocketFamily INET, this field is 4 octets (IPv4 address). For SocketFamily INET6, this field is 16 octets (IPv6 address).

§response_address: Option<Vec<u8>>

The network address of the message responder. For SocketFamily INET, this field is 4 octets (IPv4 address). For SocketFamily INET6, this field is 16 octets (IPv6 address).

§query_port: Option<u32>

The transport port of the message initiator. This is a 16-bit UDP or TCP port number, depending on SocketProtocol.

§response_port: Option<u32>

The transport port of the message responder. This is a 16-bit UDP or TCP port number, depending on SocketProtocol.

§query_time_sec: Option<u64>

The time at which the DNS query message was sent or received, depending on whether this is an AUTH_QUERY, RESOLVER_QUERY, or CLIENT_QUERY. This is the number of seconds since the UNIX epoch.

§query_time_nsec: Option<u32>

The time at which the DNS query message was sent or received. This is the seconds fraction, expressed as a count of nanoseconds.

§query_message: Option<Vec<u8>>

The initiator’s original wire-format DNS query message, verbatim.

§query_zone: Option<Vec<u8>>

The “zone” or “bailiwick” pertaining to the DNS query message. This is a wire-format DNS domain name.

§response_time_sec: Option<u64>

The time at which the DNS response message was sent or received, depending on whether this is an AUTH_RESPONSE, RESOLVER_RESPONSE, or CLIENT_RESPONSE. This is the number of seconds since the UNIX epoch.

§response_time_nsec: Option<u32>

The time at which the DNS response message was sent or received. This is the seconds fraction, expressed as a count of nanoseconds.

§response_message: Option<Vec<u8>>

The responder’s original wire-format DNS response message, verbatim.

§policy: Option<Policy>

Operator policy applied to the processing of this message, if any.

Implementations§

Source§

impl Message

Source

pub fn type(&self) -> Type

Returns the enum value of type, or the default if the field is set to an invalid enum value.

Source

pub fn set_type(&mut self, value: Type)

Sets type to the provided enum value.

Source

pub fn socket_family(&self) -> SocketFamily

Returns the enum value of socket_family, or the default if the field is unset or set to an invalid enum value.

Source

pub fn set_socket_family(&mut self, value: SocketFamily)

Sets socket_family to the provided enum value.

Source

pub fn socket_protocol(&self) -> SocketProtocol

Returns the enum value of socket_protocol, or the default if the field is unset or set to an invalid enum value.

Source

pub fn set_socket_protocol(&mut self, value: SocketProtocol)

Sets socket_protocol to the provided enum value.

Source

pub fn query_address(&self) -> &[u8]

Returns the value of query_address, or the default value if query_address is unset.

Source

pub fn response_address(&self) -> &[u8]

Returns the value of response_address, or the default value if response_address is unset.

Source

pub fn query_port(&self) -> u32

Returns the value of query_port, or the default value if query_port is unset.

Source

pub fn response_port(&self) -> u32

Returns the value of response_port, or the default value if response_port is unset.

Source

pub fn query_time_sec(&self) -> u64

Returns the value of query_time_sec, or the default value if query_time_sec is unset.

Source

pub fn query_time_nsec(&self) -> u32

Returns the value of query_time_nsec, or the default value if query_time_nsec is unset.

Source

pub fn query_message(&self) -> &[u8]

Returns the value of query_message, or the default value if query_message is unset.

Source

pub fn query_zone(&self) -> &[u8]

Returns the value of query_zone, or the default value if query_zone is unset.

Source

pub fn response_time_sec(&self) -> u64

Returns the value of response_time_sec, or the default value if response_time_sec is unset.

Source

pub fn response_time_nsec(&self) -> u32

Returns the value of response_time_nsec, or the default value if response_time_nsec is unset.

Source

pub fn response_message(&self) -> &[u8]

Returns the value of response_message, or the default value if response_message is unset.

Trait Implementations§

Source§

impl Clone for Message

Source§

fn clone(&self) -> Message

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Message

Source§

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

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

impl Default for Message

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Message for Message

Source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
Source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
Source§

fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
where B: BufMut, Self: Sized,

Encodes the message to a buffer. Read more
Source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
Source§

fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
where B: BufMut, Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
Source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
Source§

fn decode<B>(buf: B) -> Result<Self, DecodeError>
where B: Buf, Self: Default,

Decodes an instance of the message from a buffer. Read more
Source§

fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
where B: Buf, Self: Default,

Decodes a length-delimited instance of the message from the buffer.
Source§

fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
where B: Buf, Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
Source§

fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
where B: Buf, Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
Source§

impl PartialEq for Message

Source§

fn eq(&self, other: &Message) -> 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 StructuralPartialEq for Message

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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§

fn octets_into(self) -> Result<Target, ShortBuf>

Performs the conversion.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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