Show / Hide Table of Contents

Class ResourceRecord

Contains some information on the named resource.

Inheritance
Object
DnsObject
ResourceRecord
AddressRecord
AFSDBRecord
CNAMERecord
DNAMERecord
DNSKEYRecord
DSRecord
HINFORecord
MXRecord
NSEC3PARAMRecord
NSEC3Record
NSECRecord
NSRecord
NULLRecord
OPTRecord
PTRRecord
RPRecord
RRSIGRecord
SOARecord
SRVRecord
TKEYRecord
TSIGRecord
TXTRecord
UnknownRecord
Implements
IWireSerialiser
ICloneable
IPresentationSerialiser
Inherited Members
DnsObject.CreationTime
DnsObject.Length()
DnsObject.Clone()
DnsObject.Clone<T>()
DnsObject.Read(Byte[])
DnsObject.Read(Byte[], Int32, Int32)
DnsObject.Read(Stream)
DnsObject.ToByteArray()
DnsObject.Write(Stream)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetType()
Object.MemberwiseClone()
Namespace: Makaretu.Dns
Assembly: Makaretu.Dns.dll
Syntax
public class ResourceRecord : DnsObject, IWireSerialiser, ICloneable, IPresentationSerialiser
Remarks

The ResourceRegistry contains the metadata on known resource records. When reading, if the registry does not contain the record, then an UnknownRecord is used.

Fields

| Improve this Doc View Source

DefaultHostTTL

The default time interval that a resource record containing a host name maybe cached.

Declaration
public static TimeSpan DefaultHostTTL
Field Value
Type Description
TimeSpan

Defaults to 1 day.

Remarks

Host names are in A, AAAA, and HINFO records.

| Improve this Doc View Source

DefaultTTL

The default time interval that a resource record maybe cached.

Declaration
public static TimeSpan DefaultTTL
Field Value
Type Description
TimeSpan

Defaults to 1 day.

Properties

| Improve this Doc View Source

CanonicalName

The canonical form of the owner name.

Declaration
public string CanonicalName { get; }
Property Value
Type Description
String
Remarks

All uppercase US-ASCII letters in the Name are replaced by the corresponding lowercase US-ASCII letters.

| Improve this Doc View Source

Class

One of the RR CLASS codes.

Declaration
public DnsClass Class { get; set; }
Property Value
Type Description
DnsClass

Defaults to IN.

| Improve this Doc View Source

Name

An owner name, i.e., the name of the node to which this resource record pertains.

Declaration
public DomainName Name { get; set; }
Property Value
Type Description
DomainName
| Improve this Doc View Source

TTL

Specifies the time interval that the resource record may be cached before the source of the information should again be consulted.

Declaration
public TimeSpan TTL { get; set; }
Property Value
Type Description
TimeSpan

The resolution is 1 second. Defaults to 1 day.

Remarks

Zero values are interpreted to mean that the RR can only be used for the transaction in progress, and should not be cached.

See Also
DefaultTTL
| Improve this Doc View Source

Type

One of the RR TYPE codes.

Declaration
public DnsType Type { get; set; }
Property Value
Type Description
DnsType

Methods

| Improve this Doc View Source

Equals(Object)

Determines if the specified object is equal to the current object.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
Object obj

The object to compare.

Returns
Type Description
Boolean

true if the specified object is equal to the current object; otherwise, false.

Overrides
Object.Equals(Object)
Remarks

Two Resource Records are considered equal if their Name, Class, Type and GetData() are equal. Note that the TTL field is explicitly excluded from the comparison.

| Improve this Doc View Source

GetData()

The resource specific data.

Declaration
public byte[] GetData()
Returns
Type Description
Byte[]

A byte array, never null.

Remarks

This is referred to as the RDATA in the DNS spec.

| Improve this Doc View Source

GetDataLength()

The length of the resource specific data.

Declaration
public int GetDataLength()
Returns
Type Description
Int32

Number of bytes to represent the resource specific data.

Remarks

This is referred to as the RDLENGTH in the DNS spec.

| Improve this Doc View Source

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
Int32
Overrides
Object.GetHashCode()
| Improve this Doc View Source

IsExpired(Nullable<DateTime>)

Determines if the TTL has expired.

Declaration
public bool IsExpired(DateTime? from = default(DateTime? ))
Parameters
Type Name Description
Nullable<DateTime> from

