diff --git a/spec/example-all-functions.c b/spec/example-all-functions.c deleted file mode 100644 index 632bd4de..00000000 --- a/spec/example-all-functions.c +++ /dev/null @@ -1,347 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#define UNUSED_PARAM(x) ((void)(x)) - -/* The return values */ -getdns_return_t retregular; -char * retcharstar; - -/* The args */ -int boolarg; -char * charstararg; -char ** charstarptrarg; -getdns_callback_t callbackarg; -uint16_t regulararg; -uint16_t *regularptrarg; -getdns_transaction_t txidarg; -getdns_transaction_t * txidptrarg; -getdns_namespace_t *namespaceptrarg; -getdns_resolution_t resolutionarg; -getdns_redirects_t redirectsarg; -getdns_transport_t transportarg; -getdns_append_name_t appendnamearg; - -getdns_data_type * datatypeptrarg; -getdns_bindata ** bindataptrarg; -getdns_dict * dictarg; -getdns_bindata * bindataarg; -getdns_list * listarg; -getdns_dict ** dictptrarg; -getdns_list ** listptrarg; - -size_t sizetarg; -size_t * sizetptrarg; -getdns_context *contextarg = NULL; -uint8_t uint8arg; -uint16_t uint16arg; -uint32_t uint32arg; -uint8_t * uint8ptrarg; -uint16_t * uint16ptrarg; -uint32_t * uint32ptrarg; -void * arrayarg; -void * userarg; -void * allocfunctionarg(size_t foo) {UNUSED_PARAM(foo); return NULL; } -void * reallocfunctionarg(void* foo, size_t bar) - {UNUSED_PARAM(foo); UNUSED_PARAM(bar); return NULL; } -void deallocfunctionarg(void* foo) {UNUSED_PARAM(foo);} -void * extendedallocfunctionarg(void* userarg, size_t foo) - {UNUSED_PARAM(userarg); UNUSED_PARAM(foo); return NULL; } -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(getdns_context *foo1, getdns_context_code_t foo2) - {UNUSED_PARAM(foo1);UNUSED_PARAM(foo2);} - -int main() -{ - -retregular = getdns_general( - contextarg, - charstararg, - uint16arg, - dictarg, - arrayarg, - txidptrarg, - callbackarg -); - -retregular = getdns_address( - contextarg, - charstararg, - dictarg, - arrayarg, - txidptrarg, - callbackarg -); - -retregular = getdns_hostname( - contextarg, - dictarg, - dictarg, - arrayarg, - txidptrarg, - callbackarg -); - -retregular = getdns_service( - contextarg, - charstararg, - dictarg, - arrayarg, - txidptrarg, - callbackarg -); - -retregular = getdns_context_create( - &contextarg, - boolarg -); - -retregular = getdns_context_create_with_memory_functions( - &contextarg, - boolarg, - allocfunctionarg, - reallocfunctionarg, - deallocfunctionarg -); - -retregular = getdns_context_create_with_extended_memory_functions( - &contextarg, - boolarg, - userarg, - extendedallocfunctionarg, - extendedreallocfunctionarg, - extendeddeallocfunctionarg -); - -getdns_context_destroy( - contextarg -); - -retregular = getdns_cancel_callback( - contextarg, - txidarg -); - -retregular = getdns_general_sync( - contextarg, - charstararg, - uint16arg, - dictarg, - &dictarg -); - -retregular = getdns_address_sync( - contextarg, - charstararg, - dictarg, - &dictarg -); - -retregular = getdns_hostname_sync( - contextarg, - dictarg, - dictarg, - &dictarg -); - -retregular = getdns_service_sync( - contextarg, - charstararg, - dictarg, - &dictarg -); - -retregular = getdns_list_get_length(listarg, sizetptrarg); -retregular = getdns_list_get_data_type(listarg, sizetarg, datatypeptrarg); -retregular = getdns_list_get_dict(listarg, sizetarg, dictptrarg); -retregular = getdns_list_get_list(listarg, sizetarg, listptrarg); -retregular = getdns_list_get_bindata(listarg, sizetarg, bindataptrarg); -retregular = getdns_list_get_int(listarg, sizetarg, uint32ptrarg); - -retregular = getdns_dict_get_names(dictarg, listptrarg); -retregular = getdns_dict_get_data_type(dictarg, charstararg, datatypeptrarg); -retregular = getdns_dict_get_dict(dictarg, charstararg, dictptrarg); -retregular = getdns_dict_get_list(dictarg, charstararg, listptrarg); -retregular = getdns_dict_get_bindata(dictarg, charstararg, bindataptrarg); -retregular = getdns_dict_get_int(dictarg, charstararg, uint32ptrarg); - -listarg = getdns_list_create(); -listarg = getdns_list_create_with_context(contextarg); -listarg = getdns_list_create_with_memory_functions( - allocfunctionarg, - reallocfunctionarg, - deallocfunctionarg -); -listarg = getdns_list_create_with_extended_memory_functions( - userarg, - extendedallocfunctionarg, - extendedreallocfunctionarg, - extendeddeallocfunctionarg -); -getdns_list_destroy(listarg); -retregular = getdns_list_set_dict(listarg, sizetarg, dictarg); -retregular = getdns_list_set_list(listarg, sizetarg, listarg); -retregular = getdns_list_set_bindata(listarg, sizetarg, bindataarg); -retregular = getdns_list_set_int(listarg, sizetarg, uint32arg); - -dictarg = getdns_dict_create(); -dictarg = getdns_dict_create_with_context(contextarg); -dictarg = getdns_dict_create_with_memory_functions( - allocfunctionarg, - reallocfunctionarg, - deallocfunctionarg -); -dictarg = getdns_dict_create_with_extended_memory_functions( - userarg, - extendedallocfunctionarg, - extendedreallocfunctionarg, - extendeddeallocfunctionarg -); -getdns_dict_destroy(dictarg); -retregular = getdns_dict_set_dict(dictarg, charstararg, dictarg); -retregular = getdns_dict_set_list(dictarg, charstararg, listarg); -retregular = getdns_dict_set_bindata(dictarg, charstararg, bindataarg); -retregular = getdns_dict_set_int(dictarg, charstararg, uint32arg); -retregular = getdns_dict_remove_name(dictarg, charstararg); - -retregular = getdns_convert_fqdn_to_dns_name( - charstararg, - bindataptrarg -); - -retregular = getdns_convert_dns_name_to_fqdn( - bindataarg, - charstarptrarg -); - -retcharstar = getdns_convert_ulabel_to_alabel( - charstararg -); - -retcharstar = getdns_convert_alabel_to_ulabel( - charstararg -); - -retregular = getdns_validate_dnssec( - listarg, - listarg, - listarg -); - -retcharstar = getdns_pretty_print_dict( - dictarg -); - -retcharstar = getdns_display_ip_address( - bindataarg -); - -retregular = getdns_context_set_context_update_callback( - contextarg, - setcallbackfunctionarg -); - -retregular = getdns_context_set_resolution_type( - contextarg, - resolutionarg -); - -retregular = getdns_context_set_namespaces( - contextarg, - sizetarg, - namespaceptrarg -); - -retregular = getdns_context_set_dns_transport( - contextarg, - transportarg -); - -retregular = getdns_context_set_limit_outstanding_queries( - contextarg, - uint16arg -); - -retregular = getdns_context_set_timeout( - contextarg, - uint16arg -); - -retregular = getdns_context_set_follow_redirects( - contextarg, - redirectsarg -); - -retregular = getdns_context_set_dns_root_servers( - contextarg, - listarg -); - -retregular = getdns_context_set_append_name( - contextarg, - appendnamearg -); - -retregular = getdns_context_set_suffix( - contextarg, - listarg -); - -retregular = getdns_context_set_dnssec_trust_anchors( - contextarg, - listarg -); - -retregular = getdns_context_set_dnssec_allowed_skew( - contextarg, - uint16arg -); - -retregular = getdns_context_set_upstream_recursive_servers( - contextarg, - listarg -); - -retregular = getdns_context_set_edns_maximum_udp_payload_size( - contextarg, - uint16arg -); - -retregular = getdns_context_set_edns_extended_rcode( - contextarg, - uint8arg -); - -retregular = getdns_context_set_edns_version( - contextarg, - uint8arg -); - -retregular = getdns_context_set_edns_do_bit( - contextarg, - uint8arg -); - -retregular = getdns_context_set_memory_functions( - contextarg, - allocfunctionarg, - reallocfunctionarg, - deallocfunctionarg -); - -retregular = getdns_context_set_extended_memory_functions( - contextarg, - userarg, - extendedallocfunctionarg, - extendedreallocfunctionarg, - extendeddeallocfunctionarg -); - -return(0); } /* End of main() */ diff --git a/spec/example-reverse.c b/spec/example-reverse.c deleted file mode 100644 index 4f5c7751..00000000 --- a/spec/example-reverse.c +++ /dev/null @@ -1,135 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#define UNUSED_PARAM(x) ((void)(x)) - -/* Set up the callback function, which will also do the processing of the results */ -void this_callbackfn(getdns_context *this_context, - uint16_t this_callback_type, - getdns_dict *this_response, - void *this_userarg, - getdns_transaction_t this_transaction_id) -{ - getdns_return_t this_ret; /* Holder for all function returns */ - UNUSED_PARAM(this_userarg); /* Not looking at the userarg for this example */ - UNUSED_PARAM(this_context); /* Not looking at the context for this example */ - UNUSED_PARAM(this_ret); /* Set, but not read */ - if (this_callback_type == GETDNS_CALLBACK_COMPLETE) /* This is a callback with data */ - { - /* Be sure the search returned something */ - uint32_t this_error; - this_ret = getdns_dict_get_int(this_response, "status", &this_error); // Ignore any error - if (this_error != GETDNS_RESPSTATUS_GOOD) // If the search didn't return "good" - { - fprintf(stderr, "The search had no results, and a return value of %d. Exiting.\n", this_error); - getdns_dict_destroy(this_response); - return; - } - 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) - { - getdns_dict * this_reply; - this_ret = getdns_list_get_dict(replies_tree, reply_count, &this_reply); // Ignore any error - /* Just print the address */ - 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) - { - 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) - { - getdns_dict *this_rdata; - this_ret = getdns_dict_get_dict(this_rr, "rdata", &this_rdata); // Ignore any error - - 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); - free(this_dname_str); - - } - } - - } - } - else if (this_callback_type == GETDNS_CALLBACK_CANCEL) - fprintf(stderr, "The callback with ID %"PRIu64" was cancelled. Exiting.", this_transaction_id); - else - fprintf(stderr, "The callback got a callback_type of %d. Exiting.", this_callback_type); - getdns_dict_destroy(this_response); -} - -int main() -{ - /* Create the DNS context for this call */ - getdns_context *this_context = NULL; - getdns_return_t context_create_return = getdns_context_create(&this_context, 1); - if (context_create_return != GETDNS_RETURN_GOOD) - { - fprintf(stderr, "Trying to create the context failed: %d", context_create_return); - return(GETDNS_RETURN_GENERIC_ERROR); - } - /* Create an event base and put it in the context using the unknown function name */ - struct event_base *this_event_base; - this_event_base = event_base_new(); - if (this_event_base == NULL) - { - fprintf(stderr, "Trying to create the event base failed."); - getdns_context_destroy(this_context); - return(GETDNS_RETURN_GENERIC_ERROR); - } - (void)getdns_extension_set_libevent_base(this_context, this_event_base); - /* Set up the getdns call */ - getdns_dict * this_addr_to_look_up = getdns_dict_create(); - // TODO: check the return value above - 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); - 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; - - /* Make the call */ - getdns_return_t dns_request_return = getdns_hostname(this_context, this_addr_to_look_up, - NULL, this_userarg, &this_transaction_id, this_callbackfn); - if (dns_request_return == GETDNS_RETURN_BAD_DOMAIN_NAME) - { - char *ip_address_str = getdns_display_ip_address(&this_ipv4_addr); - - fprintf(stderr, "A bad IP address was used: %s. Exiting.\n", ip_address_str); - free(ip_address_str); - getdns_dict_destroy(this_addr_to_look_up); - event_base_free(this_event_base); - getdns_context_destroy(this_context); - return(GETDNS_RETURN_GENERIC_ERROR); - } - else - { - /* Call the event loop */ - int dispatch_return = event_base_dispatch(this_event_base); - UNUSED_PARAM(dispatch_return); - // TODO: check the return value above - } - /* Clean up */ - getdns_dict_destroy(this_addr_to_look_up); - event_base_free(this_event_base); - getdns_context_destroy(this_context); - /* Assuming we get here, leave gracefully */ - exit(EXIT_SUCCESS); -} diff --git a/spec/example-simple-answers.c b/spec/example-simple-answers.c deleted file mode 100644 index 1866543c..00000000 --- a/spec/example-simple-answers.c +++ /dev/null @@ -1,108 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#define UNUSED_PARAM(x) ((void)(x)) - -/* Set up the callback function, which will also do the processing of the results */ -void this_callbackfn(getdns_context *this_context, - getdns_callback_type_t this_callback_type, - getdns_dict *this_response, - void *this_userarg, - getdns_transaction_t this_transaction_id) -{ - UNUSED_PARAM(this_userarg); /* Not looking at the userarg for this example */ - UNUSED_PARAM(this_context); /* Not looking at the context for this example */ - getdns_return_t this_ret; /* Holder for all function returns */ - if (this_callback_type == GETDNS_CALLBACK_COMPLETE) /* This is a callback with data */ - { - /* Be sure the search returned something */ - uint32_t this_error; - this_ret = getdns_dict_get_int(this_response, "status", &this_error); // Ignore any error - if (this_error != GETDNS_RESPSTATUS_GOOD) // If the search didn't return "good" - { - fprintf(stderr, "The search had no results, and a return value of %d. Exiting.\n", this_error); - getdns_dict_destroy(this_response); - return; - } - 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" - { - fprintf(stderr, "Trying to get the answers failed: %d\n", this_ret); - getdns_dict_destroy(this_response); - return; - } - 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 ) - { - 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 */ - 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); - free(this_address_str); - } - } - else if (this_callback_type == GETDNS_CALLBACK_CANCEL) - fprintf(stderr, "The callback with ID %"PRIu64" was cancelled. Exiting.\n", this_transaction_id); - else - fprintf(stderr, "The callback got a callback_type of %d. Exiting.\n", this_callback_type); - getdns_dict_destroy(this_response); -} - -int main() -{ - /* Create the DNS context for this call */ - getdns_context *this_context = NULL; - getdns_return_t context_create_return = getdns_context_create(&this_context, 1); - if (context_create_return != GETDNS_RETURN_GOOD) - { - fprintf(stderr, "Trying to create the context failed: %d", context_create_return); - return(GETDNS_RETURN_GENERIC_ERROR); - } - /* Create an event base and put it in the context using the unknown function name */ - struct event_base *this_event_base; - this_event_base = event_base_new(); - if (this_event_base == NULL) - { - fprintf(stderr, "Trying to create the event base failed.\n"); - getdns_context_destroy(this_context); - return(GETDNS_RETURN_GENERIC_ERROR); - } - (void)getdns_extension_set_libevent_base(this_context, this_event_base); - /* Set up the getdns call */ - const char * this_name = "www.example.com"; - char* this_userarg = "somestring"; // Could add things here to help identify this call - getdns_transaction_t this_transaction_id = 0; - - /* Make the call */ - getdns_return_t dns_request_return = getdns_address(this_context, this_name, - NULL, this_userarg, &this_transaction_id, this_callbackfn); - if (dns_request_return == GETDNS_RETURN_BAD_DOMAIN_NAME) - { - fprintf(stderr, "A bad domain name was used: %s. Exiting.\n", this_name); - event_base_free(this_event_base); - getdns_context_destroy(this_context); - return(GETDNS_RETURN_GENERIC_ERROR); - } - else - { - /* Call the event loop */ - int dispatch_return = event_base_dispatch(this_event_base); - UNUSED_PARAM(dispatch_return); - // TODO: check the return value above - } - /* Clean up */ - event_base_free(this_event_base); - getdns_context_destroy(this_context); - /* Assuming we get here, leave gracefully */ - exit(EXIT_SUCCESS); -} diff --git a/spec/example-synchronous.c b/spec/example-synchronous.c deleted file mode 100644 index 4095388b..00000000 --- a/spec/example-synchronous.c +++ /dev/null @@ -1,81 +0,0 @@ -#include -#include -#include -#include -#include -#include - -int main() -{ - getdns_return_t this_ret; /* Holder for all function returns */ - /* Create the DNS context for this call */ - getdns_context *this_context = NULL; - getdns_return_t context_create_return = getdns_context_create(&this_context, 1); - if (context_create_return != GETDNS_RETURN_GOOD) - { - fprintf(stderr, "Trying to create the context failed: %d\n", context_create_return); - return(GETDNS_RETURN_GENERIC_ERROR); - } - /* Set up the getdns_sync_request call */ - const char * this_name = "www.example.com"; - uint8_t this_request_type = GETDNS_RRTYPE_A; - /* Get the A and AAAA records */ - 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) - { - fprintf(stderr, "Trying to set an extension do both IPv4 and IPv6 failed: %d\n", this_ret); - getdns_dict_destroy(this_extensions); - getdns_context_destroy(this_context); - return(GETDNS_RETURN_GENERIC_ERROR); - } - getdns_dict * this_response = NULL; - - /* Make the call */ - getdns_return_t dns_request_return = getdns_general_sync(this_context, this_name, this_request_type, - this_extensions, &this_response); - if (dns_request_return == GETDNS_RETURN_BAD_DOMAIN_NAME) - { - fprintf(stderr, "A bad domain name was used: %s. Exiting.\n", this_name); - getdns_dict_destroy(this_response); - getdns_dict_destroy(this_extensions); - getdns_context_destroy(this_context); - return(GETDNS_RETURN_GENERIC_ERROR); - } - else - { - /* Be sure the search returned something */ - uint32_t this_error; - this_ret = getdns_dict_get_int(this_response, "status", &this_error); // Ignore any error - if (this_error != GETDNS_RESPSTATUS_GOOD) // If the search didn't return "good" - { - fprintf(stderr, "The search had no results, and a return value of %d. Exiting.\n", this_error); - getdns_dict_destroy(this_response); - getdns_dict_destroy(this_extensions); - getdns_context_destroy(this_context); - return(GETDNS_RETURN_GENERIC_ERROR); - } - 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 ) - { - 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 */ - 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); - free(this_address_str); - } - } - /* Clean up */ - getdns_dict_destroy(this_response); - getdns_dict_destroy(this_extensions); - getdns_context_destroy(this_context); - /* Assuming we get here, leave gracefully */ - exit(EXIT_SUCCESS); -} diff --git a/spec/example-tree.c b/spec/example-tree.c deleted file mode 100644 index f815baee..00000000 --- a/spec/example-tree.c +++ /dev/null @@ -1,151 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#define UNUSED_PARAM(x) ((void)(x)) - -/* Set up the callback function, which will also do the processing of the results */ -void this_callbackfn(getdns_context *this_context, - getdns_callback_type_t this_callback_type, - getdns_dict *this_response, - void *this_userarg, - getdns_transaction_t this_transaction_id) -{ - UNUSED_PARAM(this_userarg); /* Not looking at the userarg for this example */ - UNUSED_PARAM(this_context); /* Not looking at the context for this example */ - getdns_return_t this_ret; /* Holder for all function returns */ - if (this_callback_type == GETDNS_CALLBACK_COMPLETE) /* This is a callback with data */ - { - /* Be sure the search returned something */ - uint32_t this_error; - this_ret = getdns_dict_get_int(this_response, "status", &this_error); // Ignore any error - if (this_error != GETDNS_RESPSTATUS_GOOD) // If the search didn't return "good" - { - fprintf(stderr, "The search had no results, and a return value of %d. Exiting.\n", this_error); - getdns_dict_destroy(this_response); - return; - } - /* Find all the answers returned */ - 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) - { - fprintf(stderr, "Weird: the response had no error, but also no replies_tree. Exiting.\n"); - getdns_dict_destroy(this_response); - return; - } - size_t num_answers; - this_ret = getdns_list_get_length(these_answers, &num_answers); - /* Go through each answer */ - for ( size_t rec_count = 0; rec_count < num_answers; ++rec_count ) - { - getdns_dict * this_record; - this_ret = getdns_list_get_dict(these_answers, rec_count, &this_record); // Ignore any error - /* Get the answer section */ - 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 ) - { - getdns_dict *this_rr = NULL; - this_ret = getdns_list_get_dict(this_answer, rr_count, &this_rr); // Ignore any error - /* Get the RDATA */ - 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; - this_ret = getdns_dict_get_int(this_rr, "type", &this_type); // Ignore any error - /* If it is type A or AAAA, print the value */ - if (this_type == GETDNS_RRTYPE_A) - { - 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) - { - fprintf(stderr, "Weird: the A record at %d in record at %d had no address. Exiting.\n", - (int) rr_count, (int) rec_count); - getdns_dict_destroy(this_response); - return; - } - char *this_address_str = getdns_display_ip_address(this_a_record); - printf("The IPv4 address is %s\n", this_address_str); - free(this_address_str); - } - else if (this_type == GETDNS_RRTYPE_AAAA) - { - 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) - { - fprintf(stderr, "Weird: the AAAA record at %d in record at %d had no address. Exiting.\n", - (int) rr_count, (int) rec_count); - getdns_dict_destroy(this_response); - return; - } - char *this_address_str = getdns_display_ip_address(this_aaaa_record); - printf("The IPv6 address is %s\n", this_address_str); - free(this_address_str); - } - } - } - } - else if (this_callback_type == GETDNS_CALLBACK_CANCEL) - fprintf(stderr, "The callback with ID %"PRIu64" was cancelled. Exiting.\n", this_transaction_id); - else - fprintf(stderr, "The callback got a callback_type of %d. Exiting.\n", this_callback_type); - getdns_dict_destroy(this_response); -} - -int main() -{ - /* Create the DNS context for this call */ - getdns_context *this_context = NULL; - getdns_return_t context_create_return = getdns_context_create(&this_context, 1); - if (context_create_return != GETDNS_RETURN_GOOD) - { - fprintf(stderr, "Trying to create the context failed: %d\n", context_create_return); - return(GETDNS_RETURN_GENERIC_ERROR); - } - /* Create an event base and put it in the context using the unknown function name */ - struct event_base *this_event_base; - this_event_base = event_base_new(); - if (this_event_base == NULL) - { - fprintf(stderr, "Trying to create the event base failed.\n"); - getdns_context_destroy(this_context); - return(GETDNS_RETURN_GENERIC_ERROR); - } - (void)getdns_extension_set_libevent_base(this_context, this_event_base); - /* Set up the getdns call */ - const char * this_name = "www.example.com"; - char* this_userarg = "somestring"; // Could add things here to help identify this call - getdns_transaction_t this_transaction_id = 0; - - /* Make the call */ - getdns_return_t dns_request_return = getdns_address(this_context, this_name, - NULL, this_userarg, &this_transaction_id, this_callbackfn); - if (dns_request_return == GETDNS_RETURN_BAD_DOMAIN_NAME) - { - fprintf(stderr, "A bad domain name was used: %s. Exiting.\n", this_name); - event_base_free(this_event_base); - getdns_context_destroy(this_context); - return(GETDNS_RETURN_GENERIC_ERROR); - } - else - { - /* Call the event loop */ - int dispatch_return = event_base_dispatch(this_event_base); - UNUSED_PARAM(dispatch_return); - // TODO: check the return value above - } - /* Clean up */ - event_base_free(this_event_base); - getdns_context_destroy(this_context); - /* Assuming we get here, leave gracefully */ - exit(EXIT_SUCCESS); -} diff --git a/spec/getdns_core_only.c b/spec/getdns_core_only.c deleted file mode 100644 index ca69a26e..00000000 --- a/spec/getdns_core_only.c +++ /dev/null @@ -1,471 +0,0 @@ -#include - -/* stuff to make it compile pedantically */ -#define UNUSED_PARAM(x) ((void)(x)) - -int main(){ return(0); } - -/* Function definitions */ - -getdns_return_t -getdns_general( - getdns_context *context, - const char *name, - uint16_t request_type, - getdns_dict *extensions, - void *userarg, - getdns_transaction_t *transaction_id, - getdns_callback_t callback -) -{ UNUSED_PARAM(context); UNUSED_PARAM(name); UNUSED_PARAM(request_type); UNUSED_PARAM(extensions); UNUSED_PARAM(userarg); -UNUSED_PARAM(transaction_id); UNUSED_PARAM(callback); return GETDNS_RETURN_GOOD; } - -getdns_return_t -getdns_address( - getdns_context *context, - const char *name, - getdns_dict *extensions, - void *userarg, - getdns_transaction_t *transaction_id, - getdns_callback_t callback -) -{ UNUSED_PARAM(context); UNUSED_PARAM(name); UNUSED_PARAM(extensions); UNUSED_PARAM(userarg); -UNUSED_PARAM(transaction_id); UNUSED_PARAM(callback); return GETDNS_RETURN_GOOD; } - -getdns_return_t -getdns_hostname( - getdns_context *context, - getdns_dict *address, - getdns_dict *extensions, - void *userarg, - getdns_transaction_t *transaction_id, - getdns_callback_t callback -) -{ UNUSED_PARAM(context); UNUSED_PARAM(address); UNUSED_PARAM(extensions); UNUSED_PARAM(userarg); -UNUSED_PARAM(transaction_id); UNUSED_PARAM(callback); return GETDNS_RETURN_GOOD; } - -getdns_return_t -getdns_service( - getdns_context *context, - const char *name, - getdns_dict *extensions, - void *userarg, - getdns_transaction_t *transaction_id, - getdns_callback_t callback -) -{ UNUSED_PARAM(context); UNUSED_PARAM(name); UNUSED_PARAM(extensions); UNUSED_PARAM(userarg); -UNUSED_PARAM(transaction_id); UNUSED_PARAM(callback); return GETDNS_RETURN_GOOD; } - -getdns_return_t -getdns_context_create( - 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( - getdns_context **context, - int set_from_os, - void *(*malloc)(size_t), - void *(*realloc)(void *, size_t), - void (*free)(void *) -) -{ UNUSED_PARAM(context); UNUSED_PARAM(set_from_os); - UNUSED_PARAM(malloc); UNUSED_PARAM(realloc); UNUSED_PARAM(free); - return GETDNS_RETURN_GOOD; } - -getdns_return_t -getdns_context_create_with_extended_memory_functions( - 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 *) -) -{ UNUSED_PARAM(context); UNUSED_PARAM(set_from_os); UNUSED_PARAM(userarg); - UNUSED_PARAM(malloc); UNUSED_PARAM(realloc); UNUSED_PARAM(free); - return GETDNS_RETURN_GOOD; } - -void -getdns_context_destroy( - getdns_context *context -) -{ UNUSED_PARAM(context); } - -getdns_return_t -getdns_cancel_callback( - 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( - getdns_context *context, - const char *name, - uint16_t request_type, - 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( - getdns_context *context, - const char *name, - 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( - 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( - getdns_context *context, - const char *name, - 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( - getdns_dict *response -) -{ UNUSED_PARAM(response); } - -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 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 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 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 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 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 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 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 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 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 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 getdns_dict *this_dict, const char *name, uint32_t *answer) -{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; } - -getdns_list * getdns_list_create() -{ return NULL; } - -getdns_list * getdns_list_create_with_context( - getdns_context *context -) -{ UNUSED_PARAM(context); return NULL; } - -getdns_list * getdns_list_create_with_memory_functions( - void *(*malloc)(size_t), - void *(*realloc)(void *, size_t), - void (*free)(void *) -) -{ UNUSED_PARAM(malloc); UNUSED_PARAM(realloc); UNUSED_PARAM(free); - return NULL; } - -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 *) -) -{ UNUSED_PARAM(userarg); - UNUSED_PARAM(malloc); UNUSED_PARAM(realloc); UNUSED_PARAM(free); - return NULL; } - -void getdns_list_destroy(getdns_list *this_list) -{ UNUSED_PARAM(this_list); } - -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(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(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(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; } - -getdns_dict * getdns_dict_create() -{ return NULL; } - -getdns_dict * getdns_dict_create_with_context( - getdns_context *context -) -{ UNUSED_PARAM(context); return NULL; } - -getdns_dict * getdns_dict_create_with_memory_functions( - void *(*malloc)(size_t), - void *(*realloc)(void *, size_t), - void (*free)(void *) -) -{ UNUSED_PARAM(malloc); UNUSED_PARAM(realloc); UNUSED_PARAM(free); - return NULL; } - -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 *) -) -{ UNUSED_PARAM(userarg); - UNUSED_PARAM(malloc); UNUSED_PARAM(realloc); UNUSED_PARAM(free); - return NULL; } - -void getdns_dict_destroy(getdns_dict *this_dict) -{ UNUSED_PARAM(this_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(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(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(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(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 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; } - -getdns_return_t -getdns_convert_fqdn_to_dns_name( - const char *fqdn_as_string, - getdns_bindata **dns_name_wire_fmt -) -{ UNUSED_PARAM(fqdn_as_string); UNUSED_PARAM(dns_name_wire_fmt); return GETDNS_RETURN_GOOD; } - -char * -getdns_convert_ulabel_to_alabel( - const char *ulabel -) -{ UNUSED_PARAM(ulabel); return NULL; } - -char * -getdns_convert_alabel_to_ulabel( - const char *alabel -) -{ UNUSED_PARAM(alabel); return NULL; } - -getdns_return_t -getdns_validate_dnssec( - 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; } - - -char * -getdns_pretty_print_dict( - const getdns_dict *some_dict -) -{ UNUSED_PARAM(some_dict); return NULL; } - -char * -getdns_display_ip_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( - 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( - getdns_context *context, - getdns_resolution_t value -) -{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; } - -getdns_return_t -getdns_context_set_namespaces( - getdns_context *context, - size_t namespace_count, - getdns_namespace_t *namespaces -) -{ UNUSED_PARAM(context); UNUSED_PARAM(namespace_count); UNUSED_PARAM(namespaces); -return GETDNS_RETURN_GOOD; } - -getdns_return_t -getdns_context_set_dns_transport( - 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( - getdns_context *context, - uint16_t limit -) -{ UNUSED_PARAM(context); UNUSED_PARAM(limit); return GETDNS_RETURN_GOOD; } - -getdns_return_t -getdns_context_set_timeout( - getdns_context *context, - uint64_t timeout -) -{ UNUSED_PARAM(context); UNUSED_PARAM(timeout); return GETDNS_RETURN_GOOD; } - -getdns_return_t -getdns_context_set_follow_redirects( - 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( - getdns_context *context, - getdns_list *addresses -) -{ UNUSED_PARAM(context); UNUSED_PARAM(addresses); return GETDNS_RETURN_GOOD; } - -getdns_return_t -getdns_context_set_append_name( - 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( - 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( - 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( - 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( - 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( - 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( - getdns_context *context, - uint8_t value -) -{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; } - -getdns_return_t -getdns_context_set_edns_version( - 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( - getdns_context *context, - uint8_t value -) -{ UNUSED_PARAM(context); UNUSED_PARAM(value); return GETDNS_RETURN_GOOD; } - -getdns_return_t -getdns_context_set_memory_functions( - getdns_context *context, - void *(*malloc) (size_t), - void *(*realloc) (void *, size_t), - void (*free) (void *) -) -{ UNUSED_PARAM(context); - UNUSED_PARAM(malloc); UNUSED_PARAM(realloc); UNUSED_PARAM(free); - return GETDNS_RETURN_GOOD; } - -getdns_return_t -getdns_context_set_extended_memory_functions( - 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) -) -{ UNUSED_PARAM(context); UNUSED_PARAM(userarg); - UNUSED_PARAM(malloc); UNUSED_PARAM(realloc); UNUSED_PARAM(free); - return GETDNS_RETURN_GOOD; } - - -getdns_return_t -getdns_extension_set_libevent_base( - getdns_context *context, - struct event_base *this_event_base -) -{ UNUSED_PARAM(context); UNUSED_PARAM(this_event_base); return GETDNS_RETURN_GOOD; } - diff --git a/spec/getdns_core_only.h b/spec/getdns_core_only.h deleted file mode 100644 index 9bcab902..00000000 --- a/spec/getdns_core_only.h +++ /dev/null @@ -1,673 +0,0 @@ -/* Created at 2014-02-19-15-06-22*/ -#ifndef GETDNS_H -#define GETDNS_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define GETDNS_COMPILATION_COMMENT The API implementation should fill in something here, such as a compilation version string and date, and change it each time the API is compiled. - -/* Return values */ -typedef enum getdns_return_t { - GETDNS_RETURN_GOOD = 0, - GETDNS_RETURN_GENERIC_ERROR = 1, - GETDNS_RETURN_BAD_DOMAIN_NAME = 300, - GETDNS_RETURN_BAD_CONTEXT = 301, - GETDNS_RETURN_CONTEXT_UPDATE_FAIL = 302, - GETDNS_RETURN_UNKNOWN_TRANSACTION = 303, - GETDNS_RETURN_NO_SUCH_LIST_ITEM = 304, - GETDNS_RETURN_NO_SUCH_DICT_NAME = 305, - GETDNS_RETURN_WRONG_TYPE_REQUESTED = 306, - GETDNS_RETURN_NO_SUCH_EXTENSION = 307, - GETDNS_RETURN_EXTENSION_MISFORMAT = 308, - GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED = 309, - GETDNS_RETURN_MEMORY_ERROR = 310, - GETDNS_RETURN_INVALID_PARAMETER = 311 -} getdns_return_t; - -#define GETDNS_RETURN_GOOD_TEXT "Good" -#define GETDNS_RETURN_GENERIC_ERROR_TEXT "Generic error" -#define GETDNS_RETURN_BAD_DOMAIN_NAME_TEXT "Badly-formed domain name in first argument" -#define GETDNS_RETURN_BAD_CONTEXT_TEXT "The context has internal deficiencies" -#define GETDNS_RETURN_CONTEXT_UPDATE_FAIL_TEXT "Did not update the context" -#define GETDNS_RETURN_UNKNOWN_TRANSACTION_TEXT "An attempt was made to cancel a callback with a transaction_id that is not recognized" -#define GETDNS_RETURN_NO_SUCH_LIST_ITEM_TEXT "A helper function for lists had an index argument that was too high." -#define GETDNS_RETURN_NO_SUCH_DICT_NAME_TEXT "A helper function for dicts had a name argument that for a name that is not in the dict." -#define GETDNS_RETURN_WRONG_TYPE_REQUESTED_TEXT "A helper function was supposed to return a certain type for an item, but the wrong type was given." -#define GETDNS_RETURN_NO_SUCH_EXTENSION_TEXT "A name in the extensions dict is not a valid extension." -#define GETDNS_RETURN_EXTENSION_MISFORMAT_TEXT "One or more of the extensions have a bad format." -#define GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED_TEXT "A query was made with a context that is using stub resolution and a DNSSEC extension specified." -#define GETDNS_RETURN_MEMORY_ERROR_TEXT "Unable to allocate the memory required." -#define GETDNS_RETURN_INVALID_PARAMETER_TEXT "A required parameter had an invalid value." - -/* DNSSEC values */ -#define GETDNS_DNSSEC_SECURE 400 -#define GETDNS_DNSSEC_SECURE_TEXT "The record was determined to be secure in DNSSEC" -#define GETDNS_DNSSEC_BOGUS 401 -#define GETDNS_DNSSEC_BOGUS_TEXT "The record was determined to be bogus in DNSSEC" -#define GETDNS_DNSSEC_INDETERMINATE 402 -#define GETDNS_DNSSEC_INDETERMINATE_TEXT "The record was not determined to be any state in DNSSEC" -#define GETDNS_DNSSEC_INSECURE 403 -#define GETDNS_DNSSEC_INSECURE_TEXT "The record was determined to be insecure in DNSSEC" -#define GETDNS_DNSSEC_NOT_PERFORMED 404 -#define GETDNS_DNSSEC_NOT_PERFORMED_TEXT "DNSSEC validation was not performed (only used for debugging)" - -/* Namespace types */ -typedef enum getdns_namespace_t { - GETDNS_NAMESPACE_DNS = 500, - GETDNS_NAMESPACE_LOCALNAMES = 501, - GETDNS_NAMESPACE_NETBIOS = 502, - GETDNS_NAMESPACE_MDNS = 503, - GETDNS_NAMESPACE_NIS = 504 -} getdns_namespace_t; - -#define GETDNS_NAMESPACE_DNS_TEXT "See getdns_context_set_namespaces()" -#define GETDNS_NAMESPACE_LOCALNAMES_TEXT "See getdns_context_set_namespaces()" -#define GETDNS_NAMESPACE_NETBIOS_TEXT "See getdns_context_set_namespaces()" -#define GETDNS_NAMESPACE_MDNS_TEXT "See getdns_context_set_namespaces()" -#define GETDNS_NAMESPACE_NIS_TEXT "See getdns_context_set_namespaces()" - -/* Resolution types */ -typedef enum getdns_resolution_t { - GETDNS_RESOLUTION_STUB = 520, - GETDNS_RESOLUTION_RECURSING = 521 -} getdns_resolution_t; - -#define GETDNS_RESOLUTION_STUB_TEXT "See getdns_context_set_resolution_type()" -#define GETDNS_RESOLUTION_RECURSING_TEXT "See getdns_context_set_resolution_type()" - -/* Redirect policies */ -typedef enum getdns_redirects_t { - GETDNS_REDIRECTS_FOLLOW = 530, - GETDNS_REDIRECTS_DO_NOT_FOLLOW = 531 -} getdns_redirects_t; - -#define GETDNS_REDIRECTS_FOLLOW_TEXT "See getdns_context_set_follow_redirects()" -#define GETDNS_REDIRECTS_DO_NOT_FOLLOW_TEXT "See getdns_context_set_follow_redirects()" - -/* Transport arrangements */ -typedef enum getdns_transport_t { - GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP = 540, - GETDNS_TRANSPORT_UDP_ONLY = 541, - GETDNS_TRANSPORT_TCP_ONLY = 542, - GETDNS_TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN = 543 -} getdns_transport_t; - -#define GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP_TEXT "See getdns_context_set_dns_transport()" -#define GETDNS_TRANSPORT_UDP_ONLY_TEXT "See getdns_context_set_dns_transport()" -#define GETDNS_TRANSPORT_TCP_ONLY_TEXT "See getdns_context_set_dns_transport()" -#define GETDNS_TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN_TEXT "See getdns_context_set_dns_transport()" - -/* Suffix appending methods */ -typedef enum getdns_append_name_t { - GETDNS_APPEND_NAME_ALWAYS = 550, - GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE = 551, - GETDNS_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE = 552, - GETDNS_APPEND_NAME_NEVER = 553 -} getdns_append_name_t; - -#define GETDNS_APPEND_NAME_ALWAYS_TEXT "See getdns_context_set_append_name()" -#define GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE_TEXT "See getdns_context_set_append_name()" -#define GETDNS_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE_TEXT "See getdns_context_set_append_name()" -#define GETDNS_APPEND_NAME_NEVER_TEXT "See getdns_context_set_append_name()" - -/* Context codes */ -typedef enum getdns_context_code_t { - GETDNS_CONTEXT_CODE_NAMESPACES = 600, - GETDNS_CONTEXT_CODE_RESOLUTION_TYPE = 601, - GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS = 602, - GETDNS_CONTEXT_CODE_UPSTREAM_RECURSIVE_SERVERS = 603, - GETDNS_CONTEXT_CODE_DNS_ROOT_SERVERS = 604, - GETDNS_CONTEXT_CODE_DNS_TRANSPORT = 605, - GETDNS_CONTEXT_CODE_LIMIT_OUTSTANDING_QUERIES = 606, - GETDNS_CONTEXT_CODE_APPEND_NAME = 607, - GETDNS_CONTEXT_CODE_SUFFIX = 608, - GETDNS_CONTEXT_CODE_DNSSEC_TRUST_ANCHORS = 609, - GETDNS_CONTEXT_CODE_EDNS_MAXIMUM_UDP_PAYLOAD_SIZE = 610, - GETDNS_CONTEXT_CODE_EDNS_EXTENDED_RCODE = 611, - GETDNS_CONTEXT_CODE_EDNS_VERSION = 612, - GETDNS_CONTEXT_CODE_EDNS_DO_BIT = 613, - GETDNS_CONTEXT_CODE_DNSSEC_ALLOWED_SKEW = 614, - GETDNS_CONTEXT_CODE_MEMORY_FUNCTIONS = 615, - GETDNS_CONTEXT_CODE_TIMEOUT = 616 -} getdns_context_code_t; - -#define GETDNS_CONTEXT_CODE_NAMESPACES_TEXT "Change related to getdns_context_set_namespaces" -#define GETDNS_CONTEXT_CODE_RESOLUTION_TYPE_TEXT "Change related to getdns_context_set_resolution_type" -#define GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS_TEXT "Change related to getdns_context_set_follow_redirects" -#define GETDNS_CONTEXT_CODE_UPSTREAM_RECURSIVE_SERVERS_TEXT "Change related to getdns_context_set_upstream_recursive_servers" -#define GETDNS_CONTEXT_CODE_DNS_ROOT_SERVERS_TEXT "Change related to getdns_context_set_dns_root_servers" -#define GETDNS_CONTEXT_CODE_DNS_TRANSPORT_TEXT "Change related to getdns_context_set_dns_transport" -#define GETDNS_CONTEXT_CODE_LIMIT_OUTSTANDING_QUERIES_TEXT "Change related to getdns_context_set_limit_outstanding_queries" -#define GETDNS_CONTEXT_CODE_APPEND_NAME_TEXT "Change related to getdns_context_set_append_name" -#define GETDNS_CONTEXT_CODE_SUFFIX_TEXT "Change related to getdns_context_set_suffix" -#define GETDNS_CONTEXT_CODE_DNSSEC_TRUST_ANCHORS_TEXT "Change related to getdns_context_set_dnssec_trust_anchors" -#define GETDNS_CONTEXT_CODE_EDNS_MAXIMUM_UDP_PAYLOAD_SIZE_TEXT "Change related to getdns_context_set_edns_maximum_udp_payload_size" -#define GETDNS_CONTEXT_CODE_EDNS_EXTENDED_RCODE_TEXT "Change related to getdns_context_set_edns_extended_rcode" -#define GETDNS_CONTEXT_CODE_EDNS_VERSION_TEXT "Change related to getdns_context_set_edns_version" -#define GETDNS_CONTEXT_CODE_EDNS_DO_BIT_TEXT "Change related to getdns_context_set_edns_do_bit" -#define GETDNS_CONTEXT_CODE_DNSSEC_ALLOWED_SKEW_TEXT "Change related to getdns_context_set_dnssec_allowed_skew" -#define GETDNS_CONTEXT_CODE_MEMORY_FUNCTIONS_TEXT "Change related to getdns_context_set_memory_functions" -#define GETDNS_CONTEXT_CODE_TIMEOUT_TEXT "Change related to getdns_context_set_timeout" - -/* Callback Type Variables */ -typedef enum getdns_callback_type_t { - GETDNS_CALLBACK_COMPLETE = 700, - GETDNS_CALLBACK_CANCEL = 701, - GETDNS_CALLBACK_TIMEOUT = 702, - GETDNS_CALLBACK_ERROR = 703 -} getdns_callback_type_t; - -#define GETDNS_CALLBACK_COMPLETE_TEXT "The response has the requested data in it" -#define GETDNS_CALLBACK_CANCEL_TEXT "The calling program cancelled the callback; response is NULL" -#define GETDNS_CALLBACK_TIMEOUT_TEXT "The requested action timed out; response is NULL" -#define GETDNS_CALLBACK_ERROR_TEXT "The requested action had an error; response is NULL" - -/* Type Of Name Services */ -#define GETDNS_NAMETYPE_DNS 800 -#define GETDNS_NAMETYPE_DNS_TEXT "Normal DNS (RFC 1035)" -#define GETDNS_NAMETYPE_WINS 801 -#define GETDNS_NAMETYPE_WINS_TEXT "The WINS name service (some reference needed)" - -/* Status Codes for Responses */ -#define GETDNS_RESPSTATUS_GOOD 900 -#define GETDNS_RESPSTATUS_GOOD_TEXT "At least one response was returned" -#define GETDNS_RESPSTATUS_NO_NAME 901 -#define GETDNS_RESPSTATUS_NO_NAME_TEXT "Queries for the name yielded all negative responses" -#define GETDNS_RESPSTATUS_ALL_TIMEOUT 902 -#define GETDNS_RESPSTATUS_ALL_TIMEOUT_TEXT "All queries for the name timed out" -#define GETDNS_RESPSTATUS_NO_SECURE_ANSWERS 903 -#define GETDNS_RESPSTATUS_NO_SECURE_ANSWERS_TEXT "The context setting for getting only secure responses was specified, and at least one DNS response was received, but no DNS response was determined to be secure through DNSSEC." - -/* Values Associated With Extensions */ -#define GETDNS_EXTENSION_TRUE 1000 -#define GETDNS_EXTENSION_TRUE_TEXT "Turn on the extension" -#define GETDNS_EXTENSION_FALSE 1001 -#define GETDNS_EXTENSION_FALSE_TEXT "Do not turn on the extension" - -/* Values Associated With DNS Errors Found By The API */ -#define GETDNS_BAD_DNS_CNAME_IN_TARGET 1100 -#define GETDNS_BAD_DNS_CNAME_IN_TARGET_TEXT "A DNS query type that does not allow a target to be a CNAME pointed to a CNAME" -#define GETDNS_BAD_DNS_ALL_NUMERIC_LABEL 1101 -#define GETDNS_BAD_DNS_ALL_NUMERIC_LABEL_TEXT "One or more labels in a returned domain name is all-numeric; this is not legal for a hostname" -#define GETDNS_BAD_DNS_CNAME_RETURNED_FOR_OTHER_TYPE 1102 -#define GETDNS_BAD_DNS_CNAME_RETURNED_FOR_OTHER_TYPE_TEXT "A DNS query for a type other than CNAME returned a CNAME response" - - -/* Defines for RRtypes (from 2014-02) */ -#define GETDNS_RRTYPE_A 1 -#define GETDNS_RRTYPE_NS 2 -#define GETDNS_RRTYPE_MD 3 -#define GETDNS_RRTYPE_MF 4 -#define GETDNS_RRTYPE_CNAME 5 -#define GETDNS_RRTYPE_SOA 6 -#define GETDNS_RRTYPE_MB 7 -#define GETDNS_RRTYPE_MG 8 -#define GETDNS_RRTYPE_MR 9 -#define GETDNS_RRTYPE_NULL 10 -#define GETDNS_RRTYPE_WKS 11 -#define GETDNS_RRTYPE_PTR 12 -#define GETDNS_RRTYPE_HINFO 13 -#define GETDNS_RRTYPE_MINFO 14 -#define GETDNS_RRTYPE_MX 15 -#define GETDNS_RRTYPE_TXT 16 -#define GETDNS_RRTYPE_RP 17 -#define GETDNS_RRTYPE_AFSDB 18 -#define GETDNS_RRTYPE_X25 19 -#define GETDNS_RRTYPE_ISDN 20 -#define GETDNS_RRTYPE_RT 21 -#define GETDNS_RRTYPE_NSAP 22 -#define GETDNS_RRTYPE_SIG 24 -#define GETDNS_RRTYPE_KEY 25 -#define GETDNS_RRTYPE_PX 26 -#define GETDNS_RRTYPE_GPOS 27 -#define GETDNS_RRTYPE_AAAA 28 -#define GETDNS_RRTYPE_LOC 29 -#define GETDNS_RRTYPE_NXT 30 -#define GETDNS_RRTYPE_EID 31 -#define GETDNS_RRTYPE_NIMLOC 32 -#define GETDNS_RRTYPE_SRV 33 -#define GETDNS_RRTYPE_ATMA 34 -#define GETDNS_RRTYPE_NAPTR 35 -#define GETDNS_RRTYPE_KX 36 -#define GETDNS_RRTYPE_CERT 37 -#define GETDNS_RRTYPE_A6 38 -#define GETDNS_RRTYPE_DNAME 39 -#define GETDNS_RRTYPE_SINK 40 -#define GETDNS_RRTYPE_OPT 41 -#define GETDNS_RRTYPE_APL 42 -#define GETDNS_RRTYPE_DS 43 -#define GETDNS_RRTYPE_SSHFP 44 -#define GETDNS_RRTYPE_IPSECKEY 45 -#define GETDNS_RRTYPE_RRSIG 46 -#define GETDNS_RRTYPE_NSEC 47 -#define GETDNS_RRTYPE_DNSKEY 48 -#define GETDNS_RRTYPE_DHCID 49 -#define GETDNS_RRTYPE_NSEC3 50 -#define GETDNS_RRTYPE_NSEC3PARAM 51 -#define GETDNS_RRTYPE_TLSA 52 -#define GETDNS_RRTYPE_HIP 55 -#define GETDNS_RRTYPE_NINFO 56 -#define GETDNS_RRTYPE_RKEY 57 -#define GETDNS_RRTYPE_TALINK 58 -#define GETDNS_RRTYPE_CDS 59 -#define GETDNS_RRTYPE_SPF 99 -#define GETDNS_RRTYPE_UINFO 100 -#define GETDNS_RRTYPE_UID 101 -#define GETDNS_RRTYPE_GID 102 -#define GETDNS_RRTYPE_UNSPEC 103 -#define GETDNS_RRTYPE_NID 104 -#define GETDNS_RRTYPE_L32 105 -#define GETDNS_RRTYPE_L64 106 -#define GETDNS_RRTYPE_LP 107 -#define GETDNS_RRTYPE_EUI48 108 -#define GETDNS_RRTYPE_EUI64 109 -#define GETDNS_RRTYPE_TKEY 249 -#define GETDNS_RRTYPE_TSIG 250 -#define GETDNS_RRTYPE_IXFR 251 -#define GETDNS_RRTYPE_AXFR 252 -#define GETDNS_RRTYPE_MAILB 253 -#define GETDNS_RRTYPE_MAILA 254 -#define GETDNS_RRTYPE_ANY 255 -#define GETDNS_RRTYPE_URI 256 -#define GETDNS_RRTYPE_CAA 257 -#define GETDNS_RRTYPE_TA 32768 -#define GETDNS_RRTYPE_DLV 32769 - -/* Defines for RRclasses (from 2014-02) */ -#define GETDNS_RRCLASS_IN 1 -#define GETDNS_RRCLASS_CH 3 -#define GETDNS_RRCLASS_HS 4 -#define GETDNS_RRCLASS_NONE 254 -#define GETDNS_RRCLASS_ANY 255 - -/* Defines for Opcodes (from 2014-02) */ -#define GETDNS_OPCODE_QUERY 0 -#define GETDNS_OPCODE_IQUERY 1 -#define GETDNS_OPCODE_STATUS 2 -#define GETDNS_OPCODE_NOTIFY 4 -#define GETDNS_OPCODE_UPDATE 5 - -/* Defines for Rcodes (from 2014-02) */ -#define GETDNS_RCODE_NOERROR 0 -#define GETDNS_RCODE_FORMERR 1 -#define GETDNS_RCODE_SERVFAIL 2 -#define GETDNS_RCODE_NXDOMAIN 3 -#define GETDNS_RCODE_NOTIMP 4 -#define GETDNS_RCODE_REFUSED 5 -#define GETDNS_RCODE_YXDOMAIN 6 -#define GETDNS_RCODE_YXRRSET 7 -#define GETDNS_RCODE_NXRRSET 8 -#define GETDNS_RCODE_NOTAUTH 9 -#define GETDNS_RCODE_NOTZONE 10 -#define GETDNS_RCODE_BADVERS 16 -#define GETDNS_RCODE_BADSIG 16 -#define GETDNS_RCODE_BADKEY 17 -#define GETDNS_RCODE_BADTIME 18 -#define GETDNS_RCODE_BADMODE 19 -#define GETDNS_RCODE_BADNAME 20 -#define GETDNS_RCODE_BADALG 21 -#define GETDNS_RCODE_BADTRUNC 22 - -/* Various typedefs */ -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; -typedef struct getdns_bindata { - size_t size; - uint8_t *data; -} 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 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 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 */ -getdns_list * getdns_list_create(); -getdns_list * getdns_list_create_with_context( - getdns_context *context -); -getdns_list * getdns_list_create_with_memory_functions( - void *(*malloc)(size_t), - void *(*realloc)(void *, size_t), - void (*free)(void *) -); -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(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 */ -getdns_dict * getdns_dict_create(); -getdns_dict * getdns_dict_create_with_context( - getdns_context *context -); -getdns_dict * getdns_dict_create_with_memory_functions( - void *(*malloc)(size_t), - void *(*realloc)(void *, size_t), - void (*free)(void *) -); -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(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)( - getdns_context *context, - getdns_callback_type_t callback_type, - getdns_dict *response, - void *userarg, - getdns_transaction_t transaction_id); - -/* Function definitions */ - -getdns_return_t -getdns_general( - 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( - 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( - 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( - 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( - getdns_context **context, - int set_from_os -); - -getdns_return_t -getdns_context_create_with_memory_functions( - 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( - 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( - getdns_context *context -); - -getdns_return_t -getdns_cancel_callback( - getdns_context *context, - getdns_transaction_t transaction_id -); - -getdns_return_t -getdns_general_sync( - getdns_context *context, - const char *name, - uint16_t request_type, - getdns_dict *extensions, - getdns_dict **response -); - -getdns_return_t -getdns_address_sync( - getdns_context *context, - const char *name, - getdns_dict *extensions, - getdns_dict **response -); - -getdns_return_t -getdns_hostname_sync( - getdns_context *context, - getdns_dict *address, - getdns_dict *extensions, - getdns_dict **response -); - -getdns_return_t -getdns_service_sync( - getdns_context *context, - const char *name, - getdns_dict *extensions, - getdns_dict **response -); - -getdns_return_t -getdns_convert_dns_name_to_fqdn( - 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, - getdns_bindata **dns_name_wire_fmt -); - -char * -getdns_convert_ulabel_to_alabel( - const char *ulabel -); - -char * -getdns_convert_alabel_to_ulabel( - const char *alabel -); - -getdns_return_t -getdns_validate_dnssec( - getdns_list *record_to_validate, - getdns_list *bundle_of_support_records, - getdns_list *trust_anchor_records -); - -char * -getdns_pretty_print_dict( - const getdns_dict *some_dict -); - -char * -getdns_display_ip_address( - const getdns_bindata *bindata_of_ipv4_or_ipv6_address -); - -getdns_return_t -getdns_context_set_context_update_callback( - getdns_context *context, - void (*value)(getdns_context *context, getdns_context_code_t changed_item) -); - -getdns_return_t -getdns_context_set_resolution_type( - getdns_context *context, - getdns_resolution_t value -); - -getdns_return_t -getdns_context_set_namespaces( - getdns_context *context, - size_t namespace_count, - getdns_namespace_t *namespaces -); - -getdns_return_t -getdns_context_set_dns_transport( - getdns_context *context, - getdns_transport_t value -); - -getdns_return_t -getdns_context_set_limit_outstanding_queries( - getdns_context *context, - uint16_t limit -); - -getdns_return_t -getdns_context_set_timeout( - getdns_context *context, - uint64_t timeout -); - -getdns_return_t -getdns_context_set_follow_redirects( - getdns_context *context, - getdns_redirects_t value -); - -getdns_return_t -getdns_context_set_dns_root_servers( - getdns_context *context, - getdns_list *addresses -); - -getdns_return_t -getdns_context_set_append_name( - getdns_context *context, - getdns_append_name_t value -); - -getdns_return_t -getdns_context_set_suffix( - getdns_context *context, - getdns_list *value -); - -getdns_return_t -getdns_context_set_dnssec_trust_anchors( - getdns_context *context, - getdns_list *value -); - -getdns_return_t -getdns_context_set_dnssec_allowed_skew( - getdns_context *context, - uint32_t value -); - -getdns_return_t -getdns_context_set_upstream_recursive_servers( - getdns_context *context, - getdns_list *upstream_list -); - -getdns_return_t -getdns_context_set_edns_maximum_udp_payload_size( - getdns_context *context, - uint16_t value -); - -getdns_return_t -getdns_context_set_edns_extended_rcode( - getdns_context *context, - uint8_t value -); - -getdns_return_t -getdns_context_set_edns_version( - getdns_context *context, - uint8_t value -); - -getdns_return_t -getdns_context_set_edns_do_bit( - getdns_context *context, - uint8_t value -); - -getdns_return_t -getdns_context_set_memory_functions( - getdns_context *context, - void *(*malloc) (size_t), - void *(*realloc) (void *, size_t), - void (*free) (void *) -); - -getdns_return_t -getdns_context_set_extended_memory_functions( - 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 -} -#endif -#endif /* GETDNS_H */ diff --git a/spec/getdns_libevent.h b/spec/getdns_libevent.h deleted file mode 100644 index 70c3f9e1..00000000 --- a/spec/getdns_libevent.h +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include - -/* For libevent, which we are using for these examples */ -getdns_return_t -getdns_extension_set_libevent_base( - getdns_context *context, - struct event_base *this_event_base -); diff --git a/spec/make-examples-linux.sh b/spec/make-examples-linux.sh deleted file mode 100755 index ca56726d..00000000 --- a/spec/make-examples-linux.sh +++ /dev/null @@ -1,22 +0,0 @@ -rm -rf *.o *.dylib -gcc -std=c89 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c getdns_core_only.c -gcc -std=c89 -shared -fPIC -levent_core -o libgetdns.so getdns_core_only.o -gcc -std=c89 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c example-all-functions.c -gcc -std=c89 -fPIC -L./ example-all-functions.o -levent_core -lgetdns -o example-all-functions -gcc -std=c99 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c example-simple-answers.c -gcc -std=c99 -fPIC -L./ example-simple-answers.o -levent_core -lgetdns -o example-simple-answers -gcc -std=c99 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c example-tree.c -gcc -std=c99 -fPIC -L./ example-tree.o -levent_core -lgetdns -o example-tree -gcc -std=c99 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c example-synchronous.c -gcc -std=c99 -fPIC -L./ example-synchronous.o -levent_core -lgetdns -o example-synchronous -rm -rf *.o *.dylib -clang -std=c89 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c getdns_core_only.c -clang -std=c89 -shared -fPIC -levent_core -o libgetdns.so getdns_core_only.o -clang -std=c89 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c example-all-functions.c -clang -std=c89 -fPIC -L./ example-all-functions.o -levent_core -lgetdns -o example-all-functions -clang -std=c99 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c example-simple-answers.c -clang -std=c99 -fPIC -L./ example-simple-answers.o -levent_core -lgetdns -o example-simple-answers -clang -std=c99 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c example-tree.c -clang -std=c99 -fPIC -L./ example-tree.o -levent_core -lgetdns -o example-tree -clang -std=c99 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c example-synchronous.c -clang -std=c99 -fPIC -L./ example-synchronous.o -levent_core -lgetdns -o example-synchronous diff --git a/spec/make-examples-mac.sh b/spec/make-examples-mac.sh deleted file mode 100755 index 02c91eb0..00000000 --- a/spec/make-examples-mac.sh +++ /dev/null @@ -1,22 +0,0 @@ -rm -rf *.o *.dylib -gcc -std=c89 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c getdns_core_only.c -gcc -std=c89 -dynamiclib -fPIC -levent_core -o libgetdns.dylib getdns_core_only.o -gcc -std=c89 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c example-all-functions.c -gcc -std=c89 -fPIC -L./ example-all-functions.o -levent_core -lgetdns -o example-all-functions -gcc -std=c99 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c example-simple-answers.c -gcc -std=c99 -fPIC -L./ example-simple-answers.o -levent_core -lgetdns -o example-simple-answers -gcc -std=c99 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c example-tree.c -gcc -std=c99 -fPIC -L./ example-tree.o -levent_core -lgetdns -o example-tree -gcc -std=c99 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c example-synchronous.c -gcc -std=c99 -fPIC -L./ example-synchronous.o -levent_core -lgetdns -o example-synchronous -rm -rf *.o *.dylib -clang -std=c89 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c getdns_core_only.c -clang -std=c89 -dynamiclib -fPIC -levent_core -o libgetdns.dylib getdns_core_only.o -clang -std=c89 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c example-all-functions.c -clang -std=c89 -fPIC -L./ example-all-functions.o -levent_core -lgetdns -o example-all-functions -clang -std=c99 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c example-simple-answers.c -clang -std=c99 -fPIC -L./ example-simple-answers.o -levent_core -lgetdns -o example-simple-answers -clang -std=c99 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c example-tree.c -clang -std=c99 -fPIC -L./ example-tree.o -levent_core -lgetdns -o example-tree -clang -std=c99 -c -fPIC -pedantic -g -I./ -Werror -Wall -Wextra -c example-synchronous.c -clang -std=c99 -fPIC -L./ example-synchronous.o -levent_core -lgetdns -o example-synchronous