예제 #1
0
파일: SrvRecord.cs 프로젝트: yslib/minimvc
 public SrvRecord(DataBuffer buffer)
 {
     _priority = buffer.ReadShortInt();
     _weight = buffer.ReadShortUInt();
     _port = buffer.ReadShortUInt();
     _domain = buffer.ReadDomainName();
 }
예제 #2
0
파일: DSRecord.cs 프로젝트: yslib/minimvc
 public DSRecord(DataBuffer buffer, int length)
 {
     _key = buffer.ReadShortInt();
     _algorithm = buffer.ReadByte();
     _digestType = buffer.ReadByte();
     _digest = buffer.ReadBytes(length - 4);
 }
예제 #3
0
파일: KeyRecord.cs 프로젝트: yslib/minimvc
 public KeyRecord(DataBuffer buffer, int length)
 {
     _flags = buffer.ReadShortInt();
     _protocol = buffer.ReadByte();
     _algorithm = buffer.ReadByte();
     _publicKey = buffer.ReadBytes(length - 4);
 }
예제 #4
0
 public NaptrRecord(DataBuffer buffer)
 {
     _order = buffer.ReadShortUInt();
     _priority = buffer.ReadShortUInt();
     _flags = buffer.ReadCharString();
     _services = buffer.ReadCharString();
     _regexp = buffer.ReadCharString();
     _replacement = buffer.ReadCharString();
 }
예제 #5
0
파일: WksRecord.cs 프로젝트: yslib/minimvc
        public WksRecord(DataBuffer buffer, int length)
        {
            _ipAddress = buffer.ReadIPAddress();
            _protocol = buffer.ReadByte();
            _services = new Byte[length - 5];

            for (int i = 0; i < (length - 5); i++)
                _services[i] = buffer.ReadByte();
        }
예제 #6
0
파일: LocRecord.cs 프로젝트: yslib/minimvc
 public LocRecord(DataBuffer buffer)
 {
     _version = buffer.ReadShortInt();
     _size = buffer.ReadShortInt();
     _horzPrecision = buffer.ReadShortInt();
     _vertPrecision = buffer.ReadShortInt();
     _lattitude = buffer.ReadInt();
     _longitude = buffer.ReadInt();
     _altitude = buffer.ReadInt();
 }
예제 #7
0
파일: SoaRecord.cs 프로젝트: yslib/minimvc
 public SoaRecord(DataBuffer buffer)
 {
     _primaryNameServer = buffer.ReadDomainName();
     _responsibleMailAddress = buffer.ReadDomainName();
     _serial = buffer.ReadInt();
     _refresh = buffer.ReadInt();
     _retry = buffer.ReadInt();
     _expire = buffer.ReadInt();
     _defaultTtl = buffer.ReadInt();
 }
