[API 0.387] Replace #defines with enums

Were applicable
This commit is contained in:
Willem Toorop 2014-02-06 00:25:26 +01:00
parent fed7a1fa81
commit 13571e02f1
8 changed files with 159 additions and 125 deletions

View File

@ -19,6 +19,11 @@ uint16_t regulararg;
uint16_t *regularptrarg;
getdns_transaction_t txidarg;
getdns_transaction_t * txidptrarg;
getdns_namespace_t *namespaceptrarg;
getdns_resolution_t resolutionarg;
getdns_redirects_t redirectsarg;
getdns_transport_t transportarg;
getdns_append_name_t appendnamearg;
getdns_data_type * datatypeptrarg;
struct getdns_bindata ** bindataptrarg;
@ -49,7 +54,7 @@ void * extendedreallocfunctionarg(void* userarg, void* foo, size_t bar)
{UNUSED_PARAM(userarg); UNUSED_PARAM(foo); UNUSED_PARAM(bar); return NULL; }
void extendeddeallocfunctionarg(void* userarg, void* foo)
{UNUSED_PARAM(userarg); UNUSED_PARAM(foo);}
void setcallbackfunctionarg(struct getdns_context *foo1, uint16_t foo2)
void setcallbackfunctionarg(struct getdns_context *foo1, getdns_context_code_t foo2)
{UNUSED_PARAM(foo1);UNUSED_PARAM(foo2);}
int main()
@ -242,18 +247,18 @@ retregular = getdns_context_set_context_update_callback(
retregular = getdns_context_set_resolution_type(
contextarg,
regulararg
resolutionarg
);
retregular = getdns_context_set_namespaces(
contextarg,
sizetarg,
regularptrarg
namespaceptrarg
);
retregular = getdns_context_set_dns_transport(
contextarg,
regulararg
transportarg
);
retregular = getdns_context_set_limit_outstanding_queries(
@ -268,7 +273,7 @@ retregular = getdns_context_set_timeout(
retregular = getdns_context_set_follow_redirects(
contextarg,
regulararg
redirectsarg
);
retregular = getdns_context_set_dns_root_servers(
@ -278,7 +283,7 @@ retregular = getdns_context_set_dns_root_servers(
retregular = getdns_context_set_append_name(
contextarg,
regulararg
appendnamearg
);
retregular = getdns_context_set_suffix(

View File

@ -9,7 +9,7 @@
/* Set up the callback function, which will also do the processing of the results */
void this_callbackfn(struct getdns_context *this_context,
uint16_t this_callback_type,
getdns_callback_type_t this_callback_type,
struct getdns_dict *this_response,
void *this_userarg,
getdns_transaction_t this_transaction_id)

View File

@ -9,7 +9,7 @@
/* Set up the callback function, which will also do the processing of the results */
void this_callbackfn(struct getdns_context *this_context,
getdns_return_t this_callback_type,
getdns_callback_type_t this_callback_type,
struct getdns_dict *this_response,
void *this_userarg,
getdns_transaction_t this_transaction_id)

Binary file not shown.

BIN
spec/getdns-0.387.tgz Normal file

Binary file not shown.

View File

@ -318,14 +318,14 @@ getdns_display_ip_address(
getdns_return_t
getdns_context_set_context_update_callback(
struct getdns_context *context,
void (*value)(struct getdns_context *context, uint16_t changed_item)
void (*value)(struct getdns_context *context, getdns_context_code_t changed_item)
)
{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; }
getdns_return_t
getdns_context_set_resolution_type(
struct getdns_context *context,
uint16_t value
getdns_resolution_t value
)
{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; }
@ -333,7 +333,7 @@ getdns_return_t
getdns_context_set_namespaces(
struct getdns_context *context,
size_t namespace_count,
uint16_t *namespaces
getdns_namespace_t *namespaces
)
{ UNUSED_PARAM(context); UNUSED_PARAM(namespace_count); UNUSED_PARAM(namespaces);
return GETDNS_RETURN_GOOD; }
@ -341,7 +341,7 @@ return GETDNS_RETURN_GOOD; }
getdns_return_t
getdns_context_set_dns_transport(
struct getdns_context *context,
uint16_t value
getdns_transport_t value
)
{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; }
@ -362,7 +362,7 @@ getdns_context_set_timeout(
getdns_return_t
getdns_context_set_follow_redirects(
struct getdns_context *context,
uint16_t value
getdns_redirects_t value
)
{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; }
@ -376,7 +376,7 @@ getdns_context_set_dns_root_servers(
getdns_return_t
getdns_context_set_append_name(
struct getdns_context *context,
uint16_t value
getdns_append_name_t value
)
{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; }

View File

@ -1,4 +1,4 @@
/* Created at 2014-02-05-21-38-00*/
/* Created at 2014-02-06-00-25-11*/
#ifndef GETDNS_H
#define GETDNS_H
@ -12,33 +12,36 @@ extern "C" {
#define GETDNS_COMPILATION_COMMENT The API implementation should fill in something here, such as a compilation version string and date, and change it each time the API is compiled.
/* Return values */
#define GETDNS_RETURN_GOOD 0
typedef enum getdns_return_t {
GETDNS_RETURN_GOOD = 0,
GETDNS_RETURN_GENERIC_ERROR = 1,
GETDNS_RETURN_BAD_DOMAIN_NAME = 300,
GETDNS_RETURN_BAD_CONTEXT = 301,
GETDNS_RETURN_CONTEXT_UPDATE_FAIL = 302,
GETDNS_RETURN_UNKNOWN_TRANSACTION = 303,
GETDNS_RETURN_NO_SUCH_LIST_ITEM = 304,
GETDNS_RETURN_NO_SUCH_DICT_NAME = 305,
GETDNS_RETURN_WRONG_TYPE_REQUESTED = 306,
GETDNS_RETURN_NO_SUCH_EXTENSION = 307,
GETDNS_RETURN_EXTENSION_MISFORMAT = 308,
GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED = 309,
GETDNS_RETURN_MEMORY_ERROR = 310,
GETDNS_RETURN_INVALID_PARAMETER = 311
} getdns_return_t;
#define GETDNS_RETURN_GOOD_TEXT "Good"
#define GETDNS_RETURN_GENERIC_ERROR 1
#define GETDNS_RETURN_GENERIC_ERROR_TEXT "Generic error"
#define GETDNS_RETURN_BAD_DOMAIN_NAME 300
#define GETDNS_RETURN_BAD_DOMAIN_NAME_TEXT "Badly-formed domain name in first argument"
#define GETDNS_RETURN_BAD_CONTEXT 301
#define GETDNS_RETURN_BAD_CONTEXT_TEXT "Bad value for a context type"
#define GETDNS_RETURN_CONTEXT_UPDATE_FAIL 302
#define GETDNS_RETURN_CONTEXT_UPDATE_FAIL_TEXT "Did not update the context"
#define GETDNS_RETURN_UNKNOWN_TRANSACTION 303
#define GETDNS_RETURN_UNKNOWN_TRANSACTION_TEXT "An attempt was made to cancel a callback with a transaction_id that is not recognized"
#define GETDNS_RETURN_NO_SUCH_LIST_ITEM 304
#define GETDNS_RETURN_NO_SUCH_LIST_ITEM_TEXT "A helper function for lists had an index argument that was too high."
#define GETDNS_RETURN_NO_SUCH_DICT_NAME 305
#define GETDNS_RETURN_NO_SUCH_DICT_NAME_TEXT "A helper function for dicts had a name argument that for a name that is not in the dict."
#define GETDNS_RETURN_WRONG_TYPE_REQUESTED 306
#define GETDNS_RETURN_WRONG_TYPE_REQUESTED_TEXT "A helper function was supposed to return a certain type for an item, but the wrong type was given."
#define GETDNS_RETURN_NO_SUCH_EXTENSION 307
#define GETDNS_RETURN_NO_SUCH_EXTENSION_TEXT "A name in the extensions dict is not a valid extension."
#define GETDNS_RETURN_EXTENSION_MISFORMAT 308
#define GETDNS_RETURN_EXTENSION_MISFORMAT_TEXT "One or more of the extensions have a bad format."
#define GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED 309
#define GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED_TEXT "A query was made with a context that is using stub resolution and a DNSSEC extension specified."
#define GETDNS_RETURN_MEMORY_ERROR 310
#define GETDNS_RETURN_MEMORY_ERROR_TEXT "Unable to allocate the memory required."
#define GETDNS_RETURN_INVALID_PARAMETER 311
#define GETDNS_RETURN_INVALID_PARAMETER_TEXT "A required parameter had an invalid value."
/* DNSSEC values */
@ -53,86 +56,115 @@ extern "C" {
#define GETDNS_DNSSEC_NOT_PERFORMED 404
#define GETDNS_DNSSEC_NOT_PERFORMED_TEXT "DNSSEC validation was not performed (only used for debugging)"
/* Context Variables */
#define GETDNS_CONTEXT_NAMESPACE_DNS 500
#define GETDNS_CONTEXT_NAMESPACE_DNS_TEXT "See getdns_context_set_namespaces()"
#define GETDNS_CONTEXT_NAMESPACE_LOCALNAMES 501
#define GETDNS_CONTEXT_NAMESPACE_LOCALNAMES_TEXT "See getdns_context_set_namespaces()"
#define GETDNS_CONTEXT_NAMESPACE_NETBIOS 502
#define GETDNS_CONTEXT_NAMESPACE_NETBIOS_TEXT "See getdns_context_set_namespaces()"
#define GETDNS_CONTEXT_NAMESPACE_MDNS 503
#define GETDNS_CONTEXT_NAMESPACE_MDNS_TEXT "See getdns_context_set_namespaces()"
#define GETDNS_CONTEXT_NAMESPACE_NIS 504
#define GETDNS_CONTEXT_NAMESPACE_NIS_TEXT "See getdns_context_set_namespaces()"
#define GETDNS_CONTEXT_STUB 505
#define GETDNS_CONTEXT_STUB_TEXT "See getdns_context_set_resolution_type()"
#define GETDNS_CONTEXT_RECURSING 506
#define GETDNS_CONTEXT_RECURSING_TEXT "See getdns_context_set_resolution_type()"
#define GETDNS_CONTEXT_FOLLOW_REDIRECTS 507
#define GETDNS_CONTEXT_FOLLOW_REDIRECTS_TEXT "See getdns_context_set_follow_redirects()"
#define GETDNS_CONTEXT_DO_NOT_FOLLOW_REDIRECTS 508
#define GETDNS_CONTEXT_DO_NOT_FOLLOW_REDIRECTS_TEXT "See getdns_context_set_follow_redirects()"
#define GETDNS_CONTEXT_UDP_FIRST_AND_FALL_BACK_TO_TCP 509
#define GETDNS_CONTEXT_UDP_FIRST_AND_FALL_BACK_TO_TCP_TEXT "See getdns_context_set_dns_transport()"
#define GETDNS_CONTEXT_UDP_ONLY 510
#define GETDNS_CONTEXT_UDP_ONLY_TEXT "See getdns_context_set_dns_transport()"
#define GETDNS_CONTEXT_TCP_ONLY 511
#define GETDNS_CONTEXT_TCP_ONLY_TEXT "See getdns_context_set_dns_transport()"
#define GETDNS_CONTEXT_TCP_ONLY_KEEP_CONNECTIONS_OPEN 512
#define GETDNS_CONTEXT_TCP_ONLY_KEEP_CONNECTIONS_OPEN_TEXT "See getdns_context_set_dns_transport()"
#define GETDNS_CONTEXT_APPEND_NAME_ALWAYS 513
#define GETDNS_CONTEXT_APPEND_NAME_ALWAYS_TEXT "See getdns_context_set_append_name()"
#define GETDNS_CONTEXT_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE 514
#define GETDNS_CONTEXT_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE_TEXT "See getdns_context_set_append_name()"
#define GETDNS_CONTEXT_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE 515
#define GETDNS_CONTEXT_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE_TEXT "See getdns_context_set_append_name()"
#define GETDNS_CONTEXT_DO_NOT_APPEND_NAMES 516
#define GETDNS_CONTEXT_DO_NOT_APPEND_NAMES_TEXT "See getdns_context_set_append_name()"
/* Namespace types */
typedef enum getdns_namespace_t {
GETDNS_NAMESPACE_DNS = 500,
GETDNS_NAMESPACE_LOCALNAMES = 501,
GETDNS_NAMESPACE_NETBIOS = 502,
GETDNS_NAMESPACE_MDNS = 503,
GETDNS_NAMESPACE_NIS = 504
} getdns_namespace_t;
#define GETDNS_NAMESPACE_DNS_TEXT "See getdns_context_set_namespaces()"
#define GETDNS_NAMESPACE_LOCALNAMES_TEXT "See getdns_context_set_namespaces()"
#define GETDNS_NAMESPACE_NETBIOS_TEXT "See getdns_context_set_namespaces()"
#define GETDNS_NAMESPACE_MDNS_TEXT "See getdns_context_set_namespaces()"
#define GETDNS_NAMESPACE_NIS_TEXT "See getdns_context_set_namespaces()"
/* Resolution types */
typedef enum getdns_resolution_t {
GETDNS_RESOLUTION_STUB = 520,
GETDNS_RESOLUTION_RECURSING = 521
} getdns_resolution_t;
#define GETDNS_RESOLUTION_STUB_TEXT "See getdns_context_set_resolution_type()"
#define GETDNS_RESOLUTION_RECURSING_TEXT "See getdns_context_set_resolution_type()"
/* Redirect policies */
typedef enum getdns_redirects_t {
GETDNS_REDIRECTS_FOLLOW = 530,
GETDNS_REDIRECTS_DO_NOT_FOLLOW = 531
} getdns_redirects_t;
#define GETDNS_REDIRECTS_FOLLOW_TEXT "See getdns_context_set_follow_redirects()"
#define GETDNS_REDIRECTS_DO_NOT_FOLLOW_TEXT "See getdns_context_set_follow_redirects()"
/* Transport arrangements */
typedef enum getdns_transport_t {
GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP = 540,
GETDNS_TRANSPORT_UDP_ONLY = 541,
GETDNS_TRANSPORT_TCP_ONLY = 542,
GETDNS_TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN = 543
} getdns_transport_t;
#define GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP_TEXT "See getdns_context_set_dns_transport()"
#define GETDNS_TRANSPORT_UDP_ONLY_TEXT "See getdns_context_set_dns_transport()"
#define GETDNS_TRANSPORT_TCP_ONLY_TEXT "See getdns_context_set_dns_transport()"
#define GETDNS_TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN_TEXT "See getdns_context_set_dns_transport()"
/* Suffix appending methods */
typedef enum getdns_append_name_t {
GETDNS_APPEND_NAME_ALWAYS = 550,
GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE = 551,
GETDNS_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE = 552,
GETDNS_APPEND_NAME_NEVER = 553
} getdns_append_name_t;
#define GETDNS_APPEND_NAME_ALWAYS_TEXT "See getdns_context_set_append_name()"
#define GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE_TEXT "See getdns_context_set_append_name()"
#define GETDNS_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE_TEXT "See getdns_context_set_append_name()"
#define GETDNS_APPEND_NAME_NEVER_TEXT "See getdns_context_set_append_name()"
/* Context codes */
#define GETDNS_CONTEXT_CODE_NAMESPACES 600
typedef enum getdns_context_code_t {
GETDNS_CONTEXT_CODE_NAMESPACES = 600,
GETDNS_CONTEXT_CODE_RESOLUTION_TYPE = 601,
GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS = 602,
GETDNS_CONTEXT_CODE_UPSTREAM_RECURSIVE_SERVERS = 603,
GETDNS_CONTEXT_CODE_DNS_ROOT_SERVERS = 604,
GETDNS_CONTEXT_CODE_DNS_TRANSPORT = 605,
GETDNS_CONTEXT_CODE_LIMIT_OUTSTANDING_QUERIES = 606,
GETDNS_CONTEXT_CODE_APPEND_NAME = 607,
GETDNS_CONTEXT_CODE_SUFFIX = 608,
GETDNS_CONTEXT_CODE_DNSSEC_TRUST_ANCHORS = 609,
GETDNS_CONTEXT_CODE_EDNS_MAXIMUM_UDP_PAYLOAD_SIZE = 610,
GETDNS_CONTEXT_CODE_EDNS_EXTENDED_RCODE = 611,
GETDNS_CONTEXT_CODE_EDNS_VERSION = 612,
GETDNS_CONTEXT_CODE_EDNS_DO_BIT = 613,
GETDNS_CONTEXT_CODE_DNSSEC_ALLOWED_SKEW = 614,
GETDNS_CONTEXT_CODE_MEMORY_FUNCTIONS = 615,
GETDNS_CONTEXT_CODE_TIMEOUT = 616
} getdns_context_code_t;
#define GETDNS_CONTEXT_CODE_NAMESPACES_TEXT "Change related to getdns_context_set_namespaces"
#define GETDNS_CONTEXT_CODE_RESOLUTION_TYPE 601
#define GETDNS_CONTEXT_CODE_RESOLUTION_TYPE_TEXT "Change related to getdns_context_set_resolution_type"
#define GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS 602
#define GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS_TEXT "Change related to getdns_context_set_follow_redirects"
#define GETDNS_CONTEXT_CODE_UPSTREAM_RECURSIVE_SERVERS 603
#define GETDNS_CONTEXT_CODE_UPSTREAM_RECURSIVE_SERVERS_TEXT "Change related to getdns_context_set_upstream_recursive_servers"
#define GETDNS_CONTEXT_CODE_DNS_ROOT_SERVERS 604
#define GETDNS_CONTEXT_CODE_DNS_ROOT_SERVERS_TEXT "Change related to getdns_context_set_dns_root_servers"
#define GETDNS_CONTEXT_CODE_DNS_TRANSPORT 605
#define GETDNS_CONTEXT_CODE_DNS_TRANSPORT_TEXT "Change related to getdns_context_set_dns_transport"
#define GETDNS_CONTEXT_CODE_LIMIT_OUTSTANDING_QUERIES 606
#define GETDNS_CONTEXT_CODE_LIMIT_OUTSTANDING_QUERIES_TEXT "Change related to getdns_context_set_limit_outstanding_queries"
#define GETDNS_CONTEXT_CODE_APPEND_NAME 607
#define GETDNS_CONTEXT_CODE_APPEND_NAME_TEXT "Change related to getdns_context_set_append_name"
#define GETDNS_CONTEXT_CODE_SUFFIX 608
#define GETDNS_CONTEXT_CODE_SUFFIX_TEXT "Change related to getdns_context_set_suffix"
#define GETDNS_CONTEXT_CODE_DNSSEC_TRUST_ANCHORS 609
#define GETDNS_CONTEXT_CODE_DNSSEC_TRUST_ANCHORS_TEXT "Change related to getdns_context_set_dnssec_trust_anchors"
#define GETDNS_CONTEXT_CODE_EDNS_MAXIMUM_UDP_PAYLOAD_SIZE 610
#define GETDNS_CONTEXT_CODE_EDNS_MAXIMUM_UDP_PAYLOAD_SIZE_TEXT "Change related to getdns_context_set_edns_maximum_udp_payload_size"
#define GETDNS_CONTEXT_CODE_EDNS_EXTENDED_RCODE 611
#define GETDNS_CONTEXT_CODE_EDNS_EXTENDED_RCODE_TEXT "Change related to getdns_context_set_edns_extended_rcode"
#define GETDNS_CONTEXT_CODE_EDNS_VERSION 612
#define GETDNS_CONTEXT_CODE_EDNS_VERSION_TEXT "Change related to getdns_context_set_edns_version"
#define GETDNS_CONTEXT_CODE_EDNS_DO_BIT 613
#define GETDNS_CONTEXT_CODE_EDNS_DO_BIT_TEXT "Change related to getdns_context_set_edns_do_bit"
#define GETDNS_CONTEXT_CODE_DNSSEC_ALLOWED_SKEW 614
#define GETDNS_CONTEXT_CODE_DNSSEC_ALLOWED_SKEW_TEXT "Change related to getdns_context_set_dnssec_allowed_skew"
#define GETDNS_CONTEXT_CODE_MEMORY_FUNCTIONS 615
#define GETDNS_CONTEXT_CODE_MEMORY_FUNCTIONS_TEXT "Change related to getdns_context_set_memory_functions"
#define GETDNS_CONTEXT_CODE_TIMEOUT 616
#define GETDNS_CONTEXT_CODE_TIMEOUT_TEXT "Change related to getdns_context_set_timeout"
/* Callback Type Variables */
#define GETDNS_CALLBACK_COMPLETE 700
typedef enum getdns_callback_type_t {
GETDNS_CALLBACK_COMPLETE = 700,
GETDNS_CALLBACK_CANCEL = 701,
GETDNS_CALLBACK_TIMEOUT = 702,
GETDNS_CALLBACK_ERROR = 703
} getdns_callback_type_t;
#define GETDNS_CALLBACK_COMPLETE_TEXT "The response has the requested data in it"
#define GETDNS_CALLBACK_CANCEL 701
#define GETDNS_CALLBACK_CANCEL_TEXT "The calling program cancelled the callback; response is NULL"
#define GETDNS_CALLBACK_TIMEOUT 702
#define GETDNS_CALLBACK_TIMEOUT_TEXT "The requested action timed out; response is NULL"
#define GETDNS_CALLBACK_ERROR 703
#define GETDNS_CALLBACK_ERROR_TEXT "The requested action had an error; response is NULL"
/* Type Of Name Services */
@ -165,8 +197,7 @@ extern "C" {
#define GETDNS_BAD_DNS_CNAME_RETURNED_FOR_OTHER_TYPE 1102
#define GETDNS_BAD_DNS_CNAME_RETURNED_FOR_OTHER_TYPE_TEXT "A DNS query for a type other than CNAME returned a CNAME response"
/* Defines for RRtypes (from 2012-12) */
/* Defines for RRtypes (from 2014-02) */
#define GETDNS_RRTYPE_A 1
#define GETDNS_RRTYPE_NS 2
#define GETDNS_RRTYPE_MD 3
@ -247,7 +278,6 @@ extern "C" {
/* Various typedefs */
struct getdns_context;
typedef uint16_t getdns_return_t;
typedef uint64_t getdns_transaction_t;
typedef enum getdns_data_type {
t_dict, t_list, t_int, t_bindata
@ -328,7 +358,7 @@ getdns_return_t getdns_dict_remove_name(struct getdns_dict *this_dict, const cha
/* Callback arguments */
typedef void (*getdns_callback_t)(
struct getdns_context *context,
uint16_t callback_type,
getdns_callback_type_t callback_type,
struct getdns_dict *response,
void *userarg,
getdns_transaction_t transaction_id);
@ -481,26 +511,26 @@ getdns_display_ip_address(
getdns_return_t
getdns_context_set_context_update_callback(
struct getdns_context *context,
void (*value)(struct getdns_context *context, uint16_t changed_item)
void (*value)(struct getdns_context *context, getdns_context_code_t changed_item)
);
getdns_return_t
getdns_context_set_resolution_type(
struct getdns_context *context,
uint16_t value
getdns_resolution_t value
);
getdns_return_t
getdns_context_set_namespaces(
struct getdns_context *context,
size_t namespace_count,
uint16_t *namespaces
getdns_namespace_t *namespaces
);
getdns_return_t
getdns_context_set_dns_transport(
struct getdns_context *context,
uint16_t value
getdns_transport_t value
);
getdns_return_t
@ -518,7 +548,7 @@ getdns_context_set_timeout(
getdns_return_t
getdns_context_set_follow_redirects(
struct getdns_context *context,
uint16_t value
getdns_redirects_t value
);
getdns_return_t
@ -530,7 +560,7 @@ getdns_context_set_dns_root_servers(
getdns_return_t
getdns_context_set_append_name(
struct getdns_context *context,
uint16_t value
getdns_append_name_t value
);
getdns_return_t

View File

@ -278,7 +278,7 @@ as follows:</p>
<div class=forh id="getdns_callback_t">
typedef void (*getdns_callback_t)(
struct getdns_context *context,
uint16_t callback_type,
getdns_callback_type_t callback_type,
struct getdns_dict *response,
void *userarg,
getdns_transaction_t transaction_id);
@ -876,7 +876,7 @@ be human-readable, and it might have information in it useful to an application
have to).</li>
<li><code>resolver_type</code> (an int) is the type of resolver that the API is acting as in this context:
<code>GETDNS_CONTEXT_RECURSING</code> or <code>GETDNS_CONTEXT_STUB</code> (it will be
<code>GETDNS_RESOLUTION_RECURSING</code> or <code>GETDNS_RESOLUTION_STUB</code> (it will be
a recursing resolver unless the application changed this in a context.</li>
<li><code>all_context</code> (a dict) with names for all the types of context. This can be used with
@ -1144,7 +1144,6 @@ The caller is responsible of disposing these allocations with <code>free</code>.
<h2>5.1 A Few Needed Definitions</h2>
<div class=forh id="Various">struct getdns_context;
typedef uint16_t getdns_return_t;
typedef uint64_t getdns_transaction_t;
typedef enum getdns_data_type {
t_dict, t_list, t_int, t_bindata
@ -1484,7 +1483,7 @@ function.</p>
<span class="cm">/* Set up the callback function, which will also do the processing of the results */</span>
<span class="kt">void</span> <span class="nf">this_callbackfn</span><span class="p">(</span><span class="k">struct</span> <span class="n">getdns_context</span> <span class="o">*</span><span class="n">this_context</span><span class="p">,</span>
<span class="kt">uint16_t</span> <span class="n">this_callback_type</span><span class="p">,</span>
<span class="n">getdns_callback_type_t</span> <span class="n">this_callback_type</span><span class="p">,</span>
<span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span><span class="n">this_response</span><span class="p">,</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">this_userarg</span><span class="p">,</span>
<span class="kt">getdns_transaction_t</span> <span class="n">this_transaction_id</span><span class="p">)</span>
@ -1602,7 +1601,7 @@ their TTLs.</p>
<span class="cm">/* Set up the callback function, which will also do the processing of the results */</span>
<span class="kt">void</span> <span class="nf">this_callbackfn</span><span class="p">(</span><span class="k">struct</span> <span class="n">getdns_context</span> <span class="o">*</span><span class="n">this_context</span><span class="p">,</span>
<span class="kt">getdns_return_t</span> <span class="n">this_callback_type</span><span class="p">,</span>
<span class="n">getdns_callback_type_t</span> <span class="n">this_callback_type</span><span class="p">,</span>
<span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span><span class="n">this_response</span><span class="p">,</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">this_userarg</span><span class="p">,</span>
<span class="kt">getdns_transaction_t</span> <span class="n">this_transaction_id</span><span class="p">)</span>
@ -2126,7 +2125,7 @@ is not allowed, or <code>GETDNS_RETURN_CONTEXT_UPDATE_FAIL</code> for a failure
getdns_return_t
getdns_context_set_context_update_callback(
struct getdns_context *context,
void (*value)(struct getdns_context *context, uint16_t changed_item)
void (*value)(struct getdns_context *context, getdns_context_code_t changed_item)
);</div>
<p class=cont>The value is a pointer to the callback function that will be
called when any context is changed. Such changes might be from automatic
@ -2141,18 +2140,18 @@ specifies which of the context changed; the context codes are listed
getdns_return_t
getdns_context_set_resolution_type(
struct getdns_context *context,
uint16_t value
getdns_resolution_t value
);</div>
<p class=cont>Specifies whether DNS queries are performed with nonrecurive lookups or
as a stub resolver. The value is <span class=default><code>GETDNS_CONTEXT_RECURSING</code></span> or
<code>GETDNS_CONTEXT_STUB</code>.</p>
as a stub resolver. The value is <span class=default><code>GETDNS_RESOLUTION_RECURSING</code></span> or
<code>GETDNS_RESOLUTION_STUB</code>.</p>
<p>All implementations of this API can act as recursive resolvers, and that must be the
default mode of the default context.
Some implementations of this API are expected to also be able to act as stub resolvers.
If an
implementation of this API is only able to act as a recursive resolver, a call to
<code>getdns_context_set_resolution_type(somecontext, GETDNS_CONTEXT_STUB)</code> will
<code>getdns_context_set_resolution_type(somecontext, GETDNS_RESOLUTION_STUB)</code> will
return <code>GETDNS_RETURN_CONTEXT_UPDATE_FAIL</code>.</p>
<div class=forh>
@ -2160,18 +2159,18 @@ getdns_return_t
getdns_context_set_namespaces(
struct getdns_context *context,
size_t namespace_count,
uint16_t *namespaces
getdns_namespace_t *namespaces
);</div>
<p class=cont>The <code>namespaces</code> array contains an ordered list
of namespaces that will be queried.
<b>Important:</b> this context setting is ignored for the <code>getdns_general</code> and
<code>getdns_general_sync</code> functions; it is used for the other funtions.
The values
are <code>GETDNS_CONTEXT_NAMESPACE_DNS</code>,
<code>GETDNS_CONTEXT_NAMESPACE_LOCALNAMES</code>,
<code>GETDNS_CONTEXT_NAMESPACE_NETBIOS</code>,
<code>GETDNS_CONTEXT_NAMESPACE_MDNS</code>, and
<code>GETDNS_CONTEXT_NAMESPACE_NIS</code>. When a normal lookup is done,
are <code>GETDNS_NAMESPACE_DNS</code>,
<code>GETDNS_NAMESPACE_LOCALNAMES</code>,
<code>GETDNS_NAMESPACE_NETBIOS</code>,
<code>GETDNS_NAMESPACE_MDNS</code>, and
<code>GETDNS_NAMESPACE_NIS</code>. When a normal lookup is done,
the API does the lookups in the order given and stops when it gets the
first result; a different method with the same result would be to run
the queries in parallel and return when it gets the first result.
@ -2184,14 +2183,14 @@ default is <span class=default>determined by the OS</span>.</p>
getdns_return_t
getdns_context_set_dns_transport(
struct getdns_context *context,
uint16_t value
getdns_transport_t value
);</div>
<p class=cont>Specifies what transport is used for DNS lookups.
The value is <span class=default>
<code>GETDNS_CONTEXT_UDP_FIRST_AND_FALL_BACK_TO_TCP</code></span>,
<code>GETDNS_CONTEXT_UDP_ONLY</code>,
<code>GETDNS_CONTEXT_TCP_ONLY</code>, or
<code>GETDNS_CONTEXT_TCP_ONLY_KEEP_CONNECTIONS_OPEN</code>.</p>
<code>GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP</code></span>,
<code>GETDNS_TRANSPORT_UDP_ONLY</code>,
<code>GETDNS_TRANSPORT_TCP_ONLY</code>, or
<code>GETDNS_TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN</code>.</p>
<div class=forh>
getdns_return_t
@ -2220,12 +2219,12 @@ The default is <span class=default>not specified</span>.</p>
getdns_return_t
getdns_context_set_follow_redirects(
struct getdns_context *context,
uint16_t value
getdns_redirects_t value
);</div>
<p class=cont>Specifies whether or not DNS queries follow redirects.
The value is <span class=default><code>GETDNS_CONTEXT_FOLLOW_REDIRECTS</code></span> for normal
The value is <span class=default><code>GETDNS_REDIRECTS_FOLLOW</code></span> for normal
following of redirects though CNAME and DNAME; or
<code>GETDNS_CONTEXT_DO_NOT_FOLLOW_REDIRECTS</code> to cause any lookups that would have gone
<code>GETDNS_REDIRECTS_DO_NOT_FOLLOW</code> to cause any lookups that would have gone
through CNAME and DNAME to return the CNAME or DNAME, not the eventual target.</p>
<div class=forh>
@ -2245,15 +2244,15 @@ either "IPv4" or "IPv6") and <code>address_data</code> (whose value is a bindata
getdns_return_t
getdns_context_set_append_name(
struct getdns_context *context,
uint16_t value
getdns_append_name_t value
);</div>
<p class=cont>Specifies whether to append a suffix to the query string
before the API starts resolving a name.
The value is <span class=default>
<code>GETDNS_CONTEXT_APPEND_NAME_ALWAYS</code></span>,
<code>GETDNS_CONTEXT_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE</code>,
<code>GETDNS_CONTEXT_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE</code>,
or <code>GETDNS_CONTEXT_DO_NOT_APPEND_NAMES</code>. This controls
<code>GETDNS_APPEND_NAME_ALWAYS</code></span>,
<code>GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE</code>,
<code>GETDNS_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE</code>,
or <code>GETDNS_APPEND_NAME_NEVER</code>. This controls
whether or not to append the suffix given by <code>getdns_context_set_suffix</code></p>
<div class=forh>
@ -2427,7 +2426,7 @@ The response dicts inherit the custom memory management functions and the value
<h1>9. The Generated Files</h1>
<p>There is <a href="getdns-0.386.tgz">a tarball</a> that includes the .h files,
<p>There is <a href="getdns-0.387.tgz">a tarball</a> that includes the .h files,
the examples, and so on. The examples all make, even though there is no API implementation, based
on a pseudo-implementation in the tarball; see make-examples-PLATFORM.sh. Note that this currently builds fine
on the Macintosh and Ubuntu; help is definitely appreciated on making the build process