mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 13:50:00 -04:00
namespace cleanup
This commit is contained in:
parent
234878743f
commit
9a6bbb206e
4 changed files with 43 additions and 80 deletions
|
|
@ -15,7 +15,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: lwdclient.h,v 1.2 2000/06/22 21:49:45 tale Exp $ */
|
||||
/* $Id: lwdclient.h,v 1.3 2000/06/26 20:50:00 bwelling Exp $ */
|
||||
|
||||
#ifndef NAMED_LWDCLIENT_H
|
||||
#define NAMED_LWDCLIENT_H 1
|
||||
|
|
@ -201,7 +201,6 @@ void ns_lwdclient_processnoop(ns_lwdclient_t *, lwres_buffer_t *);
|
|||
|
||||
void ns_lwdclient_errorpktsend(ns_lwdclient_t *, isc_uint32_t);
|
||||
|
||||
void DP(int level, const char *format, ...);
|
||||
void hexdump(char *msg, void *base, size_t len);
|
||||
void ns_lwdclient_log(int level, const char *format, ...);
|
||||
|
||||
#endif /* NAMED_LWDCLIENT_H */
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: lwdclient.c,v 1.3 2000/06/22 21:49:24 tale Exp $ */
|
||||
/* $Id: lwdclient.c,v 1.4 2000/06/26 20:49:56 bwelling Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -31,10 +31,9 @@
|
|||
#include <named/lwdclient.h>
|
||||
|
||||
void
|
||||
DP(int level, const char *format, ...) {
|
||||
ns_lwdclient_log(int level, const char *format, ...) {
|
||||
va_list args;
|
||||
|
||||
level = 1;
|
||||
va_start(args, format);
|
||||
isc_log_vwrite(dns_lctx,
|
||||
DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_ADB,
|
||||
|
|
@ -42,46 +41,6 @@ level = 1;
|
|||
va_end(args);
|
||||
}
|
||||
|
||||
void
|
||||
hexdump(char *msg, void *base, size_t len) {
|
||||
unsigned char *p;
|
||||
unsigned int cnt;
|
||||
char buffer[180];
|
||||
char *n;
|
||||
|
||||
p = base;
|
||||
cnt = 0;
|
||||
n = buffer;
|
||||
*n = 0;
|
||||
|
||||
printf("*** %s (%u bytes @ %p)\n", msg, len, base);
|
||||
|
||||
while (cnt < len) {
|
||||
if (cnt % 16 == 0) {
|
||||
n = buffer;
|
||||
n += sprintf(buffer, "%p: ", p);
|
||||
} else if (cnt % 8 == 0) {
|
||||
*n++ = ' ';
|
||||
*n++ = '|';
|
||||
*n = 0;
|
||||
}
|
||||
n += sprintf(n, " %02x", *p++);
|
||||
cnt++;
|
||||
|
||||
if (cnt % 16 == 0) {
|
||||
DP(80, buffer);
|
||||
n = buffer;
|
||||
*n = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (n != buffer) {
|
||||
DP(80, buffer);
|
||||
n = buffer;
|
||||
*n = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clientmgr_can_die(ns_lwdclientmgr_t *cm) {
|
||||
if ((cm->flags & NS_LWDCLIENTMGR_FLAGSHUTTINGDOWN) == 0)
|
||||
|
|
@ -106,11 +65,11 @@ process_request(ns_lwdclient_t *client) {
|
|||
|
||||
result = lwres_lwpacket_parseheader(&b, &client->pkt);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
DP(50, "invalid packet header received");
|
||||
ns_lwdclient_log(50, "invalid packet header received");
|
||||
goto restart;
|
||||
}
|
||||
|
||||
DP(50, "opcode %08x", client->pkt.opcode);
|
||||
ns_lwdclient_log(50, "opcode %08x", client->pkt.opcode);
|
||||
|
||||
switch (client->pkt.opcode) {
|
||||
case LWRES_OPCODE_GETADDRSBYNAME:
|
||||
|
|
@ -123,7 +82,7 @@ process_request(ns_lwdclient_t *client) {
|
|||
ns_lwdclient_processnoop(client, &b);
|
||||
return;
|
||||
default:
|
||||
DP(50, "unknown opcode %08x", client->pkt.opcode);
|
||||
ns_lwdclient_log(50, "unknown opcode %08x", client->pkt.opcode);
|
||||
goto restart;
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +90,7 @@ process_request(ns_lwdclient_t *client) {
|
|||
* Drop the packet.
|
||||
*/
|
||||
restart:
|
||||
DP(50, "restarting client %p...", client);
|
||||
ns_lwdclient_log(50, "restarting client %p...", client);
|
||||
ns_lwdclient_stateidle(client);
|
||||
}
|
||||
|
||||
|
|
@ -149,8 +108,10 @@ ns_lwdclient_recv(isc_task_t *task, isc_event_t *ev) {
|
|||
INSIST((cm->flags & NS_LWDCLIENTMGR_FLAGRECVPENDING) != 0);
|
||||
cm->flags &= ~NS_LWDCLIENTMGR_FLAGRECVPENDING;
|
||||
|
||||
DP(50, "event received: task %p, length %u, result %u (%s)",
|
||||
task, dev->n, dev->result, isc_result_totext(dev->result));
|
||||
ns_lwdclient_log(50,
|
||||
"event received: task %p, length %u, result %u (%s)",
|
||||
task, dev->n, dev->result,
|
||||
isc_result_totext(dev->result));
|
||||
|
||||
if (dev->result != ISC_R_SUCCESS) {
|
||||
isc_event_free(&ev);
|
||||
|
|
@ -236,7 +197,7 @@ ns_lwdclient_shutdown(isc_task_t *task, isc_event_t *ev) {
|
|||
|
||||
REQUIRE((cm->flags & NS_LWDCLIENTMGR_FLAGSHUTTINGDOWN) == 0);
|
||||
|
||||
DP(50, "got shutdown event, task %p", task);
|
||||
ns_lwdclient_log(50, "got shutdown event, task %p", task);
|
||||
|
||||
/*
|
||||
* Cancel any pending I/O.
|
||||
|
|
@ -293,7 +254,8 @@ ns_lwdclient_send(isc_task_t *task, isc_event_t *ev) {
|
|||
INSIST(NS_LWDCLIENT_ISSEND(client));
|
||||
INSIST(client->sendbuf == dev->region.base);
|
||||
|
||||
DP(50, "task %p for client %p got send-done event", task, client);
|
||||
ns_lwdclient_log(50, "task %p for client %p got send-done event",
|
||||
task, client);
|
||||
|
||||
if (client->sendbuf != client->buffer)
|
||||
lwres_context_freemem(cm->lwctx, client->sendbuf,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: lwdgabn.c,v 1.3 2000/06/22 21:49:26 tale Exp $ */
|
||||
/* $Id: lwdgabn.c,v 1.4 2000/06/26 20:49:57 bwelling Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ static void
|
|||
cleanup_gabn(ns_lwdclient_t *client) {
|
||||
dns_adbfind_t *v4;
|
||||
|
||||
DP(50, "cleaning up client %p", client);
|
||||
ns_lwdclient_log(50, "cleaning up client %p", client);
|
||||
|
||||
v4 = client->v4find;
|
||||
|
||||
|
|
@ -98,8 +98,8 @@ setup_addresses(ns_lwdclient_t *client, dns_adbfind_t *find, unsigned int at) {
|
|||
goto next;
|
||||
}
|
||||
|
||||
DP(50, "adding address %p, family %d, length %d",
|
||||
addr->address, addr->family, addr->length);
|
||||
ns_lwdclient_log(50, "adding address %p, family %d, length %d",
|
||||
addr->address, addr->family, addr->length);
|
||||
|
||||
client->gabn.naddrs++;
|
||||
REQUIRE(!LWRES_LINK_LINKED(addr, link));
|
||||
|
|
@ -121,7 +121,7 @@ generate_reply(ns_lwdclient_t *client) {
|
|||
cm = client->clientmgr;
|
||||
lwb.base = NULL;
|
||||
|
||||
DP(50, "generating gabn reply for client %p", client);
|
||||
ns_lwdclient_log(50, "generating gabn reply for client %p", client);
|
||||
|
||||
/*
|
||||
* We must make certain the client->find is not still active.
|
||||
|
|
@ -273,7 +273,7 @@ process_gabn_finddone(isc_task_t *task, isc_event_t *ev) {
|
|||
isc_eventtype_t evtype;
|
||||
isc_boolean_t claimed;
|
||||
|
||||
DP(50, "find done for task %p, client %p", task, client);
|
||||
ns_lwdclient_log(50, "find done for task %p, client %p", task, client);
|
||||
|
||||
evtype = ev->ev_type;
|
||||
isc_event_free(&ev);
|
||||
|
|
@ -337,7 +337,7 @@ start_find(ns_lwdclient_t *client) {
|
|||
isc_result_t result;
|
||||
isc_boolean_t claimed;
|
||||
|
||||
DP(50, "starting find for client %p", client);
|
||||
ns_lwdclient_log(50, "starting find for client %p", client);
|
||||
|
||||
/*
|
||||
* Issue a find for the name contained in the request. We won't
|
||||
|
|
@ -373,19 +373,21 @@ start_find(ns_lwdclient_t *client) {
|
|||
* Did we get an alias? If so, save it and re-issue the query.
|
||||
*/
|
||||
if (result == DNS_R_ALIAS) {
|
||||
DP(50, "found alias, restarting query");
|
||||
ns_lwdclient_log(50, "found alias, restarting query");
|
||||
dns_adb_destroyfind(&client->find);
|
||||
cleanup_gabn(client);
|
||||
result = add_alias(client);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
DP(50, "out of buffer space adding alias");
|
||||
ns_lwdclient_log(50,
|
||||
"out of buffer space adding alias");
|
||||
ns_lwdclient_errorpktsend(client, LWRES_R_FAILURE);
|
||||
return;
|
||||
}
|
||||
goto find_again;
|
||||
}
|
||||
|
||||
DP(50, "find returned %d (%s)", result, isc_result_totext(result));
|
||||
ns_lwdclient_log(50, "find returned %d (%s)", result,
|
||||
isc_result_totext(result));
|
||||
|
||||
/*
|
||||
* Did we get an error?
|
||||
|
|
@ -405,8 +407,8 @@ start_find(ns_lwdclient_t *client) {
|
|||
*/
|
||||
if (NEED_V4(client)
|
||||
&& ((client->find->query_pending & DNS_ADBFIND_INET) == 0)) {
|
||||
DP(50, "client %p ipv4 satisfied by find %p", client,
|
||||
client->find);
|
||||
ns_lwdclient_log(50, "client %p ipv4 satisfied by find %p",
|
||||
client, client->find);
|
||||
claimed = ISC_TRUE;
|
||||
client->v4find = client->find;
|
||||
}
|
||||
|
|
@ -416,8 +418,8 @@ start_find(ns_lwdclient_t *client) {
|
|||
*/
|
||||
if (NEED_V6(client)
|
||||
&& ((client->find->query_pending & DNS_ADBFIND_INET6) == 0)) {
|
||||
DP(50, "client %p ipv6 satisfied by find %p", client,
|
||||
client->find);
|
||||
ns_lwdclient_log(50, "client %p ipv6 satisfied by find %p",
|
||||
client, client->find);
|
||||
claimed = ISC_TRUE;
|
||||
client->v6find = client->find;
|
||||
}
|
||||
|
|
@ -432,11 +434,11 @@ start_find(ns_lwdclient_t *client) {
|
|||
* we have a programming error, so die hard.
|
||||
*/
|
||||
if ((client->find->options & DNS_ADBFIND_WANTEVENT) != 0) {
|
||||
DP(50, "event will be sent");
|
||||
ns_lwdclient_log(50, "event will be sent");
|
||||
INSIST(client->v4find == NULL || client->v6find == NULL);
|
||||
return;
|
||||
}
|
||||
DP(50, "no event will be sent");
|
||||
ns_lwdclient_log(50, "no event will be sent");
|
||||
if (claimed)
|
||||
client->find = NULL;
|
||||
else
|
||||
|
|
@ -530,8 +532,8 @@ ns_lwdclient_processgabn(ns_lwdclient_t *client, lwres_buffer_t *b) {
|
|||
goto out;
|
||||
|
||||
client->find_wanted = req->addrtypes;
|
||||
DP(50, "client %p looking for addrtypes %08x",
|
||||
client, client->find_wanted);
|
||||
ns_lwdclient_log(50, "client %p looking for addrtypes %08x",
|
||||
client, client->find_wanted);
|
||||
|
||||
/*
|
||||
* We no longer need to keep this around.
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: lwdgnba.c,v 1.3 2000/06/22 21:49:28 tale Exp $ */
|
||||
/* $Id: lwdgnba.c,v 1.4 2000/06/26 20:49:59 bwelling Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -58,8 +58,8 @@ byaddr_done(isc_task_t *task, isc_event_t *event) {
|
|||
bevent = (dns_byaddrevent_t *)event;
|
||||
gnba = &client->gnba;
|
||||
|
||||
DP(50, "byaddr event result = %s",
|
||||
isc_result_totext(bevent->result));
|
||||
ns_lwdclient_log(50, "byaddr event result = %s",
|
||||
isc_result_totext(bevent->result));
|
||||
|
||||
result = bevent->result;
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
|
|
@ -112,9 +112,9 @@ byaddr_done(isc_task_t *task, isc_event_t *event) {
|
|||
result = dns_name_totext(name, ISC_TRUE, &client->recv_buffer);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto out;
|
||||
DP(50, "found name '%.*s'",
|
||||
client->recv_buffer.used - b.used,
|
||||
(char *)(b.base) + b.used);
|
||||
ns_lwdclient_log(50, "found name '%.*s'",
|
||||
client->recv_buffer.used - b.used,
|
||||
(char *)(b.base) + b.used);
|
||||
if (gnba->realname == NULL) {
|
||||
gnba->realname = (char *)(b.base) + b.used;
|
||||
gnba->realnamelen = client->recv_buffer.used - b.used;
|
||||
|
|
@ -257,8 +257,8 @@ ns_lwdclient_processgnba(ns_lwdclient_t *client, lwres_buffer_t *b) {
|
|||
}
|
||||
isc_sockaddr_fromnetaddr(&sa, &client->na, 53);
|
||||
|
||||
DP(50, "client %p looking for addrtype %08x",
|
||||
client, req->addr.family);
|
||||
ns_lwdclient_log(50, "client %p looking for addrtype %08x",
|
||||
client, req->addr.family);
|
||||
|
||||
/*
|
||||
* We no longer need to keep this around.
|
||||
|
|
|
|||
Loading…
Reference in a new issue