예제 #8
0
파일: DnsEntry.cs 프로젝트: yslib/minimvc
        public DnsEntry(DataBuffer buffer)
        {
            try
            {
                _domain = buffer.ReadDomainName();
                byte b = buffer.ReadByte();
                _recType = (RecordType)buffer.ReadShortInt();
                _classType = buffer.ReadShortInt();
                _ttl = buffer.ReadInt();

                int length = buffer.ReadByte();
                switch (_recType)
                {
                    case RecordType.A: _data = new ARecord(buffer); break;
                    case RecordType.NS: _data = new NSRecord(buffer); break;
                    case RecordType.CNAME: _data = new CNameRecord(buffer); break;
                    case RecordType.SOA: _data = new SoaRecord(buffer); break;
                    case RecordType.MB: _data = new MBRecord(buffer); break;
                    case RecordType.MG: _data = new MGRecord(buffer); break;
                    case RecordType.MR: _data = new MRRecord(buffer); break;
                    case RecordType.NULL: _data = new NullRecord(buffer, length); break;
                    case RecordType.WKS: _data = new WksRecord(buffer, length); break;
                    case RecordType.PTR: _data = new PtrRecord(buffer); break;
                    case RecordType.HINFO: _data = new HInfoRecord(buffer, length); break;
                    case RecordType.MINFO: _data = new MInfoRecord(buffer); break;
                    case RecordType.MX: _data = new MXRecord(buffer); break;
                    case RecordType.TXT: _data = new TxtRecord(buffer, length); break;
                    case RecordType.RP: _data = new RPRecord(buffer); break;
                    case RecordType.AFSDB: _data = new AfsdbRecord(buffer); break;
                    case RecordType.X25: _data = new X25Record(buffer); break;
                    case RecordType.ISDN: _data = new IsdnRecord(buffer); break;
                    case RecordType.RT: _data = new RTRecord(buffer); break;
                    case RecordType.NSAP: _data = new NsapRecord(buffer, length); break;
                    case RecordType.SIG: _data = new SigRecord(buffer, length); break;
                    case RecordType.KEY: _data = new KeyRecord(buffer, length); break;
                    case RecordType.PX: _data = new PXRecord(buffer); break;
                    case RecordType.AAAA: _data = new AAAARecord(buffer); break;
                    case RecordType.LOC: _data = new LocRecord(buffer); break;
                    case RecordType.SRV: _data = new SrvRecord(buffer); break;
                    case RecordType.NAPTR: _data = new NaptrRecord(buffer); break;
                    case RecordType.KX: _data = new KXRecord(buffer); break;
                    case RecordType.A6: _data = new A6Record(buffer); break;
                    case RecordType.DNAME: _data = new DNameRecord(buffer); break;
                    case RecordType.DS: _data = new DSRecord(buffer, length); break;
                    case RecordType.TKEY: _data = new TKeyRecord(buffer); break;
                    case RecordType.TSIG: _data = new TSigRecord(buffer); break;
                    default: throw new DnsQueryException("Invalid DNS Record Type in DNS Response", null);
                }
            }
            catch (Exception ex)
            {
                _data = new ExceptionRecord(ex.Message);
                throw ex;
            }
        }
예제 #9
0
파일: TKeyRecord.cs 프로젝트: yslib/minimvc
 public TKeyRecord(DataBuffer buffer)
 {
     _algorithm = buffer.ReadDomainName();
     _inception = buffer.ReadUInt();
     _expiration = buffer.ReadUInt();
     _mode = buffer.ReadShortUInt();
     _error = buffer.ReadShortUInt();
     _keySize = buffer.ReadShortUInt();
     _keyData = buffer.ReadBytes(_keySize);
     _otherSize = buffer.ReadShortUInt();
     _otherData = buffer.ReadBytes(_otherSize);
 }
예제 #10
0
파일: TSigRecord.cs 프로젝트: yslib/minimvc
 public TSigRecord(DataBuffer buffer)
 {
     _algorithm = buffer.ReadDomainName();
     _timeSigned = buffer.ReadLongInt();
     _fudge = buffer.ReadShortUInt();
     _macSize = buffer.ReadShortUInt();
     _mac = buffer.ReadBytes(_macSize);
     _originalId = buffer.ReadShortUInt();
     _error = buffer.ReadShortUInt();
     _otherLen = buffer.ReadShortUInt();
     _otherData = buffer.ReadBytes(_otherLen);
 }
예제 #11
0
파일: SigRecord.cs 프로젝트: yslib/minimvc
 public SigRecord(DataBuffer buffer, int length)
 {
     int pos = buffer.Position;
     _coveredType = buffer.ReadShortInt();
     _algorithm = buffer.ReadByte();
     _numLabels = buffer.ReadByte();
     _expiration = buffer.ReadUInt();
     _inception = buffer.ReadUInt();
     _keyTag = buffer.ReadShortInt();
     _signer = buffer.ReadDomainName();
     buffer.Position = pos - length;
 }
예제 #12
0
파일: A6Record.cs 프로젝트: yslib/minimvc
        public A6Record(DataBuffer buffer)
        {
            _prefixLength = buffer.ReadByte();

            if (_prefixLength == 0) //Only Address Present
            {
                _ipAddress = buffer.ReadIPv6Address();
            }
            else if (_prefixLength == 128) //Only Domain Name Present
            {
                _domain = buffer.ReadDomainName();
            }
            else //Address and Domain Name Present
            {
                _ipAddress = buffer.ReadIPv6Address();
                _domain = buffer.ReadDomainName();
            }
        }
