# dkim_dns_set_query_waitreply()

[back to index]

SYNOPSIS

    #include <dkim.h>
    void dkim_dns_set_query_waitreply(
    	DKIM_LIB *libopendkim,
            int (*func)(void *, void *, struct timeval *,
                                 size_t *, int *, int *)
    );

Declares the function to be used by a libopendkim instance when it needs to wait on a DNS query already in progress. By default, a stub function that merely extracts the reply length nothing is set, since the standard UNIX resolver library is not asynchronous so the answer is already available.

The function will be passed the following arguments:

1. An opaque DNS service handle as previously specified by a call to `dkim_dns_set_query_service()`
2. A handle for a previously initiated DNS query as returned by the function provided by `dkim_dns_set_query_start()`
3. A pointer to a structure stipulating a timeout, whose semantics are the same as those for `select(2)`
4. A pointer to a `size_t` that will receive the length of the reply
5. A pointer to an `int` that will receive an error code, if any
6. A pointer to an `int` that will receive a `DKIM_DNSSEC` constant describing the security of the reply

The function is expected to return one of the following:

- `DKIM_DNS_SUCCESS` -- a reply is available
- `DKIM_DNS_EXPIRED` -- the query expired (artifact of libar)
- `DKIM_DNS_ERROR` -- an I/O error occurred
- `DKIM_DNS_NOREPLY` -- the specified timeout expired before a reply was received

DESCRIPTION

Called When | `dkim_dns_set_query_waitreply()` can be called at any time, but is presumably most useful prior to doing any DNS operations such as are done during `dkim_eoh()` when verifying.

ARGUMENTS

Argument | Description
--- | ---
libopendkim | The library instantiation handle, returned by `dkim_init()`.
func | A pointer to a function that should be used to wait on active DNS queries.

RETURN VALUES

- None.

NOTES

- Asynchronous key lookups can also be accomplished using `dkim_set_key_lookup()`.

Copyright (c) 2007 Sendmail, Inc. and its suppliers. All rights reserved.
Copyright (c) 2011, 2014, The Trusted Domain Project. All rights reserved.
By using this file, you agree to the terms and conditions set forth in the respective licenses.