Exemple #1
0
        internal int Write(byte[] buffer, int dnsOffset, int offsetInDns, DnsDomainNameCompressionData compressionData)
        {
            int num = this.WriteData(buffer, dnsOffset, offsetInDns + 2, compressionData);

            ByteArrayExtensions.Write(buffer, dnsOffset + offsetInDns, (ushort)num, Endianity.Big);
            return(num + 2);
        }
Exemple #2
0
 internal int Write(byte[] buffer, int dnsOffset, int offsetInDns, DnsDomainNameCompressionData compressionData)
 {
     int length = WriteData(buffer, dnsOffset, offsetInDns + sizeof(ushort), compressionData);
     buffer.Write(dnsOffset + offsetInDns, (ushort)length, Endianity.Big);
     length += sizeof(ushort);
     return length;
 }
        internal int Write(byte[] buffer, int dnsOffset, int offsetInDns, DnsDomainNameCompressionData compressionData)
        {
            int length = WriteData(buffer, dnsOffset, offsetInDns + sizeof(ushort), compressionData);

            buffer.Write(dnsOffset + offsetInDns, (ushort)length, Endianity.Big);
            length += sizeof(ushort);
            return(length);
        }
        internal override int Write(byte[] buffer, int dnsOffset, DnsDomainNameCompressionData compressionData, int offsetInDns)
        {
            int num1 = base.Write(buffer, dnsOffset, compressionData, offsetInDns);

            ByteArrayExtensions.Write(buffer, dnsOffset + offsetInDns + num1, this.Ttl, Endianity.Big);
            int num2 = num1 + 4;

            return(num2 + this.Data.Write(buffer, dnsOffset, offsetInDns + num2, compressionData));
        }
Exemple #5
0
        internal override int Write(byte[] buffer, int dnsOffset, DnsDomainNameCompressionData compressionData, int offsetInDns)
        {
            int length = base.Write(buffer, dnsOffset, compressionData, offsetInDns);

            buffer.Write(dnsOffset + offsetInDns + length, Ttl, Endianity.Big);
            length += sizeof(uint);
            length += Data.Write(buffer, dnsOffset, offsetInDns + length, compressionData);
            return(length);
        }
Exemple #6
0
        internal virtual int Write(byte[] buffer, int dnsOffset, DnsDomainNameCompressionData compressionData, int offsetInDns)
        {
            int num1 = 0;
            int num2 = num1 + this.DomainName.Write(buffer, dnsOffset, compressionData, offsetInDns + num1);

            ByteArrayExtensions.Write(buffer, dnsOffset + offsetInDns + num2, (ushort)this.DnsType, Endianity.Big);
            int num3 = num2 + 2;

            ByteArrayExtensions.Write(buffer, dnsOffset + offsetInDns + num3, (ushort)this.DnsClass, Endianity.Big);
            return(num3 + 2);
        }
        internal virtual int Write(byte[] buffer, int dnsOffset, DnsDomainNameCompressionData compressionData, int offsetInDns)
        {
            int length = 0;

            length += DomainName.Write(buffer, dnsOffset, compressionData, offsetInDns + length);
            buffer.Write(dnsOffset + offsetInDns + length, (ushort)DnsType, Endianity.Big);
            length += sizeof(ushort);
            buffer.Write(dnsOffset + offsetInDns + length, (ushort)DnsClass, Endianity.Big);
            length += sizeof(ushort);
            return(length);
        }
        internal override int GetLength(DnsDomainNameCompressionData compressionData, int offsetInDns)
        {
            int num = 0;

            foreach (DnsDomainName dnsDomainName in this.DomainNames)
            {
                int length = dnsDomainName.GetLength(compressionData, offsetInDns);
                offsetInDns += length;
                num         += length;
            }
            return(num);
        }
        internal override int GetLength(DnsDomainNameCompressionData compressionData, int offsetInDns)
        {
            int totalLength = 0;

            foreach (DnsDomainName domainName in DomainNames)
            {
                int length = domainName.GetLength(compressionData, offsetInDns);
                offsetInDns += length;
                totalLength += length;
            }

            return(totalLength);
        }
        internal static int GetLength(IEnumerable <DnsResourceRecord> resourceRecords, DnsDomainNameCompressionMode domainNameCompressionMode)
        {
            int offsetInDns = 12;
            DnsDomainNameCompressionData compressionData = new DnsDomainNameCompressionData(domainNameCompressionMode);

            if (resourceRecords != null)
            {
                foreach (DnsResourceRecord dnsResourceRecord in resourceRecords)
                {
                    offsetInDns += dnsResourceRecord.GetLength(compressionData, offsetInDns);
                }
            }
            return(offsetInDns);
        }