예제 #13
0
파일: TextOnly.cs 프로젝트: yslib/minimvc
 public TextOnly(DataBuffer buffer, int length)
 {
     int len = length;
     int pos = buffer.Position;
     _text = new List<string>();
     byte next = buffer.Next;
     while (length > 0)
     {
         _text.Add(buffer.ReadCharString());
         length -= next + 1;
         if (length < 0)
         {
             buffer.Position = pos - len;  //Reset current Pointer of Buffer to end of this record
             throw new DnsQueryException("Buffer Over Run in TextOnly Record Data Type", null);
         }
         next = buffer.Next;
     }
     if (length > 0)
     {
         buffer.Position = pos - len;  //Reset current Pointer of Buffer to end of this record
         throw new DnsQueryException("Buffer Under Run in TextOnly Record Data Type", null);
     }
 }
예제 #14
0
 public AfsdbRecord(DataBuffer buffer)
 {
     _subType = buffer.ReadShortInt();
     _domain = buffer.ReadDomainName();
 }
예제 #15
0
 public PrefAndDomain(DataBuffer buffer)
 {
     _preference = buffer.ReadBEShortInt();
     _domain     = buffer.ReadDomainName();
 }
예제 #16
0
 public MInfoRecord(DataBuffer buffer)
 {
     _responsibleMailbox = buffer.ReadDomainName();
     _errorMailbox = buffer.ReadDomainName();
 }
예제 #17
0
파일: PXRecord.cs 프로젝트: yslib/minimvc
 public PXRecord(DataBuffer buffer)
     : base(buffer)
 {
     _x400Domain = buffer.ReadDomainName();
 }
예제 #18
0
파일: TextOnly.cs 프로젝트: yslib/minimvc
 public TextOnly(DataBuffer buffer)
 {
     _text = new List<string>();
     while(buffer.Next > 0)
         _text.Add(buffer.ReadCharString());
 }
예제 #19
0
파일: Answer.cs 프로젝트: yslib/minimvc
 public Answer(DataBuffer buffer)
     : base(buffer)
 {
 }
예제 #20
0
파일: RTRecord.cs 프로젝트: dumpvn/minimvc
 public RTRecord(DataBuffer buffer)
     : base(buffer)
 {
 }
예제 #21
0
 public HInfoRecord(DataBuffer buffer, int length)
     : base(buffer, length)
 {
 }
예제 #22
0
파일: IsdnRecord.cs 프로젝트: yslib/minimvc
 public IsdnRecord(DataBuffer buffer)
 {
     _isdnAddress = buffer.ReadCharString();
     _subAddress = buffer.ReadCharString();
 }
예제 #23
0
 public NsapRecord(DataBuffer buffer, int length)
 {
     buffer.Position += length;
     throw new NotImplementedException("Experimental Record Type Unable to Implement");
 }
예제 #24
0
파일: DnsAnswer.cs 프로젝트: dumpvn/minimvc
        public DnsAnswer(byte[] response)
        {
            _questions  = new List <Question>();
            _answers    = new List <Answer>();
            _servers    = new List <Server>();
            _additional = new List <Record>();
            _exceptions = new List <Exception>();
            DataBuffer buffer = new DataBuffer(response, 2);
            byte       bits1  = buffer.ReadByte();
            byte       bits2  = buffer.ReadByte();
            //Mask off return code
            int returnCode = bits2 & 15;

            if (returnCode > 6)
            {
                returnCode = 6;
            }
            this._returnCode = (ReturnCode)returnCode;
            //Get Additional Flags
            _authoritative = TestBit(bits1, 2);
            _recursive     = TestBit(bits2, 8);
            _truncated     = TestBit(bits1, 1);

            int nQuestions  = buffer.ReadBEShortInt();
            int nAnswers    = buffer.ReadBEShortInt();
            int nServers    = buffer.ReadBEShortInt();
            int nAdditional = buffer.ReadBEShortInt();

            //read in questions
            for (int i = 0; i < nQuestions; i++)
            {
                try
                {
                    _questions.Add(new Question(buffer));
                }
                catch (Exception ex)
                {
                    _exceptions.Add(ex);
                }
            }
            //read in answers
            for (int i = 0; i < nAnswers; i++)
            {
                try
                {
                    _answers.Add(new Answer(buffer));
                }
                catch (Exception ex)
                {
                    _exceptions.Add(ex);
                }
            }
            //read in servers
            for (int i = 0; i < nServers; i++)
            {
                try
                {
                    _servers.Add(new Server(buffer));
                }
                catch (Exception ex)
                {
                    _exceptions.Add(ex);
                }
            }
            //read in additional records
            for (int i = 0; i < nAdditional; i++)
            {
                try
                {
                    _additional.Add(new Record(buffer));
                }
                catch (Exception ex)
                {
                    _exceptions.Add(ex);
                }
            }
        }
