Exemplo n.º 1
0
        void FixupTTL(DnsResourceRecordCollection matches)
        {
            if (matches.IsNullOrEmpty())
            {
                return;
            }

            for (int i = 0, count = matches.Count; i < count; ++i)
            {
                DnsResourceRecord match = matches[i];
                if (match.TTL <= 0)
                {
                    match.TTL = this.Settings.DefaultTTL;
                }
            }
        }
        public static void GetMatches(this RecordRetrievalServiceClient client, string domain, DnsResourceRecordCollection resourceRecords, DnsStandard.RecordType recordType)
        {
            DnsRecord[] matches = client.GetMatchingDnsRecords(domain, recordType);
            if (matches.IsNullOrEmpty())
            {
                return;
            }

            foreach (DnsRecord record in matches)
            {
                DnsResourceRecord responseRecord = record.Deserialize();
                if (responseRecord != null && responseRecord.Type == recordType)
                {
                    resourceRecords.Add(responseRecord);
                }
            }
        }
Exemplo n.º 3
0
        public void Add(DnsResourceRecord record)
        {
            if (record == null)
            {
                throw new ArgumentNullException();
            }

            DnsResourceRecordCollection recordList;

            if (!m_records.TryGetValue(record.Name, out recordList))
            {
                recordList = new DnsResourceRecordCollection();
                m_records.Add(record.Name, recordList);
            }

            recordList.Add(record);
        }
Exemplo n.º 4
0
        public IEnumerable <DnsResourceRecord> this[string domainName]
        {
            get
            {
                if (string.IsNullOrEmpty(domainName))
                {
                    throw new ArgumentException("domainName");
                }

                DnsResourceRecordCollection matches = null;
                if (m_records.TryGetValue(domainName, out matches))
                {
                    return(matches);
                }

                return(null);
            }
        }
 public static void GetSRVRecords(this RecordRetrievalServiceClient client, string domain, DnsResourceRecordCollection recordCollection)
 {
     client.GetMatches(domain, recordCollection, DnsStandard.RecordType.SRV);
 }
        public static void GetMatches(this RecordRetrievalServiceClient client, string domain, DnsResourceRecordCollection resourceRecords, DnsStandard.RecordType recordType)
        {
            DnsRecord[] matches = client.GetMatchingDnsRecords(domain, recordType);
            if (matches.IsNullOrEmpty())
            {
                return;
            }

            foreach (DnsRecord record in matches)
            {
                DnsResourceRecord responseRecord = record.Deserialize();
                if (responseRecord != null && responseRecord.Type == recordType)
                {
                    resourceRecords.Add(responseRecord);
                }
            }
        }
 public static void GetNSRecords(this RecordRetrievalServiceClient client, string domain, DnsResourceRecordCollection recordCollection)
 {
     client.GetMatches(domain, recordCollection, DnsStandard.RecordType.NS);
 }
Exemplo n.º 8
0
 void FixupTTL(DnsResourceRecordCollection matches)
 {
     if (matches.IsNullOrEmpty())
     {
         return;
     }
     
     for (int i = 0, count = matches.Count; i < count; ++i)
     {
         DnsResourceRecord match = matches[i];
         if (match.TTL <= 0)
         {
             match.TTL = this.Settings.DefaultTTL;
         }
     } 
 }
Exemplo n.º 9
0
 public void Add(DnsResourceRecord record)
 {
     if (record == null)
     {
         throw new ArgumentNullException();
     }
     
     DnsResourceRecordCollection recordList;
     if (!m_records.TryGetValue(record.Name, out recordList))
     {
         recordList = new DnsResourceRecordCollection();
         m_records.Add(record.Name, recordList);
     }
     
     recordList.Add(record);
 }