Class DnsHeader
Represents a DNS header, the first entry in a DnsMessage. See DnsQueryFactory for methods to create DNS headers for specific purposes.
Namespace: Ae.Dns.Protocol
Assembly: Ae.Dns.Protocol.dll
Syntax
public sealed class DnsHeader : IEquatable<DnsHeader>, IDnsByteArrayReader, IDnsByteArrayWriter
Properties
| Improve this Doc View SourceAdditionalRecordCount
The number of additional records in this header.
Declaration
public short AdditionalRecordCount { get; set; }
Property Value
Type | Description |
---|---|
Int16 | A count of the number of additional records in this header. |
AnswerRecordCount
The number of DnsMessage records in this header.
Declaration
public short AnswerRecordCount { get; set; }
Property Value
Type | Description |
---|---|
Int16 | A count of the number of answers contained within this DNS message. |
AuthoritativeAnswer
Determines whether the answer was from an authoritative DNS server.
Declaration
public bool AuthoritativeAnswer { get; set; }
Property Value
Type | Description |
---|---|
Boolean | If true, this DNS answer is authoritative. |
Host
The DNS host to use, for example "example.com".
Declaration
public string Host { get; set; }
Property Value
Type | Description |
---|---|
String |
Id
Gets or sets the unique ID of this DNS query.
Declaration
public ushort Id { get; set; }
Property Value
Type | Description |
---|---|
UInt16 | A unique ID which allows the sender/receiver to identify this DNS message (for example if the transport protocol is stateless). |
IsQueryResponse
Determines whether this is a DNS query or answer.
Declaration
public bool IsQueryResponse { get; set; }
Property Value
Type | Description |
---|---|
Boolean | For DNS queries this is false, for DNS responses this is true. |
NameServerRecordCount
The number of name server records in this header.
Declaration
public short NameServerRecordCount { get; set; }
Property Value
Type | Description |
---|---|
Int16 | A count of the number of DNS name server records in this header. |
OperationCode
Determines the operation code for this DNS header.
Declaration
public DnsOperationCode OperationCode { get; set; }
Property Value
Type | Description |
---|---|
DnsOperationCode | The DNS operation code for this DNS answer. For example QUERY. |
QueryClass
The DnsQueryClass of this header, normally IN (Internet).
Declaration
public DnsQueryClass QueryClass { get; set; }
Property Value
Type | Description |
---|---|
DnsQueryClass | The class of query, most likely IN to represent Internet DNS queries. |
QueryType
The DnsQueryType of this header.
Declaration
public DnsQueryType QueryType { get; set; }
Property Value
Type | Description |
---|---|
DnsQueryType | If the type of query is A, it means the query is for IP address records. |
QuestionCount
The number of questions in this header.
Declaration
public short QuestionCount { get; set; }
Property Value
Type | Description |
---|---|
Int16 | A count of the number of questions asked of the DNS server. |
RecursionAvailable
Indicates whether recursion is available.
Declaration
public bool RecursionAvailable { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
RecursionDesired
Indicates whether recursion is desired on this DNS query. If this is an answer, indicates whether the original query requested recursion.
Declaration
public bool RecursionDesired { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
ResponseCode
The DnsResponseCode for this result.
Declaration
public DnsResponseCode ResponseCode { get; set; }
Property Value
Type | Description |
---|---|
DnsResponseCode |
Tags
A generic bag of tags associated with this object. Will not be serialised and/or passed over the wire.
Declaration
public IDictionary<string, object> Tags { get; }
Property Value
Type | Description |
---|---|
IDictionary<String, Object> |
Truncation
Determines whether this DNS answer was truncated due to size.
Declaration
public bool Truncation { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceEquals(DnsHeader)
Declaration
public bool Equals(DnsHeader other)
Parameters
Type | Name | Description |
---|---|---|
DnsHeader | other |
Returns
Type | Description |
---|---|
Boolean |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
ReadBytes(ReadOnlyMemory<Byte>, ref Int32)
Read from the specified byte array, starting at the specified offset.
Declaration
public void ReadBytes(ReadOnlyMemory<byte> bytes, ref int offset)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlyMemory<Byte> | bytes | The byte array to read from. |
Int32 | offset | The offset to start at. |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |
WriteBytes(Memory<Byte>, ref Int32)
Write to the the specified byte array.
Declaration
public void WriteBytes(Memory<byte> bytes, ref int offset)
Parameters
Type | Name | Description |
---|---|---|
Memory<Byte> | bytes | The byte array to read from. |
Int32 | offset | The offset to start at. |