dns_cache_submit2

March 26, 2020

Name

dns_cache_submit2 — Submit a query to the dns cache

Synopsis

#include "dns-cache.h"

| void **dns_cache_submit2** ( | query, |   |
|   | callback, |   |
|   | closure, |   |
|   | flags); |   |

dns_cache_query * <var class="pdparam">query</var>;
dns_cache_callback <var class="pdparam">callback</var>;
void * <var class="pdparam">closure</var>;
int <var class="pdparam">flags</var>;

Description

Submit a query to the dns cache.

When the query completes, the completion callback will be called. If flags is set to DNS_CACHE_DISPATCH_NOW, and if called from the scheduler thread, then the query will be queued immediately and may call the completion routine before the call to dns_cache_submit2 returns.

Warning

This can make it difficult to write asynchronous code, as things may appear to complete before they have finished starting.

Parameters

query

The dns cache query. A pointer to a dns_cache_query struct. For documentation of this data structure see “dns_cache_query”

callback

The dns cache callback. A pointer to function.

typedef void (*dns_cache_callback)(dns_cache_cachenode *, void *closure);

For documentation of a dns_cache_cachenode structure see “dns_cache_cachenode”.

closure

A pointer to void.

flags

Integer parameter. Typically either 0 or DNS_CACHE_DISPATCH_NOW.

Return Values

This function returns void.

Threading

It is only legal to call this function in the Scheduler thread.

See Also

dns_cache_free_node, dns_cache_lookup_wait, and dns_cache_lookup.