X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fadns.h;h=698cfb4c5c8f6dfc7ec7bfc52b38a8263949d0da;hb=636b69b1a03bec395d304c354f4f2f8121b97150;hp=190142b75e539caeb44261932bcea76744d33e94;hpb=fc6a52aea07419d4eb1a42458ba2459faf52e4b9;p=adns.git diff --git a/src/adns.h b/src/adns.h index 190142b..698cfb4 100644 --- a/src/adns.h +++ b/src/adns.h @@ -24,11 +24,17 @@ #ifndef ADNS_H_INCLUDED #define ADNS_H_INCLUDED +#ifdef __cplusplus +extern "C" { /* I really dislike this - iwj. */ +#endif #include #include #include +#include +#include +#include /* All struct in_addr anywhere in adns are in NETWORK byte order. */ @@ -297,6 +303,9 @@ void adns_cancel(adns_query query); * first adns_submit or _transact call using the same adns_state after * it became invalid, so you may compare it for equality with other * query handles until you next call _query or _transact. + * + * _submit and _synchronous return ENOSYS if they don't understand the + * query type. */ void adns_finish(adns_state ads); @@ -305,18 +314,21 @@ void adns_finish(adns_state ads); */ -struct adns_query adns_forallqueries_begin(adns_state ads, void **context_r); -struct adns_query adns_forallqueries_next(adns_state ads, adns_query, void **context_r); +void adns_forallqueries_begin(adns_state ads); +adns_query adns_forallqueries_next(adns_state ads, void **context_r); /* Iterator functions, which you can use to loop over the outstanding - * (submitted but not yet successfuly checked/waited) queries. Each - * function returns a query handle and a corresponding context pointer, - * or returns 0 setting *context_r to 0 if there are no (more) queries. - * There is no need to explicitly finish an iteration. context_r may be 0. + * (submitted but not yet successfuly checked/waited) queries. * - * IMPORTANT: you MUST NOT call ANY other adns function with the same - * adns_state, or with a query in the same adns_state, while you are - * doing one of these iterations. After such a call the iterator - * value has undefined meaning and must not be used. + * You can only have one iteration going at once. You may call _begin + * at any time; after that, an iteration will be in progress. You may + * only call _next when an iteration is in progress - anything else + * may coredump. The iteration remains in progress until _next + * returns 0, indicating that all the queries have been walked over, + * or ANY other adns function is called with the same adns_state (or a + * query in the same adns_state). There is no need to explicitly + * finish an iteration. + * + * context_r may be 0. *context_r may not be set when _next returns 0. */ /* @@ -561,4 +573,7 @@ const char *adns_errabbrev(adns_status st); * not returned by the same adns library. */ +#ifdef __cplusplus +} /* end of extern "C" */ +#endif #endif