2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-22 10:10:06 +00:00

rename dns_client_createx() to dns_client_create()

there's no longer a need to use an alternate name.
This commit is contained in:
Evan Hunt 2021-03-22 18:16:28 -07:00 committed by Ondřej Surý
parent 1beb05f3e2
commit 568d455c99
6 changed files with 36 additions and 71 deletions

View File

@ -1781,7 +1781,7 @@ main(int argc, char *argv[]) {
#endif /* ifndef WIN32 */
/* Create client */
result = dns_client_createx(mctx, actx, taskmgr, socketmgr, timermgr, 0,
result = dns_client_create(mctx, actx, taskmgr, socketmgr, timermgr, 0,
&client, srcaddr4, srcaddr6);
if (result != ISC_R_SUCCESS) {
delv_log(ISC_LOG_ERROR, "dns_client_create: %s",
@ -1802,7 +1802,7 @@ main(int argc, char *argv[]) {
CHECK(convert_name(&qfn, &query_name, qname));
/* Set up resolution options */
resopt = DNS_CLIENTRESOPT_ALLOWRUN | DNS_CLIENTRESOPT_NOCDFLAG;
resopt = DNS_CLIENTRESOPT_NOCDFLAG;
if (no_sigs) {
resopt |= DNS_CLIENTRESOPT_NODNSSEC;
}

View File

@ -105,8 +105,6 @@ struct dns_client {
#define DEF_FIND_TIMEOUT 5
#define DEF_FIND_UDPRETRIES 3
#define DNS_CLIENTATTR_OWNCTX 0x01
/*%
* Internal state for a single name resolution procedure
*/
@ -292,13 +290,13 @@ createview(isc_mem_t *mctx, dns_rdataclass_t rdclass, isc_taskmgr_t *taskmgr,
}
isc_result_t
dns_client_createx(isc_mem_t *mctx, isc_appctx_t *actx, isc_taskmgr_t *taskmgr,
dns_client_create(isc_mem_t *mctx, isc_appctx_t *actx, isc_taskmgr_t *taskmgr,
isc_socketmgr_t *socketmgr, isc_timermgr_t *timermgr,
unsigned int options, dns_client_t **clientp,
const isc_sockaddr_t *localaddr4,
const isc_sockaddr_t *localaddr6) {
dns_client_t *client;
isc_result_t result;
dns_client_t *client = NULL;
dns_dispatchmgr_t *dispatchmgr = NULL;
dns_dispatch_t *dispatchv4 = NULL;
dns_dispatch_t *dispatchv6 = NULL;
@ -434,19 +432,6 @@ destroyclient(dns_client_t *client) {
isc_task_detach(&client->task);
/*
* If the client has created its own running environments,
* destroy them.
*/
if ((client->attributes & DNS_CLIENTATTR_OWNCTX) != 0) {
isc_taskmgr_destroy(&client->taskmgr);
isc_timermgr_destroy(&client->timermgr);
isc_socketmgr_destroy(&client->socketmgr);
isc_app_ctxfinish(client->actx);
isc_appctx_destroy(&client->actx);
}
isc_mutex_destroy(&client->lock);
client->magic = 0;
@ -1042,35 +1027,22 @@ dns_client_resolve(dns_client_t *client, const dns_name_t *name,
dns_rdataclass_t rdclass, dns_rdatatype_t type,
unsigned int options, dns_namelist_t *namelist) {
isc_result_t result;
isc_appctx_t *actx;
resarg_t *resarg;
REQUIRE(DNS_CLIENT_VALID(client));
REQUIRE(client->actx != NULL);
REQUIRE(namelist != NULL && ISC_LIST_EMPTY(*namelist));
if ((client->attributes & DNS_CLIENTATTR_OWNCTX) == 0 &&
(options & DNS_CLIENTRESOPT_ALLOWRUN) == 0)
{
/*
* If the client is run under application's control, we need
* to create a new running (sub)environment for this
* particular resolution.
*/
return (ISC_R_NOTIMPLEMENTED); /* XXXTBD */
} else {
actx = client->actx;
}
resarg = isc_mem_get(client->mctx, sizeof(*resarg));
isc_mutex_init(&resarg->lock);
*resarg = (resarg_t){
.actx = client->actx,
.client = client,
.result = DNS_R_SERVFAIL,
.namelist = namelist,
};
resarg->actx = actx;
resarg->client = client;
resarg->result = DNS_R_SERVFAIL;
resarg->namelist = namelist;
resarg->trans = NULL;
resarg->canceled = false;
result = dns_client_startresolve(client, name, rdclass, type, options,
client->task, resolve_done, resarg,
&resarg->trans);
@ -1084,7 +1056,7 @@ dns_client_resolve(dns_client_t *client, const dns_name_t *name,
* Start internal event loop. It blocks until the entire process
* is completed.
*/
result = isc_app_ctxrun(actx);
result = isc_app_ctxrun(client->actx);
LOCK(&resarg->lock);
if (result == ISC_R_SUCCESS || result == ISC_R_SUSPEND) {

View File

@ -67,7 +67,7 @@ ISC_LANG_BEGINDECLS
/*%< Do not return DNSSEC data (e.g. RRSIGS) with response. */
#define DNS_CLIENTRESOPT_NODNSSEC 0x01
/*%< Allow running external context. */
#define DNS_CLIENTRESOPT_ALLOWRUN 0x02
#define DNS_CLIENTRESOPT_RESERVED 0x02
/*%< Don't validate responses. */
#define DNS_CLIENTRESOPT_NOVALIDATE 0x04
/*%< Don't set the CD flag on upstream queries. */
@ -79,7 +79,7 @@ ISC_LANG_BEGINDECLS
* Optional flags for dns_client_(start)request.
*/
/*%< Allow running external context. */
#define DNS_CLIENTREQOPT_ALLOWRUN 0x01
#define DNS_CLIENTREQOPT_RESERVED 0x01
/*%< Use TCP transport. */
#define DNS_CLIENTREQOPT_TCP 0x02
@ -87,7 +87,7 @@ ISC_LANG_BEGINDECLS
* Optional flags for dns_client_(start)update.
*/
/*%< Allow running external context. */
#define DNS_CLIENTUPDOPT_ALLOWRUN 0x01
#define DNS_CLIENTUPDOPT_RESERVED 0x01
/*%< Use TCP transport. */
#define DNS_CLIENTUPDOPT_TCP 0x02
@ -127,7 +127,7 @@ typedef struct dns_clientreqevent {
} dns_clientreqevent_t; /* too long? */
isc_result_t
dns_client_createx(isc_mem_t *mctx, isc_appctx_t *actx, isc_taskmgr_t *taskmgr,
dns_client_create(isc_mem_t *mctx, isc_appctx_t *actx, isc_taskmgr_t *taskmgr,
isc_socketmgr_t *socketmgr, isc_timermgr_t *timermgr,
unsigned int options, dns_client_t **clientp,
const isc_sockaddr_t *localaddr4,
@ -261,11 +261,8 @@ dns_client_startresolve(dns_client_t *client, const dns_name_t *name,
* error. Otherwise, it returns the result code of the entire resolution
* process, either success or failure.
*
* It is typically expected that the client object passed to
* dns_client_resolve() was created via dns_client_create() and has its own
* managers and contexts. However, if the DNS_CLIENTRESOPT_ALLOWRUN flag is
* set in 'options', this function performs the synchronous service even if
* it does not have its own manager and context structures.
* It is expected that the client object passed to dns_client_resolve() was
* created via dns_client_create() and has external managers and contexts.
*
* dns_client_startresolve() is an asynchronous version of dns_client_resolve()
* and does not block. When name resolution is completed, 'action' will be
@ -401,11 +398,8 @@ dns_client_startrequest(dns_client_t *client, dns_message_t *qmessage,
* 'rmessage' will contain the response message. The caller must provide a
* valid initialized message.
*
* It is usually expected that the client object passed to
* dns_client_request() was created via dns_client_create() and has its own
* managers and contexts. However, if the DNS_CLIENTREQOPT_ALLOWRUN flag is
* set in 'options', this function performs the synchronous service even if
* it does not have its own manager and context structures.
* It is expected that the client object passed to dns_client_request() was
* created via dns_client_create() and has external managers and contexts.
*
* dns_client_startrequest() is an asynchronous version of dns_client_request()
* and does not block. When the transaction is completed, 'action' will be

View File

@ -135,7 +135,7 @@ dns_cert_totext
dns_client_addtrustedkey
dns_client_cancelresolve
dns_client_clearservers
dns_client_createx
dns_client_create
dns_client_destroy
dns_client_destroyrestrans
dns_client_freeresanswer

View File

@ -241,7 +241,7 @@ main(int argc, char *argv[]) {
dns_rdataset_t *rdataset;
dns_namelist_t namelist;
isc_mem_t *keymctx = NULL;
unsigned int clientopt, resopt;
unsigned int clientopt, resopt = 0;
bool is_sep = false;
const char *port = "53";
isc_mem_t *mctx = NULL;
@ -385,7 +385,7 @@ main(int argc, char *argv[]) {
}
clientopt = 0;
result = dns_client_createx(mctx, actx, taskmgr, socketmgr, timermgr,
result = dns_client_create(mctx, actx, taskmgr, socketmgr, timermgr,
clientopt, &client, addr4, addr6);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "dns_client_create failed: %u, %s\n", result,
@ -444,7 +444,6 @@ main(int argc, char *argv[]) {
}
/* Perform resolution */
resopt = DNS_CLIENTRESOPT_ALLOWRUN;
if (keynamestr == NULL) {
resopt |= DNS_CLIENTRESOPT_NODNSSEC;
}

View File

@ -343,10 +343,10 @@ main(int argc, char *argv[]) {
isc_app_ctxstart(query_actx);
result = dns_client_createx(mctx, query_actx, taskmgr, socketmgr,
result = dns_client_create(mctx, query_actx, taskmgr, socketmgr,
timermgr, 0, &client, NULL, NULL);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "dns_client_createx failed: %u\n", result);
fprintf(stderr, "dns_client_create failed: %u\n", result);
exit(1);
}