Skip to main content

DnsRData

Enum DnsRData 

Source
pub enum DnsRData {
Show 26 variants A(Ipv4Addr), AAAA(Ipv6Addr), NS(DnsName), CNAME(DnsName), PTR(DnsName), DNAME(DnsName), MX { preference: u16, exchange: DnsName, }, TXT(Vec<Vec<u8>>), SOA { mname: DnsName, rname: DnsName, serial: u32, refresh: u32, retry: u32, expire: u32, minimum: u32, }, SRV { priority: u16, weight: u16, port: u16, target: DnsName, }, HINFO { cpu: Vec<u8>, os: Vec<u8>, }, NAPTR { order: u16, preference: u16, flags: Vec<u8>, services: Vec<u8>, regexp: Vec<u8>, replacement: DnsName, }, SVCB { priority: u16, target: DnsName, params: Vec<SvcParam>, }, HTTPS { priority: u16, target: DnsName, params: Vec<SvcParam>, }, CAA { flags: u8, tag: String, value: Vec<u8>, }, RRSIG { type_covered: u16, algorithm: u8, labels: u8, original_ttl: u32, sig_expiration: u32, sig_inception: u32, key_tag: u16, signer_name: DnsName, signature: Vec<u8>, }, NSEC { next_domain: DnsName, type_bitmaps: Vec<u16>, }, NSEC3 { hash_algorithm: u8, flags: u8, iterations: u16, salt: Vec<u8>, next_hashed: Vec<u8>, type_bitmaps: Vec<u16>, }, NSEC3PARAM { hash_algorithm: u8, flags: u8, iterations: u16, salt: Vec<u8>, }, DNSKEY { flags: u16, protocol: u8, algorithm: u8, public_key: Vec<u8>, }, DS { key_tag: u16, algorithm: u8, digest_type: u8, digest: Vec<u8>, }, DLV { key_tag: u16, algorithm: u8, digest_type: u8, digest: Vec<u8>, }, TSIG { algorithm_name: DnsName, time_signed: u64, fudge: u16, mac: Vec<u8>, original_id: u16, error: u16, other_data: Vec<u8>, }, TLSA { usage: u8, selector: u8, matching_type: u8, cert_data: Vec<u8>, }, OPT(Vec<EdnsOption>), Unknown { rtype: u16, data: Vec<u8>, },
}
Expand description

Parsed DNS resource record data.

Each variant corresponds to one or more DNS RR types and contains the fully parsed fields of that record’s RDATA section.

Variants§

§

A(Ipv4Addr)

A record: IPv4 address (RFC 1035).

§

AAAA(Ipv6Addr)

AAAA record: IPv6 address (RFC 3596).

§

NS(DnsName)

NS record: authoritative name server (RFC 1035).

§

CNAME(DnsName)

CNAME record: canonical name alias (RFC 1035).

§

PTR(DnsName)

PTR record: pointer to a domain name (RFC 1035).

§

DNAME(DnsName)

DNAME record: delegation of a subtree (RFC 6672).

§

MX

MX record: mail exchange (RFC 1035).

Fields

§preference: u16
§exchange: DnsName
§

TXT(Vec<Vec<u8>>)

TXT record: text strings (RFC 1035). Contains multiple character-strings, each up to 255 bytes.

§

SOA

SOA record: start of authority (RFC 1035).

Fields

§mname: DnsName
§rname: DnsName
§serial: u32
§refresh: u32
§retry: u32
§expire: u32
§minimum: u32
§

SRV

SRV record: service location (RFC 2782).

Fields

§priority: u16
§weight: u16
§port: u16
§target: DnsName
§

HINFO

HINFO record: host information (RFC 1035).

Fields

§cpu: Vec<u8>
§os: Vec<u8>
§

NAPTR

NAPTR record: naming authority pointer (RFC 3403).

Fields

§order: u16
§preference: u16
§flags: Vec<u8>
§services: Vec<u8>
§regexp: Vec<u8>
§replacement: DnsName
§

