lookup.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2000, 2001, 2003-2005, 2007, 2013, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $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
}