Exemple #1
0
 internal override void EncodeData(Span <byte> messageData, ref int currentPosition)
 {
     if (SoaExpire.HasValue)
     {
         DnsMessageBase.EncodeInt(messageData, ref currentPosition, SoaExpire.Value);
     }
 }
Exemple #2
0
        internal void EncodeRecordHeader(byte[] messageData, int offset, ref int currentPosition, Dictionary <string, ushort> domainNames, out int recordPosition)
        {
            DnsMessageBase.EncodeDomainName(messageData, offset, ref currentPosition, Name, true, domainNames);
            DnsMessageBase.EncodeUShort(messageData, ref currentPosition, (ushort)RecordType);
            DnsMessageBase.EncodeUShort(messageData, ref currentPosition, (ushort)RecordClass);
            DnsMessageBase.EncodeInt(messageData, ref currentPosition, TimeToLive);

            recordPosition = currentPosition + 2;
        }
Exemple #3
0
 protected internal override void EncodeRecordData(byte[] messageData, int offset, ref int currentPosition, Dictionary <string, ushort> domainNames)
 {
     messageData[currentPosition++] = Version;
     messageData[currentPosition++] = ConvertPrecision(Size);
     messageData[currentPosition++] = ConvertPrecision(HorizontalPrecision);
     messageData[currentPosition++] = ConvertPrecision(VerticalPrecision);
     DnsMessageBase.EncodeInt(messageData, ref currentPosition, ConvertDegree(Latitude));
     DnsMessageBase.EncodeInt(messageData, ref currentPosition, ConvertDegree(Longitude));
     DnsMessageBase.EncodeInt(messageData, ref currentPosition, ConvertAltitude(Altitude));
 }
Exemple #4
0
 protected internal override void EncodeRecordData(byte[] messageData, int offset, ref int currentPosition, Dictionary <string, ushort> domainNames)
 {
     DnsMessageBase.EncodeDomainName(messageData, offset, ref currentPosition, MasterName, true, domainNames);
     DnsMessageBase.EncodeDomainName(messageData, offset, ref currentPosition, ResponsibleName, true, domainNames);
     DnsMessageBase.EncodeUInt(messageData, ref currentPosition, SerialNumber);
     DnsMessageBase.EncodeInt(messageData, ref currentPosition, RefreshInterval);
     DnsMessageBase.EncodeInt(messageData, ref currentPosition, RetryInterval);
     DnsMessageBase.EncodeInt(messageData, ref currentPosition, ExpireInterval);
     DnsMessageBase.EncodeInt(messageData, ref currentPosition, NegativeCachingTTL);
 }
Exemple #5
0
 protected internal override void EncodeRecordData(byte[] messageData, int offset, ref int currentPosition, Dictionary <string, ushort> domainNames)
 {
     DnsMessageBase.EncodeUShort(messageData, ref currentPosition, (ushort)TypeCovered);
     messageData[currentPosition++] = (byte)Algorithm;
     messageData[currentPosition++] = Labels;
     DnsMessageBase.EncodeInt(messageData, ref currentPosition, OriginalTimeToLive);
     EncodeDateTime(messageData, ref currentPosition, SignatureExpiration);
     EncodeDateTime(messageData, ref currentPosition, SignatureInception);
     DnsMessageBase.EncodeUShort(messageData, ref currentPosition, KeyTag);
     DnsMessageBase.EncodeDomainName(messageData, offset, ref currentPosition, SignersName, false, null);
     DnsMessageBase.EncodeByteArray(messageData, ref currentPosition, Signature);
 }
Exemple #6
0
        internal static void EncodeDateTime(byte[] buffer, ref int currentPosition, DateTime value)
        {
            int timeStamp = (int)(value.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds;

            DnsMessageBase.EncodeInt(buffer, ref currentPosition, timeStamp);
        }
Exemple #7
0
 internal override void EncodeData(Span <byte> messageData, ref int currentPosition)
 {
     DnsMessageBase.EncodeInt(messageData, ref currentPosition, (int)LeaseTime.TotalSeconds);
 }