예제 #25
0
파일: ARecord.cs 프로젝트: yslib/minimvc
 public ARecord(DataBuffer buffer)
 {
     Byte[] ipaddress = buffer.ReadBytes(4);
     _ipAddress = new IPAddress(ipaddress);
 }
예제 #26
0
파일: ARecord.cs 프로젝트: dumpvn/minimvc
 public ARecord(DataBuffer buffer)
 {
     Byte[] ipaddress = buffer.ReadBytes(4);
     _ipAddress = new IPAddress(ipaddress);
 }
예제 #27
0
 public AfsdbRecord(DataBuffer buffer)
 {
     _subType = buffer.ReadShortInt();
     _domain  = buffer.ReadDomainName();
 }
예제 #28
0
        public DnsEntry(DataBuffer buffer)
        {
            try
            {
                _domain = buffer.ReadDomainName();
                byte b = buffer.ReadByte();
                _recType   = (RecordType)buffer.ReadShortInt();
                _classType = buffer.ReadShortInt();
                _ttl       = buffer.ReadInt();

                int length = buffer.ReadByte();
                switch (_recType)
                {
                case RecordType.A: _data = new ARecord(buffer); break;

                case RecordType.NS: _data = new NSRecord(buffer); break;

                case RecordType.CNAME: _data = new CNameRecord(buffer); break;

                case RecordType.SOA: _data = new SoaRecord(buffer); break;

                case RecordType.MB: _data = new MBRecord(buffer); break;

                case RecordType.MG: _data = new MGRecord(buffer); break;

                case RecordType.MR: _data = new MRRecord(buffer); break;

                case RecordType.NULL: _data = new NullRecord(buffer, length); break;

                case RecordType.WKS: _data = new WksRecord(buffer, length); break;

                case RecordType.PTR: _data = new PtrRecord(buffer); break;

                case RecordType.HINFO: _data = new HInfoRecord(buffer, length); break;

                case RecordType.MINFO: _data = new MInfoRecord(buffer); break;

                case RecordType.MX: _data = new MXRecord(buffer); break;

                case RecordType.TXT: _data = new TxtRecord(buffer, length); break;

                case RecordType.RP: _data = new RPRecord(buffer); break;

                case RecordType.AFSDB: _data = new AfsdbRecord(buffer); break;

                case RecordType.X25: _data = new X25Record(buffer); break;

                case RecordType.ISDN: _data = new IsdnRecord(buffer); break;

                case RecordType.RT: _data = new RTRecord(buffer); break;

                case RecordType.NSAP: _data = new NsapRecord(buffer, length); break;

                case RecordType.SIG: _data = new SigRecord(buffer, length); break;

                case RecordType.KEY: _data = new KeyRecord(buffer, length); break;

                case RecordType.PX: _data = new PXRecord(buffer); break;

                case RecordType.AAAA: _data = new AAAARecord(buffer); break;

                case RecordType.LOC: _data = new LocRecord(buffer); break;

                case RecordType.SRV: _data = new SrvRecord(buffer); break;

                case RecordType.NAPTR: _data = new NaptrRecord(buffer); break;

                case RecordType.KX: _data = new KXRecord(buffer); break;

                case RecordType.A6: _data = new A6Record(buffer); break;

                case RecordType.DNAME: _data = new DNameRecord(buffer); break;

                case RecordType.DS: _data = new DSRecord(buffer, length); break;

                case RecordType.TKEY: _data = new TKeyRecord(buffer); break;

                case RecordType.TSIG: _data = new TSigRecord(buffer); break;

                default: throw new DnsQueryException("Invalid DNS Record Type in DNS Response", null);
                }
            }
            catch (Exception ex)
            {
                _data = new ExceptionRecord(ex.Message);
                throw ex;
            }
        }