The time to compare against. If null, the default value, then Now is used.

Returns
Type Description
Boolean

true if the resource is no longer valid; otherwise false.

| Improve this Doc View Source

Read(PresentationReader)

Reads the text representation of a resource record.

Declaration
public ResourceRecord Read(PresentationReader reader)
Parameters
Type Name Description
PresentationReader reader

The source of the ResourceRecord.

Returns
Type Description
ResourceRecord

The final resource record.

Remarks

Reading a ResourceRecord will return a new instance that is type specific

| Improve this Doc View Source

Read(WireReader)

Reads the DNS object that is encoded in the wire format.

Declaration
public override IWireSerialiser Read(WireReader reader)
Parameters
Type Name Description
WireReader reader

The source of the DNS object.

Returns
Type Description
IWireSerialiser

The final DNS object.

Overrides
DnsObject.Read(WireReader)
Remarks

Reading a ResourceRecord will return a new instance that is type specific unless the GetDataLength() is zero.

| Improve this Doc View Source

Read(String)

Create a new ResourceRecord from the specified string.

Declaration
public ResourceRecord Read(string text)
Parameters
Type Name Description
String text

The presentation format.

Returns
Type Description
ResourceRecord
| Improve this Doc View Source

ReadData(PresentationReader)

Read the textual representation of the data that is specific to the resource record Type.

Declaration
public virtual void ReadData(PresentationReader reader)
Parameters
Type Name Description
PresentationReader reader

The source of the resource record's data.

Remarks

Derived classes must implement this method.

| Improve this Doc View Source

ReadData(WireReader, Int32)

Read the data that is specific to the resource record Type.

Declaration
public virtual void ReadData(WireReader reader, int length)
Parameters
Type Name Description
WireReader reader

The source of the resource record's data.

Int32 length

The length, in bytes, of the data.

Remarks

Derived classes must implement this method.

| Improve this Doc View Source

ToString()

Returns the textual representation.

Declaration
public override string ToString()
Returns
Type Description
String

The presentation format of this resource record.

Overrides
Object.ToString()
| Improve this Doc View Source

Write(PresentationWriter)

Writes the text representation of a resource record.

Declaration
public void Write(PresentationWriter writer)
Parameters
Type Name Description
PresentationWriter writer

The destination of the ResourceRecord.

| Improve this Doc View Source

Write(WireWriter)

Writes the DNS object encoded in the wire format.

Declaration
public override void Write(WireWriter writer)
Parameters
Type Name Description
WireWriter writer

The destination of the DNS object.

Overrides
DnsObject.Write(WireWriter)
| Improve this Doc View Source

WriteData(PresentationWriter)

Write the textual representation of the data that is specific to the resource record.

Declaration
public virtual void WriteData(PresentationWriter writer)
Parameters
Type Name Description
PresentationWriter writer

The destination for the resource record's data.

Remarks

Derived classes should implement this method.

By default, this will write the hex encoding of the GetData() preceeded by "#" and the number integer bytes.

| Improve this Doc View Source

WriteData(WireWriter)

Write the data that is specific to the resource record Type.

Declaration
public virtual void WriteData(WireWriter writer)
Parameters
Type Name Description
WireWriter writer

The destination for the DNS object's data.

Remarks

Derived classes must implement this method.

Operators

| Improve this Doc View Source

Equality(ResourceRecord, ResourceRecord)

Value equality.

Declaration
public static bool operator ==(ResourceRecord a, ResourceRecord b)
Parameters
Type Name Description
ResourceRecord a
ResourceRecord b
Returns
Type Description
Boolean
Remarks

Two Resource Records are considered equal if their Name, Class, Type and data fields are equal. Note that the TTL field is explicitly excluded from the comparison.

| Improve this Doc View Source

Inequality(ResourceRecord, ResourceRecord)

Value inequality.

Declaration
public static bool operator !=(ResourceRecord a, ResourceRecord b)
Parameters
Type Name Description
ResourceRecord a
ResourceRecord b
Returns
Type Description
Boolean
Remarks

Two Resource Records are considered equal if their Name, Class, Type and data fields are equal. Note that the TTL field is explicitly excluded from the comparison.

Implements

IWireSerialiser
System.ICloneable
IPresentationSerialiser
  • Improve this Doc
  • View Source
Back to top Generated by DocFX