Пример #1
0
        public DNSQuery(String DomainName,
                        Boolean RecursionDesired,
                        params UInt16[]  DNSResourceRecordTypes)
        {
            if (DNSResourceRecordTypes == null || DNSResourceRecordTypes.Length == 0)
            {
                QueryTypes = new UInt16[1] {
                    255
                }
            }
            ;

            else
            {
                QueryTypes = DNSResourceRecordTypes;
            }

            if (QueryTypes.Length > 2305) // Just because of the number ;)
            {
                throw new ArgumentException("Too many DNSResourceRecordTypes!");
            }

            this._DomainName       = DomainName;
            this._TransactionId    = new Random().Next(55555);
            this._RecursionDesired = RecursionDesired;
            this.QueryClass        = DNSQueryClasses.IN;
        }
Пример #2
0
 public AAAA(String           Name,
             DNSQueryClasses  Class,
             TimeSpan         TimeToLive,
             IPv6Address      IPv6Address)
     : base(Name, TypeId, Class, TimeToLive, IPv6Address.ToString())
 {
     this._IPv6Address  = IPv6Address;
 }
Пример #3
0
 public CNAME(String           Name,
              DNSQueryClasses  Class,
              TimeSpan         TimeToLive,
              String           RText)
     : base(Name, TypeId, Class, TimeToLive, RText)
 {
     this._Text  = RText;
 }
Пример #4
0
 public MX(String           Name,
           DNSQueryClasses  Class,
           TimeSpan         TimeToLive,
           Int32            Preference,
           String           Exchange)
     : base(Name, TypeId, Class, TimeToLive)
 {
     this._Preference  = Preference;
     this._Exchange    = Exchange;
 }
Пример #5
0
        public AAAA(String Name,
                    DNSQueryClasses Class,
                    TimeSpan TimeToLive,
                    IPv6Address IPv6Address)

            : base(Name, TypeId, Class, TimeToLive, IPv6Address.ToString())

        {
            this._IPv6Address = IPv6Address;
        }
Пример #6
0
        public TXT(String Name,
                   DNSQueryClasses Class,
                   TimeSpan TimeToLive,
                   String RText)

            : base(Name, TypeId, Class, TimeToLive, RText)

        {
            this._Text = RText;
        }
Пример #7
0
 protected ADNSResourceRecord(String           Name,
                              UInt16           Type,
                              DNSQueryClasses  Class,
                              TimeSpan         TimeToLive)
 {
     this._Name          = Name;
     this._Type          = Type;
     this._Class         = Class;
     this._TimeToLive    = TimeToLive;
     this._EndOfLife     = DateTime.Now + _TimeToLive;
 }
Пример #8
0
 protected ADNSResourceRecord(String Name,
                              UInt16 Type,
                              DNSQueryClasses Class,
                              TimeSpan TimeToLive)
 {
     this._Name       = Name;
     this._Type       = Type;
     this._Class      = Class;
     this._TimeToLive = TimeToLive;
     this._EndOfLife  = DateTime.Now + _TimeToLive;
 }
Пример #9
0
        protected ADNSResourceRecord(String Name,
                                     UInt16 Type,
                                     Stream DNSStream)
        {
            this._Name       = Name;
            this._Type       = Type;
            this._Class      = (DNSQueryClasses)((DNSStream.ReadByte() & byte.MaxValue) << 8 | DNSStream.ReadByte() & byte.MaxValue);
            this._TimeToLive = TimeSpan.FromSeconds((DNSStream.ReadByte() & byte.MaxValue) << 24 | (DNSStream.ReadByte() & byte.MaxValue) << 16 | (DNSStream.ReadByte() & byte.MaxValue) << 8 | DNSStream.ReadByte() & byte.MaxValue);
            this._EndOfLife  = DateTime.Now + _TimeToLive;

            var RDLength = (DNSStream.ReadByte() & byte.MaxValue) << 8 | DNSStream.ReadByte() & byte.MaxValue;
        }
Пример #10
0
        protected ADNSResourceRecord(String  Name,
                                     UInt16  Type,
                                     Stream  DNSStream)
        {
            this._Name          = Name;
            this._Type          = Type;
            this._Class         = (DNSQueryClasses) ((DNSStream.ReadByte() & byte.MaxValue) << 8 | DNSStream.ReadByte() & byte.MaxValue);
            this._TimeToLive    = TimeSpan.FromSeconds((DNSStream.ReadByte() & byte.MaxValue) << 24 | (DNSStream.ReadByte() & byte.MaxValue) << 16 | (DNSStream.ReadByte() & byte.MaxValue) << 8 | DNSStream.ReadByte() & byte.MaxValue);
            this._EndOfLife     = DateTime.Now + _TimeToLive;

            var RDLength        = (DNSStream.ReadByte() & byte.MaxValue) << 8 | DNSStream.ReadByte() & byte.MaxValue;
        }
Пример #11
0
        public MX(String Name,
                  DNSQueryClasses Class,
                  TimeSpan TimeToLive,
                  Int32 Preference,
                  String Exchange)

            : base(Name, TypeId, Class, TimeToLive)

        {
            this._Preference = Preference;
            this._Exchange   = Exchange;
        }
