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