RegistryDNS extends AbstractService implements DNSOperations,
    ZoneSelector { protected Name getReverseZoneName(Configuration conf) { Name name = null; String zoneSubnet = getZoneSubnet(conf); if (zoneSubnet == null) { LOG.warn("Zone subnet is not configured. Reverse lookups disabled"); } else { String mask = conf.get(KEY_DNS_ZONE_MASK); if (mask != null) { SubnetUtils utils = new SubnetUtils(zoneSubnet, mask); name = getReverseZoneName(utils, zoneSubnet); } else { name = getReverseZoneName(zoneSubnet); } } return name; } RegistryDNS(String name); void initializeChannels(Configuration conf); byte[] formErrorMessage(byte[] in); void nioTCPClient(SocketChannel ch); void serveNIOTCP(ServerSocketChannel serverSocketChannel,
      InetAddress addr, int port); void addNIOTCP(final InetAddress addr, final int port); void addNIOUDP(final InetAddress addr, final int port); byte[] errorMessage(Message query, int rcode); RRset findExactMatch(Name name, int type); @Override Zone findBestZone(Name name); @Override void register(String path, ServiceRecord record); @Override void delete(String path, ServiceRecord record); static final String CONTAINER; static final String IN_ADDR_ARPA; static final String ZONE_SUFFIX; }
@Test public void testReverseZoneNames() throws Exception { Configuration conf = new Configuration(); conf.set(KEY_DNS_ZONE_SUBNET, "172.26.32.0"); conf.set(KEY_DNS_ZONE_MASK, "255.255.224.0"); Name name = getRegistryDNS().getReverseZoneName(conf); assertEquals("wrong name", "26.172.in-addr.arpa.", name.toString()); }