-void adns_event(adns_state, fd_set *readfds_mod,
- fd_set *writefds_mod, fd_set *exceptfds_mod,
- int *maxfd_mod, struct timeval *tv_mod);
-/* You may call this with *_mod=0 to have a simple callback,
- or with *fds_mod=*maxfd_mod=0 but tv_mod!=0 if you are
- not going to sleep, or with all !=0 if you are going to sleep. */
+int adns_callback(adns_state, int maxfd, const fd_set *readfds, const fd_set *writefds,
+ const fd_set *exceptfds);
+/* Gives adns flow-of-control for a bit. This will never block.
+ * If maxfd == -1 then adns will check (make nonblocking system calls on)
+ * all of its own filedescriptors; otherwise it will only use those
+ * < maxfd and specified in the fd_set's, as if select had returned them.
+ * Other fd's may be in the fd_sets, and will be ignored.
+ * _callback returns how many adns fd's were in the various sets, so
+ * you can tell if your select handling code has missed something and is going awol.
+ *
+ * May also return -1 if a critical syscall failed, setting errno.
+ */
+
+void adns_interest(adns_state, int *maxfd_io, fd_set *readfds_io,
+ fd_set *writefds_io, fd_set *exceptfds_io,
+ struct timeval **tv_mod, struct timeval *tv_buf);
+/* Find out file descriptors adns is interested in, and when it
+ * would like the opportunity to time something out. If you do not plan to
+ * block then tv_mod may be 0. Otherwise, tv_mod may point to 0 meaning
+ * you have no timeout of your own, in which case tv_buf must be non-null and
+ * _interest may fill it in and set *tv_mod=tv_buf.
+ * readfds, writefds, exceptfds and maxfd may not be 0.
+ */
+
+struct pollfd *adns_pollfds(adns_state, struct pollfd *buf, int *len_io, int *timeout);
+/* Like adns_interest, but for use with poll(2). The return value
+ * will be a pointer to an array of struct pollfd, one for each of
+ * adns's fds, and *len_io will be set to the number of file
+ * descriptors.
+ *
+ * Each descriptor's entry will have a revents==0, and events will be
+ * a combination of one or more of POLLIN, POLLOUT and POLLERR.
+ *
+ * *timeout will be adjusted to ensure that it is no more than the
+ * desired timeout (with the usual rule for poll that <0 stands for
+ * infinity). *timeout may be 0 in which case no timeout information
+ * will be returned.
+ *
+ * If *len_io is nonnegative then adns_pollfds will write to buffer
+ * provided by the caller in buf. If it is too small then *len_io
+ * will be updated to say how large it would have needed to be and
+ * adns_pollfds will fail with ENOSPC.
+ *
+ * If *len_io is -1 then buf should be 0, and adns_pollfds will use some
+ * memory belonging to the adns_state, which may be overwritten on subsequent
+ * calls.
+ *
+ * When you come out of poll(2), you should probably call adns_callback
+ * with maxfd==-1.
+ *
+ * On systems without poll(2) this function will return ENOSYS.
+ */