Class PresentationReader
Methods to read DNS data items encoded in the presentation (text) format.
Inherited Members
Namespace: Makaretu.Dns
Assembly: Makaretu.Dns.dll
Syntax
public class PresentationReader
Constructors
| Improve this Doc View SourcePresentationReader(TextReader)
Creates a new instance of the PresentationReader using the specified TextReader.
Declaration
public PresentationReader(TextReader text)
Parameters
Type | Name | Description |
---|---|---|
TextReader | text | The source for data items. |
Fields
| Improve this Doc View SourcePosition
The reader relative position within the stream.
Declaration
public int Position
Field Value
Type | Description |
---|---|
Int32 |
Properties
| Improve this Doc View SourceOrigin
The origin domain name, sometimes called the zone name.
Declaration
public DomainName Origin { get; set; }
Property Value
Type | Description |
---|---|
DomainName | Defaults to "". |
Remarks
Origin is used when the domain name "@" is used for a domain name.
Methods
| Improve this Doc View SourceIsEndOfLine()
Determines if the reader is at the end of a line.
Declaration
public bool IsEndOfLine()
Returns
Type | Description |
---|---|
Boolean |
ReadBase64String()
Read bytes encoded in base-64.
Declaration
public byte[] ReadBase64String()
Returns
Type | Description |
---|---|
Byte[] | The bytes. |
Remarks
This must be the last field in the RDATA because the string can contain embedded spaces.
ReadByte()
Read a byte.
Declaration
public byte ReadByte()
Returns
Type | Description |
---|---|
Byte | The number as a byte. |
ReadDateTime()
Read a date/time.
Declaration
public DateTime ReadDateTime()
Returns
Type | Description |
---|---|
DateTime | The DateTime. |
Remarks
Allows a DateTime in the form "yyyyMMddHHmmss" or the number of seconds since the unix epoch (00:00:00 on 1 January 1970 UTC).
ReadDnsType()
Read a DNS Type.
Declaration
public DnsType ReadDnsType()
Returns
Type | Description |
---|---|
DnsType |
Remarks
Either the name of a DnsType or the string "TYPEx".
ReadDomainName()
Read a domain name.
Declaration
public DomainName ReadDomainName()
Returns
Type | Description |
---|---|
DomainName | The domain name as a string. |
ReadIPAddress(Int32)
Read an Internet address.
Declaration
public IPAddress ReadIPAddress(int length = 4)
Parameters
Type | Name | Description |
---|---|---|
Int32 | length | Ignored. |
Returns
Type | Description |
---|---|
IPAddress | An IPAddress. |
ReadResourceData()
Read hex encoded RDATA.
Declaration
public byte[] ReadResourceData()
Returns
Type | Description |
---|---|
Byte[] | A byte array containing the RDATA. |
Remarks
See https://tools.ietf.org/html/rfc3597#section-5 for all the details.
ReadResourceRecord()
Read a resource record.
Declaration
public ResourceRecord ReadResourceRecord()
Returns
Type | Description |
---|---|
ResourceRecord | A ResourceRecord or null if no more resource records are available. |
Remarks
Processes the "$ORIGIN" and "$TTL" specials that define the Origin and a default time-to-live respectively.
A domain name can be "@" to refer to the Origin. A missing domain name will use the previous record's domain name.
Defaults the Class to IN. Defaults the TTL to either the "$TTL" or the DefaultTTL.
ReadString()
Read a string.
Declaration
public string ReadString()
Returns
Type | Description |
---|---|
String | The string. |
ReadTimeSpan16()
Read a time span (interval) in 16-bit seconds.
Declaration
public TimeSpan ReadTimeSpan16()
Returns
Type | Description |
---|---|
TimeSpan | A TimeSpan with second resolution. |
ReadTimeSpan32()
Read a time span (interval) in 32-bit seconds.
Declaration
public TimeSpan ReadTimeSpan32()
Returns
Type | Description |
---|---|
TimeSpan | A TimeSpan with second resolution. |
ReadUInt16()
Read an unsigned short.
Declaration
public ushort ReadUInt16()
Returns
Type | Description |
---|---|
UInt16 | The number as an unsigned short. |
ReadUInt32()
Read an unsigned int.
Declaration
public uint ReadUInt32()
Returns
Type | Description |
---|---|
UInt32 | The number as an unsignd int. |