The DnsRecordHeader class contains fields, properties and parsing cababilities within the DNS Record except the the RDATA. The Name, Type, Class, TTL, and RDLength. This class is used in the DnsRecordFactory to instantiate concrete DnsRecord Classes. RFC 1035 3.2.1. Format All RRs have the same top level format shown below: 1 1 1 1 1 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | | / / / NAME / | | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | TYPE | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | CLASS | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | TTL | | | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | RDLENGTH | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| where: NAME an owner name, i.e., the name of the node to which this resource record pertains. TYPE two octets containing one of the RR TYPE codes. CLASS two octets containing one of the RR CLASS codes. TTL a 32 bit signed integer that specifies the time interval that the resource record may be cached before the source of the information should again be consulted. Zero values are interpreted to mean that the RR can only be used for the transaction in progress, and should not be cached. For example, SOA records are always distributed with a zero TTL to prohibit caching. Zero values can also be used for extremely volatile data. RDLENGTH an unsigned 16 bit integer that specifies the length in octets of the RDATA field.
Esempio n. 1
0
 internal HInfoRecord(RecordHeader dnsHeader) : base(dnsHeader)
 {
 }
Esempio n. 2
0
 internal WksRecord(RecordHeader dnsHeader) : base(dnsHeader) { }
Esempio n. 3
0
 internal DnsRecordBase(RecordHeader dnsHeader)
 {
     _dnsHeader = dnsHeader;
 }
Esempio n. 4
0
 internal TxtRecord(RecordHeader dnsHeader)
     : base(dnsHeader)
 {
 }
Esempio n. 5
0
 internal MbRecord(RecordHeader dnsHeader)
     : base(dnsHeader)
 {
 }
Esempio n. 6
0
 internal SrvRecord(RecordHeader dnsHeader)
     : base(dnsHeader)
 {
 }
Esempio n. 7
0
 internal PtrRecord(RecordHeader dnsHeader) : base(dnsHeader) { }
Esempio n. 8
0
 internal AaaaRecord(RecordHeader dnsHeader)
     : base(dnsHeader)
 {
 }
Esempio n. 9
0
 public UnknownRecord(RecordHeader dnsHeader) : base(dnsHeader) { }
Esempio n. 10
0
        public static IDnsRecord Create(ref MemoryStream ms) 
        {
            IDnsRecord dnsRecord;
            // Have to start out with an unknown record, since we have to parse the entire
            // header before we can determine the type of DNS record it is.
            // TODO: Consider other options.
            
            // start as an unknown type, then create a known type, parse the response 
            // and return the object.	
            //DnsRecordBase dr = new DnsUnknownRecord();
            //dr.ParseRecordHeader(ref ms);

            RecordHeader dnsHeader = new RecordHeader();
            dnsHeader.ParseRecordHeader(ref ms);

            switch (dnsHeader.NsType)
            {
                case NsType.A:
                    {
                        dnsRecord = new ARecord(dnsHeader);
                        break;
                    }
                case NsType.AAAA:
                    {
                        dnsRecord = new AaaaRecord(dnsHeader);
                        break;
                    }
                case NsType.MX:
                    {
                        dnsRecord = new MxRecord(dnsHeader);
                        break;
                    }
                case NsType.RP:
                    {
                        dnsRecord = new RpRecord(dnsHeader);
                        break;
                    }
                case NsType.MR:
                    {
                        dnsRecord = new MrRecord(dnsHeader);
                        break;
                    }
                case NsType.MB:
                    {
                        dnsRecord = new MbRecord(dnsHeader);
                        break;
                    }
                case NsType.MG:
                    {
                        dnsRecord = new MgRecord(dnsHeader);
                        break;
                    }
                case NsType.NS:
                    {
                        dnsRecord = new NsRecord(dnsHeader);
                        break;
                    }
                case NsType.CNAME:
                    {
                        dnsRecord = new CNameRecord(dnsHeader);
                        break;
                    }
                case NsType.PTR:
                    {
                        dnsRecord = new PtrRecord(dnsHeader);
                        break;
                    }
                case NsType.HINFO:
                    {
                        dnsRecord = new HInfoRecord(dnsHeader);
                        break;
                    }
                case NsType.MINFO:
                    {
                        dnsRecord = new MInfoRecord(dnsHeader);
                        break;
                    }
                case NsType.X25:
                    {
                        dnsRecord = new X25Record(dnsHeader);
                        break;
                    }
                case NsType.TXT:
                    {
                        dnsRecord = new TxtRecord(dnsHeader);
                        break;
                    }
                case NsType.LOC:
                    {
                        dnsRecord = new LocRecord(dnsHeader);
                        break;
                    }
                case NsType.SOA:
                    {
                        dnsRecord = new SoaRecord(dnsHeader);
                        break;
                    }
                case NsType.SRV:
                    {
                        dnsRecord = new SrvRecord(dnsHeader);
                        break;
                    }
                case NsType.AFSDB:
                    {
                        dnsRecord = new AfsdbRecord(dnsHeader);
                        break;
                    }
                case NsType.ATMA:
                    {
                        dnsRecord = new AtmaRecord(dnsHeader);
                        break;
                    }
                case NsType.ISDN:
                    {
                        dnsRecord = new IsdnRecord(dnsHeader);
                        break;
                    }
                case NsType.RT:
                    {
                        dnsRecord = new RtRecord(dnsHeader);
                        break;
                    }
                case NsType.WKS:
                    {
                        dnsRecord = new WksRecord(dnsHeader);
                        break;
                    }
                default:
                    {
                        // Unknown type. parse and return the DnsUnknownRecord
                        dnsRecord = new UnknownRecord(dnsHeader);
                        break;
                    }
            }

            //dnsRecord.ParseRecordHeader(ref ms);
            dnsRecord.ParseRecord(ref ms);
            return dnsRecord;
        }
