[−][src]Struct trust_dns_proto::rr::resource::Record
Resource records are storage value in DNS, into which all key/value pair data is stored.
RFC 1035, DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION, November 1987
4.1.3. Resource record format
The answer, authority, and additional sections all share the same
format: a variable number of resource records, where the number of
records is specified in the corresponding count field in the header.
Each resource record has the following format:
1 1 1 1 1 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| |
/ /
/ NAME /
| |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| TYPE |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| CLASS |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| TTL |
| |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| RDLENGTH |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
/ RDATA /
/ /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Methods
impl Record
[src]
pub fn new() -> Record
[src]
Creates a default record, use the setters to build a more useful object.
There are no optional elements in this object, defaults are an empty name, type A, class IN, ttl of 0 and the 0.0.0.0 ip address.
pub fn with(name: Name, rr_type: RecordType, ttl: u32) -> Record
[src]
Create a record with the specified initial values.
Arguments
name
- name of the resource recordsrr_type
- the record typettl
- time-to-live is the amount of time this record should be cached before refreshing
pub fn from_rdata(name: Name, ttl: u32, rdata: RData) -> Record
[src]
Create a record with the specified initial values.
Arguments
name
- name of the resource recordsttl
- time-to-live is the amount of time this record should be cached before refreshingrdata
- record data to associate with the Record
pub fn set_name(&mut self, name: Name) -> &mut Self
[src]
NAME a domain name to which this resource record pertains.
pub fn set_rr_type(&mut self, rr_type: RecordType) -> &mut Self
[src]
TYPE two octets containing one of the RR type codes. This
field specifies the meaning of the data in the RDATA
field.
pub fn set_record_type(&mut self, rr_type: RecordType) -> &mut Self
[src]
TYPE two octets containing one of the RR type codes. This
field specifies the meaning of the data in the RDATA
field.
pub fn set_dns_class(&mut self, dns_class: DNSClass) -> &mut Self
[src]
CLASS two octets which specify the class of the data in the
RDATA field.
pub fn set_ttl(&mut self, ttl: u32) -> &mut Self
[src]
TTL a 32 bit unsigned integer that specifies the time
interval (in seconds) that the resource record may be
cached before it should be discarded. Zero values are
interpreted to mean that the RR can only be used for the
transaction in progress, and should not be cached.
pub fn set_rdata(&mut self, rdata: RData) -> &mut Self
[src]
RDATA a variable length string of octets that describes the
resource. The format of this information varies
according to the TYPE and CLASS of the resource record.
For example, the if the TYPE is A and the CLASS is IN,
the RDATA field is a 4 octet ARPA Internet address.
pub fn name(&self) -> &Name
[src]
Returns the name of the record
pub fn rr_type(&self) -> RecordType
[src]
Returns the type of the RData in the record
pub fn record_type(&self) -> RecordType
[src]
Returns the type of the RecordData in the record
pub fn dns_class(&self) -> DNSClass
[src]
Returns the DNSClass of the Record, generally IN fro internet
pub fn ttl(&self) -> u32
[src]
Returns the time-to-live of the record, for caching purposes
pub fn rdata(&self) -> &RData
[src]
Returns the Record Data, i.e. the record information
pub fn rdata_mut(&mut self) -> &mut RData
[src]
Returns a mutable reference to the Record Data
pub fn unwrap_rdata(self) -> RData
[src]
Returns the RData consuming the Record
Trait Implementations
impl IntoRecordSet for Record
[src]
fn into_record_set(self) -> RecordSet
[src]
impl BinEncodable for Record
[src]
fn emit(&self, encoder: &mut BinEncoder) -> ProtoResult<()>
[src]
fn to_bytes(&self) -> ProtoResult<Vec<u8>>
[src]
Returns the object in binary form
impl<'r> BinDecodable<'r> for Record
[src]
fn read(decoder: &mut BinDecoder<'r>) -> ProtoResult<Record>
[src]
parse a resource record line example: WARNING: the record_bytes is 100% consumed and destroyed in this parsing process
fn from_bytes(bytes: &'r [u8]) -> ProtoResult<Self>
[src]
Returns the object in binary form
impl PartialEq<Record> for Record
[src]
fn eq(&self, other: &Self) -> bool
[src]
Equality or records, as defined by RFC 2136, DNS Update, April 1997
1.1.1. Two RRs are considered equal if their NAME, CLASS, TYPE,
RDLENGTH and RDATA fields are equal. Note that the time-to-live
(TTL) field is explicitly excluded from the comparison.
1.1.2. The rules for comparison of character strings in names are
specified in [RFC1035 2.3.3]. i.e. case insensitive
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'a> From<&'a Record> for Edns
[src]
impl<'a> From<&'a Edns> for Record
[src]
fn from(value: &'a Edns) -> Record
[src]
This returns a Resource Record that is formatted for Edns(0). Note: the rcode_high value is only part of the rcode, the rest is part of the base
impl From<Record> for RecordSet
[src]
impl Clone for Record
[src]
fn clone(&self) -> Record
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Ord for Record
[src]
fn cmp(&self, other: &Record) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Restrict a value to a certain interval. Read more
impl Default for Record
[src]
impl Eq for Record
[src]
impl PartialOrd<Record> for Record
[src]
fn partial_cmp(&self, other: &Record) -> Option<Ordering>
[src]
Canonical ordering as defined by RFC 4034, DNSSEC Resource Records, March 2005
6.2. Canonical RR Form
For the purposes of DNS security, the canonical form of an RR is the
wire format of the RR where:
1. every domain name in the RR is fully expanded (no DNS name
compression) and fully qualified;
2. all uppercase US-ASCII letters in the owner name of the RR are
replaced by the corresponding lowercase US-ASCII letters;
3. if the type of the RR is NS, MD, MF, CNAME, SOA, MB, MG, MR, PTR,
HINFO, MINFO, MX, HINFO, RP, AFSDB, RT, SIG, PX, NXT, NAPTR, KX,
SRV, DNAME, A6, RRSIG, or NSEC, all uppercase US-ASCII letters in
the DNS names contained within the RDATA are replaced by the
corresponding lowercase US-ASCII letters;
4. if the owner name of the RR is a wildcard name, the owner name is
in its original unexpanded form, including the "*" label (no
wildcard substitution); and
5. the RR's TTL is set to its original value as it appears in the
originating authoritative zone or the Original TTL field of the
covering RRSIG RR.
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Debug for Record
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,