Пример #12
0
        public SSHFP(String Name,
                     DNSQueryClasses Class,
                     TimeSpan TimeToLive,
                     SSHFP_Algorithm Algorithm,
                     SSHFP_FingerprintType Typ,
                     String Fingerprint)

            : base(Name, TypeId, Class, TimeToLive)

        {
            this._Algorithm   = Algorithm;
            this._Typ         = Typ;
            this._Fingerprint = Fingerprint;
        }
Пример #13
0
        protected ADNSResourceRecord(Stream DNSStream, UInt16 Type)
        {
            this._Name          = DNSTools.ExtractName(DNSStream);

            this._Type = Type;
            //this._Type          = (DNSResourceRecordTypes) ((DNSStream.ReadByte() & byte.MaxValue) << 8 | DNSStream.ReadByte() & byte.MaxValue);

            //if (_Type != Type)
            //    throw new ArgumentException("Invalid DNS RR Type!");

            this._Class         = (DNSQueryClasses) ((DNSStream.ReadByte() & byte.MaxValue) << 8 | DNSStream.ReadByte() & byte.MaxValue);
            this._TimeToLive    = TimeSpan.FromSeconds((DNSStream.ReadByte() & byte.MaxValue) << 24 | (DNSStream.ReadByte() & byte.MaxValue) << 16 | (DNSStream.ReadByte() & byte.MaxValue) << 8 | DNSStream.ReadByte() & byte.MaxValue);
            this._EndOfLife     = DateTime.Now + _TimeToLive;

            var RDLength        = (DNSStream.ReadByte() & byte.MaxValue) << 8 | DNSStream.ReadByte() & byte.MaxValue;
        }
Пример #14
0
        protected ADNSResourceRecord(Stream DNSStream, UInt16 Type)
        {
            this._Name = DNSTools.ExtractName(DNSStream);

            this._Type = Type;
            //this._Type          = (DNSResourceRecordTypes) ((DNSStream.ReadByte() & byte.MaxValue) << 8 | DNSStream.ReadByte() & byte.MaxValue);

            //if (_Type != Type)
            //    throw new ArgumentException("Invalid DNS RR Type!");

            this._Class      = (DNSQueryClasses)((DNSStream.ReadByte() & byte.MaxValue) << 8 | DNSStream.ReadByte() & byte.MaxValue);
            this._TimeToLive = TimeSpan.FromSeconds((DNSStream.ReadByte() & byte.MaxValue) << 24 | (DNSStream.ReadByte() & byte.MaxValue) << 16 | (DNSStream.ReadByte() & byte.MaxValue) << 8 | DNSStream.ReadByte() & byte.MaxValue);
            this._EndOfLife  = DateTime.Now + _TimeToLive;

            var RDLength = (DNSStream.ReadByte() & byte.MaxValue) << 8 | DNSStream.ReadByte() & byte.MaxValue;
        }
Пример #15
0
        public DNSQuery(String           DomainName,
                        Boolean          RecursionDesired,
                        params UInt16[]  DNSResourceRecordTypes)
        {
            if (DNSResourceRecordTypes == null || DNSResourceRecordTypes.Length == 0)
                QueryTypes = new UInt16[1] { 255 };

            else
                QueryTypes = DNSResourceRecordTypes;

            if (QueryTypes.Length > 2305) // Just because of the number ;)
                throw new ArgumentException("Too many DNSResourceRecordTypes!");

            this._DomainName        = DomainName;
            this._TransactionId     = new Random().Next(55555);
            this._RecursionDesired  = RecursionDesired;
            this.QueryClass         = DNSQueryClasses.IN;
        }
Пример #16
0
 public SOA(String           Name,
            DNSQueryClasses  Class,
            TimeSpan         TimeToLive,
            String           Server,
            String           Email,
            Int64            Serial,
            Int64            Refresh,
            Int64            Retry,
            Int64            Expire,
            Int64            Minimum)
     : base(Name, TypeId, Class, TimeToLive)
 {
     this._Server   = Server;
     this._Email    = Email;
     this._Serial   = Serial;
     this._Refresh  = Refresh;
     this._Retry    = Retry;
     this._Expire   = Expire;
     this._Minimum  = Minimum;
 }
Пример #17
0
        public SOA(String Name,
                   DNSQueryClasses Class,
                   TimeSpan TimeToLive,
                   String Server,
                   String Email,
                   Int64 Serial,
                   Int64 Refresh,
                   Int64 Retry,
                   Int64 Expire,
                   Int64 Minimum)

            : base(Name, TypeId, Class, TimeToLive)

        {
            this._Server  = Server;
            this._Email   = Email;
            this._Serial  = Serial;
            this._Refresh = Refresh;
            this._Retry   = Retry;
            this._Expire  = Expire;
            this._Minimum = Minimum;
        }
Пример #18
0
 public SSHFP(String                 Name,
              DNSQueryClasses        Class,
              TimeSpan               TimeToLive,
              SSHFP_Algorithm        Algorithm,
              SSHFP_FingerprintType  Typ,
              String                 Fingerprint)
     : base(Name, TypeId, Class, TimeToLive)
 {
     this._Algorithm    = Algorithm;
     this._Typ          = Typ;
     this._Fingerprint  = Fingerprint;
 }