Merge pull request #37 from johndickinson/min_specify_class

Added support for specify_class
Looks perfect to me
This commit is contained in:
wtoorop 2014-05-21 19:58:31 +02:00
commit 53cfe4d59d
2 changed files with 18 additions and 2 deletions

View File

@ -115,6 +115,9 @@ dns_req_new(struct getdns_context *context,
getdns_dns_req *result = NULL;
getdns_network_req *req = NULL;
getdns_return_t r;
uint32_t klass;
result = GETDNS_MALLOC(context->mf, getdns_dns_req);
if (result == NULL) {
return NULL;
@ -135,9 +138,14 @@ dns_req_new(struct getdns_context *context,
result->user_callback = NULL;
result->local_timeout_id = 0;
/* check the specify_class extension */
if ((r = getdns_dict_get_int(extensions, "specify_class", &klass))
!= GETDNS_RETURN_GOOD) {
klass = LDNS_RR_CLASS_IN;
}
/* create the requests */
req = network_req_new(result,
request_type, LDNS_RR_CLASS_IN, extensions);
req = network_req_new(result, request_type, klass, extensions);
if (!req) {
dns_req_free(result);
return NULL;

View File

@ -126,6 +126,14 @@ getdns_return_t validate_extensions(struct getdns_dict * extensions);
struct getdns_list *
create_list_from_rr_list(struct getdns_context *context, ldns_rr_list * rr_list);
/**
* helper to check if an extension is set.
* Should only be called for "boolean" type extensions that have a value of
* GETDNS_EXTENSION_TRUE or GETDNS_EXTENSION_FALSE
* @param extensions dictionary
* @param name of extension to check
* @return int with value 1 if set to GETDNS_EXTENSION_TRUE and 0 otherwise
*/
int is_extension_set(struct getdns_dict *extensions, const char *extension);
/* util-internal.h */