Пример #1
0
 /// <inheritdoc />
 public override void WriteData(WireWriter writer)
 {
     writer.WriteDomainName(Algorithm);
     writer.WriteDateTime32(Inception);
     writer.WriteDateTime32(Expiration);
     writer.WriteUInt16((ushort)Mode);
     writer.WriteUInt16((ushort)Error);
     writer.WriteUint16LengthPrefixedBytes(Key);
     writer.WriteUint16LengthPrefixedBytes(OtherData);
 }
Пример #2
0
 /// <inheritdoc />
 public override void WriteData(WireWriter writer)
 {
     writer.WriteDomainName(Algorithm);
     writer.WriteDateTime48(TimeSigned);
     writer.WriteTimeSpan16(Fudge);
     writer.WriteUint16LengthPrefixedBytes(MAC);
     writer.WriteUInt16(OriginalMessageId);
     writer.WriteUInt16((ushort)Error);
     writer.WriteUint16LengthPrefixedBytes(OtherData);
 }
Пример #3
0
        /// <inheritdoc />
        public override void Write(WireWriter writer)
        {
            writer.WriteDomainName(Name);
            writer.WriteUInt16((ushort)Type);
            writer.WriteUInt16((ushort)Class);
            writer.WriteTimeSpan32(TTL);

            writer.PushLengthPrefixedScope();
            WriteData(writer);
            writer.PopLengthPrefixedScope();
        }
Пример #4
0
 /// <inheritdoc />
 public override void WriteData(WireWriter writer)
 {
     writer.WriteUInt16((ushort)TypeCovered);
     writer.WriteByte((byte)Algorithm);
     writer.WriteByte(Labels);
     writer.WriteTimeSpan32(OriginalTTL);
     writer.WriteDateTime32(SignatureExpiration);
     writer.WriteDateTime32(SignatureInception);
     writer.WriteUInt16(KeyTag);
     writer.WriteDomainName(SignerName, uncompressed: true);
     writer.WriteBytes(Signature);
 }
Пример #5
0
        /// <inheritdoc />
        public override void Write(WireWriter writer)
        {
            writer.WriteDomainName(Name);
            writer.WriteUInt16((ushort)Type);

            var classValue = (ushort)Class;

            if (QU)
            {
                classValue = (ushort)(classValue | 0x01 << 15);
            }

            writer.WriteUInt16((ushort)classValue);
        }
Пример #6
0
 /// <inheritdoc />
 public override void WriteData(WireWriter writer)
 {
     writer.WriteUInt16(KeyTag);
     writer.WriteByte((byte)Algorithm);
     writer.WriteByte((byte)HashAlgorithm);
     writer.WriteBytes(Digest);
 }
Пример #7
0
 /// <inheritdoc />
 public override void WriteData(WireWriter writer)
 {
     if (Timeout.HasValue)
     {
         writer.WriteUInt16((ushort)(Timeout.Value.TotalMilliseconds / 100));
     }
 }
Пример #8
0
 /// <inheritdoc />
 public override void WriteData(WireWriter writer)
 {
     writer.WriteByte((byte)HashAlgorithm);
     writer.WriteByte(Flags);
     writer.WriteUInt16(Iterations);
     writer.WriteByteLengthPrefixedBytes(Salt);
 }
Пример #9
0
 /// <inheritdoc />
 public override void WriteData(WireWriter writer)
 {
     writer.WriteUInt16((ushort)Flags);
     writer.WriteByte(Protocol);
     writer.WriteByte((byte)Algorithm);
     writer.WriteBytes(PublicKey);
 }
Пример #10
0
 /// <inheritdoc />
 public override void WriteData(WireWriter writer)
 {
     writer.WriteByte((byte)HashAlgorithm);
     writer.WriteByte((byte)Flags);
     writer.WriteUInt16(Iterations);
     writer.WriteByteLengthPrefixedBytes(Salt);
     writer.WriteByteLengthPrefixedBytes(NextHashedOwnerName);
     writer.WriteBitmap(Types.Select(t => (ushort)t));
 }
Пример #11
0
        /// <inheritdoc />
        public override void WriteData(WireWriter writer)
        {
            foreach (var option in Options)
            {
                writer.WriteUInt16((ushort)option.Type);

                writer.PushLengthPrefixedScope();
                option.WriteData(writer);
                writer.PopLengthPrefixedScope();
            }
        }
Пример #12
0
        /// <inheritdoc />
        public override void Write(WireWriter writer)
        {
            writer.WriteUInt16(Id);
            var flags =
                (Convert.ToInt32(QR) << 15) |
                (((ushort)Opcode & 0xf) << 11) |
                ((Z & 0x7F) << 4) |
                ((ushort)Status & 0xf);

            writer.WriteUInt16((ushort)flags);
            writer.WriteUInt16((ushort)1);
            writer.WriteUInt16((ushort)Prerequisites.Count);
            writer.WriteUInt16((ushort)Updates.Count);
            writer.WriteUInt16((ushort)AdditionalResources.Count);
            Zone.Write(writer);
            foreach (var r in Prerequisites)
            {
                r.Write(writer);
            }
            foreach (var r in Updates)
            {
                r.Write(writer);
            }
            foreach (var r in AdditionalResources)
            {
                r.Write(writer);
            }
        }
Пример #13
0
        /// <inheritdoc />
        public override void Write(WireWriter writer)
        {
            writer.WriteUInt16(Id);
            var flags =
                (Convert.ToInt32(QR) << 15) |
                (((ushort)opcode4 & 0xf) << 11) |
                (Convert.ToInt32(AA) << 10) |
                (Convert.ToInt32(TC) << 9) |
                (Convert.ToInt32(RD) << 8) |
                (Convert.ToInt32(RA) << 7) |
                ((Z & 0x1) << 6) |
                (Convert.ToInt32(AD) << 5) |
                (Convert.ToInt32(CD) << 4) |
                ((ushort)Status & 0xf);

            writer.WriteUInt16((ushort)flags);
            writer.WriteUInt16((ushort)Questions.Count);
            writer.WriteUInt16((ushort)Answers.Count);
            writer.WriteUInt16((ushort)AuthorityRecords.Count);
            writer.WriteUInt16((ushort)AdditionalRecords.Count);
            foreach (var r in Questions)
            {
                r.Write(writer);
            }
            foreach (var r in Answers)
            {
                r.Write(writer);
            }
            foreach (var r in AuthorityRecords)
            {
                r.Write(writer);
            }
            foreach (var r in AdditionalRecords)
            {
                r.Write(writer);
            }
        }