1999-07-08 03:16:00 +00:00
|
|
|
/*
|
2000-06-22 01:27:11 +00:00
|
|
|
* Copyright (C) 1998-2000 Internet Software Consortium.
|
1999-07-08 03:16:00 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2000-06-22 22:00:42 +00:00
|
|
|
/* $Id: dispatch_test.c,v 1.43 2000/06/22 21:50:15 tale Exp $ */
|
|
|
|
|
1999-07-08 03:16:00 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
1999-10-02 02:54:16 +00:00
|
|
|
|
1999-07-09 01:57:55 +00:00
|
|
|
#include <isc/app.h>
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
#include <isc/log.h>
|
1999-07-08 03:16:00 +00:00
|
|
|
#include <isc/mem.h>
|
2000-05-08 14:38:29 +00:00
|
|
|
#include <isc/string.h>
|
1999-07-08 03:16:00 +00:00
|
|
|
#include <isc/task.h>
|
2000-04-28 01:12:23 +00:00
|
|
|
#include <isc/util.h>
|
1999-07-08 03:16:00 +00:00
|
|
|
|
|
|
|
#include <dns/dispatch.h>
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
#include <dns/log.h>
|
2000-05-22 19:36:34 +00:00
|
|
|
#include <dns/message.h>
|
2000-05-30 23:16:47 +00:00
|
|
|
#include <dns/name.h>
|
1999-07-09 20:34:33 +00:00
|
|
|
#include <dns/rdatalist.h>
|
|
|
|
#include <dns/rdataset.h>
|
2000-05-03 21:11:40 +00:00
|
|
|
#include <dns/result.h>
|
1999-07-08 03:16:00 +00:00
|
|
|
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
#define NCLIENTS 16
|
|
|
|
|
1999-07-22 01:34:31 +00:00
|
|
|
typedef struct {
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
unsigned int client_number;
|
1999-07-22 01:34:31 +00:00
|
|
|
int count;
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
dns_dispentry_t *resp;
|
1999-07-22 01:34:31 +00:00
|
|
|
isc_buffer_t render;
|
|
|
|
unsigned char render_buffer[1024];
|
|
|
|
} clictx_t;
|
|
|
|
|
1999-07-08 03:16:00 +00:00
|
|
|
isc_mem_t *mctx;
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
isc_taskmgr_t *taskmgr;
|
1999-07-08 03:16:00 +00:00
|
|
|
isc_socketmgr_t *socketmgr;
|
2000-05-10 23:43:48 +00:00
|
|
|
dns_dispatchmgr_t *dispatchmgr;
|
1999-07-08 03:16:00 +00:00
|
|
|
dns_dispatch_t *disp;
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
isc_task_t *t0;
|
|
|
|
clictx_t clients[NCLIENTS]; /* Lots of things might want to use this. */
|
1999-07-22 01:34:31 +00:00
|
|
|
unsigned int client_count = 0;
|
|
|
|
isc_mutex_t client_lock;
|
1999-07-08 03:16:00 +00:00
|
|
|
|
2000-05-08 14:38:29 +00:00
|
|
|
/*
|
|
|
|
* Forward declarations.
|
|
|
|
*/
|
1999-07-12 23:46:05 +00:00
|
|
|
void
|
2000-05-08 14:38:29 +00:00
|
|
|
got_response(isc_task_t *, isc_event_t *);
|
|
|
|
|
2000-05-22 19:36:34 +00:00
|
|
|
static isc_result_t
|
|
|
|
printmsg(dns_message_t *msg, FILE *out) {
|
|
|
|
unsigned char text[8192];
|
|
|
|
isc_buffer_t textbuf;
|
|
|
|
int result;
|
|
|
|
|
|
|
|
isc_buffer_init(&textbuf, text, sizeof text);
|
2000-05-24 18:17:53 +00:00
|
|
|
result = dns_message_totext(msg, 0, &textbuf);
|
2000-05-22 19:36:34 +00:00
|
|
|
|
|
|
|
if (result != ISC_R_SUCCESS)
|
|
|
|
return (result);
|
|
|
|
|
|
|
|
fprintf(out, "msg:\n%*s\n",
|
|
|
|
isc_buffer_usedlength(&textbuf),
|
2000-06-01 19:11:07 +00:00
|
|
|
(char *)isc_buffer_base(&textbuf));
|
2000-05-22 19:36:34 +00:00
|
|
|
|
|
|
|
return (ISC_R_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2000-05-08 14:38:29 +00:00
|
|
|
static void
|
|
|
|
hex_dump(isc_buffer_t *b) {
|
1999-07-12 23:46:05 +00:00
|
|
|
unsigned int len;
|
|
|
|
isc_region_t r;
|
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_buffer_remainingregion(b, &r);
|
1999-07-12 23:46:05 +00:00
|
|
|
|
|
|
|
printf("Buffer %p: used region base %p, length %d",
|
|
|
|
b, r.base, r.length);
|
|
|
|
for (len = 0 ; len < r.length ; len++) {
|
|
|
|
if (len % 16 == 0)
|
|
|
|
printf("\n");
|
|
|
|
printf("%02x ", r.base[len]);
|
|
|
|
}
|
|
|
|
printf("\n");
|
|
|
|
}
|
1999-07-09 17:45:06 +00:00
|
|
|
|
|
|
|
static inline void
|
2000-06-01 19:11:07 +00:00
|
|
|
CHECKRESULT(isc_result_t result, const char *msg) {
|
2000-04-06 22:03:35 +00:00
|
|
|
if (result != ISC_R_SUCCESS) {
|
1999-07-09 17:45:06 +00:00
|
|
|
printf("%s: %s\n", msg, isc_result_totext(result));
|
|
|
|
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
1999-07-08 03:16:00 +00:00
|
|
|
|
2000-05-08 14:38:29 +00:00
|
|
|
static void
|
|
|
|
send_done(isc_task_t *task, isc_event_t *ev_in) {
|
1999-07-09 20:34:33 +00:00
|
|
|
isc_socketevent_t *ev = (isc_socketevent_t *)ev_in;
|
2000-04-17 19:22:44 +00:00
|
|
|
clictx_t *cli = (clictx_t *)ev_in->ev_arg;
|
1999-07-09 20:34:33 +00:00
|
|
|
|
1999-07-09 20:45:58 +00:00
|
|
|
(void)task;
|
|
|
|
|
1999-07-09 20:34:33 +00:00
|
|
|
if (ev->result == ISC_R_SUCCESS) {
|
|
|
|
printf("Send done (SUCCESS)\n");
|
|
|
|
isc_event_free(&ev_in);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
CHECKRESULT(ev->result, "send_done got event");
|
|
|
|
|
|
|
|
isc_event_free(&ev_in);
|
|
|
|
|
|
|
|
printf("--- removing response (FAILURE)\n");
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
dns_dispatch_removeresponse(&cli->resp, NULL);
|
1999-07-09 20:34:33 +00:00
|
|
|
isc_app_shutdown();
|
|
|
|
}
|
|
|
|
|
2000-05-08 14:38:29 +00:00
|
|
|
static void
|
2000-06-01 19:11:07 +00:00
|
|
|
start_response(clictx_t *cli, const char *query, isc_task_t *task) {
|
1999-07-09 01:57:55 +00:00
|
|
|
dns_messageid_t id;
|
|
|
|
isc_sockaddr_t from;
|
|
|
|
dns_message_t *msg;
|
1999-07-09 20:34:33 +00:00
|
|
|
isc_result_t result;
|
1999-09-10 20:25:51 +00:00
|
|
|
dns_name_t *name;
|
1999-07-09 20:34:33 +00:00
|
|
|
unsigned char namebuf[255];
|
|
|
|
isc_buffer_t target;
|
|
|
|
isc_buffer_t source;
|
|
|
|
isc_region_t region;
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
dns_rdataset_t *rdataset;
|
|
|
|
dns_rdatalist_t *rdatalist;
|
1999-07-09 20:34:33 +00:00
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_buffer_init(&source, query, strlen(query));
|
1999-07-22 01:34:31 +00:00
|
|
|
isc_buffer_add(&source, strlen(query));
|
|
|
|
isc_buffer_setactive(&source, strlen(query));
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_buffer_init(&target, namebuf, sizeof(namebuf));
|
1999-07-09 20:34:33 +00:00
|
|
|
|
|
|
|
memset(&from, 0, sizeof(from));
|
|
|
|
from.length = sizeof(struct sockaddr_in);
|
1999-10-28 01:36:36 +00:00
|
|
|
#ifdef ISC_PLATFORM_HAVESALEN
|
1999-07-09 20:34:33 +00:00
|
|
|
from.type.sa.sa_len = sizeof(struct sockaddr_in);
|
1999-07-09 21:10:40 +00:00
|
|
|
#endif
|
1999-07-09 20:34:33 +00:00
|
|
|
from.type.sin.sin_port = htons(53);
|
|
|
|
from.type.sa.sa_family = AF_INET;
|
1999-07-16 00:47:22 +00:00
|
|
|
RUNTIME_CHECK(inet_aton("204.152.184.97",
|
|
|
|
&from.type.sin.sin_addr) == 1);
|
1999-07-09 20:34:33 +00:00
|
|
|
|
|
|
|
msg = NULL;
|
1999-07-24 00:55:35 +00:00
|
|
|
result = dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER, &msg);
|
1999-07-09 20:34:33 +00:00
|
|
|
CHECKRESULT(result, "dns_message_create()");
|
|
|
|
|
1999-09-10 20:25:51 +00:00
|
|
|
name = NULL;
|
|
|
|
result = dns_message_gettempname(msg, &name);
|
|
|
|
CHECKRESULT(result, "dns_message_gettempname()");
|
|
|
|
|
|
|
|
dns_name_init(name, NULL);
|
|
|
|
result = dns_name_fromtext(name, &source, dns_rootname, ISC_FALSE,
|
|
|
|
&target);
|
|
|
|
CHECKRESULT(result, "dns_name_fromtext()");
|
|
|
|
|
|
|
|
dns_message_addname(msg, name, DNS_SECTION_QUESTION);
|
1999-07-09 20:34:33 +00:00
|
|
|
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
rdataset = NULL;
|
|
|
|
result = dns_message_gettemprdataset(msg, &rdataset);
|
|
|
|
CHECKRESULT(result, "dns_message_gettemprdataset()");
|
|
|
|
|
|
|
|
rdatalist = NULL;
|
|
|
|
result = dns_message_gettemprdatalist(msg, &rdatalist);
|
|
|
|
CHECKRESULT(result, "dns_message_gettemprdatalist()");
|
1999-07-09 20:34:33 +00:00
|
|
|
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
dns_rdatalist_init(rdatalist);
|
|
|
|
rdatalist->rdclass = dns_rdataclass_in;
|
|
|
|
rdatalist->type = dns_rdatatype_a;
|
|
|
|
rdatalist->ttl = 0;
|
|
|
|
ISC_LIST_INIT(rdatalist->rdata);
|
|
|
|
|
|
|
|
dns_rdataset_init(rdataset);
|
|
|
|
result = dns_rdatalist_tordataset(rdatalist, rdataset);
|
1999-07-09 20:34:33 +00:00
|
|
|
CHECKRESULT(result, "dns_rdatalist_tordataset()");
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
rdataset->attributes |= DNS_RDATASETATTR_QUESTION;
|
1999-07-09 20:34:33 +00:00
|
|
|
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
ISC_LIST_APPEND(name->list, rdataset, link);
|
|
|
|
rdataset = NULL;
|
|
|
|
rdatalist = NULL;
|
1999-07-09 20:34:33 +00:00
|
|
|
|
2000-05-22 19:36:34 +00:00
|
|
|
result = printmsg(msg, stderr);
|
|
|
|
CHECKRESULT(result, "printmsg() failed");
|
1999-07-09 20:34:33 +00:00
|
|
|
|
1999-07-22 01:34:31 +00:00
|
|
|
isc_buffer_init(&cli->render, cli->render_buffer,
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
sizeof(cli->render_buffer));
|
1999-07-22 01:34:31 +00:00
|
|
|
result = dns_message_renderbegin(msg, &cli->render);
|
1999-07-09 20:34:33 +00:00
|
|
|
CHECKRESULT(result, "dns_message_renderbegin()");
|
|
|
|
|
1999-12-22 03:22:59 +00:00
|
|
|
result = dns_message_rendersection(msg, DNS_SECTION_QUESTION, 0);
|
1999-07-09 20:34:33 +00:00
|
|
|
CHECKRESULT(result, "dns_message_rendersection(QUESTION)");
|
|
|
|
|
1999-12-22 03:22:59 +00:00
|
|
|
result = dns_message_rendersection(msg, DNS_SECTION_ANSWER, 0);
|
1999-07-09 20:34:33 +00:00
|
|
|
CHECKRESULT(result, "dns_message_rendersection(ANSWER)");
|
|
|
|
|
1999-12-22 03:22:59 +00:00
|
|
|
result = dns_message_rendersection(msg, DNS_SECTION_ADDITIONAL, 0);
|
1999-07-09 20:34:33 +00:00
|
|
|
CHECKRESULT(result, "dns_message_rendersection(ADDITIONAL)");
|
|
|
|
|
1999-12-22 03:22:59 +00:00
|
|
|
result = dns_message_rendersection(msg, DNS_SECTION_AUTHORITY, 0);
|
1999-07-09 20:34:33 +00:00
|
|
|
CHECKRESULT(result, "dns_message_rendersection(AUTHORITY)");
|
1999-07-09 01:57:55 +00:00
|
|
|
|
|
|
|
printf("--- adding response\n");
|
1999-07-22 01:34:31 +00:00
|
|
|
RUNTIME_CHECK(isc_mutex_lock(&client_lock) == ISC_R_SUCCESS);
|
|
|
|
client_count++;
|
|
|
|
RUNTIME_CHECK(isc_mutex_unlock(&client_lock) == ISC_R_SUCCESS);
|
|
|
|
cli->resp = NULL;
|
|
|
|
result = dns_dispatch_addresponse(disp, &from, task, got_response,
|
|
|
|
cli, &id, &cli->resp);
|
1999-07-09 20:34:33 +00:00
|
|
|
CHECKRESULT(result, "dns_dispatch_addresponse");
|
|
|
|
|
1999-07-09 01:57:55 +00:00
|
|
|
printf("Assigned MessageID %d\n", id);
|
1999-07-09 20:34:33 +00:00
|
|
|
|
|
|
|
msg->opcode = dns_opcode_query;
|
|
|
|
msg->rcode = dns_rcode_noerror;
|
|
|
|
msg->flags = DNS_MESSAGEFLAG_RD;
|
|
|
|
msg->id = id;
|
|
|
|
|
|
|
|
result = dns_message_renderend(msg);
|
|
|
|
CHECKRESULT(result, "dns_message_renderend");
|
|
|
|
|
|
|
|
dns_message_destroy(&msg);
|
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_buffer_usedregion(&cli->render, ®ion);
|
1999-07-09 20:34:33 +00:00
|
|
|
result = isc_socket_sendto(dns_dispatch_getsocket(disp), ®ion,
|
1999-12-04 01:27:44 +00:00
|
|
|
task, send_done, cli->resp, &from, NULL);
|
1999-07-09 20:34:33 +00:00
|
|
|
CHECKRESULT(result, "isc_socket_sendto()");
|
1999-07-09 01:57:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-05-08 14:38:29 +00:00
|
|
|
got_response(isc_task_t *task, isc_event_t *ev_in) {
|
1999-07-08 03:16:00 +00:00
|
|
|
dns_dispatchevent_t *ev = (dns_dispatchevent_t *)ev_in;
|
2000-04-17 19:22:44 +00:00
|
|
|
dns_dispentry_t *resp = ev->ev_sender;
|
1999-07-09 20:34:33 +00:00
|
|
|
dns_message_t *msg;
|
|
|
|
isc_result_t result;
|
1999-07-22 01:34:31 +00:00
|
|
|
unsigned int cnt;
|
1999-07-09 20:34:33 +00:00
|
|
|
|
1999-07-09 20:45:58 +00:00
|
|
|
(void)task;
|
|
|
|
|
1999-07-09 20:34:33 +00:00
|
|
|
printf("App: Got response (id %d). Result: %s\n",
|
|
|
|
ev->id, isc_result_totext(ev->result));
|
|
|
|
|
1999-07-22 01:34:31 +00:00
|
|
|
if (ev->result != ISC_R_SUCCESS) {
|
|
|
|
printf("--- ERROR, shutting down response slot\n");
|
|
|
|
printf("--- shutting down dispatcher\n");
|
|
|
|
dns_dispatch_cancel(disp);
|
|
|
|
printf("--- removing response\n");
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
dns_dispatch_removeresponse(&resp, &ev);
|
1999-07-22 01:34:31 +00:00
|
|
|
RUNTIME_CHECK(isc_mutex_lock(&client_lock) == ISC_R_SUCCESS);
|
|
|
|
INSIST(client_count > 0);
|
|
|
|
client_count--;
|
|
|
|
cnt = client_count;
|
|
|
|
RUNTIME_CHECK(isc_mutex_unlock(&client_lock) == ISC_R_SUCCESS);
|
|
|
|
if (cnt == 0)
|
|
|
|
isc_app_shutdown();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-07-09 20:34:33 +00:00
|
|
|
msg = NULL;
|
1999-07-24 00:55:35 +00:00
|
|
|
result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &msg);
|
1999-07-09 20:34:33 +00:00
|
|
|
CHECKRESULT(result, "dns_message_create() failed");
|
1999-07-08 03:16:00 +00:00
|
|
|
|
1999-08-20 06:09:46 +00:00
|
|
|
result = dns_message_parse(msg, &ev->buffer, ISC_FALSE);
|
1999-07-09 20:34:33 +00:00
|
|
|
CHECKRESULT(result, "dns_message_parse() failed");
|
|
|
|
|
2000-05-22 19:36:34 +00:00
|
|
|
result = printmsg(msg, stderr);
|
|
|
|
CHECKRESULT(result, "printmsg() failed");
|
1999-07-09 20:34:33 +00:00
|
|
|
|
|
|
|
dns_message_destroy(&msg);
|
|
|
|
|
1999-07-22 01:34:31 +00:00
|
|
|
printf("--- shutting down dispatcher\n");
|
|
|
|
dns_dispatch_cancel(disp);
|
1999-07-09 20:34:33 +00:00
|
|
|
printf("--- removing response\n");
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
dns_dispatch_removeresponse(&resp, &ev);
|
1999-07-22 01:34:31 +00:00
|
|
|
RUNTIME_CHECK(isc_mutex_lock(&client_lock) == ISC_R_SUCCESS);
|
|
|
|
INSIST(client_count > 0);
|
|
|
|
client_count--;
|
|
|
|
cnt = client_count;
|
|
|
|
RUNTIME_CHECK(isc_mutex_unlock(&client_lock) == ISC_R_SUCCESS);
|
|
|
|
if (cnt == 0)
|
|
|
|
isc_app_shutdown();
|
1999-07-09 01:57:55 +00:00
|
|
|
}
|
|
|
|
|
2000-05-08 14:38:29 +00:00
|
|
|
static void
|
|
|
|
got_request(isc_task_t *task, isc_event_t *ev_in) {
|
1999-07-09 01:57:55 +00:00
|
|
|
dns_dispatchevent_t *ev = (dns_dispatchevent_t *)ev_in;
|
2000-04-17 19:22:44 +00:00
|
|
|
clictx_t *cli = (clictx_t *)ev_in->ev_arg;
|
1999-07-09 17:45:06 +00:00
|
|
|
dns_message_t *msg;
|
1999-12-23 00:09:04 +00:00
|
|
|
isc_result_t result;
|
1999-07-22 01:34:31 +00:00
|
|
|
unsigned int cnt;
|
1999-07-09 17:45:06 +00:00
|
|
|
|
1999-07-09 20:34:33 +00:00
|
|
|
printf("App: Got request. Result: %s\n",
|
1999-07-09 17:45:06 +00:00
|
|
|
isc_result_totext(ev->result));
|
|
|
|
|
2000-04-06 22:03:35 +00:00
|
|
|
if (ev->result != ISC_R_SUCCESS) {
|
1999-07-22 01:34:31 +00:00
|
|
|
RUNTIME_CHECK(isc_mutex_lock(&client_lock) == ISC_R_SUCCESS);
|
|
|
|
printf("Got error, terminating CLIENT %p resp %p\n",
|
|
|
|
cli, cli->resp);
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
dns_dispatch_removerequest(&cli->resp, &ev);
|
1999-07-22 01:34:31 +00:00
|
|
|
INSIST(client_count > 0);
|
|
|
|
client_count--;
|
|
|
|
cnt = client_count;
|
|
|
|
printf("CLIENT %p ENDING, %d remain\n", cli, client_count);
|
|
|
|
RUNTIME_CHECK(isc_mutex_unlock(&client_lock) == ISC_R_SUCCESS);
|
|
|
|
if (cnt == 0)
|
|
|
|
isc_app_shutdown();
|
1999-07-09 17:45:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-07-12 23:46:05 +00:00
|
|
|
hex_dump(&ev->buffer);
|
|
|
|
|
1999-07-09 17:45:06 +00:00
|
|
|
msg = NULL;
|
1999-07-24 00:55:35 +00:00
|
|
|
result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &msg);
|
1999-07-09 17:45:06 +00:00
|
|
|
CHECKRESULT(result, "dns_message_create() failed");
|
|
|
|
|
1999-08-20 06:09:46 +00:00
|
|
|
result = dns_message_parse(msg, &ev->buffer, ISC_FALSE);
|
1999-07-09 17:45:06 +00:00
|
|
|
CHECKRESULT(result, "dns_message_parse() failed");
|
|
|
|
|
2000-05-22 19:36:34 +00:00
|
|
|
result = printmsg(msg, stderr);
|
|
|
|
CHECKRESULT(result, "printmsg() failed");
|
1999-07-08 03:16:00 +00:00
|
|
|
|
1999-07-09 17:45:06 +00:00
|
|
|
dns_message_destroy(&msg);
|
1999-07-08 22:12:37 +00:00
|
|
|
|
1999-07-22 01:34:31 +00:00
|
|
|
cli->count++;
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
printf("App: Client %p(%u) ready, count == %d.\n",
|
|
|
|
cli, cli->client_number, cli->count);
|
1999-07-22 01:34:31 +00:00
|
|
|
switch (cli->count) {
|
|
|
|
case 4:
|
|
|
|
printf("--- starting DNS lookup\n");
|
|
|
|
dns_dispatch_freeevent(disp, cli->resp, &ev);
|
|
|
|
start_response(&clients[3], "flame.org", task);
|
|
|
|
start_response(&clients[4], "vix.com", task);
|
|
|
|
start_response(&clients[5], "isc.org", task);
|
1999-07-09 00:51:08 +00:00
|
|
|
break;
|
|
|
|
|
1999-07-22 01:34:31 +00:00
|
|
|
case 2:
|
1999-07-09 00:51:08 +00:00
|
|
|
printf("--- removing request\n");
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
dns_dispatch_removerequest(&cli->resp, &ev);
|
1999-07-09 00:51:08 +00:00
|
|
|
printf("--- adding request\n");
|
1999-07-09 01:57:55 +00:00
|
|
|
RUNTIME_CHECK(dns_dispatch_addrequest(disp, task, got_request,
|
1999-07-22 01:34:31 +00:00
|
|
|
cli, &cli->resp)
|
2000-04-06 22:03:35 +00:00
|
|
|
== ISC_R_SUCCESS);
|
1999-07-09 00:51:08 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
1999-07-22 01:34:31 +00:00
|
|
|
dns_dispatch_freeevent(disp, cli->resp, &ev);
|
1999-07-09 00:51:08 +00:00
|
|
|
break;
|
1999-07-08 22:12:37 +00:00
|
|
|
}
|
1999-07-08 03:16:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2000-05-08 14:38:29 +00:00
|
|
|
main(int argc, char *argv[]) {
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
isc_sockaddr_t sa;
|
1999-07-22 01:34:31 +00:00
|
|
|
unsigned int i;
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
unsigned int attrs;
|
|
|
|
isc_log_t *log;
|
|
|
|
isc_logconfig_t *lcfg;
|
|
|
|
isc_logdestination_t destination;
|
|
|
|
isc_result_t result;
|
1999-07-08 03:16:00 +00:00
|
|
|
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
UNUSED(argc);
|
|
|
|
UNUSED(argv);
|
1999-07-08 03:16:00 +00:00
|
|
|
|
1999-07-09 01:57:55 +00:00
|
|
|
RUNTIME_CHECK(isc_app_start() == ISC_R_SUCCESS);
|
|
|
|
|
1999-07-08 03:16:00 +00:00
|
|
|
/*
|
|
|
|
* EVERYTHING needs a memory context.
|
|
|
|
*/
|
|
|
|
mctx = NULL;
|
|
|
|
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
|
|
|
|
|
1999-07-08 22:12:37 +00:00
|
|
|
dns_result_register();
|
|
|
|
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
log = NULL;
|
|
|
|
lcfg = NULL;
|
|
|
|
RUNTIME_CHECK(isc_log_create(mctx, &log, &lcfg) == ISC_R_SUCCESS);
|
|
|
|
isc_log_setcontext(log);
|
|
|
|
dns_log_init(log);
|
|
|
|
dns_log_setcontext(log);
|
|
|
|
|
|
|
|
destination.file.stream = stderr;
|
|
|
|
destination.file.name = NULL;
|
|
|
|
destination.file.versions = ISC_LOG_ROLLNEVER;
|
|
|
|
destination.file.maximum_size = 0;
|
|
|
|
result = isc_log_createchannel(lcfg, "_default",
|
|
|
|
ISC_LOG_TOFILEDESC,
|
|
|
|
ISC_LOG_DYNAMIC,
|
|
|
|
&destination, ISC_LOG_PRINTTIME);
|
|
|
|
INSIST(result == ISC_R_SUCCESS);
|
|
|
|
result = isc_log_usechannel(lcfg, "_default", NULL, NULL);
|
|
|
|
INSIST(result == ISC_R_SUCCESS);
|
|
|
|
|
1999-07-08 03:16:00 +00:00
|
|
|
/*
|
2000-05-08 14:38:29 +00:00
|
|
|
* The task manager is independent (other than memory context).
|
1999-07-08 03:16:00 +00:00
|
|
|
*/
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
taskmgr = NULL;
|
|
|
|
RUNTIME_CHECK(isc_taskmgr_create(mctx, 5, 0, &taskmgr) ==
|
1999-07-08 03:16:00 +00:00
|
|
|
ISC_R_SUCCESS);
|
|
|
|
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
isc_log_setdebuglevel(log, 99);
|
|
|
|
|
1999-07-08 03:16:00 +00:00
|
|
|
t0 = NULL;
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
RUNTIME_CHECK(isc_task_create(taskmgr, 0, &t0) == ISC_R_SUCCESS);
|
1999-07-08 03:16:00 +00:00
|
|
|
|
|
|
|
socketmgr = NULL;
|
|
|
|
RUNTIME_CHECK(isc_socketmgr_create(mctx, &socketmgr) == ISC_R_SUCCESS);
|
|
|
|
|
2000-05-10 23:43:48 +00:00
|
|
|
dispatchmgr = NULL;
|
|
|
|
RUNTIME_CHECK(dns_dispatchmgr_create(mctx, &dispatchmgr)
|
|
|
|
== ISC_R_SUCCESS);
|
|
|
|
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
isc_sockaddr_any(&sa);
|
|
|
|
isc_sockaddr_setport(&sa, 5356);
|
|
|
|
|
1999-07-08 03:16:00 +00:00
|
|
|
/*
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
* Get or create a dispatch context.
|
1999-07-08 03:16:00 +00:00
|
|
|
*/
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
attrs = 0;
|
|
|
|
attrs |= DNS_DISPATCHATTR_IPV4;
|
|
|
|
attrs |= DNS_DISPATCHATTR_UDP;
|
|
|
|
|
1999-07-08 03:16:00 +00:00
|
|
|
disp = NULL;
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
RUNTIME_CHECK(dns_dispatch_getudp(dispatchmgr, socketmgr,
|
|
|
|
taskmgr, &sa, 512, 6, 1024,
|
|
|
|
17, 19, attrs, attrs, &disp)
|
2000-01-07 01:17:47 +00:00
|
|
|
== ISC_R_SUCCESS);
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
INSIST(disp != NULL);
|
1999-07-08 03:16:00 +00:00
|
|
|
|
1999-07-22 01:34:31 +00:00
|
|
|
RUNTIME_CHECK(isc_mutex_init(&client_lock) == ISC_R_SUCCESS);
|
|
|
|
RUNTIME_CHECK(isc_mutex_lock(&client_lock) == ISC_R_SUCCESS);
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
|
|
|
|
memset(clients, 0, sizeof (clients));
|
|
|
|
for (i = 0 ; i < NCLIENTS ; i++)
|
|
|
|
clients[i].client_number = i;
|
|
|
|
|
1999-07-22 01:34:31 +00:00
|
|
|
for (i = 0 ; i < 2 ; i++) {
|
|
|
|
clients[i].count = 0;
|
|
|
|
clients[i].resp = NULL;
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
RUNTIME_CHECK(dns_dispatch_addrequest(disp, t0, got_request,
|
1999-07-22 01:34:31 +00:00
|
|
|
&clients[i],
|
|
|
|
&clients[i].resp)
|
|
|
|
== ISC_R_SUCCESS);
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
INSIST(clients[i].resp != NULL);
|
|
|
|
fprintf(stderr, "Started client %i via addrequest\n", i);
|
1999-07-22 01:34:31 +00:00
|
|
|
client_count++;
|
|
|
|
}
|
|
|
|
RUNTIME_CHECK(isc_mutex_unlock(&client_lock) == ISC_R_SUCCESS);
|
1999-07-08 03:16:00 +00:00
|
|
|
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
isc_mem_stats(mctx, stderr);
|
|
|
|
|
1999-07-09 01:57:55 +00:00
|
|
|
isc_app_run();
|
|
|
|
|
1999-07-28 23:04:33 +00:00
|
|
|
fprintf(stderr, "canceling dispatcher\n");
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
isc_mem_stats(mctx, stderr);
|
|
|
|
sleep(2);
|
1999-07-22 10:23:50 +00:00
|
|
|
dns_dispatch_cancel(disp);
|
|
|
|
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
INSIST(disp != NULL);
|
1999-07-28 23:04:33 +00:00
|
|
|
fprintf(stderr, "detaching from dispatcher\n");
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
isc_mem_stats(mctx, stderr);
|
|
|
|
sleep(2);
|
1999-07-13 00:25:21 +00:00
|
|
|
dns_dispatch_detach(&disp);
|
1999-07-08 22:12:37 +00:00
|
|
|
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
fprintf(stderr, "destroying dispatch manager\n");
|
|
|
|
isc_mem_stats(mctx, stderr);
|
|
|
|
sleep(2);
|
|
|
|
dns_dispatchmgr_destroy(&dispatchmgr);
|
|
|
|
|
1999-07-08 03:16:00 +00:00
|
|
|
fprintf(stderr, "Destroying socket manager\n");
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
isc_mem_stats(mctx, stderr);
|
|
|
|
sleep(2);
|
1999-07-08 03:16:00 +00:00
|
|
|
isc_socketmgr_destroy(&socketmgr);
|
|
|
|
|
1999-07-09 01:57:55 +00:00
|
|
|
isc_task_shutdown(t0);
|
|
|
|
isc_task_detach(&t0);
|
|
|
|
|
1999-07-08 03:16:00 +00:00
|
|
|
fprintf(stderr, "Destroying task manager\n");
|
1999-07-09 20:34:33 +00:00
|
|
|
isc_mem_stats(mctx, stderr);
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
sleep(2);
|
|
|
|
isc_taskmgr_destroy(&taskmgr);
|
1999-07-08 03:16:00 +00:00
|
|
|
|
1999-07-09 01:57:55 +00:00
|
|
|
isc_app_finish();
|
|
|
|
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
isc_log_destroy(&log);
|
|
|
|
sleep(2);
|
2000-05-22 19:36:34 +00:00
|
|
|
|
Merge the mlg-20000518 branch onto the mainline. Change summary:
dns_dispatch_create() no longer exists. dns_dispatch_createtcp()
and dns_dispatch_getudp() are the replacements. _createtcp() takes
a bound, connected TCP socket, while _getudp() will search for
a sharable UDP socket, and if found, attach to it and return a
pointer to it. If one is not found, it will create a udp socket,
bind it to a supplied local address, and create a new dispatcher
around it.
dns_dispatch_remove{request,response}() no longer take the dispatch
as an argument.
query-source can now be set per view.
The dispatch manager holds onto three memory pools, one for
allocating dispatchers from, one for events, and one for
requests/replies. The free list on these pools is hard-coded,
but set to 1024. This keeps us from having to dig into the
isc_mem_t the pools draw from as often.
dns_resolver_create() and dns_view_createresolver() require that
valid dispatchers be passed in; dispatchers are no longer created
for the caller.
2000-05-19 21:46:46 +00:00
|
|
|
isc_mem_stats(mctx, stderr);
|
|
|
|
fflush(stderr);
|
|
|
|
isc_mem_detach(&mctx);
|
|
|
|
|
1999-07-08 03:16:00 +00:00
|
|
|
return (0);
|
|
|
|
}
|