SVCB

SVCB record: service binding (RFC 9460).

Fields

§priority: u16
§target: DnsName
§params: Vec<SvcParam>
§

HTTPS

HTTPS record: HTTPS service binding (RFC 9460).

Fields

§priority: u16
§target: DnsName
§params: Vec<SvcParam>
§

CAA

CAA record: certificate authority authorization (RFC 8659).

Fields

§flags: u8
§value: Vec<u8>
§

RRSIG

RRSIG record: DNSSEC signature (RFC 4034).

Fields

§type_covered: u16
§algorithm: u8
§labels: u8
§original_ttl: u32
§sig_expiration: u32
§sig_inception: u32
§key_tag: u16
§signer_name: DnsName
§signature: Vec<u8>
§

NSEC

NSEC record: authenticated denial of existence (RFC 4034).

Fields

§next_domain: DnsName
§type_bitmaps: Vec<u16>
§

NSEC3

NSEC3 record: hashed authenticated denial of existence (RFC 5155).

Fields

§hash_algorithm: u8
§flags: u8
§iterations: u16
§salt: Vec<u8>
§next_hashed: Vec<u8>
§type_bitmaps: Vec<u16>
§

NSEC3PARAM

NSEC3PARAM record: NSEC3 parameters (RFC 5155).

Fields

§hash_algorithm: u8
§flags: u8
§iterations: u16
§salt: Vec<u8>
§

DNSKEY

DNSKEY record: DNSSEC public key (RFC 4034).

Fields

§flags: u16
§protocol: u8
§algorithm: u8
§public_key: Vec<u8>
§

DS

DS record: delegation signer (RFC 4034).

Fields

§key_tag: u16
§algorithm: u8
§digest_type: u8
§digest: Vec<u8>
§

DLV

DLV record: DNSSEC lookaside validation (RFC 4431).

Fields

§key_tag: u16
§algorithm: u8
§digest_type: u8
§digest: Vec<u8>
§

TSIG

TSIG record: transaction signature (RFC 8945).

Fields

§algorithm_name: DnsName
§time_signed: u64
§fudge: u16
§mac: Vec<u8>
§original_id: u16
§error: u16
§other_data: Vec<u8>
§

TLSA

TLSA record: TLS authentication (RFC 6698).

Fields

§usage: u8
§selector: u8
§matching_type: u8
§cert_data: Vec<u8>
§

OPT(Vec<EdnsOption>)

OPT pseudo-record: EDNS(0) options (RFC 6891).

§

Unknown

Unknown/unsupported record type.

Fields

§rtype: u16
§data: Vec<u8>

Implementations§

Source§

impl DnsRData

Source

pub fn parse( rtype: u16, packet: &[u8], rdata_offset: usize, rdlength: u16, ) -> Result<Self, FieldError>

Parse RDATA from wire format.

§Arguments
  • rtype - DNS record type number
  • packet - Full DNS packet buffer (needed for name compression pointer resolution)
  • rdata_offset - Byte offset where RDATA begins in packet
  • rdlength - Length of RDATA in bytes
Source

pub fn build(&self) -> Vec<u8>

Serialize RDATA to wire format without DNS name compression.

Source

pub fn build_compressed( &self, offset: usize, map: &mut HashMap<String, u16>, ) -> Vec<u8>

Serialize RDATA to wire format with DNS name compression.

§Arguments
  • offset - Byte offset where this RDATA will be placed in the packet. Used to record name positions in the compression map.
  • map - Compression map tracking previously written domain names and their offsets.
Source

pub fn summary(&self) -> String

Get a human-readable summary of this RDATA.

Trait Implementations§

Source§

impl Clone for DnsRData

Source§

fn clone(&self) -> DnsRData

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 DnsRData

Source§

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

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

impl PartialEq for DnsRData

Source§

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

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

Source§

type Output = T

Should always be Self
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