Exemple #11
0
        internal static int GetLength(IEnumerable <DnsResourceRecord> resourceRecords, DnsDomainNameCompressionMode domainNameCompressionMode)
        {
            int length = HeaderLength;
            DnsDomainNameCompressionData compressionData = new DnsDomainNameCompressionData(domainNameCompressionMode);

            if (resourceRecords != null)
            {
                foreach (DnsResourceRecord record in resourceRecords)
                {
                    length += record.GetLength(compressionData, length);
                }
            }

            return(length);
        }
Exemple #12
0
        internal int GetLength(DnsDomainNameCompressionData compressionData, int offsetInDns)
        {
            int num = 0;

            for (int startIndex = 0; startIndex != this.LabelsCount; ++startIndex)
            {
                ListSegment <DataSegment> labels = new ListSegment <DataSegment>((IList <DataSegment>) this._labels, startIndex);
                if (compressionData.IsAvailable(labels))
                {
                    return(num + 2);
                }
                compressionData.AddCompressionData(labels, offsetInDns + num);
                num += 1 + labels[0].Length;
            }
            return(num + 1);
        }
Exemple #13
0
        internal int GetLength(DnsDomainNameCompressionData compressionData, int offsetInDns)
        {
            int length = 0;

            for (int i = 0; i != LabelsCount; ++i)
            {
                ListSegment <DataSegment> labels = new ListSegment <DataSegment>(_labels, i);
                if (compressionData.IsAvailable(labels))
                {
                    return(length + sizeof(ushort));
                }
                compressionData.AddCompressionData(labels, offsetInDns + length);
                length += sizeof(byte) + labels[0].Length;
            }
            return(length + sizeof(byte));
        }
Exemple #14
0
        internal int Write(byte[] buffer, int dnsOffset, DnsDomainNameCompressionData compressionData, int offsetInDns)
        {
            int length = 0;

            for (int i = 0; i != LabelsCount; ++i)
            {
                ListSegment <DataSegment> labels = new ListSegment <DataSegment>(_labels, i);
                int pointerOffset;
                if (compressionData.TryGetOffset(labels, out pointerOffset))
                {
                    buffer.Write(dnsOffset + offsetInDns + length, (ushort)(CompressionMarker | (ushort)pointerOffset), Endianity.Big);
                    return(length + sizeof(ushort));
                }
                DataSegment currentLabel = labels[0];
                compressionData.AddCompressionData(labels, offsetInDns + length);
                buffer.Write(dnsOffset + offsetInDns + length, (byte)currentLabel.Length);
                length += sizeof(byte);
                currentLabel.Write(buffer, dnsOffset + offsetInDns + length);
                length += currentLabel.Length;
            }
            return(length + sizeof(byte));
        }
Exemple #15
0
        internal int Write(byte[] buffer, int dnsOffset, DnsDomainNameCompressionData compressionData, int offsetInDns)
        {
            int num1 = 0;

            for (int startIndex = 0; startIndex != this.LabelsCount; ++startIndex)
            {
                ListSegment <DataSegment> labels = new ListSegment <DataSegment>((IList <DataSegment>) this._labels, startIndex);
                int offsetInDns1;
                if (compressionData.TryGetOffset(labels, out offsetInDns1))
                {
                    ByteArrayExtensions.Write(buffer, dnsOffset + offsetInDns + num1, (ushort)(49152U | (uint)(ushort)offsetInDns1), Endianity.Big);
                    return(num1 + 2);
                }
                DataSegment dataSegment = labels[0];
                compressionData.AddCompressionData(labels, offsetInDns + num1);
                ByteArrayExtensions.Write(buffer, dnsOffset + offsetInDns + num1, (byte)dataSegment.Length);
                int num2 = num1 + 1;
                dataSegment.Write(buffer, dnsOffset + offsetInDns + num2);
                num1 = num2 + dataSegment.Length;
            }
            return(num1 + 1);
        }
