/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* The Resolver class performs DNS client operations in support of DnsContext.
*
* <p> Every DnsName instance passed to or returned from a method of
* this class should be fully-qualified and contain a root label (an
* empty component at position 0).
*
* @author Scott Seligman
*/
class Resolver {
/*
* Constructs a new Resolver given its servers and timeout parameters.
* Each server is of the form "server[:port]".
* IPv6 literal host names include delimiting brackets.
* There must be at least one server.
* "timeout" is the initial timeout interval (in ms) for UDP queries,
* and "retries" gives the number of retries per server.
*/
throws NamingException {
}
public void close() {
}
/*
* Queries resource records of a particular class and type for a
* given domain name.
* Useful values of rrclass are ResourceRecord.[Q]CLASS_xxx.
* Useful values of rrtype are ResourceRecord.[Q]TYPE_xxx.
* If recursion is true, recursion is requested on the query.
* If auth is true, only authoritative responses are accepted.
*/
throws NamingException {
}
/*
* Queries all resource records of a zone given its domain name and class.
* If recursion is true, recursion is requested on the query to find
* the name server (and also on the zone transfer, but it won't matter).
*/
throws NamingException {
try {
} finally {
}
}
/*
* Finds the zone of a given domain name. The method is to look
* for the first SOA record on the path from the given domain to
* the root. This search may be partially bypassed if the zone's
* SOA record is received in the authority section of a response.
* If recursion is true, recursion is requested on any queries.
*/
throws NamingException {
try {
recursion, false);
} catch (NameNotFoundException e) {
throw e;
} catch (NamingException e) {
// Ignore error and keep searching up the tree.
}
return fqdn;
}
// Look for an SOA record giving the zone's top node.
return zone;
}
}
}
}
}
return fqdn; // no SOA found below root, so
// return root
}
/*
* Finds a zone's SOA record. Returns null if no SOA is found (in
* which case "zone" is not actually a zone).
* If recursion is true, recursion is requested on the query.
*/
throws NamingException {
recursion, false);
return rr;
}
}
return null;
}
/*
* Finds the name servers of a zone. <tt>zone</tt> is a fully-qualified
* domain name at the top of a zone.
* If recursion is true, recursion is requested on the query.
*/
throws NamingException {
// %%% As an optimization, could look in authority section of
// findZoneName() response first.
recursion, false);
throw new CommunicationException("Corrupted DNS message");
}
// Server name will be passed to InetAddress.getByName(), which
// may not be able to handle a trailing dot.
// assert ns[i].endsWith(".");
}
return ns;
}
}