예제 #29
0
 public CNameRecord(DataBuffer buffer)
     : base(buffer)
 {
 }
예제 #30
0
파일: AAAARecord.cs 프로젝트: yslib/minimvc
 public AAAARecord(DataBuffer buffer)
 {
     _ipAddress = buffer.ReadIPv6Address();
 }
예제 #31
0
파일: NsapRecord.cs 프로젝트: yslib/minimvc
 public NsapRecord(DataBuffer buffer, int length)
 {
     buffer.Position += length;
     throw new NotImplementedException("Experimental Record Type Unable to Implement");
 }
예제 #32
0
파일: Answer.cs 프로젝트: dumpvn/minimvc
 public Answer(DataBuffer buffer)
     : base(buffer)
 {
 }
예제 #33
0
파일: Record.cs 프로젝트: yslib/minimvc
 public Record(DataBuffer buffer)
     : base(buffer)
 {
 }
예제 #34
0
파일: Question.cs 프로젝트: yslib/minimvc
 public Question(DataBuffer buffer)
 {
     _domain = buffer.ReadDomainName();
     _recType = (RecordType)buffer.ReadBEShortInt();
     _classType = buffer.ReadBEShortInt();
 }
예제 #35
0
파일: Server.cs 프로젝트: yslib/minimvc
 public Server(DataBuffer buffer)
     : base(buffer)
 {
 }
예제 #36
0
파일: TxtRecord.cs 프로젝트: yslib/minimvc
 public TxtRecord(DataBuffer buffer, int length)
     : base(buffer, length)
 {
 }
예제 #37
0
파일: DnsAnswer.cs 프로젝트: yslib/minimvc
        public DnsAnswer(byte[] response)
        {
            _questions = new List<Question>();
            _answers = new List<Answer>();
            _servers = new List<Server>();
            _additional = new List<Record>();
            _exceptions = new List<Exception>();
            DataBuffer buffer = new DataBuffer(response, 2);
            byte bits1 = buffer.ReadByte();
            byte bits2 = buffer.ReadByte();
            //Mask off return code
            int returnCode = bits2 & 15;
            if (returnCode > 6) returnCode = 6;
            this._returnCode = (ReturnCode)returnCode;
            //Get Additional Flags
            _authoritative = TestBit(bits1, 2);
            _recursive = TestBit(bits2, 8);
            _truncated = TestBit(bits1, 1);

            int nQuestions = buffer.ReadBEShortInt();
            int nAnswers = buffer.ReadBEShortInt();
            int nServers = buffer.ReadBEShortInt();
            int nAdditional = buffer.ReadBEShortInt();

            //read in questions
            for (int i = 0; i < nQuestions; i++)
            {
                try
                {
                    _questions.Add(new Question(buffer));
                }
                catch (Exception ex)
                {
                    _exceptions.Add(ex);
                }
            }
            //read in answers
            for (int i = 0; i < nAnswers; i++)
            {
                try
                {
                    _answers.Add(new Answer(buffer));
                }
                catch (Exception ex)
                {
                    _exceptions.Add(ex);
                }
            }
            //read in servers
            for (int i = 0; i < nServers; i++)
            {
                try
                {
                    _servers.Add(new Server(buffer));
                }
                catch (Exception ex)
                {
                    _exceptions.Add(ex);
                }
            }
            //read in additional records
            for (int i = 0; i < nAdditional; i++)
            {
                try
                {
                    _additional.Add(new Record(buffer));
                }
                catch (Exception ex)
                {
                    _exceptions.Add(ex);
                }
            }
        }
예제 #38
0
파일: RPRecord.cs 프로젝트: yslib/minimvc
 public RPRecord(DataBuffer buffer)
 {
     _responsibleMailbox = buffer.ReadDomainName();
     _textDomain = buffer.ReadDomainName();
 }