Exemple #16
0
 internal override int GetLength(DnsDomainNameCompressionData compressionData, int offsetInDns)
 {
     return(this.NextDomainName.GetLength(compressionData, offsetInDns) + this.TypeBitmap.Length);
 }
 internal override int GetLength(DnsDomainNameCompressionData compressionData, int offsetInDns)
 {
     return(Algorithm.GetLength(compressionData, offsetInDns) + ConstantPartLength + Key.Length + Other.Length);
 }
        internal override int WriteData(byte[] buffer, int dnsOffset, int offsetInDns, DnsDomainNameCompressionData compressionData)
        {
            int algorithmLength = Algorithm.Write(buffer, dnsOffset, compressionData, offsetInDns);
            int offset          = dnsOffset + offsetInDns + algorithmLength;

            buffer.Write(offset + OffsetAfterAlgorithm.Inception, Inception.Value, Endianity.Big);
            buffer.Write(offset + OffsetAfterAlgorithm.Expiration, Expiration.Value, Endianity.Big);
            buffer.Write(offset + OffsetAfterAlgorithm.Mode, (ushort)Mode, Endianity.Big);
            buffer.Write(offset + OffsetAfterAlgorithm.Error, (ushort)Error, Endianity.Big);
            buffer.Write(offset + OffsetAfterAlgorithm.KeySize, (ushort)Key.Length, Endianity.Big);
            Key.Write(buffer, offset + OffsetAfterAlgorithm.KeyData);

            int otherSizeOffset = offset + OffsetAfterAlgorithm.KeyData + Key.Length;

            buffer.Write(otherSizeOffset, (ushort)Other.Length, Endianity.Big);
            Other.Write(buffer, otherSizeOffset + sizeof(ushort));

            return(algorithmLength + ConstantPartLength + Key.Length + Other.Length);
        }
Exemple #19
0
 internal abstract int WriteData(byte[] buffer, int dnsOffset, int offsetInDns, DnsDomainNameCompressionData compressionData);
Exemple #20
0
        internal override int WriteData(byte[] buffer, int dnsOffset, int offsetInDns, DnsDomainNameCompressionData compressionData)
        {
            buffer.Write(dnsOffset + offsetInDns + Offset.Value, Value, Endianity.Big);
            int numBytesWritten = DomainName.Write(buffer, dnsOffset, compressionData, offsetInDns + Offset.DomainName);

            return(ConstantPartLength + numBytesWritten);
        }
 internal override int GetLength(DnsDomainNameCompressionData compressionData, int offsetInDns)
 {
     return(ConstantPartLength + SignersName.GetLength(compressionData, offsetInDns) + Signature.Length);
 }
Exemple #22
0
        internal override int WriteData(byte[] buffer, int dnsOffset, int offsetInDns, DnsDomainNameCompressionData compressionData)
        {
            ByteArrayExtensions.Write(buffer, dnsOffset + offsetInDns, this.Preference, Endianity.Big);
            int num = this.Map822.Write(buffer, dnsOffset, compressionData, offsetInDns + 2);

            return(2 + (num + this.MapX400.Write(buffer, dnsOffset, compressionData, offsetInDns + 2 + num)));
        }
Exemple #23
0
 internal int GetLength(DnsDomainNameCompressionData compressionData, int offsetInDns)
 {
     return DomainName.GetLength(compressionData, offsetInDns) + MinimumLengthAfterDomainName + GetLengthAfterBase(compressionData, offsetInDns);
 }
        internal override int WriteData(byte[] buffer, int dnsOffset, int offsetInDns, DnsDomainNameCompressionData compressionData)
        {
            int numBytesWritten = 0;

            foreach (DnsDomainName domainName in DomainNames)
            {
                numBytesWritten += domainName.Write(buffer, dnsOffset, compressionData, offsetInDns + numBytesWritten);
            }
            return(numBytesWritten);
        }
Exemple #25
0
 internal abstract int GetLengthAfterBase(DnsDomainNameCompressionData compressionData, int offsetInDns);
