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:
parent
1beb05f3e2
commit
568d455c99
@ -1781,8 +1781,8 @@ main(int argc, char *argv[]) {
|
|||||||
#endif /* ifndef WIN32 */
|
#endif /* ifndef WIN32 */
|
||||||
|
|
||||||
/* Create client */
|
/* 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);
|
&client, srcaddr4, srcaddr6);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
delv_log(ISC_LOG_ERROR, "dns_client_create: %s",
|
delv_log(ISC_LOG_ERROR, "dns_client_create: %s",
|
||||||
isc_result_totext(result));
|
isc_result_totext(result));
|
||||||
@ -1802,7 +1802,7 @@ main(int argc, char *argv[]) {
|
|||||||
CHECK(convert_name(&qfn, &query_name, qname));
|
CHECK(convert_name(&qfn, &query_name, qname));
|
||||||
|
|
||||||
/* Set up resolution options */
|
/* Set up resolution options */
|
||||||
resopt = DNS_CLIENTRESOPT_ALLOWRUN | DNS_CLIENTRESOPT_NOCDFLAG;
|
resopt = DNS_CLIENTRESOPT_NOCDFLAG;
|
||||||
if (no_sigs) {
|
if (no_sigs) {
|
||||||
resopt |= DNS_CLIENTRESOPT_NODNSSEC;
|
resopt |= DNS_CLIENTRESOPT_NODNSSEC;
|
||||||
}
|
}
|
||||||
|
@ -105,8 +105,6 @@ struct dns_client {
|
|||||||
#define DEF_FIND_TIMEOUT 5
|
#define DEF_FIND_TIMEOUT 5
|
||||||
#define DEF_FIND_UDPRETRIES 3
|
#define DEF_FIND_UDPRETRIES 3
|
||||||
|
|
||||||
#define DNS_CLIENTATTR_OWNCTX 0x01
|
|
||||||
|
|
||||||
/*%
|
/*%
|
||||||
* Internal state for a single name resolution procedure
|
* 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
|
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,
|
isc_socketmgr_t *socketmgr, isc_timermgr_t *timermgr,
|
||||||
unsigned int options, dns_client_t **clientp,
|
unsigned int options, dns_client_t **clientp,
|
||||||
const isc_sockaddr_t *localaddr4,
|
const isc_sockaddr_t *localaddr4,
|
||||||
const isc_sockaddr_t *localaddr6) {
|
const isc_sockaddr_t *localaddr6) {
|
||||||
dns_client_t *client;
|
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
dns_client_t *client = NULL;
|
||||||
dns_dispatchmgr_t *dispatchmgr = NULL;
|
dns_dispatchmgr_t *dispatchmgr = NULL;
|
||||||
dns_dispatch_t *dispatchv4 = NULL;
|
dns_dispatch_t *dispatchv4 = NULL;
|
||||||
dns_dispatch_t *dispatchv6 = NULL;
|
dns_dispatch_t *dispatchv6 = NULL;
|
||||||
@ -434,19 +432,6 @@ destroyclient(dns_client_t *client) {
|
|||||||
|
|
||||||
isc_task_detach(&client->task);
|
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);
|
isc_mutex_destroy(&client->lock);
|
||||||
client->magic = 0;
|
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,
|
dns_rdataclass_t rdclass, dns_rdatatype_t type,
|
||||||
unsigned int options, dns_namelist_t *namelist) {
|
unsigned int options, dns_namelist_t *namelist) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
isc_appctx_t *actx;
|
|
||||||
resarg_t *resarg;
|
resarg_t *resarg;
|
||||||
|
|
||||||
REQUIRE(DNS_CLIENT_VALID(client));
|
REQUIRE(DNS_CLIENT_VALID(client));
|
||||||
|
REQUIRE(client->actx != NULL);
|
||||||
REQUIRE(namelist != NULL && ISC_LIST_EMPTY(*namelist));
|
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));
|
resarg = isc_mem_get(client->mctx, sizeof(*resarg));
|
||||||
|
|
||||||
isc_mutex_init(&resarg->lock);
|
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,
|
result = dns_client_startresolve(client, name, rdclass, type, options,
|
||||||
client->task, resolve_done, resarg,
|
client->task, resolve_done, resarg,
|
||||||
&resarg->trans);
|
&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
|
* Start internal event loop. It blocks until the entire process
|
||||||
* is completed.
|
* is completed.
|
||||||
*/
|
*/
|
||||||
result = isc_app_ctxrun(actx);
|
result = isc_app_ctxrun(client->actx);
|
||||||
|
|
||||||
LOCK(&resarg->lock);
|
LOCK(&resarg->lock);
|
||||||
if (result == ISC_R_SUCCESS || result == ISC_R_SUSPEND) {
|
if (result == ISC_R_SUCCESS || result == ISC_R_SUSPEND) {
|
||||||
|
@ -67,7 +67,7 @@ ISC_LANG_BEGINDECLS
|
|||||||
/*%< Do not return DNSSEC data (e.g. RRSIGS) with response. */
|
/*%< Do not return DNSSEC data (e.g. RRSIGS) with response. */
|
||||||
#define DNS_CLIENTRESOPT_NODNSSEC 0x01
|
#define DNS_CLIENTRESOPT_NODNSSEC 0x01
|
||||||
/*%< Allow running external context. */
|
/*%< Allow running external context. */
|
||||||
#define DNS_CLIENTRESOPT_ALLOWRUN 0x02
|
#define DNS_CLIENTRESOPT_RESERVED 0x02
|
||||||
/*%< Don't validate responses. */
|
/*%< Don't validate responses. */
|
||||||
#define DNS_CLIENTRESOPT_NOVALIDATE 0x04
|
#define DNS_CLIENTRESOPT_NOVALIDATE 0x04
|
||||||
/*%< Don't set the CD flag on upstream queries. */
|
/*%< Don't set the CD flag on upstream queries. */
|
||||||
@ -79,7 +79,7 @@ ISC_LANG_BEGINDECLS
|
|||||||
* Optional flags for dns_client_(start)request.
|
* Optional flags for dns_client_(start)request.
|
||||||
*/
|
*/
|
||||||
/*%< Allow running external context. */
|
/*%< Allow running external context. */
|
||||||
#define DNS_CLIENTREQOPT_ALLOWRUN 0x01
|
#define DNS_CLIENTREQOPT_RESERVED 0x01
|
||||||
/*%< Use TCP transport. */
|
/*%< Use TCP transport. */
|
||||||
#define DNS_CLIENTREQOPT_TCP 0x02
|
#define DNS_CLIENTREQOPT_TCP 0x02
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ ISC_LANG_BEGINDECLS
|
|||||||
* Optional flags for dns_client_(start)update.
|
* Optional flags for dns_client_(start)update.
|
||||||
*/
|
*/
|
||||||
/*%< Allow running external context. */
|
/*%< Allow running external context. */
|
||||||
#define DNS_CLIENTUPDOPT_ALLOWRUN 0x01
|
#define DNS_CLIENTUPDOPT_RESERVED 0x01
|
||||||
/*%< Use TCP transport. */
|
/*%< Use TCP transport. */
|
||||||
#define DNS_CLIENTUPDOPT_TCP 0x02
|
#define DNS_CLIENTUPDOPT_TCP 0x02
|
||||||
|
|
||||||
@ -127,11 +127,11 @@ typedef struct dns_clientreqevent {
|
|||||||
} dns_clientreqevent_t; /* too long? */
|
} dns_clientreqevent_t; /* too long? */
|
||||||
|
|
||||||
isc_result_t
|
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,
|
isc_socketmgr_t *socketmgr, isc_timermgr_t *timermgr,
|
||||||
unsigned int options, dns_client_t **clientp,
|
unsigned int options, dns_client_t **clientp,
|
||||||
const isc_sockaddr_t *localaddr4,
|
const isc_sockaddr_t *localaddr4,
|
||||||
const isc_sockaddr_t *localaddr6);
|
const isc_sockaddr_t *localaddr6);
|
||||||
/*%<
|
/*%<
|
||||||
* Create a DNS client object with minimal internal resources, such as
|
* Create a DNS client object with minimal internal resources, such as
|
||||||
* a default view for the IN class and IPv4/IPv6 dispatches for the view.
|
* a default view for the IN class and IPv4/IPv6 dispatches for the view.
|
||||||
@ -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
|
* error. Otherwise, it returns the result code of the entire resolution
|
||||||
* process, either success or failure.
|
* process, either success or failure.
|
||||||
*
|
*
|
||||||
* It is typically expected that the client object passed to
|
* It is expected that the client object passed to dns_client_resolve() was
|
||||||
* dns_client_resolve() was created via dns_client_create() and has its own
|
* created via dns_client_create() and has external managers and contexts.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
* dns_client_startresolve() is an asynchronous version of dns_client_resolve()
|
* dns_client_startresolve() is an asynchronous version of dns_client_resolve()
|
||||||
* and does not block. When name resolution is completed, 'action' will be
|
* 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
|
* 'rmessage' will contain the response message. The caller must provide a
|
||||||
* valid initialized message.
|
* valid initialized message.
|
||||||
*
|
*
|
||||||
* It is usually expected that the client object passed to
|
* It is expected that the client object passed to dns_client_request() was
|
||||||
* dns_client_request() was created via dns_client_create() and has its own
|
* created via dns_client_create() and has external managers and contexts.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
* dns_client_startrequest() is an asynchronous version of dns_client_request()
|
* dns_client_startrequest() is an asynchronous version of dns_client_request()
|
||||||
* and does not block. When the transaction is completed, 'action' will be
|
* and does not block. When the transaction is completed, 'action' will be
|
||||||
|
@ -135,7 +135,7 @@ dns_cert_totext
|
|||||||
dns_client_addtrustedkey
|
dns_client_addtrustedkey
|
||||||
dns_client_cancelresolve
|
dns_client_cancelresolve
|
||||||
dns_client_clearservers
|
dns_client_clearservers
|
||||||
dns_client_createx
|
dns_client_create
|
||||||
dns_client_destroy
|
dns_client_destroy
|
||||||
dns_client_destroyrestrans
|
dns_client_destroyrestrans
|
||||||
dns_client_freeresanswer
|
dns_client_freeresanswer
|
||||||
|
@ -241,7 +241,7 @@ main(int argc, char *argv[]) {
|
|||||||
dns_rdataset_t *rdataset;
|
dns_rdataset_t *rdataset;
|
||||||
dns_namelist_t namelist;
|
dns_namelist_t namelist;
|
||||||
isc_mem_t *keymctx = NULL;
|
isc_mem_t *keymctx = NULL;
|
||||||
unsigned int clientopt, resopt;
|
unsigned int clientopt, resopt = 0;
|
||||||
bool is_sep = false;
|
bool is_sep = false;
|
||||||
const char *port = "53";
|
const char *port = "53";
|
||||||
isc_mem_t *mctx = NULL;
|
isc_mem_t *mctx = NULL;
|
||||||
@ -385,8 +385,8 @@ main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clientopt = 0;
|
clientopt = 0;
|
||||||
result = dns_client_createx(mctx, actx, taskmgr, socketmgr, timermgr,
|
result = dns_client_create(mctx, actx, taskmgr, socketmgr, timermgr,
|
||||||
clientopt, &client, addr4, addr6);
|
clientopt, &client, addr4, addr6);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
fprintf(stderr, "dns_client_create failed: %u, %s\n", result,
|
fprintf(stderr, "dns_client_create failed: %u, %s\n", result,
|
||||||
isc_result_totext(result));
|
isc_result_totext(result));
|
||||||
@ -444,7 +444,6 @@ main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Perform resolution */
|
/* Perform resolution */
|
||||||
resopt = DNS_CLIENTRESOPT_ALLOWRUN;
|
|
||||||
if (keynamestr == NULL) {
|
if (keynamestr == NULL) {
|
||||||
resopt |= DNS_CLIENTRESOPT_NODNSSEC;
|
resopt |= DNS_CLIENTRESOPT_NODNSSEC;
|
||||||
}
|
}
|
||||||
|
@ -343,10 +343,10 @@ main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
isc_app_ctxstart(query_actx);
|
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);
|
timermgr, 0, &client, NULL, NULL);
|
||||||
if (result != ISC_R_SUCCESS) {
|
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);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user