Exemple #1
0
        private AuthZone CreateEmptyZone(AuthZoneInfo zoneInfo)
        {
            AuthZone zone;

            switch (zoneInfo.Type)
            {
            case AuthZoneType.Primary:
                zone = new PrimaryZone(_dnsServer, zoneInfo);
                break;

            case AuthZoneType.Secondary:
                zone = new SecondaryZone(_dnsServer, zoneInfo);
                break;

            case AuthZoneType.Stub:
                zone = new StubZone(_dnsServer, zoneInfo);
                break;

            case AuthZoneType.Forwarder:
                zone = new ForwarderZone(zoneInfo);
                break;

            default:
                throw new InvalidDataException("DNS zone type not supported.");
            }

            if (_root.TryAdd(zone))
            {
                return(zone);
            }

            throw new DnsServerException("Zone already exists: " + zoneInfo.Name);
        }