request.c revision 34ee961fa2f0f5f2ee3cff40fdb4d7d7b48b7728
/*
* 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.
*/
#include <config.h>
#include <isc/assertions.h>
#include <dns/dispatch.h>
struct dns_requestmgr {
/* locked */
};
struct dns_request {
void *action_arg;
};
/***
*** Forward
***/
/***
*** Public
***/
if (dispatchv4 != NULL) {
}
if (dispatchv6 != NULL) {
}
if (requestmgr == NULL)
return (ISC_R_NOMEMORY);
if (result != DNS_R_SUCCESS) {
return (result);
}
if (dispatchv4 != NULL)
if (dispatchv6 != NULL)
return (ISC_R_SUCCESS);
}
void
{
if (requestmgr->exiting) {
/*
* We're already shutdown. Send the event.
*/
} else {
}
}
void
if (!requestmgr->exiting) {
/* XXXMPA shutdown existing requests */
}
}
void
source->references++;
}
void
requestmgr->references--;
if (requestmgr->references == 0) {
}
if (need_destroy)
*requestmgrp = NULL;
}
static void
/*
* Caller must be holding the manager lock.
*/
event = next_event) {
}
}
static void
requestmgr->magic = 0;
}
{
isc_region_t r;
goto cleanup;
}
event = (dns_requestevent_t *)
goto cleanup;
}
if (result == DNS_R_USETCP) {
}
if (result != ISC_R_SUCCESS)
goto cleanup;
if ((options & DNS_REQUESTOPT_USETCP) != 0) {
/* result = isc_socket_create(requestmgr->socketmgr,
isc_sockaddr_pf(address),
isc_sockettype_tcp, &socket); */
if (result != ISC_R_SUCCESS)
goto cleanup;
&dispatch);
if (result != ISC_R_SUCCESS)
goto cleanup;
} else {
switch (isc_sockaddr_pf(address)) {
case PF_INET:
break;
case PF_INET6:
break;
default:
goto cleanup;
}
}
if (result != ISC_R_SUCCESS)
goto cleanup;
if (result != ISC_R_SUCCESS)
goto cleanup;
isc_buffer_used(query, &r);
if (result != ISC_R_SUCCESS)
goto cleanup;
return (ISC_R_SUCCESS);
return (result);
}
static isc_result_t
isc_region_t r;
/*
* Create buffer able to hold largest possible message.
*/
if (result != ISC_R_SUCCESS)
return (result);
/*
* Render message.
*/
if (result != DNS_R_SUCCESS)
goto cleanup;
if (result != DNS_R_SUCCESS)
goto cleanup;
if (result != DNS_R_SUCCESS)
goto cleanup;
if (result != DNS_R_SUCCESS)
goto cleanup;
if (result != DNS_R_SUCCESS)
goto cleanup;
if (result != DNS_R_SUCCESS)
goto cleanup;
/*
* Copy rendered message to exact sized buffer.
*/
isc_buffer_used(buf1, &r);
if (result != ISC_R_SUCCESS)
goto cleanup;
if (r.length > 512) {
}
if (result != ISC_R_SUCCESS)
goto cleanup;
/*
* Cleanup and return.
*/
return (ISC_R_SUCCESS);
return (result);
}
/*
* Create and send a request.
*
* Notes:
*
* 'message' will be rendered and sent to 'address'. If the
* DNS_REQUESTOPT_TCP option is set, TCP will be used. The request
* will timeout after 'timeout' seconds.
*
* When the request completes, successfully, due to a timeout, or
* because it was canceled, a completion event will be sent to 'task'.
*
* Requires:
*
* 'message' is a valid DNS message.
*
* 'address' is a valid sockaddr.
*
* 'timeout' > 0
*
* 'task' is a valid task.
*
* requestp != NULL && *requestp == NULL
*/
return (ISC_R_NOTIMPLEMENTED);
}
/*
* Cancel 'request'.
*
* Requires:
*
* 'request' is a valid request.
*
* Ensures:
*
* If the completion event for 'request' has not yet been sent, it
* will be sent, and the result code will be ISC_R_CANCELED.
*/
}
void
}
/*
* Destroy 'request'.
*
* Requires:
*
* 'request' is a valid request for which the caller has received the
* completion event.
*
* Ensures:
*
* *requestp == NULL
*/
static void
(void)task;
/*
if (sevent->result != ISC_R_SUCCESS)
fctx_cancelquery(&query, NULL, NULL, ISC_FALSE);
*/
}
static void
(void)task;
goto done;
/*
* copy buffer
*/
done:
return;
}
static void
} else {
}
}