Esempio n. 11
0
        public static IDnsRecord Create(ref MemoryStream ms)
        {
            IDnsRecord dnsRecord;
            // Have to start out with an unknown record, since we have to parse the entire
            // header before we can determine the type of DNS record it is.
            // TODO: Consider other options.

            // start as an unknown type, then create a known type, parse the response
            // and return the object.
            //DnsRecordBase dr = new DnsUnknownRecord();
            //dr.ParseRecordHeader(ref ms);

            RecordHeader dnsHeader = new RecordHeader();

            dnsHeader.ParseRecordHeader(ref ms);

            switch (dnsHeader.NsType)
            {
            case NsType.A:
            {
                dnsRecord = new ARecord(dnsHeader);
                break;
            }

            case NsType.AAAA:
            {
                dnsRecord = new AaaaRecord(dnsHeader);
                break;
            }

            case NsType.MX:
            {
                dnsRecord = new MxRecord(dnsHeader);
                break;
            }

            case NsType.RP:
            {
                dnsRecord = new RpRecord(dnsHeader);
                break;
            }

            case NsType.MR:
            {
                dnsRecord = new MrRecord(dnsHeader);
                break;
            }

            case NsType.MB:
            {
                dnsRecord = new MbRecord(dnsHeader);
                break;
            }

            case NsType.MG:
            {
                dnsRecord = new MgRecord(dnsHeader);
                break;
            }

            case NsType.NS:
            {
                dnsRecord = new NsRecord(dnsHeader);
                break;
            }

            case NsType.CNAME:
            {
                dnsRecord = new CNameRecord(dnsHeader);
                break;
            }

            case NsType.PTR:
            {
                dnsRecord = new PtrRecord(dnsHeader);
                break;
            }

            case NsType.HINFO:
            {
                dnsRecord = new HInfoRecord(dnsHeader);
                break;
            }

            case NsType.MINFO:
            {
                dnsRecord = new MInfoRecord(dnsHeader);
                break;
            }

            case NsType.X25:
            {
                dnsRecord = new X25Record(dnsHeader);
                break;
            }

            case NsType.TXT:
            {
                dnsRecord = new TxtRecord(dnsHeader);
                break;
            }

            case NsType.LOC:
            {
                dnsRecord = new LocRecord(dnsHeader);
                break;
            }

            case NsType.SOA:
            {
                dnsRecord = new SoaRecord(dnsHeader);
                break;
            }

            case NsType.SRV:
            {
                dnsRecord = new SrvRecord(dnsHeader);
                break;
            }

            case NsType.AFSDB:
            {
                dnsRecord = new AfsdbRecord(dnsHeader);
                break;
            }

            case NsType.ATMA:
            {
                dnsRecord = new AtmaRecord(dnsHeader);
                break;
            }

            case NsType.ISDN:
            {
                dnsRecord = new IsdnRecord(dnsHeader);
                break;
            }

            case NsType.RT:
            {
                dnsRecord = new RtRecord(dnsHeader);
                break;
            }

            case NsType.WKS:
            {
                dnsRecord = new WksRecord(dnsHeader);
                break;
            }

            default:
            {
                // Unknown type. parse and return the DnsUnknownRecord
                dnsRecord = new UnknownRecord(dnsHeader);
                break;
            }
            }

            //dnsRecord.ParseRecordHeader(ref ms);
            dnsRecord.ParseRecord(ref ms);
            return(dnsRecord);
        }
Esempio n. 12
0
		internal LocRecord(RecordHeader dnsHeader) : base(dnsHeader) {}
Esempio n. 13
0
 internal CNameRecord(RecordHeader dnsHeader)
     : base(dnsHeader)
 {
 }
Esempio n. 14
0
 internal IsdnRecord(RecordHeader dnsHeader) : base(dnsHeader)
 {
 }
Esempio n. 15
0
 internal DnsRecordBase(RecordHeader dnsHeader)
 {
     _dnsHeader = dnsHeader;
 }
Esempio n. 16
0
 internal ARecord(RecordHeader dnsHeader) : base(dnsHeader)
 {
 }
Esempio n. 17
0
 internal CNameRecord(RecordHeader dnsHeader) : base(dnsHeader)
 {
 }
Esempio n. 18
0
 internal HInfoRecord(RecordHeader dnsHeader)
     : base(dnsHeader)
 {
 }
Esempio n. 19
0
 internal IsdnRecord(RecordHeader dnsHeader) : base(dnsHeader) { }
Esempio n. 20
0
 internal X25Record(RecordHeader dnsHeader)
     : base(dnsHeader)
 {
 }
Esempio n. 21
0
 public UnknownRecord(RecordHeader dnsHeader) : base(dnsHeader)
 {
 }