コード例 #1
0
        internal override void ParseAnswer(byte[] resultData, int startPosition, int length)
        {
            int endPosition = startPosition + length;

            Options = new List <EDnsOptionBase>();
            while (startPosition < endPosition)
            {
                EDnsOptionType type       = (EDnsOptionType)DnsMessageBase.ParseUShort(resultData, ref startPosition);
                ushort         dataLength = DnsMessageBase.ParseUShort(resultData, ref startPosition);

                EDnsOptionBase option;

                switch (type)
                {
                case EDnsOptionType.NsId:
                    option = new NsIdOption();
                    break;

                default:
                    option = new UnknownOption(type);
                    break;
                }

                option.ParseData(resultData, startPosition, dataLength);
                Options.Add(option);
                startPosition += dataLength;
            }
        }
コード例 #2
0
ファイル: OptRecord.cs プロジェクト: markchipman/DnsSharp
        internal override void ParseRecordData(byte[] resultData, int startPosition, int length)
        {
            int endPosition = startPosition + length;

            Options = new List <EDnsOptionBase>();
            while (startPosition < endPosition)
            {
                EDnsOptionType type       = (EDnsOptionType)DnsMessageBase.ParseUShort(resultData, ref startPosition);
                ushort         dataLength = DnsMessageBase.ParseUShort(resultData, ref startPosition);

                EDnsOptionBase option;

                switch (type)
                {
                case EDnsOptionType.LongLivedQuery:
                    option = new LongLivedQueryOption();
                    break;

                case EDnsOptionType.UpdateLease:
                    option = new UpdateLeaseOption();
                    break;

                case EDnsOptionType.NsId:
                    option = new NsIdOption();
                    break;

                case EDnsOptionType.Owner:
                    option = new OwnerOption();
                    break;

                case EDnsOptionType.DnssecAlgorithmUnderstood:
                    option = new DnssecAlgorithmUnderstoodOption();
                    break;

                case EDnsOptionType.DsHashUnderstood:
                    option = new DsHashUnderstoodOption();
                    break;

                case EDnsOptionType.Nsec3HashUnderstood:
                    option = new Nsec3HashUnderstoodOption();
                    break;

                case EDnsOptionType.ClientSubnet:
                    option = new ClientSubnetOption();
                    break;

                default:
                    option = new UnknownOption(type);
                    break;
                }

                option.ParseData(resultData, startPosition, dataLength);
                Options.Add(option);
                startPosition += dataLength;
            }
        }
コード例 #3
0
ファイル: OptRecord.cs プロジェクト: hultqvist/DnsSharp
        internal override void ParseRecordData(byte[] resultData, int startPosition, int length)
        {
            int endPosition = startPosition + length;

            Options = new List<EDnsOptionBase>();
            while (startPosition < endPosition)
            {
                EDnsOptionType type = (EDnsOptionType) DnsMessageBase.ParseUShort(resultData, ref startPosition);
                ushort dataLength = DnsMessageBase.ParseUShort(resultData, ref startPosition);

                EDnsOptionBase option;

                switch (type)
                {
                    case EDnsOptionType.LongLivedQuery:
                        option = new LongLivedQueryOption();
                        break;

                    case EDnsOptionType.UpdateLease:
                        option = new UpdateLeaseOption();
                        break;

                    case EDnsOptionType.NsId:
                        option = new NsIdOption();
                        break;

                    case EDnsOptionType.Owner:
                        option = new OwnerOption();
                        break;

                    case EDnsOptionType.DnssecAlgorithmUnderstood:
                        option = new DnssecAlgorithmUnderstoodOption();
                        break;

                    case EDnsOptionType.DsHashUnderstood:
                        option = new DsHashUnderstoodOption();
                        break;

                    case EDnsOptionType.Nsec3HashUnderstood:
                        option = new Nsec3HashUnderstoodOption();
                        break;

                    case EDnsOptionType.ClientSubnet:
                        option = new ClientSubnetOption();
                        break;

                    default:
                        option = new UnknownOption(type);
                        break;
                }

                option.ParseData(resultData, startPosition, dataLength);
                Options.Add(option);
                startPosition += dataLength;
            }
        }
コード例 #4
0
        internal override void ParseAnswer(byte[] resultData, int startPosition, int length)
        {
            int endPosition = startPosition + length;

            Options = new List<EDnsOptionBase>();
            while (startPosition < endPosition)
            {
                EDnsOptionType type = (EDnsOptionType) DnsMessageBase.ParseUShort(resultData, ref startPosition);
                ushort dataLength = DnsMessageBase.ParseUShort(resultData, ref startPosition);

                EDnsOptionBase option;

                switch (type)
                {
                    case EDnsOptionType.NsId:
                        option = new NsIdOption();
                        break;

                    default:
                        option = new UnknownOption(type);
                        break;
                }

                option.ParseData(resultData, startPosition, dataLength);
                Options.Add(option);
                startPosition += dataLength;
            }
        }