예제 #1
0
        /// <summary>
        /// Formats and writes this header to the specified query writer.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when <paramref name="writer"/> is <see langword="null"/>.
        /// </exception>
        public virtual void Write(IDnsWriter writer)
        {
            Guard.NotNull(writer, "writer");

            writer.WriteUInt16((ushort)this.Id);

            byte b3 = 0;

            if (!this.IsQuery)
            {
                b3 |= 0x80;
            }
            b3 |= (byte)(((byte)this.OpCode & 0x0F) << 3);
            if (this.IsAuthorative)
            {
                b3 |= 0x04;
            }
            if (this.IsTruncated)
            {
                b3 |= 0x02;
            }
            if (this.IsRecursionDesired)
            {
                b3 |= 0x01;
            }
            writer.WriteByte(b3);

            byte b4 = (byte)this.ResponseCode;

            if (this.IsRecursionAllowed)
            {
                b4 |= 0x80;
            }
            writer.WriteByte(b4);

            writer.WriteUInt16(this.QuestionCount);
            writer.WriteUInt16(this.AnswerCount);
            writer.WriteUInt16(this.AuthorityCount);
            writer.WriteUInt16(this.AdditionalCount);
        }
예제 #2
0
        /// <summary>
        /// Writes the RDATA of this resource record to the specified
        /// <see cref="AK.Net.Dns.IDnsWriter"/>.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when <paramref name="writer"/> is <see langword="null"/>.
        /// </exception>
        public override void WriteData(IDnsWriter writer)
        {
            Guard.NotNull(writer, "writer");

            writer.WriteName(this.Domain);
        }
예제 #3
0
        /// <summary>
        /// Writes the RDATA of this resource record to the specified
        /// <see cref="AK.Net.Dns.IDnsWriter"/>.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when <paramref name="writer"/> is <see langword="null"/>.
        /// </exception>
        public override void WriteData(IDnsWriter writer)
        {
            Guard.NotNull(writer, "writer");

            writer.WriteBytes(this.Data);
        }
예제 #4
0
        /// <summary>
        /// Writes the RDATA of this resource record to the specified
        /// <see cref="AK.Net.Dns.IDnsWriter"/>.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when <paramref name="writer"/> is <see langword="null"/>.
        /// </exception>
        public override void WriteData(IDnsWriter writer)
        {
            Guard.NotNull(writer, "writer");

            writer.WriteIPAddress(this.Address);
        }
예제 #5
0
        /// <summary>
        /// Writes the RDATA of this resource record to the specified
        /// <see cref="AK.Net.Dns.IDnsWriter"/>.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when <paramref name="writer"/> <see langword="null"/>.
        /// </exception>
        public override void WriteData(IDnsWriter writer)
        {
            Guard.NotNull(writer, "writer");

            writer.WriteName(this.NewMailbox);
        }
예제 #6
0
        /// <summary>
        /// Writes the RDATA of this resource record to the specified
        /// <see cref="AK.Net.Dns.IDnsWriter"/>.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when <paramref name="writer"/> is <see langword="null"/>.
        /// </exception>
        public override void WriteData(IDnsWriter writer)
        {
            Guard.NotNull(writer, "writer");

            writer.WriteCharString(this.Text);
        }
예제 #7
0
 /// <summary>
 /// When overriden in a dervied class; the RDATA section of the resource
 /// record is written to the specified <see cref="AK.Net.Dns.IDnsWriter"/>.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <exception cref="System.ArgumentNullException">
 /// Thrown when <paramref name="writer"/> is <see langword="null"/>.
 /// </exception>
 public abstract void WriteData(IDnsWriter writer);
예제 #8
0
        /// <summary>
        /// Writes the RDATA of this resource record to the specified
        /// <see cref="AK.Net.Dns.IDnsWriter"/>.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when <paramref name="writer"/> is <see langword="null"/>.
        /// </exception>
        public override void WriteData(IDnsWriter writer)
        {
            Guard.NotNull(writer, "writer");

            writer.WriteCharString(this.Specification);
        }