Show / Hide Table of Contents

Class Message

All communications inside of the domain protocol are carried in a single format called a message.

Inheritance
Object
DnsObject
Message
Implements
IWireSerialiser
ICloneable
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.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: Makaretu.Dns
Assembly: Makaretu.Dns.dll
Syntax
public class Message : DnsObject, IWireSerialiser, ICloneable

Fields

| Improve this Doc View Source

MaxLength

Maximum bytes of a message.

Declaration
public const int MaxLength = 9000
Field Value
Type Description
Int32

9000 bytes.

Remarks

In reality the max length is dictated by the network MTU. For legacy IPv4 systems, 512 bytes should be used. For DNSSEC, at least 4096 bytes are needed.

9000 bytes (less IP and UPD header lengths) is specified by Multicast DNS.

| Improve this Doc View Source

MinLength

Minimum bytes of a messages

Declaration
public const int MinLength = 12
Field Value
Type Description
Int32

12 bytes.

Properties

| Improve this Doc View Source

AA

Authoritative Answer - this bit is valid in responses, and specifies that the responding name server is an authority for the domain name in question section.

Note that the contents of the answer section may have multiple owner names because of aliases.The AA bit corresponds to the name which matches the query name, or the first owner name in the answer section.

Declaration
public bool AA { get; set; }
Property Value
Type Description
Boolean

true for an authoritative answer; otherwise, false.

| Improve this Doc View Source

AD

Authentic data.

Declaration
public bool AD { get; set; }
Property Value
Type Description
Boolean

true if the response data is authentic; otherwise, false.

Remarks

Only used in a response and indicates that all the data included in the Answers and AuthorityRecords sections are authenticated by the server according to its DNSSEC policies.

| Improve this Doc View Source

AdditionalRecords

The list of additional records.

Declaration
public List<ResourceRecord> AdditionalRecords { get; set; }
Property Value
Type Description
List<ResourceRecord>

A list of additional resource records.

| Improve this Doc View Source

Answers

The list of answers.

Declaration
public List<ResourceRecord> Answers { get; set; }
Property Value
Type Description
List<ResourceRecord>

A list of answers.

| Improve this Doc View Source

AuthorityRecords

The list of authority records.

Declaration
public List<ResourceRecord> AuthorityRecords { get; set; }
Property Value
Type Description
List<ResourceRecord>

A list of authority resource records.

| Improve this Doc View Source

CD

Checking disabled.

Declaration
public bool CD { get; set; }
Property Value
Type Description
Boolean

true if the query does not require AD; otherwise, false.

Remarks

Only used in a query and indicates that pending (non-authenticated) data is acceptable to the resolver sending the query.

| Improve this Doc View Source

DO

Indicates that DNS Security Extensions (DNSSEC) are supported.

Declaration
public bool DO { get; set; }
Property Value
Type Description
Boolean

true if DNSSEC is supported; otherwise, false.

Remarks

The DO bit is actually in the OPTRecord, when setting the record is added to AdditionalRecords if not already present.

See Also
UseDnsSecurity()
https://tools.ietf.org/html/rfc3225
| Improve this Doc View Source

Id

A 16 bit identifier assigned by the program that generates any kind of query. This identifier is copied the corresponding reply and can be used by the requester to match up replies to outstanding queries.

Declaration
public ushort Id { get; set; }
Property Value
Type Description
UInt16

A unique identifier.

| Improve this Doc View Source

IsQuery

Determines if the message is query.

Declaration
public bool IsQuery { get; }
Property Value
Type Description
Boolean

true for a query; otherwise, false for a response.

| Improve this Doc View Source

IsResponse

Determines if the message is a response to a query.

Declaration
public bool IsResponse { get; }
Property Value
Type Description
Boolean

false for a query; otherwise, true for a response.

| Improve this Doc View Source

Opcode

The requested operation.

Declaration
public MessageOperation Opcode { get; set; }
Property Value
Type Description
MessageOperation

One of the MessageOperation values. Both standard and extended values are supported.

Remarks

This value is set by the originator of a query and copied into the response.

Extended opcodes (values requiring more than 4 bits) are split between the message header and the OPTRecord in the AdditionalRecords section. When setting an extended opcode, the OPTRecord will be created if it does not already exist.

See Also
CreateResponse()
| Improve this Doc View Source

QR

A one bit field that specifies whether this message is a query(0), or a response(1).

Declaration
public bool QR { get; set; }
Property Value
Type Description
Boolean

false for a query; otherwise, true for a response.

| Improve this Doc View Source

Questions

The list of question.

Declaration
public List<Question> Questions { get; }
Property Value
Type Description
List<Question>

A list of questions.

| Improve this Doc View Source

RA

Recursion Available - this be is set or cleared in a response, and denotes whether recursive query support is available in the name server.

Declaration
public bool RA { get; set; }
Property Value
Type Description
Boolean

true if recursion is available; otherwise, false.

| Improve this Doc View Source

RD

Recursion Desired - this bit may be set in a query and is copied into the response. If RD is set, it directs the name server to pursue the query recursively.

Recursive query support is optional.

Declaration
public bool RD { get; set; }
Property Value
Type Description
Boolean

true if recursion is desired; otherwise, false.

| Improve this Doc View Source

Status

Response code - this 4 bit field is set as part of responses.

Declaration
public MessageStatus Status { get; set; }
Property Value
Type Description
MessageStatus

One of the MessageStatus values.

| Improve this Doc View Source

TC

TrunCation - specifies that this message was truncated due to length greater than that permitted on the transmission channel.

Declaration
public bool TC { get; set; }
Property Value
Type Description
Boolean

true for a truncated message; otherwise, false.

See Also
Truncate(Int32)
| Improve this Doc View Source

Z

Reserved for future use.

Declaration
public int Z { get; set; }
Property Value
Type Description
Int32

Must be zero in all queries and responses.

Methods

| Improve this Doc View Source

CreateResponse()

Create a response for the query message.

Declaration
public Message CreateResponse()
Returns
Type Description
Message

A new response for the query message.

| 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

ToString()

Declaration
public override string ToString()
Returns
Type Description
String
Overrides
Object.ToString()
| Improve this Doc View Source

Truncate(Int32)

Make the message not exceed the specified length.

Declaration
public void Truncate(int length)
Parameters
Type Name Description
Int32 length

The maximum number bytes for the message.

Remarks

If the message does not fit into length bytes, then AdditionalRecords are removed and then AuthorityRecords are removed.

If it is still too big, then the TC bit is set.

| Improve this Doc View Source

UseDnsSecurity()

Enables DNS Security Extensions (DNSSEC) for the message.

Declaration
public Message UseDnsSecurity()
Returns
Type Description
Message

The Message for a fluent design.

Remarks

Sets DO to true. Adds an OPTRecord to AdditionalRecords if not already present.

See Also
DO
| 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)

Implements

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