lookup.c revision 13090db2b1c210b8386793ff0cbbb0b4348c1eca
/*
* Copyright (C) 2000 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* 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 INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM 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.6 2000/12/20 03:38:42 bwelling Exp $ */
#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))
}
}
if (sigrdataset != NULL) {
}
return (result);
}
static isc_result_t
else
&lookup->sigrdataset);
return (result);
}
static void
int order;
do {
(&lookup->sigrdataset));
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;
NULL);
if (result == ISC_R_SUCCESS)
break;
case DNS_R_DNAME:
/*
* 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.
*/
NULL);
if (result != ISC_R_SUCCESS) {
break;
}
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
}