lookup.c revision 573d78f3d53859bc01ce5d5cebbaac9b8b90bfba
/*
* Copyright (C) 2004, 2005, 2007, 2013 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000, 2001, 2003 Internet Software Consortium.
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lookup.c,v 1.21 2007/06/18 23:47:40 tbox Exp $ */
/*! \file */
#include <config.h>
#include <dns/rdataset.h>
#include <dns/rdatastruct.h>
#include <dns/resolver.h>
struct dns_lookup {
/* Unlocked. */
unsigned int magic;
/* Locked by lock. */
unsigned int options;
isc_task_t * task;
dns_view_t * view;
dns_fetch_t * fetch;
unsigned int restarts;
};
#define MAX_RESTARTS 16
static void
}
static inline isc_result_t
/*
* The caller must be holding the lookup's lock.
*/
return (result);
}
static isc_result_t
goto fail;
}
if (result != ISC_R_SUCCESS)
goto fail;
goto fail;
}
}
sizeof(dns_rdataset_t));
if (sigrdataset == NULL) {
goto fail;
}
}
return (ISC_R_SUCCESS);
fail:
if (dns_name_dynamic(name))
}
}
return (result);
}
static isc_result_t
else
&lookup->sigrdataset);
return (result);
}
static void
unsigned int nlabels;
int order;
do {
(&lookup->sigrdataset));
/*
* If we have restarted then clear the old node. */
}
if (result == ISC_R_NOTFOUND) {
/*
* We don't know anything about the name.
* Launch a fetch.
*/
}
if (result == ISC_R_SUCCESS)
goto done;
}
} else
/*
* If we've been canceled, forget about the result.
*/
switch (result) {
case ISC_R_SUCCESS:
break;
break;
case DNS_R_CNAME:
/*
* Copy the CNAME's target into the lookup's
* query name and start over.
*/
if (result != ISC_R_SUCCESS)
break;
if (result != ISC_R_SUCCESS)
break;
if (result == ISC_R_SUCCESS) {
}
break;
case DNS_R_DNAME:
&nlabels);
/*
* Get the target name of the DNAME.
*/
if (result != ISC_R_SUCCESS)
break;
if (result != ISC_R_SUCCESS)
break;
/*
* Construct the new query name and start over.
*/
if (result == ISC_R_SUCCESS) {
}
break;
default:
}
done:
}
/*
* Limit the number of restarts.
*/
}
} while (want_restart);
if (send_event) {
}
}
static void
}
}
}
}
{
return (ISC_R_NOMEMORY);
goto cleanup_lookup;
}
if (result != ISC_R_SUCCESS)
goto cleanup_event;
if (result != ISC_R_SUCCESS)
goto cleanup_lock;
return (ISC_R_SUCCESS);
return (result);
}
void
}
}
}
void
}