mirror of https://github.com/getdnsapi/getdns.git
[API 0.400] Typedeffed the structs away
This commit is contained in:
parent
5b70ed9b1a
commit
0d3327f411
|
@ -27,16 +27,16 @@ getdns_transport_t transportarg;
|
|||
getdns_append_name_t appendnamearg;
|
||||
|
||||
getdns_data_type * datatypeptrarg;
|
||||
struct getdns_bindata ** bindataptrarg;
|
||||
struct getdns_dict * dictarg;
|
||||
struct getdns_bindata * bindataarg;
|
||||
struct getdns_list * listarg;
|
||||
struct getdns_dict ** dictptrarg;
|
||||
struct getdns_list ** listptrarg;
|
||||
getdns_bindata ** bindataptrarg;
|
||||
getdns_dict * dictarg;
|
||||
getdns_bindata * bindataarg;
|
||||
getdns_list * listarg;
|
||||
getdns_dict ** dictptrarg;
|
||||
getdns_list ** listptrarg;
|
||||
|
||||
size_t sizetarg;
|
||||
size_t * sizetptrarg;
|
||||
struct getdns_context *contextarg = NULL;
|
||||
getdns_context *contextarg = NULL;
|
||||
uint8_t uint8arg;
|
||||
uint16_t uint16arg;
|
||||
uint32_t uint32arg;
|
||||
|
@ -55,7 +55,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, getdns_context_code_t foo2)
|
||||
void setcallbackfunctionarg(getdns_context *foo1, getdns_context_code_t foo2)
|
||||
{UNUSED_PARAM(foo1);UNUSED_PARAM(foo2);}
|
||||
|
||||
int main()
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#define UNUSED_PARAM(x) ((void)(x))
|
||||
|
||||
/* Set up the callback function, which will also do the processing of the results */
|
||||
void this_callbackfn(struct getdns_context *this_context,
|
||||
void this_callbackfn(getdns_context *this_context,
|
||||
uint16_t this_callback_type,
|
||||
struct getdns_dict *this_response,
|
||||
getdns_dict *this_response,
|
||||
void *this_userarg,
|
||||
getdns_transaction_t this_transaction_id)
|
||||
{
|
||||
|
@ -29,34 +29,34 @@ void this_callbackfn(struct getdns_context *this_context,
|
|||
getdns_dict_destroy(this_response);
|
||||
return;
|
||||
}
|
||||
struct getdns_list *replies_tree;
|
||||
getdns_list *replies_tree;
|
||||
this_ret = getdns_dict_get_list(this_response, "replies_tree", &replies_tree); // Ignore any error
|
||||
size_t num_replies;
|
||||
this_ret = getdns_list_get_length(replies_tree, &num_replies); // Ignore any error
|
||||
/* Go through each reply */
|
||||
for ( size_t reply_count = 0; reply_count < num_replies; ++reply_count)
|
||||
{
|
||||
struct getdns_dict * this_reply;
|
||||
getdns_dict * this_reply;
|
||||
this_ret = getdns_list_get_dict(replies_tree, reply_count, &this_reply); // Ignore any error
|
||||
/* Just print the address */
|
||||
struct getdns_list* reply_answers;
|
||||
getdns_list* reply_answers;
|
||||
this_ret = getdns_dict_get_list(this_reply, "answer", &reply_answers); // Ignore any error
|
||||
size_t num_answers;
|
||||
this_ret = getdns_list_get_length(reply_answers, &num_answers); // Ignore any error
|
||||
/* Go through each answer */
|
||||
for ( size_t answer_count = 0; answer_count < num_answers; ++answer_count)
|
||||
{
|
||||
struct getdns_dict * this_rr;
|
||||
getdns_dict * this_rr;
|
||||
this_ret = getdns_list_get_dict(reply_answers, answer_count, &this_rr);
|
||||
/* Get the RDATA type */
|
||||
uint32_t this_type;
|
||||
this_ret = getdns_dict_get_int(this_rr, "type", &this_type); // Ignore any error
|
||||
if (this_type == GETDNS_RRTYPE_PTR)
|
||||
{
|
||||
struct getdns_dict *this_rdata;
|
||||
getdns_dict *this_rdata;
|
||||
this_ret = getdns_dict_get_dict(this_rr, "rdata", &this_rdata); // Ignore any error
|
||||
|
||||
struct getdns_bindata * this_dname;
|
||||
getdns_bindata * this_dname;
|
||||
this_ret = getdns_dict_get_bindata(this_rdata, "rdata_raw", &this_dname);
|
||||
char *this_dname_str = getdns_convert_dns_name_to_fqdn((char *)this_dname->data);
|
||||
printf("The dname is %s\n", this_dname_str);
|
||||
|
@ -77,7 +77,7 @@ void this_callbackfn(struct getdns_context *this_context,
|
|||
int main()
|
||||
{
|
||||
/* Create the DNS context for this call */
|
||||
struct getdns_context *this_context = NULL;
|
||||
getdns_context *this_context = NULL;
|
||||
getdns_return_t context_create_return = getdns_context_create(&this_context, 1);
|
||||
if (context_create_return != GETDNS_RETURN_GOOD)
|
||||
{
|
||||
|
@ -95,12 +95,12 @@ int main()
|
|||
}
|
||||
(void)getdns_extension_set_libevent_base(this_context, this_event_base);
|
||||
/* Set up the getdns call */
|
||||
struct getdns_dict * this_addr_to_look_up = getdns_dict_create();
|
||||
getdns_dict * this_addr_to_look_up = getdns_dict_create();
|
||||
// TODO: check the return value above
|
||||
struct getdns_bindata this_type = { 4, (void *)"IPv4" };
|
||||
getdns_bindata this_type = { 4, (void *)"IPv4" };
|
||||
getdns_return_t this_ret = getdns_dict_set_bindata(this_addr_to_look_up, "address_type", &this_type);
|
||||
UNUSED_PARAM(this_ret);
|
||||
struct getdns_bindata this_ipv4_addr = { 4, (void *)"\x08\x08\x08\x08" };
|
||||
getdns_bindata this_ipv4_addr = { 4, (void *)"\x08\x08\x08\x08" };
|
||||
this_ret = getdns_dict_set_bindata(this_addr_to_look_up, "address_data", &this_ipv4_addr);
|
||||
char* this_userarg = "somestring"; // Could add things here to help identify this call
|
||||
getdns_transaction_t this_transaction_id = 0;
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#define UNUSED_PARAM(x) ((void)(x))
|
||||
|
||||
/* Set up the callback function, which will also do the processing of the results */
|
||||
void this_callbackfn(struct getdns_context *this_context,
|
||||
void this_callbackfn(getdns_context *this_context,
|
||||
getdns_callback_type_t this_callback_type,
|
||||
struct getdns_dict *this_response,
|
||||
getdns_dict *this_response,
|
||||
void *this_userarg,
|
||||
getdns_transaction_t this_transaction_id)
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ void this_callbackfn(struct getdns_context *this_context,
|
|||
getdns_dict_destroy(this_response);
|
||||
return;
|
||||
}
|
||||
struct getdns_list * just_the_addresses_ptr;
|
||||
getdns_list * just_the_addresses_ptr;
|
||||
this_ret = getdns_dict_get_list(this_response, "just_address_answers", &just_the_addresses_ptr);
|
||||
if (this_ret != GETDNS_RETURN_GOOD) // This check is really not needed, but prevents a compiler error under "pedantic"
|
||||
{
|
||||
|
@ -41,10 +41,10 @@ void this_callbackfn(struct getdns_context *this_context,
|
|||
/* Go through each record */
|
||||
for ( size_t rec_count = 0; rec_count < num_addresses; ++rec_count )
|
||||
{
|
||||
struct getdns_dict * this_address;
|
||||
getdns_dict * this_address;
|
||||
this_ret = getdns_list_get_dict(just_the_addresses_ptr, rec_count, &this_address); // Ignore any error
|
||||
/* Just print the address */
|
||||
struct getdns_bindata * this_address_data;
|
||||
getdns_bindata * this_address_data;
|
||||
this_ret = getdns_dict_get_bindata(this_address, "address_data", &this_address_data); // Ignore any error
|
||||
char *this_address_str = getdns_display_ip_address(this_address_data);
|
||||
printf("The address is %s\n", this_address_str);
|
||||
|
@ -61,7 +61,7 @@ void this_callbackfn(struct getdns_context *this_context,
|
|||
int main()
|
||||
{
|
||||
/* Create the DNS context for this call */
|
||||
struct getdns_context *this_context = NULL;
|
||||
getdns_context *this_context = NULL;
|
||||
getdns_return_t context_create_return = getdns_context_create(&this_context, 1);
|
||||
if (context_create_return != GETDNS_RETURN_GOOD)
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ int main()
|
|||
{
|
||||
getdns_return_t this_ret; /* Holder for all function returns */
|
||||
/* Create the DNS context for this call */
|
||||
struct getdns_context *this_context = NULL;
|
||||
getdns_context *this_context = NULL;
|
||||
getdns_return_t context_create_return = getdns_context_create(&this_context, 1);
|
||||
if (context_create_return != GETDNS_RETURN_GOOD)
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ int main()
|
|||
const char * this_name = "www.example.com";
|
||||
uint8_t this_request_type = GETDNS_RRTYPE_A;
|
||||
/* Get the A and AAAA records */
|
||||
struct getdns_dict * this_extensions = getdns_dict_create();
|
||||
getdns_dict * this_extensions = getdns_dict_create();
|
||||
this_ret = getdns_dict_set_int(this_extensions, "return_both_v4_and_v6", GETDNS_EXTENSION_TRUE);
|
||||
if (this_ret != GETDNS_RETURN_GOOD)
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ int main()
|
|||
getdns_context_destroy(this_context);
|
||||
return(GETDNS_RETURN_GENERIC_ERROR);
|
||||
}
|
||||
struct getdns_dict * this_response = NULL;
|
||||
getdns_dict * this_response = NULL;
|
||||
|
||||
/* Make the call */
|
||||
getdns_return_t dns_request_return = getdns_general_sync(this_context, this_name, this_request_type,
|
||||
|
@ -55,17 +55,17 @@ int main()
|
|||
getdns_context_destroy(this_context);
|
||||
return(GETDNS_RETURN_GENERIC_ERROR);
|
||||
}
|
||||
struct getdns_list * just_the_addresses_ptr;
|
||||
getdns_list * just_the_addresses_ptr;
|
||||
this_ret = getdns_dict_get_list(this_response, "just_address_answers", &just_the_addresses_ptr); // Ignore any error
|
||||
size_t num_addresses;
|
||||
this_ret = getdns_list_get_length(just_the_addresses_ptr, &num_addresses); // Ignore any error
|
||||
/* Go through each record */
|
||||
for ( size_t rec_count = 0; rec_count < num_addresses; ++rec_count )
|
||||
{
|
||||
struct getdns_dict * this_address;
|
||||
getdns_dict * this_address;
|
||||
this_ret = getdns_list_get_dict(just_the_addresses_ptr, rec_count, &this_address); // Ignore any error
|
||||
/* Just print the address */
|
||||
struct getdns_bindata * this_address_data;
|
||||
getdns_bindata * this_address_data;
|
||||
this_ret = getdns_dict_get_bindata(this_address, "address_data", &this_address_data); // Ignore any error
|
||||
char *this_address_str = getdns_display_ip_address(this_address_data);
|
||||
printf("The address is %s\n", this_address_str);
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#define UNUSED_PARAM(x) ((void)(x))
|
||||
|
||||
/* Set up the callback function, which will also do the processing of the results */
|
||||
void this_callbackfn(struct getdns_context *this_context,
|
||||
void this_callbackfn(getdns_context *this_context,
|
||||
getdns_callback_type_t this_callback_type,
|
||||
struct getdns_dict *this_response,
|
||||
getdns_dict *this_response,
|
||||
void *this_userarg,
|
||||
getdns_transaction_t this_transaction_id)
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ void this_callbackfn(struct getdns_context *this_context,
|
|||
return;
|
||||
}
|
||||
/* Find all the answers returned */
|
||||
struct getdns_list * these_answers;
|
||||
getdns_list * these_answers;
|
||||
this_ret = getdns_dict_get_list(this_response, "replies_tree", &these_answers);
|
||||
if (this_ret == GETDNS_RETURN_NO_SUCH_DICT_NAME)
|
||||
{
|
||||
|
@ -42,20 +42,20 @@ void this_callbackfn(struct getdns_context *this_context,
|
|||
/* Go through each answer */
|
||||
for ( size_t rec_count = 0; rec_count < num_answers; ++rec_count )
|
||||
{
|
||||
struct getdns_dict * this_record;
|
||||
getdns_dict * this_record;
|
||||
this_ret = getdns_list_get_dict(these_answers, rec_count, &this_record); // Ignore any error
|
||||
/* Get the answer section */
|
||||
struct getdns_list * this_answer;
|
||||
getdns_list * this_answer;
|
||||
this_ret = getdns_dict_get_list(this_record, "answer", &this_answer); // Ignore any error
|
||||
/* Get each RR in the answer section */
|
||||
size_t num_rrs;
|
||||
this_ret = getdns_list_get_length(this_answer, &num_rrs);
|
||||
for ( size_t rr_count = 0; rr_count < num_rrs; ++rr_count )
|
||||
{
|
||||
struct getdns_dict *this_rr = NULL;
|
||||
getdns_dict *this_rr = NULL;
|
||||
this_ret = getdns_list_get_dict(this_answer, rr_count, &this_rr); // Ignore any error
|
||||
/* Get the RDATA */
|
||||
struct getdns_dict * this_rdata = NULL;
|
||||
getdns_dict * this_rdata = NULL;
|
||||
this_ret = getdns_dict_get_dict(this_rr, "rdata", &this_rdata); // Ignore any error
|
||||
/* Get the RDATA type */
|
||||
uint32_t this_type;
|
||||
|
@ -63,7 +63,7 @@ void this_callbackfn(struct getdns_context *this_context,
|
|||
/* If it is type A or AAAA, print the value */
|
||||
if (this_type == GETDNS_RRTYPE_A)
|
||||
{
|
||||
struct getdns_bindata * this_a_record = NULL;
|
||||
getdns_bindata * this_a_record = NULL;
|
||||
this_ret = getdns_dict_get_bindata(this_rdata, "ipv4_address", &this_a_record);
|
||||
if (this_ret == GETDNS_RETURN_NO_SUCH_DICT_NAME)
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ void this_callbackfn(struct getdns_context *this_context,
|
|||
}
|
||||
else if (this_type == GETDNS_RRTYPE_AAAA)
|
||||
{
|
||||
struct getdns_bindata * this_aaaa_record = NULL;
|
||||
getdns_bindata * this_aaaa_record = NULL;
|
||||
this_ret = getdns_dict_get_bindata(this_rdata, "ipv6_address", &this_aaaa_record);
|
||||
if (this_ret == GETDNS_RETURN_NO_SUCH_DICT_NAME)
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ void this_callbackfn(struct getdns_context *this_context,
|
|||
int main()
|
||||
{
|
||||
/* Create the DNS context for this call */
|
||||
struct getdns_context *this_context = NULL;
|
||||
getdns_context *this_context = NULL;
|
||||
getdns_return_t context_create_return = getdns_context_create(&this_context, 1);
|
||||
if (context_create_return != GETDNS_RETURN_GOOD)
|
||||
{
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -9,10 +9,10 @@ int main(){ return(0); }
|
|||
|
||||
getdns_return_t
|
||||
getdns_general(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
const char *name,
|
||||
uint16_t request_type,
|
||||
struct getdns_dict *extensions,
|
||||
getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callback
|
||||
|
@ -22,9 +22,9 @@ UNUSED_PARAM(transaction_id); UNUSED_PARAM(callback); return GETDNS_RETURN_GOOD;
|
|||
|
||||
getdns_return_t
|
||||
getdns_address(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
const char *name,
|
||||
struct getdns_dict *extensions,
|
||||
getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callback
|
||||
|
@ -34,9 +34,9 @@ UNUSED_PARAM(transaction_id); UNUSED_PARAM(callback); return GETDNS_RETURN_GOOD;
|
|||
|
||||
getdns_return_t
|
||||
getdns_hostname(
|
||||
struct getdns_context *context,
|
||||
struct getdns_dict *address,
|
||||
struct getdns_dict *extensions,
|
||||
getdns_context *context,
|
||||
getdns_dict *address,
|
||||
getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callback
|
||||
|
@ -46,9 +46,9 @@ UNUSED_PARAM(transaction_id); UNUSED_PARAM(callback); return GETDNS_RETURN_GOOD;
|
|||
|
||||
getdns_return_t
|
||||
getdns_service(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
const char *name,
|
||||
struct getdns_dict *extensions,
|
||||
getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callback
|
||||
|
@ -58,14 +58,14 @@ UNUSED_PARAM(transaction_id); UNUSED_PARAM(callback); return GETDNS_RETURN_GOOD;
|
|||
|
||||
getdns_return_t
|
||||
getdns_context_create(
|
||||
struct getdns_context **context,
|
||||
getdns_context **context,
|
||||
int set_from_os
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(set_from_os); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_create_with_memory_functions(
|
||||
struct getdns_context **context,
|
||||
getdns_context **context,
|
||||
int set_from_os,
|
||||
void *(*malloc)(size_t),
|
||||
void *(*realloc)(void *, size_t),
|
||||
|
@ -77,7 +77,7 @@ getdns_context_create_with_memory_functions(
|
|||
|
||||
getdns_return_t
|
||||
getdns_context_create_with_extended_memory_functions(
|
||||
struct getdns_context **context,
|
||||
getdns_context **context,
|
||||
int set_from_os,
|
||||
void *userarg,
|
||||
void *(*malloc)(void *userarg, size_t),
|
||||
|
@ -90,109 +90,109 @@ getdns_context_create_with_extended_memory_functions(
|
|||
|
||||
void
|
||||
getdns_context_destroy(
|
||||
struct getdns_context *context
|
||||
getdns_context *context
|
||||
)
|
||||
{ UNUSED_PARAM(context); }
|
||||
|
||||
getdns_return_t
|
||||
getdns_cancel_callback(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
getdns_transaction_t transaction_id
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(transaction_id); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_general_sync(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
const char *name,
|
||||
uint16_t request_type,
|
||||
struct getdns_dict *extensions,
|
||||
struct getdns_dict **response
|
||||
getdns_dict *extensions,
|
||||
getdns_dict **response
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(name); UNUSED_PARAM(request_type); UNUSED_PARAM(extensions);
|
||||
UNUSED_PARAM(response); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_address_sync(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
const char *name,
|
||||
struct getdns_dict *extensions,
|
||||
struct getdns_dict **response
|
||||
getdns_dict *extensions,
|
||||
getdns_dict **response
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(name); UNUSED_PARAM(extensions);
|
||||
UNUSED_PARAM(response); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_hostname_sync(
|
||||
struct getdns_context *context,
|
||||
struct getdns_dict *address,
|
||||
struct getdns_dict *extensions,
|
||||
struct getdns_dict **response
|
||||
getdns_context *context,
|
||||
getdns_dict *address,
|
||||
getdns_dict *extensions,
|
||||
getdns_dict **response
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(address); UNUSED_PARAM(extensions);
|
||||
UNUSED_PARAM(response); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_service_sync(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
const char *name,
|
||||
struct getdns_dict *extensions,
|
||||
struct getdns_dict **response
|
||||
getdns_dict *extensions,
|
||||
getdns_dict **response
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(name); UNUSED_PARAM(extensions);
|
||||
UNUSED_PARAM(response); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
void
|
||||
getdns_free_sync_request_memory(
|
||||
struct getdns_dict *response
|
||||
getdns_dict *response
|
||||
)
|
||||
{ UNUSED_PARAM(response); }
|
||||
|
||||
getdns_return_t getdns_list_get_length(const struct getdns_list *this_list, size_t *answer)
|
||||
getdns_return_t getdns_list_get_length(const getdns_list *this_list, size_t *answer)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_list_get_data_type(const struct getdns_list *this_list, size_t index, getdns_data_type *answer)
|
||||
getdns_return_t getdns_list_get_data_type(const getdns_list *this_list, size_t index, getdns_data_type *answer)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(index); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_list_get_dict(const struct getdns_list *this_list, size_t index, struct getdns_dict **answer)
|
||||
getdns_return_t getdns_list_get_dict(const getdns_list *this_list, size_t index, getdns_dict **answer)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(index); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_list_get_list(const struct getdns_list *this_list, size_t index, struct getdns_list **answer)
|
||||
getdns_return_t getdns_list_get_list(const getdns_list *this_list, size_t index, getdns_list **answer)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(index); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_list_get_bindata(const struct getdns_list *this_list, size_t index, struct getdns_bindata **answer)
|
||||
getdns_return_t getdns_list_get_bindata(const getdns_list *this_list, size_t index, getdns_bindata **answer)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(index); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_list_get_int(const struct getdns_list *this_list, size_t index, uint32_t *answer)
|
||||
getdns_return_t getdns_list_get_int(const getdns_list *this_list, size_t index, uint32_t *answer)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(index); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_dict_get_names(const struct getdns_dict *this_dict, struct getdns_list **answer)
|
||||
getdns_return_t getdns_dict_get_names(const getdns_dict *this_dict, getdns_list **answer)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_dict_get_data_type(const struct getdns_dict *this_dict, const char *name, getdns_data_type *answer)
|
||||
getdns_return_t getdns_dict_get_data_type(const getdns_dict *this_dict, const char *name, getdns_data_type *answer)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_dict_get_dict(const struct getdns_dict *this_dict, const char *name, struct getdns_dict **answer)
|
||||
getdns_return_t getdns_dict_get_dict(const getdns_dict *this_dict, const char *name, getdns_dict **answer)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_dict_get_list(const struct getdns_dict *this_dict, const char *name, struct getdns_list **answer)
|
||||
getdns_return_t getdns_dict_get_list(const getdns_dict *this_dict, const char *name, getdns_list **answer)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_dict_get_bindata(const struct getdns_dict *this_dict, const char *name, struct getdns_bindata **answer)
|
||||
getdns_return_t getdns_dict_get_bindata(const getdns_dict *this_dict, const char *name, getdns_bindata **answer)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_dict_get_int(const struct getdns_dict *this_dict, const char *name, uint32_t *answer)
|
||||
getdns_return_t getdns_dict_get_int(const getdns_dict *this_dict, const char *name, uint32_t *answer)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
struct getdns_list * getdns_list_create()
|
||||
getdns_list * getdns_list_create()
|
||||
{ return NULL; }
|
||||
|
||||
struct getdns_list * getdns_list_create_with_context(
|
||||
struct getdns_context *context
|
||||
getdns_list * getdns_list_create_with_context(
|
||||
getdns_context *context
|
||||
)
|
||||
{ UNUSED_PARAM(context); return NULL; }
|
||||
|
||||
struct getdns_list * getdns_list_create_with_memory_functions(
|
||||
getdns_list * getdns_list_create_with_memory_functions(
|
||||
void *(*malloc)(size_t),
|
||||
void *(*realloc)(void *, size_t),
|
||||
void (*free)(void *)
|
||||
|
@ -200,7 +200,7 @@ struct getdns_list * getdns_list_create_with_memory_functions(
|
|||
{ UNUSED_PARAM(malloc); UNUSED_PARAM(realloc); UNUSED_PARAM(free);
|
||||
return NULL; }
|
||||
|
||||
struct getdns_list * getdns_list_create_with_extended_memory_functions(
|
||||
getdns_list * getdns_list_create_with_extended_memory_functions(
|
||||
void *userarg,
|
||||
void *(*malloc)(void *userarg, size_t),
|
||||
void *(*realloc)(void *userarg, void *, size_t),
|
||||
|
@ -210,30 +210,30 @@ struct getdns_list * getdns_list_create_with_extended_memory_functions(
|
|||
UNUSED_PARAM(malloc); UNUSED_PARAM(realloc); UNUSED_PARAM(free);
|
||||
return NULL; }
|
||||
|
||||
void getdns_list_destroy(struct getdns_list *this_list)
|
||||
void getdns_list_destroy(getdns_list *this_list)
|
||||
{ UNUSED_PARAM(this_list); }
|
||||
|
||||
getdns_return_t getdns_list_set_dict(struct getdns_list *this_list, size_t index, const struct getdns_dict *child_dict)
|
||||
getdns_return_t getdns_list_set_dict(getdns_list *this_list, size_t index, const getdns_dict *child_dict)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(index); UNUSED_PARAM(child_dict); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_list_set_list(struct getdns_list *this_list, size_t index, const struct getdns_list *child_list)
|
||||
getdns_return_t getdns_list_set_list(getdns_list *this_list, size_t index, const getdns_list *child_list)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(index); UNUSED_PARAM(child_list); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_list_set_bindata(struct getdns_list *this_list, size_t index, const struct getdns_bindata *child_bindata)
|
||||
getdns_return_t getdns_list_set_bindata(getdns_list *this_list, size_t index, const getdns_bindata *child_bindata)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(index); UNUSED_PARAM(child_bindata); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_list_set_int(struct getdns_list *this_list, size_t index, uint32_t child_uint32)
|
||||
getdns_return_t getdns_list_set_int(getdns_list *this_list, size_t index, uint32_t child_uint32)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(index); UNUSED_PARAM(child_uint32); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
struct getdns_dict * getdns_dict_create()
|
||||
getdns_dict * getdns_dict_create()
|
||||
{ return NULL; }
|
||||
|
||||
struct getdns_dict * getdns_dict_create_with_context(
|
||||
struct getdns_context *context
|
||||
getdns_dict * getdns_dict_create_with_context(
|
||||
getdns_context *context
|
||||
)
|
||||
{ UNUSED_PARAM(context); return NULL; }
|
||||
|
||||
struct getdns_dict * getdns_dict_create_with_memory_functions(
|
||||
getdns_dict * getdns_dict_create_with_memory_functions(
|
||||
void *(*malloc)(size_t),
|
||||
void *(*realloc)(void *, size_t),
|
||||
void (*free)(void *)
|
||||
|
@ -241,7 +241,7 @@ struct getdns_dict * getdns_dict_create_with_memory_functions(
|
|||
{ UNUSED_PARAM(malloc); UNUSED_PARAM(realloc); UNUSED_PARAM(free);
|
||||
return NULL; }
|
||||
|
||||
struct getdns_dict * getdns_dict_create_with_extended_memory_functions(
|
||||
getdns_dict * getdns_dict_create_with_extended_memory_functions(
|
||||
void *userarg,
|
||||
void *(*malloc)(void *userarg, size_t),
|
||||
void *(*realloc)(void *userarg, void *, size_t),
|
||||
|
@ -251,27 +251,27 @@ struct getdns_dict * getdns_dict_create_with_extended_memory_functions(
|
|||
UNUSED_PARAM(malloc); UNUSED_PARAM(realloc); UNUSED_PARAM(free);
|
||||
return NULL; }
|
||||
|
||||
void getdns_dict_destroy(struct getdns_dict *this_dict)
|
||||
void getdns_dict_destroy(getdns_dict *this_dict)
|
||||
{ UNUSED_PARAM(this_dict); }
|
||||
|
||||
getdns_return_t getdns_dict_set_dict(struct getdns_dict *this_dict, const char *name, const struct getdns_dict *child_dict)
|
||||
getdns_return_t getdns_dict_set_dict(getdns_dict *this_dict, const char *name, const getdns_dict *child_dict)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(child_dict); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_dict_set_list(struct getdns_dict *this_dict, const char *name, const struct getdns_list *child_list)
|
||||
getdns_return_t getdns_dict_set_list(getdns_dict *this_dict, const char *name, const getdns_list *child_list)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(child_list); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_dict_set_bindata(struct getdns_dict *this_dict, const char *name, const struct getdns_bindata *child_bindata)
|
||||
getdns_return_t getdns_dict_set_bindata(getdns_dict *this_dict, const char *name, const getdns_bindata *child_bindata)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(child_bindata); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_dict_set_int(struct getdns_dict *this_dict, const char *name, uint32_t child_uint32)
|
||||
getdns_return_t getdns_dict_set_int(getdns_dict *this_dict, const char *name, uint32_t child_uint32)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(child_uint32); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_dict_remove_name(struct getdns_dict *this_dict, const char *name)
|
||||
getdns_return_t getdns_dict_remove_name(getdns_dict *this_dict, const char *name)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_convert_dns_name_to_fqdn(
|
||||
const struct getdns_bindata *dns_name_wire_fmt,
|
||||
const getdns_bindata *dns_name_wire_fmt,
|
||||
char **fqdn_as_string
|
||||
)
|
||||
{ UNUSED_PARAM(dns_name_wire_fmt); UNUSED_PARAM(fqdn_as_string); return GETDNS_RETURN_GOOD; }
|
||||
|
@ -279,7 +279,7 @@ getdns_convert_dns_name_to_fqdn(
|
|||
getdns_return_t
|
||||
getdns_convert_fqdn_to_dns_name(
|
||||
const char *fqdn_as_string,
|
||||
struct getdns_bindata **dns_name_wire_fmt
|
||||
getdns_bindata **dns_name_wire_fmt
|
||||
)
|
||||
{ UNUSED_PARAM(fqdn_as_string); UNUSED_PARAM(dns_name_wire_fmt); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
|
@ -297,9 +297,9 @@ getdns_convert_alabel_to_ulabel(
|
|||
|
||||
getdns_return_t
|
||||
getdns_validate_dnssec(
|
||||
struct getdns_list *record_to_validate,
|
||||
struct getdns_list *bundle_of_support_records,
|
||||
struct getdns_list *trust_anchor_rdatas
|
||||
getdns_list *record_to_validate,
|
||||
getdns_list *bundle_of_support_records,
|
||||
getdns_list *trust_anchor_rdatas
|
||||
)
|
||||
{ UNUSED_PARAM(record_to_validate); UNUSED_PARAM(bundle_of_support_records); UNUSED_PARAM(trust_anchor_rdatas);
|
||||
return GETDNS_RETURN_GOOD; }
|
||||
|
@ -307,33 +307,33 @@ return GETDNS_RETURN_GOOD; }
|
|||
|
||||
char *
|
||||
getdns_pretty_print_dict(
|
||||
const struct getdns_dict *some_dict
|
||||
const getdns_dict *some_dict
|
||||
)
|
||||
{ UNUSED_PARAM(some_dict); return NULL; }
|
||||
|
||||
char *
|
||||
getdns_display_ip_address(
|
||||
const struct getdns_bindata *bindata_of_ipv4_or_ipv6_address
|
||||
const getdns_bindata *bindata_of_ipv4_or_ipv6_address
|
||||
)
|
||||
{ UNUSED_PARAM(bindata_of_ipv4_or_ipv6_address); return NULL; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_context_update_callback(
|
||||
struct getdns_context *context,
|
||||
void (*value)(struct getdns_context *context, getdns_context_code_t changed_item)
|
||||
getdns_context *context,
|
||||
void (*value)(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,
|
||||
getdns_context *context,
|
||||
getdns_resolution_t value
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_namespaces(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
size_t namespace_count,
|
||||
getdns_namespace_t *namespaces
|
||||
)
|
||||
|
@ -342,105 +342,105 @@ return GETDNS_RETURN_GOOD; }
|
|||
|
||||
getdns_return_t
|
||||
getdns_context_set_dns_transport(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
getdns_transport_t value
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_limit_outstanding_queries(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
uint16_t limit
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(limit); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_timeout(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
uint64_t timeout
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(timeout); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_follow_redirects(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
getdns_redirects_t value
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_dns_root_servers(
|
||||
struct getdns_context *context,
|
||||
struct getdns_list *addresses
|
||||
getdns_context *context,
|
||||
getdns_list *addresses
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(addresses); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_append_name(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
getdns_append_name_t value
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_suffix(
|
||||
struct getdns_context *context,
|
||||
struct getdns_list *value
|
||||
getdns_context *context,
|
||||
getdns_list *value
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_dnssec_trust_anchors(
|
||||
struct getdns_context *context,
|
||||
struct getdns_list *value
|
||||
getdns_context *context,
|
||||
getdns_list *value
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_dnssec_allowed_skew(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
unsigned int value
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_upstream_recursive_servers(
|
||||
struct getdns_context *context,
|
||||
struct getdns_list *upstream_list
|
||||
getdns_context *context,
|
||||
getdns_list *upstream_list
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(upstream_list); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_edns_maximum_udp_payload_size(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
uint16_t value
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_edns_extended_rcode(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
uint8_t value
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_edns_version(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
uint8_t value
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_edns_do_bit(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
uint8_t value
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_memory_functions(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
void *(*malloc) (size_t),
|
||||
void *(*realloc) (void *, size_t),
|
||||
void (*free) (void *)
|
||||
|
@ -451,7 +451,7 @@ getdns_context_set_memory_functions(
|
|||
|
||||
getdns_return_t
|
||||
getdns_context_set_extended_memory_functions(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
void *userarg,
|
||||
void *(*malloc)(void *userarg, size_t sz),
|
||||
void *(*realloc)(void *userarg, void *ptr, size_t sz),
|
||||
|
@ -464,7 +464,7 @@ getdns_context_set_extended_memory_functions(
|
|||
|
||||
getdns_return_t
|
||||
getdns_extension_set_libevent_base(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
struct event_base *this_event_base
|
||||
)
|
||||
{ UNUSED_PARAM(context); UNUSED_PARAM(this_event_base); return GETDNS_RETURN_GOOD; }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Created at 2014-02-19-10-58-16*/
|
||||
/* Created at 2014-02-19-15-06-22*/
|
||||
#ifndef GETDNS_H
|
||||
#define GETDNS_H
|
||||
|
||||
|
@ -314,89 +314,89 @@ typedef enum getdns_callback_type_t {
|
|||
#define GETDNS_RCODE_BADTRUNC 22
|
||||
|
||||
/* Various typedefs */
|
||||
struct getdns_context;
|
||||
typedef struct getdns_context getdns_context;
|
||||
typedef uint64_t getdns_transaction_t;
|
||||
typedef enum getdns_data_type {
|
||||
t_dict, t_list, t_int, t_bindata
|
||||
} getdns_data_type;
|
||||
struct getdns_bindata {
|
||||
typedef struct getdns_bindata {
|
||||
size_t size;
|
||||
uint8_t *data;
|
||||
};
|
||||
struct getdns_dict;
|
||||
struct getdns_list;
|
||||
} getdns_bindata;
|
||||
typedef struct getdns_dict getdns_dict;
|
||||
typedef struct getdns_list getdns_list;
|
||||
|
||||
/* Helper functions for data structures */
|
||||
|
||||
/* Lists: get the length, get the data_type of the value at a given
|
||||
position, and get the data at a given position */
|
||||
getdns_return_t getdns_list_get_length(const struct getdns_list *this_list, size_t *answer);
|
||||
getdns_return_t getdns_list_get_data_type(const struct getdns_list *this_list, size_t index, getdns_data_type *answer);
|
||||
getdns_return_t getdns_list_get_dict(const struct getdns_list *this_list, size_t index, struct getdns_dict **answer);
|
||||
getdns_return_t getdns_list_get_list(const struct getdns_list *this_list, size_t index, struct getdns_list **answer);
|
||||
getdns_return_t getdns_list_get_bindata(const struct getdns_list *this_list, size_t index, struct getdns_bindata **answer);
|
||||
getdns_return_t getdns_list_get_int(const struct getdns_list *this_list, size_t index, uint32_t *answer);
|
||||
getdns_return_t getdns_list_get_length(const getdns_list *this_list, size_t *answer);
|
||||
getdns_return_t getdns_list_get_data_type(const getdns_list *this_list, size_t index, getdns_data_type *answer);
|
||||
getdns_return_t getdns_list_get_dict(const getdns_list *this_list, size_t index, getdns_dict **answer);
|
||||
getdns_return_t getdns_list_get_list(const getdns_list *this_list, size_t index, getdns_list **answer);
|
||||
getdns_return_t getdns_list_get_bindata(const getdns_list *this_list, size_t index, getdns_bindata **answer);
|
||||
getdns_return_t getdns_list_get_int(const getdns_list *this_list, size_t index, uint32_t *answer);
|
||||
|
||||
/* Dicts: get the list of names, get the data_type of the
|
||||
value at a given name, and get the data at a given name */
|
||||
getdns_return_t getdns_dict_get_names(const struct getdns_dict *this_dict, struct getdns_list **answer);
|
||||
getdns_return_t getdns_dict_get_data_type(const struct getdns_dict *this_dict, const char *name, getdns_data_type *answer);
|
||||
getdns_return_t getdns_dict_get_dict(const struct getdns_dict *this_dict, const char *name, struct getdns_dict **answer);
|
||||
getdns_return_t getdns_dict_get_list(const struct getdns_dict *this_dict, const char *name, struct getdns_list **answer);
|
||||
getdns_return_t getdns_dict_get_bindata(const struct getdns_dict *this_dict, const char *name, struct getdns_bindata **answer);
|
||||
getdns_return_t getdns_dict_get_int(const struct getdns_dict *this_dict, const char *name, uint32_t *answer);
|
||||
getdns_return_t getdns_dict_get_names(const getdns_dict *this_dict, getdns_list **answer);
|
||||
getdns_return_t getdns_dict_get_data_type(const getdns_dict *this_dict, const char *name, getdns_data_type *answer);
|
||||
getdns_return_t getdns_dict_get_dict(const getdns_dict *this_dict, const char *name, getdns_dict **answer);
|
||||
getdns_return_t getdns_dict_get_list(const getdns_dict *this_dict, const char *name, getdns_list **answer);
|
||||
getdns_return_t getdns_dict_get_bindata(const getdns_dict *this_dict, const char *name, getdns_bindata **answer);
|
||||
getdns_return_t getdns_dict_get_int(const getdns_dict *this_dict, const char *name, uint32_t *answer);
|
||||
|
||||
|
||||
/* Lists: create, destroy, and set the data at a given position */
|
||||
struct getdns_list * getdns_list_create();
|
||||
struct getdns_list * getdns_list_create_with_context(
|
||||
struct getdns_context *context
|
||||
getdns_list * getdns_list_create();
|
||||
getdns_list * getdns_list_create_with_context(
|
||||
getdns_context *context
|
||||
);
|
||||
struct getdns_list * getdns_list_create_with_memory_functions(
|
||||
getdns_list * getdns_list_create_with_memory_functions(
|
||||
void *(*malloc)(size_t),
|
||||
void *(*realloc)(void *, size_t),
|
||||
void (*free)(void *)
|
||||
);
|
||||
struct getdns_list * getdns_list_create_with_extended_memory_functions(
|
||||
getdns_list * getdns_list_create_with_extended_memory_functions(
|
||||
void *userarg,
|
||||
void *(*malloc)(void *userarg, size_t),
|
||||
void *(*realloc)(void *userarg, void *, size_t),
|
||||
void (*free)(void *userarg, void *)
|
||||
);
|
||||
void getdns_list_destroy(struct getdns_list *this_list);
|
||||
getdns_return_t getdns_list_set_dict(struct getdns_list *this_list, size_t index, const struct getdns_dict *child_dict);
|
||||
getdns_return_t getdns_list_set_list(struct getdns_list *this_list, size_t index, const struct getdns_list *child_list);
|
||||
getdns_return_t getdns_list_set_bindata(struct getdns_list *this_list, size_t index, const struct getdns_bindata *child_bindata);
|
||||
getdns_return_t getdns_list_set_int(struct getdns_list *this_list, size_t index, uint32_t child_uint32);
|
||||
void getdns_list_destroy(getdns_list *this_list);
|
||||
getdns_return_t getdns_list_set_dict(getdns_list *this_list, size_t index, const getdns_dict *child_dict);
|
||||
getdns_return_t getdns_list_set_list(getdns_list *this_list, size_t index, const getdns_list *child_list);
|
||||
getdns_return_t getdns_list_set_bindata(getdns_list *this_list, size_t index, const getdns_bindata *child_bindata);
|
||||
getdns_return_t getdns_list_set_int(getdns_list *this_list, size_t index, uint32_t child_uint32);
|
||||
|
||||
/* Dicts: create, destroy, and set the data at a given name */
|
||||
struct getdns_dict * getdns_dict_create();
|
||||
struct getdns_dict * getdns_dict_create_with_context(
|
||||
struct getdns_context *context
|
||||
getdns_dict * getdns_dict_create();
|
||||
getdns_dict * getdns_dict_create_with_context(
|
||||
getdns_context *context
|
||||
);
|
||||
struct getdns_dict * getdns_dict_create_with_memory_functions(
|
||||
getdns_dict * getdns_dict_create_with_memory_functions(
|
||||
void *(*malloc)(size_t),
|
||||
void *(*realloc)(void *, size_t),
|
||||
void (*free)(void *)
|
||||
);
|
||||
struct getdns_dict * getdns_dict_create_with_extended_memory_functions(
|
||||
getdns_dict * getdns_dict_create_with_extended_memory_functions(
|
||||
void *userarg,
|
||||
void *(*malloc)(void *userarg, size_t),
|
||||
void *(*realloc)(void *userarg, void *, size_t),
|
||||
void (*free)(void *userarg, void *)
|
||||
);
|
||||
void getdns_dict_destroy(struct getdns_dict *this_dict);
|
||||
getdns_return_t getdns_dict_set_dict(struct getdns_dict *this_dict, const char *name, const struct getdns_dict *child_dict);
|
||||
getdns_return_t getdns_dict_set_list(struct getdns_dict *this_dict, const char *name, const struct getdns_list *child_list);
|
||||
getdns_return_t getdns_dict_set_bindata(struct getdns_dict *this_dict, const char *name, const struct getdns_bindata *child_bindata);
|
||||
getdns_return_t getdns_dict_set_int(struct getdns_dict *this_dict, const char *name, uint32_t child_uint32);
|
||||
getdns_return_t getdns_dict_remove_name(struct getdns_dict *this_dict, const char *name);
|
||||
void getdns_dict_destroy(getdns_dict *this_dict);
|
||||
getdns_return_t getdns_dict_set_dict(getdns_dict *this_dict, const char *name, const getdns_dict *child_dict);
|
||||
getdns_return_t getdns_dict_set_list(getdns_dict *this_dict, const char *name, const getdns_list *child_list);
|
||||
getdns_return_t getdns_dict_set_bindata(getdns_dict *this_dict, const char *name, const getdns_bindata *child_bindata);
|
||||
getdns_return_t getdns_dict_set_int(getdns_dict *this_dict, const char *name, uint32_t child_uint32);
|
||||
getdns_return_t getdns_dict_remove_name(getdns_dict *this_dict, const char *name);
|
||||
|
||||
/* Callback arguments */
|
||||
typedef void (*getdns_callback_t)(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
getdns_callback_type_t callback_type,
|
||||
struct getdns_dict *response,
|
||||
getdns_dict *response,
|
||||
void *userarg,
|
||||
getdns_transaction_t transaction_id);
|
||||
|
||||
|
@ -404,120 +404,120 @@ typedef void (*getdns_callback_t)(
|
|||
|
||||
getdns_return_t
|
||||
getdns_general(
|
||||
struct getdns_context *context,
|
||||
const char *name,
|
||||
uint16_t request_type,
|
||||
struct getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn
|
||||
getdns_context *context,
|
||||
const char *name,
|
||||
uint16_t request_type,
|
||||
getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn
|
||||
);
|
||||
getdns_return_t
|
||||
getdns_address(
|
||||
struct getdns_context *context,
|
||||
const char *name,
|
||||
struct getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn
|
||||
getdns_context *context,
|
||||
const char *name,
|
||||
getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn
|
||||
);
|
||||
getdns_return_t
|
||||
getdns_hostname(
|
||||
struct getdns_context *context,
|
||||
struct getdns_dict *address,
|
||||
struct getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn
|
||||
getdns_context *context,
|
||||
getdns_dict *address,
|
||||
getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn
|
||||
);
|
||||
getdns_return_t
|
||||
getdns_service(
|
||||
struct getdns_context *context,
|
||||
const char *name,
|
||||
struct getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn
|
||||
getdns_context *context,
|
||||
const char *name,
|
||||
getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_create(
|
||||
struct getdns_context **context,
|
||||
int set_from_os
|
||||
getdns_context **context,
|
||||
int set_from_os
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_create_with_memory_functions(
|
||||
struct getdns_context **context,
|
||||
int set_from_os,
|
||||
void *(*malloc)(size_t),
|
||||
void *(*realloc)(void *, size_t),
|
||||
void (*free)(void *)
|
||||
getdns_context **context,
|
||||
int set_from_os,
|
||||
void *(*malloc)(size_t),
|
||||
void *(*realloc)(void *, size_t),
|
||||
void (*free)(void *)
|
||||
);
|
||||
getdns_return_t
|
||||
getdns_context_create_with_extended_memory_functions(
|
||||
struct getdns_context **context,
|
||||
int set_from_os,
|
||||
void *userarg,
|
||||
void *(*malloc)(void *userarg, size_t),
|
||||
void *(*realloc)(void *userarg, void *, size_t),
|
||||
void (*free)(void *userarg, void *)
|
||||
getdns_context **context,
|
||||
int set_from_os,
|
||||
void *userarg,
|
||||
void *(*malloc)(void *userarg, size_t),
|
||||
void *(*realloc)(void *userarg, void *, size_t),
|
||||
void (*free)(void *userarg, void *)
|
||||
);
|
||||
|
||||
void
|
||||
getdns_context_destroy(
|
||||
struct getdns_context *context
|
||||
getdns_context *context
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_cancel_callback(
|
||||
struct getdns_context *context,
|
||||
getdns_transaction_t transaction_id
|
||||
getdns_context *context,
|
||||
getdns_transaction_t transaction_id
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_general_sync(
|
||||
struct getdns_context *context,
|
||||
const char *name,
|
||||
uint16_t request_type,
|
||||
struct getdns_dict *extensions,
|
||||
struct getdns_dict **response
|
||||
getdns_context *context,
|
||||
const char *name,
|
||||
uint16_t request_type,
|
||||
getdns_dict *extensions,
|
||||
getdns_dict **response
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_address_sync(
|
||||
struct getdns_context *context,
|
||||
const char *name,
|
||||
struct getdns_dict *extensions,
|
||||
struct getdns_dict **response
|
||||
getdns_context *context,
|
||||
const char *name,
|
||||
getdns_dict *extensions,
|
||||
getdns_dict **response
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_hostname_sync(
|
||||
struct getdns_context *context,
|
||||
struct getdns_dict *address,
|
||||
struct getdns_dict *extensions,
|
||||
struct getdns_dict **response
|
||||
getdns_context *context,
|
||||
getdns_dict *address,
|
||||
getdns_dict *extensions,
|
||||
getdns_dict **response
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_service_sync(
|
||||
struct getdns_context *context,
|
||||
const char *name,
|
||||
struct getdns_dict *extensions,
|
||||
struct getdns_dict **response
|
||||
getdns_context *context,
|
||||
const char *name,
|
||||
getdns_dict *extensions,
|
||||
getdns_dict **response
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_convert_dns_name_to_fqdn(
|
||||
const struct getdns_bindata *dns_name_wire_fmt,
|
||||
const getdns_bindata *dns_name_wire_fmt,
|
||||
char **fqdn_as_string
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_convert_fqdn_to_dns_name(
|
||||
const char *fqdn_as_string,
|
||||
struct getdns_bindata **dns_name_wire_fmt
|
||||
getdns_bindata **dns_name_wire_fmt
|
||||
);
|
||||
|
||||
char *
|
||||
|
@ -532,139 +532,139 @@ getdns_convert_alabel_to_ulabel(
|
|||
|
||||
getdns_return_t
|
||||
getdns_validate_dnssec(
|
||||
struct getdns_list *record_to_validate,
|
||||
struct getdns_list *bundle_of_support_records,
|
||||
struct getdns_list *trust_anchor_rdatas
|
||||
getdns_list *record_to_validate,
|
||||
getdns_list *bundle_of_support_records,
|
||||
getdns_list *trust_anchor_records
|
||||
);
|
||||
|
||||
char *
|
||||
getdns_pretty_print_dict(
|
||||
const struct getdns_dict *some_dict
|
||||
const getdns_dict *some_dict
|
||||
);
|
||||
|
||||
char *
|
||||
getdns_display_ip_address(
|
||||
const struct getdns_bindata *bindata_of_ipv4_or_ipv6_address
|
||||
const getdns_bindata *bindata_of_ipv4_or_ipv6_address
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_context_update_callback(
|
||||
struct getdns_context *context,
|
||||
void (*value)(struct getdns_context *context, getdns_context_code_t changed_item)
|
||||
getdns_context *context,
|
||||
void (*value)(getdns_context *context, getdns_context_code_t changed_item)
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_resolution_type(
|
||||
struct getdns_context *context,
|
||||
getdns_resolution_t value
|
||||
getdns_context *context,
|
||||
getdns_resolution_t value
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_namespaces(
|
||||
struct getdns_context *context,
|
||||
size_t namespace_count,
|
||||
getdns_namespace_t *namespaces
|
||||
getdns_context *context,
|
||||
size_t namespace_count,
|
||||
getdns_namespace_t *namespaces
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_dns_transport(
|
||||
struct getdns_context *context,
|
||||
getdns_transport_t value
|
||||
getdns_context *context,
|
||||
getdns_transport_t value
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_limit_outstanding_queries(
|
||||
struct getdns_context *context,
|
||||
uint16_t limit
|
||||
getdns_context *context,
|
||||
uint16_t limit
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_timeout(
|
||||
struct getdns_context *context,
|
||||
uint64_t timeout
|
||||
getdns_context *context,
|
||||
uint64_t timeout
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_follow_redirects(
|
||||
struct getdns_context *context,
|
||||
getdns_redirects_t value
|
||||
getdns_context *context,
|
||||
getdns_redirects_t value
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_dns_root_servers(
|
||||
struct getdns_context *context,
|
||||
struct getdns_list *addresses
|
||||
getdns_context *context,
|
||||
getdns_list *addresses
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_append_name(
|
||||
struct getdns_context *context,
|
||||
getdns_append_name_t value
|
||||
getdns_context *context,
|
||||
getdns_append_name_t value
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_suffix(
|
||||
struct getdns_context *context,
|
||||
struct getdns_list *value
|
||||
getdns_context *context,
|
||||
getdns_list *value
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_dnssec_trust_anchors(
|
||||
struct getdns_context *context,
|
||||
struct getdns_list *value
|
||||
getdns_context *context,
|
||||
getdns_list *value
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_dnssec_allowed_skew(
|
||||
struct getdns_context *context,
|
||||
uint32_t value
|
||||
getdns_context *context,
|
||||
uint32_t value
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_upstream_recursive_servers(
|
||||
struct getdns_context *context,
|
||||
struct getdns_list *upstream_list
|
||||
getdns_context *context,
|
||||
getdns_list *upstream_list
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_edns_maximum_udp_payload_size(
|
||||
struct getdns_context *context,
|
||||
uint16_t value
|
||||
getdns_context *context,
|
||||
uint16_t value
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_edns_extended_rcode(
|
||||
struct getdns_context *context,
|
||||
uint8_t value
|
||||
getdns_context *context,
|
||||
uint8_t value
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_edns_version(
|
||||
struct getdns_context *context,
|
||||
uint8_t value
|
||||
getdns_context *context,
|
||||
uint8_t value
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_edns_do_bit(
|
||||
struct getdns_context *context,
|
||||
uint8_t value
|
||||
getdns_context *context,
|
||||
uint8_t value
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_memory_functions(
|
||||
struct getdns_context *context,
|
||||
void *(*malloc) (size_t),
|
||||
void *(*realloc) (void *, size_t),
|
||||
void (*free) (void *)
|
||||
getdns_context *context,
|
||||
void *(*malloc) (size_t),
|
||||
void *(*realloc) (void *, size_t),
|
||||
void (*free) (void *)
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_set_extended_memory_functions(
|
||||
struct getdns_context *context,
|
||||
void *userarg,
|
||||
void *(*malloc)(void *userarg, size_t sz),
|
||||
void *(*realloc)(void *userarg, void *ptr, size_t sz),
|
||||
void (*free)(void *userarg, void *ptr)
|
||||
getdns_context *context,
|
||||
void *userarg,
|
||||
void *(*malloc)(void *userarg, size_t sz),
|
||||
void *(*realloc)(void *userarg, void *ptr, size_t sz),
|
||||
void (*free)(void *userarg, void *ptr)
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
/* For libevent, which we are using for these examples */
|
||||
getdns_return_t
|
||||
getdns_extension_set_libevent_base(
|
||||
struct getdns_context *context,
|
||||
struct event_base *this_event_base
|
||||
getdns_context *context,
|
||||
struct event_base *this_event_base
|
||||
);
|
||||
|
|
374
spec/index.html
374
spec/index.html
|
@ -140,13 +140,13 @@ href="mailto:paul.hoffman@vpnc.org">paul.hoffman@vpnc.org</a>.)</p>
|
|||
|
||||
<div class=forh id="getdnsfuncgeneral">getdns_return_t
|
||||
getdns_general(
|
||||
struct getdns_context *context,
|
||||
const char *name,
|
||||
uint16_t request_type,
|
||||
struct getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn
|
||||
getdns_context *context,
|
||||
const char *name,
|
||||
uint16_t request_type,
|
||||
getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn
|
||||
);
|
||||
</div>
|
||||
|
||||
|
@ -208,12 +208,12 @@ href="#ReturnCodes">later in this document</a>.</p>
|
|||
|
||||
<div class=forh id="getdnsfuncaddress">getdns_return_t
|
||||
getdns_address(
|
||||
struct getdns_context *context,
|
||||
const char *name,
|
||||
struct getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn
|
||||
getdns_context *context,
|
||||
const char *name,
|
||||
getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn
|
||||
);
|
||||
</div>
|
||||
|
||||
|
@ -236,12 +236,12 @@ getdns_address(
|
|||
|
||||
<div class=forh id="getdnsfunchostname">getdns_return_t
|
||||
getdns_hostname(
|
||||
struct getdns_context *context,
|
||||
struct getdns_dict *address,
|
||||
struct getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn
|
||||
getdns_context *context,
|
||||
getdns_dict *address,
|
||||
getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn
|
||||
);
|
||||
</div>
|
||||
|
||||
|
@ -253,12 +253,12 @@ or "IPv6" (which are case-sensitive)) and <code>address_data</code> (whose value
|
|||
|
||||
<div class=forh id="getdnsfuncservice">getdns_return_t
|
||||
getdns_service(
|
||||
struct getdns_context *context,
|
||||
const char *name,
|
||||
struct getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn
|
||||
getdns_context *context,
|
||||
const char *name,
|
||||
getdns_dict *extensions,
|
||||
void *userarg,
|
||||
getdns_transaction_t *transaction_id,
|
||||
getdns_callback_t callbackfn
|
||||
);
|
||||
</div>
|
||||
|
||||
|
@ -277,9 +277,9 @@ returned an error, in which case the callback function is never called.<p>
|
|||
as follows:</p>
|
||||
<div class=forh id="getdns_callback_t">
|
||||
typedef void (*getdns_callback_t)(
|
||||
struct getdns_context *context,
|
||||
getdns_context *context,
|
||||
getdns_callback_type_t callback_type,
|
||||
struct getdns_dict *response,
|
||||
getdns_dict *response,
|
||||
void *userarg,
|
||||
getdns_transaction_t transaction_id);
|
||||
</div>
|
||||
|
@ -324,8 +324,8 @@ that affect how DNS calls are made. For most applications, a default context is
|
|||
|
||||
<div class=forh>getdns_return_t
|
||||
getdns_context_create(
|
||||
struct getdns_context **context,
|
||||
int set_from_os
|
||||
getdns_context **context,
|
||||
int set_from_os
|
||||
);
|
||||
</div>
|
||||
|
||||
|
@ -335,20 +335,20 @@ want <code>set_from_os</code> set to <code>1</code>.</p>
|
|||
|
||||
<div class=forh>getdns_return_t
|
||||
getdns_context_create_with_memory_functions(
|
||||
struct getdns_context **context,
|
||||
int set_from_os,
|
||||
void *(*malloc)(size_t),
|
||||
void *(*realloc)(void *, size_t),
|
||||
void (*free)(void *)
|
||||
getdns_context **context,
|
||||
int set_from_os,
|
||||
void *(*malloc)(size_t),
|
||||
void *(*realloc)(void *, size_t),
|
||||
void (*free)(void *)
|
||||
);
|
||||
getdns_return_t
|
||||
getdns_context_create_with_extended_memory_functions(
|
||||
struct getdns_context **context,
|
||||
int set_from_os,
|
||||
void *userarg,
|
||||
void *(*malloc)(void *userarg, size_t),
|
||||
void *(*realloc)(void *userarg, void *, size_t),
|
||||
void (*free)(void *userarg, void *)
|
||||
getdns_context **context,
|
||||
int set_from_os,
|
||||
void *userarg,
|
||||
void *(*malloc)(void *userarg, size_t),
|
||||
void *(*realloc)(void *userarg, void *, size_t),
|
||||
void (*free)(void *userarg, void *)
|
||||
);
|
||||
</div>
|
||||
|
||||
|
@ -357,7 +357,7 @@ using this context, use the function:</p>
|
|||
|
||||
<div class=forh>void
|
||||
getdns_context_destroy(
|
||||
struct getdns_context *context
|
||||
getdns_context *context
|
||||
);
|
||||
</div>
|
||||
|
||||
|
@ -374,8 +374,8 @@ all of the needed cleanup is done and callbacks are made.</p>
|
|||
|
||||
<div class=forh>getdns_return_t
|
||||
getdns_cancel_callback(
|
||||
struct getdns_context *context,
|
||||
getdns_transaction_t transaction_id
|
||||
getdns_context *context,
|
||||
getdns_transaction_t transaction_id
|
||||
);
|
||||
</div>
|
||||
|
||||
|
@ -455,38 +455,38 @@ same as the response returned in the callback if you had used the async version
|
|||
|
||||
<div class=forh>getdns_return_t
|
||||
getdns_general_sync(
|
||||
struct getdns_context *context,
|
||||
const char *name,
|
||||
uint16_t request_type,
|
||||
struct getdns_dict *extensions,
|
||||
struct getdns_dict **response
|
||||
getdns_context *context,
|
||||
const char *name,
|
||||
uint16_t request_type,
|
||||
getdns_dict *extensions,
|
||||
getdns_dict **response
|
||||
);
|
||||
</div>
|
||||
|
||||
<div class=forh>getdns_return_t
|
||||
getdns_address_sync(
|
||||
struct getdns_context *context,
|
||||
const char *name,
|
||||
struct getdns_dict *extensions,
|
||||
struct getdns_dict **response
|
||||
getdns_context *context,
|
||||
const char *name,
|
||||
getdns_dict *extensions,
|
||||
getdns_dict **response
|
||||
);
|
||||
</div>
|
||||
|
||||
<div class=forh>getdns_return_t
|
||||
getdns_hostname_sync(
|
||||
struct getdns_context *context,
|
||||
struct getdns_dict *address,
|
||||
struct getdns_dict *extensions,
|
||||
struct getdns_dict **response
|
||||
getdns_context *context,
|
||||
getdns_dict *address,
|
||||
getdns_dict *extensions,
|
||||
getdns_dict **response
|
||||
);
|
||||
</div>
|
||||
|
||||
<div class=forh>getdns_return_t
|
||||
getdns_service_sync(
|
||||
struct getdns_context *context,
|
||||
const char *name,
|
||||
struct getdns_dict *extensions,
|
||||
struct getdns_dict **response
|
||||
getdns_context *context,
|
||||
const char *name,
|
||||
getdns_dict *extensions,
|
||||
getdns_dict **response
|
||||
);
|
||||
</div>
|
||||
|
||||
|
@ -495,7 +495,7 @@ free the memory from its internal pool.</p>
|
|||
|
||||
<pre>void
|
||||
getdns_dict_destroy(
|
||||
struct getdns_dict *response
|
||||
getdns_dict *response
|
||||
);
|
||||
</pre>
|
||||
|
||||
|
@ -525,21 +525,21 @@ name-value pairs in a dict is not important.</li>
|
|||
<div class=forh id="datagetters">
|
||||
/* Lists: get the length, get the data_type of the value at a given
|
||||
position, and get the data at a given position */
|
||||
getdns_return_t getdns_list_get_length(const struct getdns_list *this_list, size_t *answer);
|
||||
getdns_return_t getdns_list_get_data_type(const struct getdns_list *this_list, size_t index, getdns_data_type *answer);
|
||||
getdns_return_t getdns_list_get_dict(const struct getdns_list *this_list, size_t index, struct getdns_dict **answer);
|
||||
getdns_return_t getdns_list_get_list(const struct getdns_list *this_list, size_t index, struct getdns_list **answer);
|
||||
getdns_return_t getdns_list_get_bindata(const struct getdns_list *this_list, size_t index, struct getdns_bindata **answer);
|
||||
getdns_return_t getdns_list_get_int(const struct getdns_list *this_list, size_t index, uint32_t *answer);
|
||||
getdns_return_t getdns_list_get_length(const getdns_list *this_list, size_t *answer);
|
||||
getdns_return_t getdns_list_get_data_type(const getdns_list *this_list, size_t index, getdns_data_type *answer);
|
||||
getdns_return_t getdns_list_get_dict(const getdns_list *this_list, size_t index, getdns_dict **answer);
|
||||
getdns_return_t getdns_list_get_list(const getdns_list *this_list, size_t index, getdns_list **answer);
|
||||
getdns_return_t getdns_list_get_bindata(const getdns_list *this_list, size_t index, getdns_bindata **answer);
|
||||
getdns_return_t getdns_list_get_int(const getdns_list *this_list, size_t index, uint32_t *answer);
|
||||
|
||||
/* Dicts: get the list of names, get the data_type of the
|
||||
value at a given name, and get the data at a given name */
|
||||
getdns_return_t getdns_dict_get_names(const struct getdns_dict *this_dict, struct getdns_list **answer);
|
||||
getdns_return_t getdns_dict_get_data_type(const struct getdns_dict *this_dict, const char *name, getdns_data_type *answer);
|
||||
getdns_return_t getdns_dict_get_dict(const struct getdns_dict *this_dict, const char *name, struct getdns_dict **answer);
|
||||
getdns_return_t getdns_dict_get_list(const struct getdns_dict *this_dict, const char *name, struct getdns_list **answer);
|
||||
getdns_return_t getdns_dict_get_bindata(const struct getdns_dict *this_dict, const char *name, struct getdns_bindata **answer);
|
||||
getdns_return_t getdns_dict_get_int(const struct getdns_dict *this_dict, const char *name, uint32_t *answer);
|
||||
getdns_return_t getdns_dict_get_names(const getdns_dict *this_dict, getdns_list **answer);
|
||||
getdns_return_t getdns_dict_get_data_type(const getdns_dict *this_dict, const char *name, getdns_data_type *answer);
|
||||
getdns_return_t getdns_dict_get_dict(const getdns_dict *this_dict, const char *name, getdns_dict **answer);
|
||||
getdns_return_t getdns_dict_get_list(const getdns_dict *this_dict, const char *name, getdns_list **answer);
|
||||
getdns_return_t getdns_dict_get_bindata(const getdns_dict *this_dict, const char *name, getdns_bindata **answer);
|
||||
getdns_return_t getdns_dict_get_int(const getdns_dict *this_dict, const char *name, uint32_t *answer);
|
||||
</div>
|
||||
|
||||
<p>All of these helper getter functions return <code>GETDNS_RETURN_GOOD</code> if the call is successful.
|
||||
|
@ -566,49 +566,49 @@ you need to create a dict. The requisite functions are:</p>
|
|||
|
||||
<div class=forh id="datasetters">
|
||||
/* Lists: create, destroy, and set the data at a given position */
|
||||
struct getdns_list * getdns_list_create();
|
||||
struct getdns_list * getdns_list_create_with_context(
|
||||
struct getdns_context *context
|
||||
getdns_list * getdns_list_create();
|
||||
getdns_list * getdns_list_create_with_context(
|
||||
getdns_context *context
|
||||
);
|
||||
struct getdns_list * getdns_list_create_with_memory_functions(
|
||||
getdns_list * getdns_list_create_with_memory_functions(
|
||||
void *(*malloc)(size_t),
|
||||
void *(*realloc)(void *, size_t),
|
||||
void (*free)(void *)
|
||||
);
|
||||
struct getdns_list * getdns_list_create_with_extended_memory_functions(
|
||||
getdns_list * getdns_list_create_with_extended_memory_functions(
|
||||
void *userarg,
|
||||
void *(*malloc)(void *userarg, size_t),
|
||||
void *(*realloc)(void *userarg, void *, size_t),
|
||||
void (*free)(void *userarg, void *)
|
||||
);
|
||||
void getdns_list_destroy(struct getdns_list *this_list);
|
||||
getdns_return_t getdns_list_set_dict(struct getdns_list *this_list, size_t index, const struct getdns_dict *child_dict);
|
||||
getdns_return_t getdns_list_set_list(struct getdns_list *this_list, size_t index, const struct getdns_list *child_list);
|
||||
getdns_return_t getdns_list_set_bindata(struct getdns_list *this_list, size_t index, const struct getdns_bindata *child_bindata);
|
||||
getdns_return_t getdns_list_set_int(struct getdns_list *this_list, size_t index, uint32_t child_uint32);
|
||||
void getdns_list_destroy(getdns_list *this_list);
|
||||
getdns_return_t getdns_list_set_dict(getdns_list *this_list, size_t index, const getdns_dict *child_dict);
|
||||
getdns_return_t getdns_list_set_list(getdns_list *this_list, size_t index, const getdns_list *child_list);
|
||||
getdns_return_t getdns_list_set_bindata(getdns_list *this_list, size_t index, const getdns_bindata *child_bindata);
|
||||
getdns_return_t getdns_list_set_int(getdns_list *this_list, size_t index, uint32_t child_uint32);
|
||||
|
||||
/* Dicts: create, destroy, and set the data at a given name */
|
||||
struct getdns_dict * getdns_dict_create();
|
||||
struct getdns_dict * getdns_dict_create_with_context(
|
||||
struct getdns_context *context
|
||||
getdns_dict * getdns_dict_create();
|
||||
getdns_dict * getdns_dict_create_with_context(
|
||||
getdns_context *context
|
||||
);
|
||||
struct getdns_dict * getdns_dict_create_with_memory_functions(
|
||||
getdns_dict * getdns_dict_create_with_memory_functions(
|
||||
void *(*malloc)(size_t),
|
||||
void *(*realloc)(void *, size_t),
|
||||
void (*free)(void *)
|
||||
);
|
||||
struct getdns_dict * getdns_dict_create_with_extended_memory_functions(
|
||||
getdns_dict * getdns_dict_create_with_extended_memory_functions(
|
||||
void *userarg,
|
||||
void *(*malloc)(void *userarg, size_t),
|
||||
void *(*realloc)(void *userarg, void *, size_t),
|
||||
void (*free)(void *userarg, void *)
|
||||
);
|
||||
void getdns_dict_destroy(struct getdns_dict *this_dict);
|
||||
getdns_return_t getdns_dict_set_dict(struct getdns_dict *this_dict, const char *name, const struct getdns_dict *child_dict);
|
||||
getdns_return_t getdns_dict_set_list(struct getdns_dict *this_dict, const char *name, const struct getdns_list *child_list);
|
||||
getdns_return_t getdns_dict_set_bindata(struct getdns_dict *this_dict, const char *name, const struct getdns_bindata *child_bindata);
|
||||
getdns_return_t getdns_dict_set_int(struct getdns_dict *this_dict, const char *name, uint32_t child_uint32);
|
||||
getdns_return_t getdns_dict_remove_name(struct getdns_dict *this_dict, const char *name);
|
||||
void getdns_dict_destroy(getdns_dict *this_dict);
|
||||
getdns_return_t getdns_dict_set_dict(getdns_dict *this_dict, const char *name, const getdns_dict *child_dict);
|
||||
getdns_return_t getdns_dict_set_list(getdns_dict *this_dict, const char *name, const getdns_list *child_list);
|
||||
getdns_return_t getdns_dict_set_bindata(getdns_dict *this_dict, const char *name, const getdns_bindata *child_bindata);
|
||||
getdns_return_t getdns_dict_set_int(getdns_dict *this_dict, const char *name, uint32_t child_uint32);
|
||||
getdns_return_t getdns_dict_remove_name(getdns_dict *this_dict, const char *name);
|
||||
</div>
|
||||
|
||||
<p>Lists are extended with the <code>getdns_list_set_</code> calls with the <code>index</code> set to the
|
||||
|
@ -639,7 +639,7 @@ results that have been validated with DNSSEC, you might use:</p>
|
|||
|
||||
<pre>
|
||||
/* . . . */
|
||||
struct getdns_dict * this_extensions = getdns_dict_create();
|
||||
getdns_dict * this_extensions = getdns_dict_create();
|
||||
this_ret = getdns_dict_set_int(this_extensions, "dnssec_return_only_secure", GETDNS_EXTENSION_TRUE);
|
||||
/* . . . Do some processing with the extensions and results . . . */
|
||||
/* Remember to clean up memory*/
|
||||
|
@ -1127,14 +1127,14 @@ string in FQDN format to bytes in DNS format.</p>
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_convert_dns_name_to_fqdn(
|
||||
const struct getdns_bindata *dns_name_wire_fmt,
|
||||
const getdns_bindata *dns_name_wire_fmt,
|
||||
char **fqdn_as_string
|
||||
);
|
||||
|
||||
getdns_return_t
|
||||
getdns_convert_fqdn_to_dns_name(
|
||||
const char *fqdn_as_string,
|
||||
struct getdns_bindata **dns_name_wire_fmt
|
||||
getdns_bindata **dns_name_wire_fmt
|
||||
);
|
||||
</div>
|
||||
|
||||
|
@ -1145,17 +1145,17 @@ 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;
|
||||
<div class=forh id="Various">typedef struct getdns_context getdns_context;
|
||||
typedef uint64_t getdns_transaction_t;
|
||||
typedef enum getdns_data_type {
|
||||
t_dict, t_list, t_int, t_bindata
|
||||
} getdns_data_type;
|
||||
struct getdns_bindata {
|
||||
typedef struct getdns_bindata {
|
||||
size_t size;
|
||||
uint8_t *data;
|
||||
};
|
||||
struct getdns_dict;
|
||||
struct getdns_list;
|
||||
} getdns_bindata;
|
||||
typedef struct getdns_dict getdns_dict;
|
||||
typedef struct getdns_list getdns_list;
|
||||
</div>
|
||||
|
||||
<h2>5.2 <a id="ReturnCodes">Return Codes</a></h2>
|
||||
|
@ -1484,9 +1484,9 @@ function.</p>
|
|||
<span class="cp">#define UNUSED_PARAM(x) ((void)(x))</span>
|
||||
|
||||
<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">void</span> <span class="nf">this_callbackfn</span><span class="p">(</span><span class="n">getdns_context</span> <span class="o">*</span><span class="n">this_context</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="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>
|
||||
<span class="p">{</span>
|
||||
|
@ -1504,7 +1504,7 @@ function.</p>
|
|||
<span class="n">getdns_dict_destroy</span><span class="p">(</span><span class="n">this_response</span><span class="p">);</span>
|
||||
<span class="k">return</span><span class="p">;</span>
|
||||
<span class="p">}</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_list</span> <span class="o">*</span> <span class="n">just_the_addresses_ptr</span><span class="p">;</span>
|
||||
<span class="n">getdns_list</span> <span class="o">*</span> <span class="n">just_the_addresses_ptr</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_list</span><span class="p">(</span><span class="n">this_response</span><span class="p">,</span> <span class="s">"just_address_answers"</span><span class="p">,</span> <span class="o">&</span><span class="n">just_the_addresses_ptr</span><span class="p">);</span>
|
||||
<span class="k">if</span> <span class="p">(</span><span class="n">this_ret</span> <span class="o">!=</span> <span class="n">GETDNS_RETURN_GOOD</span><span class="p">)</span> <span class="c1">// This check is really not needed, but prevents a compiler error under "pedantic"</span>
|
||||
<span class="p">{</span>
|
||||
|
@ -1517,10 +1517,10 @@ function.</p>
|
|||
<span class="cm">/* Go through each record */</span>
|
||||
<span class="k">for</span> <span class="p">(</span> <span class="kt">size_t</span> <span class="n">rec_count</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">rec_count</span> <span class="o"><</span> <span class="n">num_addresses</span><span class="p">;</span> <span class="o">++</span><span class="n">rec_count</span> <span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_address</span><span class="p">;</span>
|
||||
<span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_address</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_list_get_dict</span><span class="p">(</span><span class="n">just_the_addresses_ptr</span><span class="p">,</span> <span class="n">rec_count</span><span class="p">,</span> <span class="o">&</span><span class="n">this_address</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
|
||||
<span class="cm">/* Just print the address */</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_bindata</span> <span class="o">*</span> <span class="n">this_address_data</span><span class="p">;</span>
|
||||
<span class="n">getdns_bindata</span> <span class="o">*</span> <span class="n">this_address_data</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_bindata</span><span class="p">(</span><span class="n">this_address</span><span class="p">,</span> <span class="s">"address_data"</span><span class="p">,</span> <span class="o">&</span><span class="n">this_address_data</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
|
||||
<span class="kt">char</span> <span class="o">*</span><span class="n">this_address_str</span> <span class="o">=</span> <span class="n">getdns_display_ip_address</span><span class="p">(</span><span class="n">this_address_data</span><span class="p">);</span>
|
||||
<span class="n">printf</span><span class="p">(</span><span class="s">"The address is %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">this_address_str</span><span class="p">);</span>
|
||||
|
@ -1537,7 +1537,7 @@ function.</p>
|
|||
<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span>
|
||||
<span class="p">{</span>
|
||||
<span class="cm">/* Create the DNS context for this call */</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_context</span> <span class="o">*</span><span class="n">this_context</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
|
||||
<span class="n">getdns_context</span> <span class="o">*</span><span class="n">this_context</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
|
||||
<span class="kt">getdns_return_t</span> <span class="n">context_create_return</span> <span class="o">=</span> <span class="n">getdns_context_create</span><span class="p">(</span><span class="o">&</span><span class="n">this_context</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
|
||||
<span class="k">if</span> <span class="p">(</span><span class="n">context_create_return</span> <span class="o">!=</span> <span class="n">GETDNS_RETURN_GOOD</span><span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
|
@ -1602,9 +1602,9 @@ their TTLs.</p>
|
|||
<span class="cp">#define UNUSED_PARAM(x) ((void)(x))</span>
|
||||
|
||||
<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">void</span> <span class="nf">this_callbackfn</span><span class="p">(</span><span class="n">getdns_context</span> <span class="o">*</span><span class="n">this_context</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="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>
|
||||
<span class="p">{</span>
|
||||
|
@ -1623,7 +1623,7 @@ their TTLs.</p>
|
|||
<span class="k">return</span><span class="p">;</span>
|
||||
<span class="p">}</span>
|
||||
<span class="cm">/* Find all the answers returned */</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_list</span> <span class="o">*</span> <span class="n">these_answers</span><span class="p">;</span>
|
||||
<span class="n">getdns_list</span> <span class="o">*</span> <span class="n">these_answers</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_list</span><span class="p">(</span><span class="n">this_response</span><span class="p">,</span> <span class="s">"replies_tree"</span><span class="p">,</span> <span class="o">&</span><span class="n">these_answers</span><span class="p">);</span>
|
||||
<span class="k">if</span> <span class="p">(</span><span class="n">this_ret</span> <span class="o">==</span> <span class="n">GETDNS_RETURN_NO_SUCH_DICT_NAME</span><span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
|
@ -1636,20 +1636,20 @@ their TTLs.</p>
|
|||
<span class="cm">/* Go through each answer */</span>
|
||||
<span class="k">for</span> <span class="p">(</span> <span class="kt">size_t</span> <span class="n">rec_count</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">rec_count</span> <span class="o"><</span> <span class="n">num_answers</span><span class="p">;</span> <span class="o">++</span><span class="n">rec_count</span> <span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_record</span><span class="p">;</span>
|
||||
<span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_record</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_list_get_dict</span><span class="p">(</span><span class="n">these_answers</span><span class="p">,</span> <span class="n">rec_count</span><span class="p">,</span> <span class="o">&</span><span class="n">this_record</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
|
||||
<span class="cm">/* Get the answer section */</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_list</span> <span class="o">*</span> <span class="n">this_answer</span><span class="p">;</span>
|
||||
<span class="n">getdns_list</span> <span class="o">*</span> <span class="n">this_answer</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_list</span><span class="p">(</span><span class="n">this_record</span><span class="p">,</span> <span class="s">"answer"</span><span class="p">,</span> <span class="o">&</span><span class="n">this_answer</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
|
||||
<span class="cm">/* Get each RR in the answer section */</span>
|
||||
<span class="kt">size_t</span> <span class="n">num_rrs</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_list_get_length</span><span class="p">(</span><span class="n">this_answer</span><span class="p">,</span> <span class="o">&</span><span class="n">num_rrs</span><span class="p">);</span>
|
||||
<span class="k">for</span> <span class="p">(</span> <span class="kt">size_t</span> <span class="n">rr_count</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">rr_count</span> <span class="o"><</span> <span class="n">num_rrs</span><span class="p">;</span> <span class="o">++</span><span class="n">rr_count</span> <span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span><span class="n">this_rr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
|
||||
<span class="n">getdns_dict</span> <span class="o">*</span><span class="n">this_rr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_list_get_dict</span><span class="p">(</span><span class="n">this_answer</span><span class="p">,</span> <span class="n">rr_count</span><span class="p">,</span> <span class="o">&</span><span class="n">this_rr</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
|
||||
<span class="cm">/* Get the RDATA */</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_rdata</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
|
||||
<span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_rdata</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_dict</span><span class="p">(</span><span class="n">this_rr</span><span class="p">,</span> <span class="s">"rdata"</span><span class="p">,</span> <span class="o">&</span><span class="n">this_rdata</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
|
||||
<span class="cm">/* Get the RDATA type */</span>
|
||||
<span class="kt">uint32_t</span> <span class="n">this_type</span><span class="p">;</span>
|
||||
|
@ -1657,7 +1657,7 @@ their TTLs.</p>
|
|||
<span class="cm">/* If it is type A or AAAA, print the value */</span>
|
||||
<span class="k">if</span> <span class="p">(</span><span class="n">this_type</span> <span class="o">==</span> <span class="n">GETDNS_RRTYPE_A</span><span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_bindata</span> <span class="o">*</span> <span class="n">this_a_record</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
|
||||
<span class="n">getdns_bindata</span> <span class="o">*</span> <span class="n">this_a_record</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_bindata</span><span class="p">(</span><span class="n">this_rdata</span><span class="p">,</span> <span class="s">"ipv4_address"</span><span class="p">,</span> <span class="o">&</span><span class="n">this_a_record</span><span class="p">);</span>
|
||||
<span class="k">if</span> <span class="p">(</span><span class="n">this_ret</span> <span class="o">==</span> <span class="n">GETDNS_RETURN_NO_SUCH_DICT_NAME</span><span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
|
@ -1672,7 +1672,7 @@ their TTLs.</p>
|
|||
<span class="p">}</span>
|
||||
<span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">this_type</span> <span class="o">==</span> <span class="n">GETDNS_RRTYPE_AAAA</span><span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_bindata</span> <span class="o">*</span> <span class="n">this_aaaa_record</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
|
||||
<span class="n">getdns_bindata</span> <span class="o">*</span> <span class="n">this_aaaa_record</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_bindata</span><span class="p">(</span><span class="n">this_rdata</span><span class="p">,</span> <span class="s">"ipv6_address"</span><span class="p">,</span> <span class="o">&</span><span class="n">this_aaaa_record</span><span class="p">);</span>
|
||||
<span class="k">if</span> <span class="p">(</span><span class="n">this_ret</span> <span class="o">==</span> <span class="n">GETDNS_RETURN_NO_SUCH_DICT_NAME</span><span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
|
@ -1698,7 +1698,7 @@ their TTLs.</p>
|
|||
<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span>
|
||||
<span class="p">{</span>
|
||||
<span class="cm">/* Create the DNS context for this call */</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_context</span> <span class="o">*</span><span class="n">this_context</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
|
||||
<span class="n">getdns_context</span> <span class="o">*</span><span class="n">this_context</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
|
||||
<span class="kt">getdns_return_t</span> <span class="n">context_create_return</span> <span class="o">=</span> <span class="n">getdns_context_create</span><span class="p">(</span><span class="o">&</span><span class="n">this_context</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
|
||||
<span class="k">if</span> <span class="p">(</span><span class="n">context_create_return</span> <span class="o">!=</span> <span class="n">GETDNS_RETURN_GOOD</span><span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
|
@ -1755,7 +1755,7 @@ callback function, add a check for the DNSSEC status. It shows how to add two
|
|||
extensions to the <code>extensions</code> argument of the call.</p>
|
||||
|
||||
<pre>
|
||||
struct getdns_dict * this_extensions = getdns_dict_create();
|
||||
getdns_dict * this_extensions = getdns_dict_create();
|
||||
this_ret = getdns_dict_set_int(this_extensions, "return_both_v4_and_v6", GETDNS_EXTENSION_TRUE);
|
||||
this_ret = getdns_dict_set_int(this_extensions, "dnssec_return_status", GETDNS_EXTENSION_TRUE);
|
||||
. . .
|
||||
|
@ -1795,7 +1795,7 @@ as it is for the synchronous example, it is just done in <code>main()</code>.</p
|
|||
<span class="p">{</span>
|
||||
<span class="kt">getdns_return_t</span> <span class="n">this_ret</span><span class="p">;</span> <span class="cm">/* Holder for all function returns */</span>
|
||||
<span class="cm">/* Create the DNS context for this call */</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_context</span> <span class="o">*</span><span class="n">this_context</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
|
||||
<span class="n">getdns_context</span> <span class="o">*</span><span class="n">this_context</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
|
||||
<span class="kt">getdns_return_t</span> <span class="n">context_create_return</span> <span class="o">=</span> <span class="n">getdns_context_create</span><span class="p">(</span><span class="o">&</span><span class="n">this_context</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
|
||||
<span class="k">if</span> <span class="p">(</span><span class="n">context_create_return</span> <span class="o">!=</span> <span class="n">GETDNS_RETURN_GOOD</span><span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
|
@ -1806,7 +1806,7 @@ as it is for the synchronous example, it is just done in <code>main()</code>.</p
|
|||
<span class="k">const</span> <span class="kt">char</span> <span class="o">*</span> <span class="n">this_name</span> <span class="o">=</span> <span class="s">"www.example.com"</span><span class="p">;</span>
|
||||
<span class="kt">uint8_t</span> <span class="n">this_request_type</span> <span class="o">=</span> <span class="n">GETDNS_RRTYPE_A</span><span class="p">;</span>
|
||||
<span class="cm">/* Get the A and AAAA records */</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_extensions</span> <span class="o">=</span> <span class="n">getdns_dict_create</span><span class="p">();</span>
|
||||
<span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_extensions</span> <span class="o">=</span> <span class="n">getdns_dict_create</span><span class="p">();</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_set_int</span><span class="p">(</span><span class="n">this_extensions</span><span class="p">,</span> <span class="s">"return_both_v4_and_v6"</span><span class="p">,</span> <span class="n">GETDNS_EXTENSION_TRUE</span><span class="p">);</span>
|
||||
<span class="k">if</span> <span class="p">(</span><span class="n">this_ret</span> <span class="o">!=</span> <span class="n">GETDNS_RETURN_GOOD</span><span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
|
@ -1815,7 +1815,7 @@ as it is for the synchronous example, it is just done in <code>main()</code>.</p
|
|||
<span class="n">getdns_context_destroy</span><span class="p">(</span><span class="n">this_context</span><span class="p">);</span>
|
||||
<span class="k">return</span><span class="p">(</span><span class="n">GETDNS_RETURN_GENERIC_ERROR</span><span class="p">);</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="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
|
||||
<span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_response</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
|
||||
|
||||
<span class="cm">/* Make the call */</span>
|
||||
<span class="kt">getdns_return_t</span> <span class="n">dns_request_return</span> <span class="o">=</span> <span class="n">getdns_general_sync</span><span class="p">(</span><span class="n">this_context</span><span class="p">,</span> <span class="n">this_name</span><span class="p">,</span> <span class="n">this_request_type</span><span class="p">,</span>
|
||||
|
@ -1841,17 +1841,17 @@ as it is for the synchronous example, it is just done in <code>main()</code>.</p
|
|||
<span class="n">getdns_context_destroy</span><span class="p">(</span><span class="n">this_context</span><span class="p">);</span>
|
||||
<span class="k">return</span><span class="p">(</span><span class="n">GETDNS_RETURN_GENERIC_ERROR</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_list</span> <span class="o">*</span> <span class="n">just_the_addresses_ptr</span><span class="p">;</span>
|
||||
<span class="n">getdns_list</span> <span class="o">*</span> <span class="n">just_the_addresses_ptr</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_list</span><span class="p">(</span><span class="n">this_response</span><span class="p">,</span> <span class="s">"just_address_answers"</span><span class="p">,</span> <span class="o">&</span><span class="n">just_the_addresses_ptr</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
|
||||
<span class="kt">size_t</span> <span class="n">num_addresses</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_list_get_length</span><span class="p">(</span><span class="n">just_the_addresses_ptr</span><span class="p">,</span> <span class="o">&</span><span class="n">num_addresses</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
|
||||
<span class="cm">/* Go through each record */</span>
|
||||
<span class="k">for</span> <span class="p">(</span> <span class="kt">size_t</span> <span class="n">rec_count</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">rec_count</span> <span class="o"><</span> <span class="n">num_addresses</span><span class="p">;</span> <span class="o">++</span><span class="n">rec_count</span> <span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_address</span><span class="p">;</span>
|
||||
<span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_address</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_list_get_dict</span><span class="p">(</span><span class="n">just_the_addresses_ptr</span><span class="p">,</span> <span class="n">rec_count</span><span class="p">,</span> <span class="o">&</span><span class="n">this_address</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
|
||||
<span class="cm">/* Just print the address */</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_bindata</span> <span class="o">*</span> <span class="n">this_address_data</span><span class="p">;</span>
|
||||
<span class="n">getdns_bindata</span> <span class="o">*</span> <span class="n">this_address_data</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_bindata</span><span class="p">(</span><span class="n">this_address</span><span class="p">,</span> <span class="s">"address_data"</span><span class="p">,</span> <span class="o">&</span><span class="n">this_address_data</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
|
||||
<span class="kt">char</span> <span class="o">*</span><span class="n">this_address_str</span> <span class="o">=</span> <span class="n">getdns_display_ip_address</span><span class="p">(</span><span class="n">this_address_data</span><span class="p">);</span>
|
||||
<span class="n">printf</span><span class="p">(</span><span class="s">"The address is %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">this_address_str</span><span class="p">);</span>
|
||||
|
@ -1883,9 +1883,9 @@ as it is for the synchronous example, it is just done in <code>main()</code>.</p
|
|||
<span class="cp">#define UNUSED_PARAM(x) ((void)(x))</span>
|
||||
|
||||
<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">void</span> <span class="nf">this_callbackfn</span><span class="p">(</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="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="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>
|
||||
<span class="p">{</span>
|
||||
|
@ -1904,34 +1904,34 @@ as it is for the synchronous example, it is just done in <code>main()</code>.</p
|
|||
<span class="n">getdns_dict_destroy</span><span class="p">(</span><span class="n">this_response</span><span class="p">);</span>
|
||||
<span class="k">return</span><span class="p">;</span>
|
||||
<span class="p">}</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_list</span> <span class="o">*</span><span class="n">replies_tree</span><span class="p">;</span>
|
||||
<span class="n">getdns_list</span> <span class="o">*</span><span class="n">replies_tree</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_list</span><span class="p">(</span><span class="n">this_response</span><span class="p">,</span> <span class="s">"replies_tree"</span><span class="p">,</span> <span class="o">&</span><span class="n">replies_tree</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
|
||||
<span class="kt">size_t</span> <span class="n">num_replies</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_list_get_length</span><span class="p">(</span><span class="n">replies_tree</span><span class="p">,</span> <span class="o">&</span><span class="n">num_replies</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
|
||||
<span class="cm">/* Go through each reply */</span>
|
||||
<span class="k">for</span> <span class="p">(</span> <span class="kt">size_t</span> <span class="n">reply_count</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">reply_count</span> <span class="o"><</span> <span class="n">num_replies</span><span class="p">;</span> <span class="o">++</span><span class="n">reply_count</span><span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_reply</span><span class="p">;</span>
|
||||
<span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_reply</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_list_get_dict</span><span class="p">(</span><span class="n">replies_tree</span><span class="p">,</span> <span class="n">reply_count</span><span class="p">,</span> <span class="o">&</span><span class="n">this_reply</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
|
||||
<span class="cm">/* Just print the address */</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_list</span><span class="o">*</span> <span class="n">reply_answers</span><span class="p">;</span>
|
||||
<span class="n">getdns_list</span><span class="o">*</span> <span class="n">reply_answers</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_list</span><span class="p">(</span><span class="n">this_reply</span><span class="p">,</span> <span class="s">"answer"</span><span class="p">,</span> <span class="o">&</span><span class="n">reply_answers</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
|
||||
<span class="kt">size_t</span> <span class="n">num_answers</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_list_get_length</span><span class="p">(</span><span class="n">reply_answers</span><span class="p">,</span> <span class="o">&</span><span class="n">num_answers</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
|
||||
<span class="cm">/* Go through each answer */</span>
|
||||
<span class="k">for</span> <span class="p">(</span> <span class="kt">size_t</span> <span class="n">answer_count</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">answer_count</span> <span class="o"><</span> <span class="n">num_answers</span><span class="p">;</span> <span class="o">++</span><span class="n">answer_count</span><span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_rr</span><span class="p">;</span>
|
||||
<span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_rr</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_list_get_dict</span><span class="p">(</span><span class="n">reply_answers</span><span class="p">,</span> <span class="n">answer_count</span><span class="p">,</span> <span class="o">&</span><span class="n">this_rr</span><span class="p">);</span>
|
||||
<span class="cm">/* Get the RDATA type */</span>
|
||||
<span class="kt">uint32_t</span> <span class="n">this_type</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_int</span><span class="p">(</span><span class="n">this_rr</span><span class="p">,</span> <span class="s">"type"</span><span class="p">,</span> <span class="o">&</span><span class="n">this_type</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
|
||||
<span class="k">if</span> <span class="p">(</span><span class="n">this_type</span> <span class="o">==</span> <span class="n">GETDNS_RRTYPE_PTR</span><span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span><span class="n">this_rdata</span><span class="p">;</span>
|
||||
<span class="n">getdns_dict</span> <span class="o">*</span><span class="n">this_rdata</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_dict</span><span class="p">(</span><span class="n">this_rr</span><span class="p">,</span> <span class="s">"rdata"</span><span class="p">,</span> <span class="o">&</span><span class="n">this_rdata</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
|
||||
|
||||
<span class="k">struct</span> <span class="n">getdns_bindata</span> <span class="o">*</span> <span class="n">this_dname</span><span class="p">;</span>
|
||||
<span class="n">getdns_bindata</span> <span class="o">*</span> <span class="n">this_dname</span><span class="p">;</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_bindata</span><span class="p">(</span><span class="n">this_rdata</span><span class="p">,</span> <span class="s">"rdata_raw"</span><span class="p">,</span> <span class="o">&</span><span class="n">this_dname</span><span class="p">);</span>
|
||||
<span class="kt">char</span> <span class="o">*</span><span class="n">this_dname_str</span> <span class="o">=</span> <span class="n">getdns_convert_dns_name_to_fqdn</span><span class="p">((</span><span class="kt">char</span> <span class="o">*</span><span class="p">)</span><span class="n">this_dname</span><span class="o">-></span><span class="n">data</span><span class="p">);</span>
|
||||
<span class="n">printf</span><span class="p">(</span><span class="s">"The dname is %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">this_dname_str</span><span class="p">);</span>
|
||||
|
@ -1952,7 +1952,7 @@ as it is for the synchronous example, it is just done in <code>main()</code>.</p
|
|||
<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span>
|
||||
<span class="p">{</span>
|
||||
<span class="cm">/* Create the DNS context for this call */</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_context</span> <span class="o">*</span><span class="n">this_context</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
|
||||
<span class="n">getdns_context</span> <span class="o">*</span><span class="n">this_context</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
|
||||
<span class="kt">getdns_return_t</span> <span class="n">context_create_return</span> <span class="o">=</span> <span class="n">getdns_context_create</span><span class="p">(</span><span class="o">&</span><span class="n">this_context</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
|
||||
<span class="k">if</span> <span class="p">(</span><span class="n">context_create_return</span> <span class="o">!=</span> <span class="n">GETDNS_RETURN_GOOD</span><span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
|
@ -1970,12 +1970,12 @@ as it is for the synchronous example, it is just done in <code>main()</code>.</p
|
|||
<span class="p">}</span>
|
||||
<span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="n">getdns_extension_set_libevent_base</span><span class="p">(</span><span class="n">this_context</span><span class="p">,</span> <span class="n">this_event_base</span><span class="p">);</span>
|
||||
<span class="cm">/* Set up the getdns call */</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_addr_to_look_up</span> <span class="o">=</span> <span class="n">getdns_dict_create</span><span class="p">();</span>
|
||||
<span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_addr_to_look_up</span> <span class="o">=</span> <span class="n">getdns_dict_create</span><span class="p">();</span>
|
||||
<span class="c1">// TODO: check the return value above</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_bindata</span> <span class="n">this_type</span> <span class="o">=</span> <span class="p">{</span> <span class="mi">4</span><span class="p">,</span> <span class="p">(</span><span class="kt">void</span> <span class="o">*</span><span class="p">)</span><span class="s">"IPv4"</span> <span class="p">};</span>
|
||||
<span class="n">getdns_bindata</span> <span class="n">this_type</span> <span class="o">=</span> <span class="p">{</span> <span class="mi">4</span><span class="p">,</span> <span class="p">(</span><span class="kt">void</span> <span class="o">*</span><span class="p">)</span><span class="s">"IPv4"</span> <span class="p">};</span>
|
||||
<span class="kt">getdns_return_t</span> <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_set_bindata</span><span class="p">(</span><span class="n">this_addr_to_look_up</span><span class="p">,</span> <span class="s">"address_type"</span><span class="p">,</span> <span class="o">&</span><span class="n">this_type</span><span class="p">);</span>
|
||||
<span class="n">UNUSED_PARAM</span><span class="p">(</span><span class="n">this_ret</span><span class="p">);</span>
|
||||
<span class="k">struct</span> <span class="n">getdns_bindata</span> <span class="n">this_ipv4_addr</span> <span class="o">=</span> <span class="p">{</span> <span class="mi">4</span><span class="p">,</span> <span class="p">(</span><span class="kt">void</span> <span class="o">*</span><span class="p">)</span><span class="s">"</span><span class="se">\x08\x08\x08\x08</span><span class="s">"</span> <span class="p">};</span>
|
||||
<span class="n">getdns_bindata</span> <span class="n">this_ipv4_addr</span> <span class="o">=</span> <span class="p">{</span> <span class="mi">4</span><span class="p">,</span> <span class="p">(</span><span class="kt">void</span> <span class="o">*</span><span class="p">)</span><span class="s">"</span><span class="se">\x08\x08\x08\x08</span><span class="s">"</span> <span class="p">};</span>
|
||||
<span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_set_bindata</span><span class="p">(</span><span class="n">this_addr_to_look_up</span><span class="p">,</span> <span class="s">"address_data"</span><span class="p">,</span> <span class="o">&</span><span class="n">this_ipv4_addr</span><span class="p">);</span>
|
||||
<span class="kt">char</span><span class="o">*</span> <span class="n">this_userarg</span> <span class="o">=</span> <span class="s">"somestring"</span><span class="p">;</span> <span class="c1">// Could add things here to help identify this call</span>
|
||||
<span class="kt">getdns_transaction_t</span> <span class="n">this_transaction_id</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
|
||||
|
@ -2032,9 +2032,9 @@ getdns_convert_alabel_to_ulabel(
|
|||
can use the <code>getdns_validate_dnssec()</code> helper function.</p>
|
||||
<div class=forh>getdns_return_t
|
||||
getdns_validate_dnssec(
|
||||
struct getdns_list *record_to_validate,
|
||||
struct getdns_list *bundle_of_support_records,
|
||||
struct getdns_list *trust_anchor_rdatas
|
||||
getdns_list *record_to_validate,
|
||||
getdns_list *bundle_of_support_records,
|
||||
getdns_list *trust_anchor_records
|
||||
);
|
||||
</div>
|
||||
<p class=cont>
|
||||
|
@ -2048,7 +2048,7 @@ The function returns one of <code>GETDNS_DNSSEC_SECURE</code>, <code>GETDNS_DNSS
|
|||
<div class=forh>
|
||||
char *
|
||||
getdns_pretty_print_dict(
|
||||
const struct getdns_dict *some_dict
|
||||
const getdns_dict *some_dict
|
||||
);
|
||||
</div>
|
||||
<p class=cont>This returns a string that is the nicely-formatted version
|
||||
|
@ -2057,7 +2057,7 @@ of the dict and all of the named elements in it.</p>
|
|||
<div class=forh>
|
||||
char *
|
||||
getdns_display_ip_address(
|
||||
const struct getdns_bindata *bindata_of_ipv4_or_ipv6_address
|
||||
const getdns_bindata *bindata_of_ipv4_or_ipv6_address
|
||||
);
|
||||
</div>
|
||||
<p class=cont>This returns a string that is the nicely-formatted version
|
||||
|
@ -2125,8 +2125,8 @@ success or <code>GETDNS_RETURN_CONTEXT_UPDATE_FAIL</code> for a failure to updat
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_context_update_callback(
|
||||
struct getdns_context *context,
|
||||
void (*value)(struct getdns_context *context, getdns_context_code_t changed_item)
|
||||
getdns_context *context,
|
||||
void (*value)(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,8 +2141,8 @@ specifies which of the context changed; the context codes are listed
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_resolution_type(
|
||||
struct getdns_context *context,
|
||||
getdns_resolution_t value
|
||||
getdns_context *context,
|
||||
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_RESOLUTION_RECURSING</code></span> or
|
||||
|
@ -2159,9 +2159,9 @@ return <code>GETDNS_RETURN_CONTEXT_UPDATE_FAIL</code>.</p>
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_namespaces(
|
||||
struct getdns_context *context,
|
||||
size_t namespace_count,
|
||||
getdns_namespace_t *namespaces
|
||||
getdns_context *context,
|
||||
size_t namespace_count,
|
||||
getdns_namespace_t *namespaces
|
||||
);</div>
|
||||
<p class=cont>The <code>namespaces</code> array contains an ordered list
|
||||
of namespaces that will be queried.
|
||||
|
@ -2184,8 +2184,8 @@ default is <span class=default>determined by the OS</span>.</p>
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_dns_transport(
|
||||
struct getdns_context *context,
|
||||
getdns_transport_t value
|
||||
getdns_context *context,
|
||||
getdns_transport_t value
|
||||
);</div>
|
||||
<p class=cont>Specifies what transport is used for DNS lookups.
|
||||
The value is <span class=default>
|
||||
|
@ -2197,8 +2197,8 @@ The value is <span class=default>
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_limit_outstanding_queries(
|
||||
struct getdns_context *context,
|
||||
uint16_t limit
|
||||
getdns_context *context,
|
||||
uint16_t limit
|
||||
);</div>
|
||||
<p class=cont>Specifies limit the number of outstanding DNS queries.
|
||||
The API will block itself from sending more queries if it is about to exceed
|
||||
|
@ -2209,8 +2209,8 @@ the number of outstanding DNS queries is unlimited.</p>
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_timeout(
|
||||
struct getdns_context *context,
|
||||
uint64_t timeout
|
||||
getdns_context *context,
|
||||
uint64_t timeout
|
||||
);</div>
|
||||
<p class=cont>Specifies number of milliseconds the API will wait for request to return.
|
||||
The default is <span class=default>not specified</span>.</p>
|
||||
|
@ -2220,8 +2220,8 @@ The default is <span class=default>not specified</span>.</p>
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_follow_redirects(
|
||||
struct getdns_context *context,
|
||||
getdns_redirects_t value
|
||||
getdns_context *context,
|
||||
getdns_redirects_t value
|
||||
);</div>
|
||||
<p class=cont>Specifies whether or not DNS queries follow redirects.
|
||||
The value is <span class=default><code>GETDNS_REDIRECTS_FOLLOW</code></span> for normal
|
||||
|
@ -2232,8 +2232,8 @@ through CNAME and DNAME to return the CNAME or DNAME, not the eventual target.</
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_dns_root_servers(
|
||||
struct getdns_context *context,
|
||||
struct getdns_list *addresses
|
||||
getdns_context *context,
|
||||
getdns_list *addresses
|
||||
);</div>
|
||||
<p class=cont>The list contains dicts that are addresses to be used for looking up top-level
|
||||
domains; the default is the list of <b>"normal" IANA root servers</b>. Each dict in the list
|
||||
|
@ -2245,8 +2245,8 @@ either "IPv4" or "IPv6") and <code>address_data</code> (whose value is a bindata
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_append_name(
|
||||
struct getdns_context *context,
|
||||
getdns_append_name_t value
|
||||
getdns_context *context,
|
||||
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.
|
||||
|
@ -2260,8 +2260,8 @@ whether or not to append the suffix given by <code>getdns_context_set_suffix</co
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_suffix(
|
||||
struct getdns_context *context,
|
||||
struct getdns_list *value
|
||||
getdns_context *context,
|
||||
getdns_list *value
|
||||
);</div>
|
||||
<p class=cont>The value is a list of bindatas that are strings that are
|
||||
to be appended based on <code>getdns_context_set_append_name</code>; the default is an <span
|
||||
|
@ -2276,8 +2276,8 @@ to allow non-ASCII octets and special characters in labels.</p>
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_dnssec_trust_anchors(
|
||||
struct getdns_context *context,
|
||||
struct getdns_list *value
|
||||
getdns_context *context,
|
||||
getdns_list *value
|
||||
);</div>
|
||||
<p class=cont>The value is a list of bindatas that are the DNSSEC trust anchors. The default
|
||||
is the trust anchors from the <span class=default>IANA root</span>. The trust anchors
|
||||
|
@ -2287,8 +2287,8 @@ are expressed as RDATAs from DNSKEY resource records.</p>
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_dnssec_allowed_skew(
|
||||
struct getdns_context *context,
|
||||
uint32_t value
|
||||
getdns_context *context,
|
||||
uint32_t value
|
||||
);</div>
|
||||
<p class=cont>The value is the number of seconds of skew that is allowed in either direction when
|
||||
checking an RRSIG's Expiration and Inception fields. The default
|
||||
|
@ -2307,8 +2307,8 @@ must do its own DNSSEC processing, possibly with the <code>getdns_validate_dnsse
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_upstream_recursive_servers(
|
||||
struct getdns_context *context,
|
||||
struct getdns_list *upstream_list
|
||||
getdns_context *context,
|
||||
getdns_list *upstream_list
|
||||
);</div>
|
||||
<p class=cont>The list of dicts define where a stub resolver will send queries. Each dict contains
|
||||
at least two names: <code>address_type</code> (whose value is a bindata; it is currently either
|
||||
|
@ -2326,8 +2326,8 @@ These come from RFC 2671.</p>
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_edns_maximum_udp_payload_size(
|
||||
struct getdns_context *context,
|
||||
uint16_t value
|
||||
getdns_context *context,
|
||||
uint16_t value
|
||||
);</div>
|
||||
<p class=cont>The value is between 512 and 65535; the default
|
||||
is <span class=default>512</span>.</p>
|
||||
|
@ -2335,8 +2335,8 @@ is <span class=default>512</span>.</p>
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_edns_extended_rcode(
|
||||
struct getdns_context *context,
|
||||
uint8_t value
|
||||
getdns_context *context,
|
||||
uint8_t value
|
||||
);</div>
|
||||
<p class=cont>The value is between 0 and 255; the default
|
||||
is <span class=default>0</span>.</p>
|
||||
|
@ -2344,8 +2344,8 @@ is <span class=default>0</span>.</p>
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_edns_version(
|
||||
struct getdns_context *context,
|
||||
uint8_t value
|
||||
getdns_context *context,
|
||||
uint8_t value
|
||||
);</div>
|
||||
<p class=cont>The value is between 0 and 255; the default
|
||||
is <span class=default>0</span>.</p>
|
||||
|
@ -2353,8 +2353,8 @@ is <span class=default>0</span>.</p>
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_edns_do_bit(
|
||||
struct getdns_context *context,
|
||||
uint8_t value
|
||||
getdns_context *context,
|
||||
uint8_t value
|
||||
);</div>
|
||||
<p class=cont>The value is between 0 and 1; the default
|
||||
is <span class=default>0</span>.</p>
|
||||
|
@ -2364,10 +2364,10 @@ is <span class=default>0</span>.</p>
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_memory_functions(
|
||||
struct getdns_context *context,
|
||||
void *(*malloc) (size_t),
|
||||
void *(*realloc) (void *, size_t),
|
||||
void (*free) (void *)
|
||||
getdns_context *context,
|
||||
void *(*malloc) (size_t),
|
||||
void *(*realloc) (void *, size_t),
|
||||
void (*free) (void *)
|
||||
);</div>
|
||||
<p class=cont>The given memory management functions will be used for creating the response dicts.
|
||||
The response dicts inherit the custom memory management functions from the context and will deallocate themselves (and their members) with the custom deallocator.
|
||||
|
@ -2376,11 +2376,11 @@ By default, the system <span class=default>malloc</span>, <span class=default>re
|
|||
<div class=forh>
|
||||
getdns_return_t
|
||||
getdns_context_set_extended_memory_functions(
|
||||
struct getdns_context *context,
|
||||
void *userarg,
|
||||
void *(*malloc)(void *userarg, size_t sz),
|
||||
void *(*realloc)(void *userarg, void *ptr, size_t sz),
|
||||
void (*free)(void *userarg, void *ptr)
|
||||
getdns_context *context,
|
||||
void *userarg,
|
||||
void *(*malloc)(void *userarg, size_t sz),
|
||||
void *(*realloc)(void *userarg, void *ptr, size_t sz),
|
||||
void (*free)(void *userarg, void *ptr)
|
||||
);</div>
|
||||
<p class=cont>The given extended memory management functions will be used for creating the response dicts.
|
||||
The value of <code>userarg</code> argument will be passed to the custom <code>malloc</code>, <code>realloc</code>, and <code>free</code>.
|
||||
|
@ -2428,7 +2428,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.399.tgz">a tarball</a> that includes the .h files,
|
||||
<p>There is <a href="getdns-0.400.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
|
||||
|
|
Loading…
Reference in New Issue