dispatch.c revision 35f06ab0e6d5ad26176b7584de7b4d405272ba68
a66619fe32b9ac43b67f8fc635aec3cfea95fd91Curtis Blackburn * Copyright (C) 1999-2001 Internet Software Consortium.
a66619fe32b9ac43b67f8fc635aec3cfea95fd91Curtis Blackburn * Permission to use, copy, modify, and distribute this software for any
a66619fe32b9ac43b67f8fc635aec3cfea95fd91Curtis Blackburn * purpose with or without fee is hereby granted, provided that the above
a66619fe32b9ac43b67f8fc635aec3cfea95fd91Curtis Blackburn * copyright notice and this permission notice appear in all copies.
a66619fe32b9ac43b67f8fc635aec3cfea95fd91Curtis Blackburn * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
a66619fe32b9ac43b67f8fc635aec3cfea95fd91Curtis Blackburn * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
a66619fe32b9ac43b67f8fc635aec3cfea95fd91Curtis Blackburn * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
a66619fe32b9ac43b67f8fc635aec3cfea95fd91Curtis Blackburn * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
a66619fe32b9ac43b67f8fc635aec3cfea95fd91Curtis Blackburn * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
a66619fe32b9ac43b67f8fc635aec3cfea95fd91Curtis Blackburn * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
a66619fe32b9ac43b67f8fc635aec3cfea95fd91Curtis Blackburn * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
a66619fe32b9ac43b67f8fc635aec3cfea95fd91Curtis Blackburn * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
a66619fe32b9ac43b67f8fc635aec3cfea95fd91Curtis Blackburn/* $Id: dispatch.c,v 1.86 2001/01/27 02:08:04 bwelling Exp $ */
a66619fe32b9ac43b67f8fc635aec3cfea95fd91Curtis Blackburntypedef ISC_LIST(dns_dispentry_t) dns_displist_t;
a66619fe32b9ac43b67f8fc635aec3cfea95fd91Curtis Blackburntypedef struct dns_qid {
a66619fe32b9ac43b67f8fc635aec3cfea95fd91Curtis Blackburn unsigned int qid_nbuckets; /* hash table size */
a66619fe32b9ac43b67f8fc635aec3cfea95fd91Curtis Blackburn unsigned int qid_increment; /* id increment on collision */
} dns_qid_t;
struct dns_dispatchmgr {
unsigned int magic;
unsigned int state;
struct dns_dispentry {
unsigned int magic;
unsigned int bucket;
void *arg;
struct dns_dispatch {
unsigned int attributes;
dns_messageid_t, unsigned int);
unsigned int maxrequests,
unsigned int attributes,
msgbuf);
msgbuf);
NULL, 0);
static dns_messageid_t
static isc_uint32_t
unsigned int ret;
return (ret);
static dns_dispentry_t *
unsigned int bucket;
bucket = 0;
return (ret);
bucket++;
return (NULL);
static dns_dispentry_t *
unsigned int bucket;
return (ret);
return (ret);
bucket++;
return (NULL);
static isc_boolean_t
return (ISC_FALSE);
return (ISC_FALSE);
return (ISC_FALSE);
return (ISC_TRUE);
if (killmgr)
static dns_dispentry_t *
unsigned int bucket)
return (res);
return (NULL);
case isc_sockettype_tcp:
case isc_sockettype_udp:
INSIST(0);
void *temp;
return (temp);
static inline dns_dispatchevent_t *
return (NULL);
return (ev);
unsigned int flags;
unsigned int bucket;
int match;
if (killit)
goto restart;
match > 0)
sizeof(netaddrstr));
goto restart;
goto restart;
goto restart;
goto restart;
goto restart;
if (queue_request) {
} else if (queue_response) {
unsigned int flags;
unsigned int bucket;
case ISC_R_CANCELED:
case ISC_R_EOF:
if (killit)
goto restart;
goto restart;
goto restart;
goto restart;
if (queue_request) {
} else if (queue_response) {
case isc_sockettype_udp:
case isc_sockettype_tcp:
static isc_boolean_t
return (ISC_FALSE);
return (ISC_FALSE);
return (ISC_FALSE);
return (ISC_FALSE);
return (ISC_FALSE);
return (ISC_TRUE);
static isc_result_t
return (result);
return (result);
return (ISC_R_SUCCESS);
return (ISC_R_NOMEMORY);
goto deallocate;
goto kill_lock;
goto kill_buffer_lock;
goto kill_pool_lock;
goto kill_epool;
goto kill_rpool;
return (ISC_R_SUCCESS);
return (result);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
static isc_result_t
return (ISC_R_SUCCESS);
return (ISC_R_NOMEMORY);
goto cleanup;
return (ISC_R_SUCCESS);
return (ISC_R_NOMEMORY);
if (killit)
static isc_boolean_t
return (ISC_TRUE);
if (port == 0)
static isc_result_t
goto out;
out:
return (result);
static isc_result_t
return (ISC_R_NOMEMORY);
return (ISC_R_NOMEMORY);
return (ISC_R_UNEXPECTED);
for (i = 0 ; i < buckets ; i++)
return (ISC_R_SUCCESS);
static isc_result_t
return (ISC_R_NOMEMORY);
goto deallocate;
goto kill_lock;
return (ISC_R_SUCCESS);
return (res);
return (result);
goto deallocate_dispatch;
goto kill_socket;
sizeof(isc_event_t));
goto kill_task;
return (ISC_R_SUCCESS);
return (result);
unsigned int buffersize,
return (result);
return (ISC_R_SUCCESS);
return (result);
return (ISC_R_SUCCESS);
static isc_result_t
unsigned int maxrequests,
unsigned int attributes,
return (result);
goto deallocate_dispatch;
goto kill_socket;
sizeof(isc_event_t));
goto kill_task;
return (ISC_R_SUCCESS);
return (result);
if (killit)
unsigned int bucket;
return (ISC_R_SHUTTINGDOWN);
return (ISC_R_QUOTA);
if (!ok) {
return (ISC_R_NOMORE);
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
unsigned int bucket;
if (killit)
return (ISC_R_SHUTTINGDOWN);
return (ISC_R_QUOTA);
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
if (killit)
if (response)
void *buf;