# dkim_dns_set_query_start()

[back to index]

SYNOPSIS

    #include <dkim.h>
    void dkim_dns_set_query_start(
    	DKIM_LIB *libopendkim,
            int (*func)(void *, int, u_char *, u_char *, size_t,
                        void **)
    );

Declares the function to be used by a libopendkim instance when it needs to start a DNS query. By default, a stub function that calls the standard UNIX resolver library is set.

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. The DNS query type (e.g., `ns_t_txt` or the older `T_TXT`)
3. A NULL-terminated string containing the name to be queried
4. The address of a buffer into which the result should be written
5. The length of that buffer
6. The address of a `void *` that should be updated to contain an opaque handle for the started query

The function is expected to return one of the following:

- `DKIM_DNS_SUCCESS` -- query was successfully initiated
- `DKIM_DNS_ERROR` -- an error occurred

The query type should be a DNS resource record type as registered with IANA (here). The constants are typically given names for use in source code via the include file `<arpa/nameser.h>`.

DESCRIPTION

Called When | `dkim_dns_set_query_start()` 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 initiate 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.