+2695. [func] DHCP/DDNS - update fdwatch code for use by
+ DHCP. Modify the api to isc_sockfdwatch_t (the
+ callback funciton for isc_socket_fdwatchcreate)
+ to include information about the direction (read
+ or write) and add isc_socket_fdwatchpoke.
+ [RT #20253]
+
2694. [bug] Reduce default NSEC3 iterations from 100 to 10.
[RT #19970]
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: msgs.h,v 1.17 2008/08/08 06:28:59 tbox Exp $ */
+/* $Id: msgs.h,v 1.18 2009/10/01 01:30:01 sar Exp $ */
#ifndef ISC_MSGS_H
#define ISC_MSGS_H 1
#define ISC_MSG_FILTER 1421 /*%< setsockopt(SO_ACCEPTFILTER): %s */
#define ISC_MSG_TOOMANYHANDLES 1422 /*%< %s: too many open WSA event handles: %s */
-
+#define ISC_MSG_POKED 1423 /*%< "poked flags: %d" */
#define ISC_MSG_AWAKE 1502 /*%< "awake" */
#define ISC_MSG_WORKING 1503 /*%< "working" */
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: namespace.h,v 1.4 2009/09/02 23:48:03 tbox Exp $ */
+/* $Id: namespace.h,v 1.5 2009/10/01 01:30:01 sar Exp $ */
#ifndef ISCAPI_NAMESPACE_H
#define ISCAPI_NAMESPACE_H 1
#define isc_socket_listen isc__socket_listen
#define isc_socket_accept isc__socket_accept
#define isc_socket_connect isc__socket_connect
-#define isc_socket_fdwatchcreate isc__socket_fdwatchcreate
#define isc_socket_getname isc__socket_getname
#define isc_socket_gettag isc__socket_gettag
#define isc_socket_getpeername isc__socket_getpeername
#define isc_socketmgr_setstats isc__socketmgr_setstats
#define isc_socketmgr_setreserved isc__socketmgr_setreserved
#define isc__socketmgr_maxudp isc___socketmgr_maxudp
+#define isc_socket_fdwatchcreate isc__socket_fdwatchcreate
+#define isc_socket_fdwatchpoke isc__socket_fdwatchpoke
#define isc_task_create isc__task_create
#define isc_task_attach isc__task_attach
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: socket.h,v 1.93 2009/09/02 23:43:54 each Exp $ */
+/* $Id: socket.h,v 1.94 2009/10/01 01:30:01 sar Exp $ */
#ifndef ISC_SOCKET_H
#define ISC_SOCKET_H 1
isc_result_t (*socketcreate)(isc_socketmgr_t *manager, int pf,
isc_sockettype_t type,
isc_socket_t **socketp);
+ isc_result_t (*fdwatchcreate)(isc_socketmgr_t *manager, int fd,
+ int flags,
+ isc_sockfdwatch_t callback,
+ void *cbarg, isc_task_t *task,
+ isc_socket_t **socketp);
} isc_socketmgrmethods_t;
typedef struct isc_socketmethods {
isc_sockaddr_t *addressp);
isc_sockettype_t (*gettype)(isc_socket_t *sock);
void (*ipv6only)(isc_socket_t *sock, isc_boolean_t yes);
+ isc_result_t (*fdwatchpoke)(isc_socket_t *sock, int flags);
} isc_socketmethods_t;
/*%
*\li #ISC_R_UNEXPECTED
*/
+isc_result_t
+isc_socket_fdwatchpoke(isc_socket_t *sock,
+ int flags);
+/*%<
+ * Poke a file descriptor watch socket informing the manager that it
+ * should restart watching the socket
+ *
+ * Note:
+ *
+ *\li 'sock' is the socket returned by isc_socket_fdwatchcreate
+ *
+ *\li 'flags' indicates what the manager should watch for on the socket
+ * in addition to what it may already be watching. It can be one or
+ * both of ISC_SOCKFDWATCH_READ and ISC_SOCKFDWATCH_WRITE. To
+ * temporarily disable watching on a socket the value indicating
+ * no more data should be returned from the call back routine.
+ *
+ *\li This function is not available on Windows.
+ *
+ * Requires:
+ *
+ *\li 'sock' is a valid isc socket
+ *
+ *
+ * Returns:
+ *
+ *\li #ISC_R_SUCCESS
+ */
+
isc_result_t
isc_socket_create(isc_socketmgr_t *manager,
int pf,
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: types.h,v 1.50 2009/09/01 18:40:25 jinmei Exp $ */
+/* $Id: types.h,v 1.51 2009/10/01 01:30:01 sar Exp $ */
#ifndef ISC_TYPES_H
#define ISC_TYPES_H 1
typedef struct isc_timermgr isc_timermgr_t; /*%< Timer Manager */
typedef void (*isc_taskaction_t)(isc_task_t *, isc_event_t *);
-typedef int (*isc_sockfdwatch_t)(isc_task_t *, isc_socket_t *, void *);
+typedef int (*isc_sockfdwatch_t)(isc_task_t *, isc_socket_t *, void *, int);
/* The following cannot be listed alphabetically due to forward reference */
typedef isc_result_t (isc_httpdaction_t)(const char *url,
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: socket_api.c,v 1.4 2009/09/02 23:48:02 tbox Exp $ */
+/* $Id: socket_api.c,v 1.5 2009/10/01 01:30:01 sar Exp $ */
#include <config.h>
UNUSED(name);
UNUSED(tag);
}
+
+isc_result_t
+isc_socket_fdwatchcreate(isc_socketmgr_t *manager, int fd, int flags,
+ isc_sockfdwatch_t callback, void *cbarg,
+ isc_task_t *task, isc_socket_t **socketp)
+{
+ REQUIRE(ISCAPI_SOCKETMGR_VALID(manager));
+
+ return (manager->methods->fdwatchcreate(manager, fd, flags,
+ callback, cbarg, task,
+ socketp));
+}
+
+isc_result_t
+isc_socket_fdwatchpoke(isc_socket_t *sock, int flags)
+{
+ REQUIRE(ISCAPI_SOCKET_VALID(sock));
+
+ return(sock->methods->fdwatchpoke(sock, flags));
+}
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: socket.c,v 1.324 2009/09/07 02:08:51 marka Exp $ */
+/* $Id: socket.c,v 1.325 2009/10/01 01:30:01 sar Exp $ */
/*! \file */
isc__socketmgr_renderxml(isc_socketmgr_t *mgr0, xmlTextWriterPtr writer);
#endif
+ISC_SOCKETFUNC_SCOPE isc_result_t
+isc__socket_fdwatchcreate(isc_socketmgr_t *manager, int fd, int flags,
+ isc_sockfdwatch_t callback, void *cbarg,
+ isc_task_t *task, isc_socket_t **socketp);
+ISC_SOCKETFUNC_SCOPE isc_result_t
+isc__socket_fdwatchpoke(isc_socket_t *sock, int flags);
+
static struct {
isc_socketmethods_t methods;
isc__socket_cancel,
isc__socket_getsockname,
isc__socket_gettype,
- isc__socket_ipv6only
+ isc__socket_ipv6only,
+ isc__socket_fdwatchpoke
}
#ifndef BIND9
,
static isc_socketmgrmethods_t socketmgrmethods = {
isc__socketmgr_destroy,
- isc__socket_create
+ isc__socket_create,
+ isc__socket_fdwatchcreate
};
#define SELECT_POKE_SHUTDOWN (-1)
return (result);
}
+#endif /* BIND9 */
/*
* Create a new 'type' socket managed by 'manager'. Events
return (ISC_R_SUCCESS);
}
-#endif /* BIND9 */
+
+/* Indicate to the manager that it should watch the socket again.
+ * This can be used to restart watching if the previous event handler
+ * didn't indicate there was more data to be processed. Primarily
+ * it is for writing but could be used for reading if desired */
+
+ISC_SOCKETFUNC_SCOPE isc_result_t
+isc__socket_fdwatchpoke(isc_socket_t *sock0, int flags)
+{
+ isc__socket_t *sock = (isc__socket_t *)sock0;
+
+ REQUIRE(VALID_SOCKET(sock));
+
+ if (flags & ISC_SOCKFDWATCH_READ)
+ select_poke(sock->manager, sock->fd, SELECT_POKE_READ);
+ if (flags & ISC_SOCKFDWATCH_WRITE)
+ select_poke(sock->manager, sock->fd, SELECT_POKE_WRITE);
+
+ socket_log(sock, NULL, TRACE, isc_msgcat, ISC_MSGSET_SOCKET,
+ ISC_MSG_POKED, "fdwatch-poked flags: %d", flags);
+
+ return (ISC_R_SUCCESS);
+}
/*
* Attach to a socket. Caller must explicitly detach when it is done.
UNLOCK(&sock->lock);
more_data = (sock->fdwatchcb)(me, (isc_socket_t *)sock,
- sock->fdwatcharg);
+ sock->fdwatcharg, ISC_SOCKFDWATCH_WRITE);
LOCK(&sock->lock);
sock->pending_send = 0;
UNLOCK(&sock->lock);
more_data = (sock->fdwatchcb)(me, (isc_socket_t *)sock,
- sock->fdwatcharg);
+ sock->fdwatcharg, ISC_SOCKFDWATCH_READ);
LOCK(&sock->lock);
sock->pending_recv = 0;