Example #1
0
        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;
            }
        }
Example #2
0
        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;
            }
        }