diff options
Diffstat (limited to 'lib/dns/include/dns/dispatch.h')
| -rw-r--r-- | lib/dns/include/dns/dispatch.h | 66 | 
1 files changed, 64 insertions, 2 deletions
| diff --git a/lib/dns/include/dns/dispatch.h b/lib/dns/include/dns/dispatch.h index 3f881dfcf1d6c..1235f7ca40f39 100644 --- a/lib/dns/include/dns/dispatch.h +++ b/lib/dns/include/dns/dispatch.h @@ -1,5 +1,5 @@  /* - * Copyright (C) 2004-2009, 2012  Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2009, 2011, 2012  Internet Systems Consortium, Inc. ("ISC")   * Copyright (C) 1999-2003  Internet Software Consortium.   *   * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@   * PERFORMANCE OF THIS SOFTWARE.   */ -/* $Id$ */ +/* $Id: dispatch.h,v 1.64 2011/07/28 23:47:58 tbox Exp $ */  #ifndef DNS_DISPATCH_H  #define DNS_DISPATCH_H 1 @@ -54,6 +54,7 @@  #include <isc/buffer.h>  #include <isc/lang.h> +#include <isc/mutex.h>  #include <isc/socket.h>  #include <isc/types.h> @@ -88,6 +89,18 @@ struct dns_dispatchevent {  	isc_uint32_t		attributes;	/*%< mirrored from socket.h */  }; +/*% + * This is a set of one or more dispatches which can be retrieved + * round-robin fashion. + */ +struct dns_dispatchset { +	isc_mem_t		*mctx; +	dns_dispatch_t		**dispatches; +	int			ndisp; +	int			cur; +	isc_mutex_t		lock; +}; +  /*@{*/  /*%   * Attributes for added dispatchers. @@ -245,6 +258,15 @@ dns_dispatch_getudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,  		    unsigned int buckets, unsigned int increment,  		    unsigned int attributes, unsigned int mask,  		    dns_dispatch_t **dispp); + +isc_result_t +dns_dispatch_getudp_dup(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr, +		    isc_taskmgr_t *taskmgr, isc_sockaddr_t *localaddr, +		    unsigned int buffersize, +		    unsigned int maxbuffers, unsigned int maxrequests, +		    unsigned int buckets, unsigned int increment, +		    unsigned int attributes, unsigned int mask, +		    dns_dispatch_t **dispp, dns_dispatch_t *dup);  /*%<   * Attach to existing dns_dispatch_t if one is found with dns_dispatchmgr_find,   * otherwise create a new UDP dispatch. @@ -496,6 +518,46 @@ dns_dispatch_importrecv(dns_dispatch_t *disp, isc_event_t *event);   * 	event != NULL   */ +dns_dispatch_t * +dns_dispatchset_get(dns_dispatchset_t *dset); +/*%< + * Retrieve the next dispatch from dispatch set 'dset', and increment + * the round-robin counter. + * + * Requires: + *\li 	dset != NULL + */ + +isc_result_t +dns_dispatchset_create(isc_mem_t *mctx, isc_socketmgr_t *sockmgr, +		       isc_taskmgr_t *taskmgr, dns_dispatch_t *source, +		       dns_dispatchset_t **dsetp, int n); +/*%< + * Given a valid dispatch 'source', create a dispatch set containing + * 'n' UDP dispatches, with the remainder filled out by clones of the + * source. + * + * Requires: + *\li 	source is a valid UDP dispatcher + *\li 	dsetp != NULL, *dsetp == NULL + */ + +void +dns_dispatchset_cancelall(dns_dispatchset_t *dset, isc_task_t *task); +/*%< + * Cancel socket operations for the dispatches in 'dset'. + */ + +void +dns_dispatchset_destroy(dns_dispatchset_t **dsetp); +/*%< + * Dereference all the dispatches in '*dsetp', free the dispatchset + * memory, and set *dsetp to NULL. + * + * Requires: + *\li 	dset is valid + */ +  ISC_LANG_ENDDECLS  #endif /* DNS_DISPATCH_H */ | 