Exemple #26
0
 internal abstract int WriteData(byte[] buffer, int dnsOffset, int offsetInDns, DnsDomainNameCompressionData compressionData);
        internal override int WriteData(byte[] buffer, int dnsOffset, int offsetInDns, DnsDomainNameCompressionData compressionData)
        {
            int numBytesWritten = MainNameServer.Write(buffer, dnsOffset, compressionData, offsetInDns);

            numBytesWritten += ResponsibleMailbox.Write(buffer, dnsOffset, compressionData, offsetInDns + numBytesWritten);
            buffer.Write(dnsOffset + offsetInDns + numBytesWritten + Offset.Serial, Serial.Value, Endianity.Big);
            buffer.Write(dnsOffset + offsetInDns + numBytesWritten + Offset.Refresh, Refresh, Endianity.Big);
            buffer.Write(dnsOffset + offsetInDns + numBytesWritten + Offset.Retry, Retry, Endianity.Big);
            buffer.Write(dnsOffset + offsetInDns + numBytesWritten + Offset.Expire, Expire, Endianity.Big);
            buffer.Write(dnsOffset + offsetInDns + numBytesWritten + Offset.MinimumTtl, MinimumTtl, Endianity.Big);

            return(numBytesWritten + ConstantPartLength);
        }
 internal override int GetLength(DnsDomainNameCompressionData compressionData, int offsetInDns)
 {
     return(MainNameServer.GetLength(compressionData, offsetInDns) +
            ResponsibleMailbox.GetLength(compressionData, offsetInDns) +
            ConstantPartLength);
 }
Exemple #29
0
 internal virtual int Write(byte[] buffer, int dnsOffset, DnsDomainNameCompressionData compressionData, int offsetInDns)
 {
     int length = 0;
     length += DomainName.Write(buffer, dnsOffset, compressionData, offsetInDns + length);
     buffer.Write(dnsOffset + offsetInDns + length, (ushort)DnsType, Endianity.Big);
     length += sizeof(ushort);
     buffer.Write(dnsOffset + offsetInDns + length, (ushort)DnsClass, Endianity.Big);
     length += sizeof(ushort);
     return length;
 }
Exemple #30
0
        internal override int WriteData(byte[] buffer, int dnsOffset, int offsetInDns, DnsDomainNameCompressionData compressionData)
        {
            int num = this.NextDomainName.Write(buffer, dnsOffset, compressionData, offsetInDns);

            this.TypeBitmap.Write(buffer, dnsOffset + offsetInDns + num);
            return(num + this.TypeBitmap.Length);
        }
Exemple #31
0
 internal int GetLength(DnsDomainNameCompressionData compressionData, int offsetInDns)
 {
     return(this.DomainName.GetLength(compressionData, offsetInDns) + 4 + this.GetLengthAfterBase(compressionData, offsetInDns));
 }
 internal override int GetLengthAfterBase(DnsDomainNameCompressionData compressionData, int offsetInDns)
 {
     return(0);
 }
Exemple #33
0
 internal abstract int GetLengthAfterBase(DnsDomainNameCompressionData compressionData, int offsetInDns);
        internal override int WriteData(byte[] buffer, int dnsOffset, int offsetInDns, DnsDomainNameCompressionData compressionData)
        {
            buffer.Write(dnsOffset + offsetInDns + Offset.TypeCovered, (ushort)TypeCovered, Endianity.Big);
            buffer.Write(dnsOffset + offsetInDns + Offset.Algorithm, (byte)Algorithm);
            buffer.Write(dnsOffset + offsetInDns + Offset.Labels, Labels);
            buffer.Write(dnsOffset + offsetInDns + Offset.OriginalTtl, OriginalTtl, Endianity.Big);
            buffer.Write(dnsOffset + offsetInDns + Offset.SignatureExpiration, SignatureExpiration.Value, Endianity.Big);
            buffer.Write(dnsOffset + offsetInDns + Offset.SignatureInception, SignatureInception.Value, Endianity.Big);
            buffer.Write(dnsOffset + offsetInDns + Offset.KeyTag, KeyTag, Endianity.Big);

            int numBytesWritten = ConstantPartLength;

            numBytesWritten += SignersName.Write(buffer, dnsOffset, compressionData, offsetInDns + numBytesWritten);

            Signature.Write(buffer, dnsOffset + offsetInDns + numBytesWritten);
            return(numBytesWritten + Signature.Length);
        }
Exemple #35
0
 internal override int GetLength(DnsDomainNameCompressionData compressionData, int offsetInDns)
 {
     return(2 + this.Map822.GetLength(compressionData, offsetInDns) + this.MapX400.GetLength(compressionData, offsetInDns));
 }