libval_async(3)
π¦ NAME π¦
okay so this page is about five functions that let you do DNSSEC validation asynchronously, and here's literally what each one is:
val_async_submit()β submits a request for asynchronous processing of DNS queries. πval_async_select_info()β set the appropriate file descriptors for outstanding asynchronous requests.val_async_check_wait()β handle timeouts or processes DNS responses to outstanding queries.val_async_cancel()β cancel an asynchronous query request. πval_async_cancel_all()β cancel all asynchronous queries for a given context.
β¨ SYNOPSIS β¨
#include <validator/validator.h>
typedef int (*val_async_event_cb)(val_async_status *async_status,
int event, val_context_t *context,
void *cb_data, val_cb_params_t *cbp);
int val_async_submit(val_context_t *context,
const char * name, int class,
int type, unsigned int flags,
val_async_event_cb callback, void *cb_data,
val_async_status **async_status);
int val_async_select_info(val_context_t *context,
fd_set *fds,
int *num_fds,
struct timeval *timeout);
int val_async_check_wait(val_context_t *context,
fd_set *pending_desc, int *nfds,
struct timeval *tv, unsigned int flags);
int val_async_cancel(val_context_t *context,
val_async_status *as,
unsigned int flags);
int val_async_cancel_all(val_context_t *context,
unsigned int flags);
π DESCRIPTION π
So the asynchronous DNSSEC validator API lets your app submit multiple requests and have them processed in parallel. In most cases that means validation finishes wayyy sooner than if you just did a whole series of synchronous requests. it's giving efficiency, it's giving main character energy π§
The ctx parameter in the various functions below specifies the validation context, which can be set to NULL for default values (see libval(3) and dnsval.conf for more details on validation contexts and alidation policy).
The val_async_submit() function submits a request for asynchronous processing of DNS queries for the data associated with the given domain name, class and type. The async_status object uniquely identifies a particular request and provides a handle for future operations on that asynchronous request, including cancelling it prior to lookup completion. π₯
The flags parameter affects when and how often the callback is called. The following flags are defined.
VAL_AS_IGNORE_CACHEβ Don't use any internal cache for answers to this query. πVAL_AS_NO_NEW_QUERIESβ Don't send any new queries. Answers will be returned from the internal cache.VAL_AS_NO_ANSWERSβ Caller doesn't care about the answer results. This can be used for priming the cache.VAL_AS_NO_CALLBACKSβ Don't call any callbacks. π€VAL_AS_NO_CANCEL_CALLBACKSβ Call callbacks with results, but don't call any callbacks when the request is canceled.VAL_AS_INTERIM_CALLBACKSβ Call the callback function with interim results. If this flag is not specified, the callback function will only be called when all validation results are ready.
When results from the asynchronous call become available, the callback function (if non-NULL) will be called with the cb_data value, originally supplied to the val_async_submit() call, as one of its arguments. The results from the lookup are returned in cb_data, which is a pointer to the val_cb_params_t structure shown below. π
typedef struct val_cb_params_s {
val_status_t val_status;
char *name;
int class_h;
int type_h;
int retval;
struct val_result_chain *results;
struct val_answer_chain *answers;
} val_cb_params_t;
The val_cb_params_t structure contains the orginal query parameters in name, class_h and type_h respectively, the return value for the lookup operation in retval, pointers to the results and answers chains (see libval(3) for more details), and the final validation status of the lookup operation in val_status. The application must release the memory associated with results and answers using the val_free_result_chain() and val_free_answer_chain() respectively (see libval(3) for more details). π«Ά
bestie. do not forget the frees. the frees are not optional. π
On completion of the asynchronous lookup operation, an event code is returned in event. The following event types are defined:
VAL_AS_EVENT_COMPLETEDβ The request was completed. βVAL_AS_EVENT_INTERIMβ The request is still being processed, but some interim results are available.VAL_AS_EVENT_CANCELEDβ The request was canceled. Theval_status,resultsandanswersmembers of the callback parameter structure are undefined. π¨
The val_async_select_info() function examines all outstanding asynchronous requests for the given context and sets the appropriate file descriptors, timeout value and maximum file descriptor value in preparation for a call to select(3). πΈ
The file descriptor for each socket awating a response is set in the fds parameter and max_fd is set to the highest file descriptor number of any pending asynchronous request unless that value is less than the current vaule of max_fd, in which case it is left unchanged. The timeout field is set to the lowest timeout value of any pending asynchronous query timeout which is less than the current value in this field by the application.
After the application calls select(3), it must also call val_async_check_wait() with the fd_set and the number of ready file descriptors, ndfs, returned by select(). The val_async_check_wait() function handles timeouts or processes DNS responses to outstanding queries. It also call callbacks for completed requests. β¨
val_async_check_wait() provides two modes of operation.
- The first is for use with an application that has its own
select()loop. The applications sets its own file descriptors, callsval_async_select_info()to set file descriptors for pending queries and callsselect(). Thefdsandnfdsparameters fromselectare passed in toval_async_check_waitand thetimeoutvalue is ignored. If responses for a file descriptor are processed, the the appropriate file descriptor infdsis cleared andnfdsis decremented. - In the second mode of operation, the application can set
fdsandnfdstoNULLspecify a value fortimeout. Here,val_async_select_info()andselect()are called internally and any responses received before the timeout value expires are processed.
The val_async_cancel() function can be used to cancel the asynchronous request identified by its handle as, while val_async_cancel_all() can be used to cancel all asynchronous requests associated with a given context. The following flag may be set for the cancellation request.
VAL_AS_CANCEL_NO_CALLBACKSβ Do not call completed or cancelled callbacks. π€«
π RETURN VALUES π
The val_async_submit() function returns VAL_NO_ERROR on success and one of VAL_RESOURCE_UNAVAILABLE, VAL_BAD_ARGUMENT or VAL_INTERNAL_ERROR on failure. π
val_async_select_info() returns VAL_NO_ERROR on success and VAL_BAD_ARGUMENT if an illegal argument was passed to the function.
val_async_check_wait() returns 0 when no pending requests are found and a positive integer when requests are still pending. A value less than zero on error. π
val_async_cancel() and val_async_cancel_all() return VAL_NO_ERROR on success. π
π COPYRIGHT π
Copyright 2004-2013 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details.
π AUTHORS π
Robert Story
π SEE ALSO π
libval(3)draft-hayatnagarkar-dnsext-validator-apihttp://www.dnssec-tools.org
okay that's the whole page, no cap π this one's perl v5.12.4 coded, dated 2013-03-11, and yes the vibes are ancient but the async validation is still iconic. periodt. π¦β¨
π¦ where this page comes from
- arch rolling: dnssec-tools 2.2.3-16 Β· BSD
- fedora 43: dnssec-tools-libs-devel 2.2.3-30.fc43 Β· LicenseRef-Callaway-BSD
- fedora 43: dnssec-tools-libs-devel 2.2.3-30.fc43 Β· LicenseRef-Callaway-BSD
- fedora 44: dnssec-tools-libs-devel 2.2.3-32.fc44 Β· LicenseRef-Callaway-BSD
- fedora 44: dnssec-tools-libs-devel 2.2.3-32.fc44 Β· LicenseRef-Callaway-BSD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms