dispatch.c revision 3cd4668988c5bccd59cca899459df4cfa985be67
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * Copyright (C) 1999 Internet Software Consortium.
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * Permission to use, copy, modify, and distribute this software for any
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * purpose with or without fee is hereby granted, provided that the above
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * copyright notice and this permission notice appear in all copies.
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews unsigned int magic;
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews unsigned int bucket;
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrewstypedef ISC_LIST(dns_dispentry_t) dns_displist_t;
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews /* Unlocked. */
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews isc_socket_t *socket; /* isc socket attached to */
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews unsigned int buffersize; /* size of each buffer */
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews /* Locked. */
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews isc_mempool_t *epool; /* memory pool for events */
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews isc_mempool_t *bpool; /* memory pool for buffers */
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews isc_mempool_t *rpool; /* memory pool request/reply */
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews dns_dispatchevent_t *failsafe_ev; /* failsafe cancel event */
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews unsigned int recvs; /* recv() calls outstanding */
9cc53f2a0819301c2de7ab93197eee11e8a365e7Mark Andrews unsigned int recvs_wanted; /* recv() calls wanted */
static dns_dispentry_t *
dns_messageid_t, unsigned int);
static dns_messageid_t
static inline dns_dispatchevent_t *
static dns_dispentry_t *
static dns_dispentry_t *
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);
unsigned int ret;
return (ret);
static dns_messageid_t
static dns_dispentry_t *
unsigned int bucket)
return (res);
return (NULL);
switch (socktype) {
case isc_sockettype_tcp:
case isc_sockettype_udp:
INSIST(0);
void *temp;
return (temp);
static inline dns_dispatchevent_t *
return (ev);
unsigned int flags;
unsigned int bucket;
if (killit)
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_SUCCESS:
case ISC_R_EOF:
case ISC_R_CANCELED:
if (killit)
goto restart;
goto restart;
goto restart;
goto restart;
goto restart;
if (queue_request) {
} else if (queue_response) {
unsigned int wanted;
if (wanted == 0)
switch (socktype) {
case isc_sockettype_udp:
case isc_sockettype_tcp:
disp);
unsigned int maxbuffersize,
unsigned int hashsize,
unsigned int tablesize;
return (DNS_R_NOMEMORY);
goto out1;
for (i = 0 ; i < tablesize ; i++)
goto out2;
goto out3;
goto out4;
goto out5;
goto out6;
return (DNS_R_SUCCESS);
out6:
out5:
out4:
out3:
out2:
out1:
return (res);
if (killit)
unsigned int bucket;
return (ISC_R_SHUTTINGDOWN);
return (ISC_R_QUOTA);
if (!ok) {
return (DNS_R_NOMORE);
return (DNS_R_NOMEMORY);
return (DNS_R_SUCCESS);
unsigned int bucket;
if (killit)
return (ISC_R_SHUTTINGDOWN);
return (ISC_R_QUOTA);
return (DNS_R_NOMEMORY);
return (DNS_R_SUCCESS);
if (killit)
if (response)
resp,