DnsRecordExt

Trait DnsRecordExt 

Source
pub trait DnsRecordExt: Debug {
Show 22 methods // Required methods fn get_record(&self) -> &DnsRecord; fn get_record_mut(&mut self) -> &mut DnsRecord; fn write(&self, packet: &mut DnsOutPacket); fn any(&self) -> &dyn Any; fn matches(&self, other: &dyn DnsRecordExt) -> bool; fn rrdata_match(&self, other: &dyn DnsRecordExt) -> bool; fn compare_rdata(&self, other: &dyn DnsRecordExt) -> Ordering; fn rdata_print(&self) -> String; fn clone_box(&self) -> DnsRecordBox; // Provided methods fn compare(&self, other: &dyn DnsRecordExt) -> Ordering { ... } fn get_class(&self) -> u16 { ... } fn get_cache_flush(&self) -> bool { ... } fn get_name(&self) -> &str { ... } fn get_type(&self) -> RRType { ... } fn reset_ttl(&mut self, other: &dyn DnsRecordExt) { ... } fn get_created(&self) -> u64 { ... } fn get_expire(&self) -> u64 { ... } fn set_expire(&mut self, expire_at: u64) { ... } fn set_expire_sooner(&mut self, expire_at: u64) { ... } fn updated_refresh_time(&mut self, now: u64) -> Option<u64> { ... } fn suppressed_by_answer(&self, other: &dyn DnsRecordExt) -> bool { ... } fn suppressed_by(&self, msg: &DnsIncoming) -> bool { ... }
}
Expand description

Common methods for DNS resource records.

Required Methods§

Source

fn get_record(&self) -> &DnsRecord

Source

fn get_record_mut(&mut self) -> &mut DnsRecord

Source

fn write(&self, packet: &mut DnsOutPacket)

Source

fn any(&self) -> &dyn Any

Source

fn matches(&self, other: &dyn DnsRecordExt) -> bool

Returns whether other record is considered the same except TTL.

Source

fn rrdata_match(&self, other: &dyn DnsRecordExt) -> bool

Returns whether other record has the same rdata.

Source

fn compare_rdata(&self, other: &dyn DnsRecordExt) -> Ordering

Returns the result based on a byte-level comparison of rdata. If other is not valid, returns Greater.

Source

fn rdata_print(&self) -> String

Returns a human-readable string of rdata.

Source

fn clone_box(&self) -> DnsRecordBox

Provided Methods§

Source

fn compare(&self, other: &dyn DnsRecordExt) -> Ordering

Returns the result based on “lexicographically later” defined below.

Source

fn get_class(&self) -> u16

Returns the class only, excluding class_flush / unique bit.

Source

fn get_cache_flush(&self) -> bool

Source

fn get_name(&self) -> &str

Return the new name if exists, otherwise the regular name in DnsEntry.

Source

fn get_type(&self) -> RRType

Source

fn reset_ttl(&mut self, other: &dyn DnsRecordExt)

Resets TTL using other record. self.refresh and self.expires are also reset.

Source

fn get_created(&self) -> u64

Source

fn get_expire(&self) -> u64

Source

fn set_expire(&mut self, expire_at: u64)

Source

fn set_expire_sooner(&mut self, expire_at: u64)

Set expire as expire_at if it is sooner than the current expire.

Source

fn updated_refresh_time(&mut self, now: u64) -> Option<u64>

Given now, if the record is due to refresh, this method updates the refresh time and returns the new refresh time. Otherwise, returns None.

Source

fn suppressed_by_answer(&self, other: &dyn DnsRecordExt) -> bool

Returns true if another record has matched content, and if its TTL is at least half of this record’s.

Source

fn suppressed_by(&self, msg: &DnsIncoming) -> bool

Required by RFC 6762 Section 7.1: Known-Answer Suppression.

Implementors§