Merge branch 'feature/check_examples' of github.com:verisign/getdns into feature/check_examples

final convert_alabel_to_ulabel.h convert_ulabel_to_alabel.h
This commit is contained in:
Bryan Graham 2014-01-13 21:28:34 +00:00
commit 952308d200
14 changed files with 55 additions and 51 deletions

View File

@ -70,11 +70,15 @@ getdns_convert_dns_name_to_fqdn(char *name_from_dns_response)
char * char *
getdns_convert_fqdn_to_dns_name(char *fqdn_as_string) getdns_convert_fqdn_to_dns_name(char *fqdn_as_string)
{ {
UNUSED_PARAM(fqdn_as_string); ldns *rdf;
char *data;
if (ldns_str2rdf_dname(&rdf, fqdn_as_string) != LDNS_STATUS_OK)
return NULL; return NULL;
data = (char *)ldns_rdf_data(rdf);
ldns_rdf_free(rdf);
return data;
} }
/*---------------------------------------- getdns_convert_alabel_to_ulabel */ /*---------------------------------------- getdns_convert_alabel_to_ulabel */
/** /**
* Convert UTF-8 string into an ACE-encoded domain * Convert UTF-8 string into an ACE-encoded domain

View File

@ -27,7 +27,7 @@
{ {
/* /*
* name = NULL * name = NULL
* expect: GETDNS_RETURN_GENERIC_ERROR * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_context *context = NULL; struct getdns_context *context = NULL;
struct getdns_dict *response = NULL; struct getdns_dict *response = NULL;
@ -35,7 +35,7 @@
CONTEXT_CREATE(TRUE); CONTEXT_CREATE(TRUE);
ASSERT_RC(getdns_address_sync(context, NULL, NULL, &response), ASSERT_RC(getdns_address_sync(context, NULL, NULL, &response),
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_address_sync()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_address_sync()");
CONTEXT_DESTROY; CONTEXT_DESTROY;
} }
@ -64,14 +64,14 @@
{ {
/* /*
* response = NULL * response = NULL
* expect: GETDNS_RETURN_GENERIC_ERROR * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_context *context = NULL; struct getdns_context *context = NULL;
CONTEXT_CREATE(TRUE); CONTEXT_CREATE(TRUE);
ASSERT_RC(getdns_address_sync(context, "google.com", NULL, NULL), ASSERT_RC(getdns_address_sync(context, "google.com", NULL, NULL),
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_address_sync()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_address_sync()");
CONTEXT_DESTROY; CONTEXT_DESTROY;
} }

View File

@ -13,11 +13,11 @@
{ {
/* /*
* context = NULL * context = NULL
* expect: GETDNS_RETURN_GENERIC_ERROR * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
ASSERT_RC(getdns_context_create(NULL, TRUE), ASSERT_RC(getdns_context_create(NULL, TRUE),
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_context_create()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_context_create()");
} }
END_TEST END_TEST

View File

@ -13,13 +13,13 @@
{ {
/* /*
* this_dict = NULL * this_dict = NULL
* expect: GETDNS_RETURN_NO_SUCH_DICT_NAME * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_dict *this_dict = NULL; struct getdns_dict *this_dict = NULL;
struct getdns_bindata *answer = NULL; struct getdns_bindata *answer = NULL;
ASSERT_RC(getdns_dict_get_bindata(this_dict, "key", &answer), ASSERT_RC(getdns_dict_get_bindata(this_dict, "key", &answer),
GETDNS_RETURN_NO_SUCH_DICT_NAME, "Return code from getdns_dict_get_bindata()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_dict_get_bindata()");
} }
END_TEST END_TEST
@ -28,7 +28,7 @@
{ {
/* /*
* name = NULL * name = NULL
* expect: GETDNS_RETURN_NO_SUCH_DICT_NAME * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_dict *this_dict = NULL; struct getdns_dict *this_dict = NULL;
struct getdns_bindata bindata = { 8, (void *)"bindata" }; struct getdns_bindata bindata = { 8, (void *)"bindata" };
@ -39,7 +39,7 @@
GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_bindata()"); GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_bindata()");
ASSERT_RC(getdns_dict_get_bindata(this_dict, NULL, &answer), ASSERT_RC(getdns_dict_get_bindata(this_dict, NULL, &answer),
GETDNS_RETURN_NO_SUCH_DICT_NAME, "Return code from getdns_dict_get_bindata()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_dict_get_bindata()");
DICT_DESTROY(this_dict); DICT_DESTROY(this_dict);
} }
@ -96,7 +96,7 @@
{ {
/* /*
* answer = NULL * answer = NULL
* expect: GETDNS_RETURN_NO_SUCH_DICT_NAME * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_dict *this_dict = NULL; struct getdns_dict *this_dict = NULL;
struct getdns_bindata bindata = { 8, (void *)"bindata" }; struct getdns_bindata bindata = { 8, (void *)"bindata" };
@ -107,7 +107,7 @@
GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_bindata()"); GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_bindata()");
ASSERT_RC(getdns_dict_get_bindata(this_dict, "bindata", NULL), ASSERT_RC(getdns_dict_get_bindata(this_dict, "bindata", NULL),
GETDNS_RETURN_NO_SUCH_DICT_NAME, "Return code from getdns_dict_get_bindata()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_dict_get_bindata()");
DICT_DESTROY(this_dict); DICT_DESTROY(this_dict);
} }

View File

@ -13,13 +13,13 @@
{ {
/* /*
* this_dict = NULL * this_dict = NULL
* expect: GETDNS_RETURN_NO_SUCH_DICT_NAME * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_dict *this_dict = NULL; struct getdns_dict *this_dict = NULL;
struct getdns_dict *answer = NULL; struct getdns_dict *answer = NULL;
ASSERT_RC(getdns_dict_get_dict(this_dict, "key", &answer), ASSERT_RC(getdns_dict_get_dict(this_dict, "key", &answer),
GETDNS_RETURN_NO_SUCH_DICT_NAME, "Return code from getdns_dict_get_dict()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_dict_get_dict()");
} }
END_TEST END_TEST
@ -28,7 +28,7 @@
{ {
/* /*
* name = NULL * name = NULL
* expect: GETDNS_RETURN_NO_SUCH_DICT_NAME * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_dict *this_dict = NULL; struct getdns_dict *this_dict = NULL;
struct getdns_dict *second_dict = NULL; struct getdns_dict *second_dict = NULL;
@ -40,7 +40,7 @@
GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_dict()"); GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_dict()");
ASSERT_RC(getdns_dict_get_dict(this_dict, NULL, &answer), ASSERT_RC(getdns_dict_get_dict(this_dict, NULL, &answer),
GETDNS_RETURN_NO_SUCH_DICT_NAME, "Return code from getdns_dict_get_dict()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_dict_get_dict()");
DICT_DESTROY(this_dict); DICT_DESTROY(this_dict);
DICT_DESTROY(second_dict); DICT_DESTROY(second_dict);
@ -111,7 +111,7 @@
{ {
/* /*
* answer = NULL * answer = NULL
* expect: GETDNS_RETURN_NO_SUCH_DICT_NAME * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_dict *this_dict = NULL; struct getdns_dict *this_dict = NULL;
struct getdns_dict *second_dict = NULL; struct getdns_dict *second_dict = NULL;
@ -123,7 +123,7 @@
GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_dict()"); GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_dict()");
ASSERT_RC(getdns_dict_get_dict(this_dict, "dict", NULL), ASSERT_RC(getdns_dict_get_dict(this_dict, "dict", NULL),
GETDNS_RETURN_NO_SUCH_DICT_NAME, "Return code from getdns_dict_get_dict()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_dict_get_dict()");
DICT_DESTROY(this_dict); DICT_DESTROY(this_dict);
DICT_DESTROY(second_dict); DICT_DESTROY(second_dict);

View File

@ -13,13 +13,13 @@
{ {
/* /*
* this_dict = NULL * this_dict = NULL
* expect: GETDNS_RETURN_NO_SUCH_DICT_NAME * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_dict *this_dict = NULL; struct getdns_dict *this_dict = NULL;
uint32_t answer; uint32_t answer;
ASSERT_RC(getdns_dict_get_int(this_dict, "key", &answer), ASSERT_RC(getdns_dict_get_int(this_dict, "key", &answer),
GETDNS_RETURN_NO_SUCH_DICT_NAME, "Return code from getdns_dict_get_int()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_dict_get_int()");
} }
END_TEST END_TEST
@ -28,7 +28,7 @@
{ {
/* /*
* name = NULL * name = NULL
* expect: GETDNS_RETURN_NO_SUCH_DICT_NAME * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_dict *this_dict = NULL; struct getdns_dict *this_dict = NULL;
uint32_t answer; uint32_t answer;
@ -38,7 +38,7 @@
GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_int()"); GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_int()");
ASSERT_RC(getdns_dict_get_int(this_dict, NULL, &answer), ASSERT_RC(getdns_dict_get_int(this_dict, NULL, &answer),
GETDNS_RETURN_NO_SUCH_DICT_NAME, "Return code from getdns_dict_get_int()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_dict_get_int()");
DICT_DESTROY(this_dict); DICT_DESTROY(this_dict);
} }
@ -95,7 +95,7 @@
{ {
/* /*
* answer = NULL * answer = NULL
* expect: GETDNS_RETURN_NO_SUCH_DICT_NAME * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_dict *this_dict = NULL; struct getdns_dict *this_dict = NULL;
@ -105,7 +105,7 @@
GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_int()"); GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_int()");
ASSERT_RC(getdns_dict_get_int(this_dict, "int", NULL), ASSERT_RC(getdns_dict_get_int(this_dict, "int", NULL),
GETDNS_RETURN_NO_SUCH_DICT_NAME, "Return code from getdns_dict_get_int()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_dict_get_int()");
DICT_DESTROY(this_dict); DICT_DESTROY(this_dict);
} }

View File

@ -13,13 +13,13 @@
{ {
/* /*
* this_dict = NULL * this_dict = NULL
* expect: GETDNS_RETURN_NO_SUCH_DICT_NAME * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_dict *this_dict = NULL; struct getdns_dict *this_dict = NULL;
struct getdns_list *answer = NULL; struct getdns_list *answer = NULL;
ASSERT_RC(getdns_dict_get_list(this_dict, "key", &answer), ASSERT_RC(getdns_dict_get_list(this_dict, "key", &answer),
GETDNS_RETURN_NO_SUCH_DICT_NAME, "Return code from getdns_dict_get_list()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_dict_get_list()");
} }
END_TEST END_TEST
@ -28,7 +28,7 @@
{ {
/* /*
* name = NULL * name = NULL
* expect: GETDNS_RETURN_NO_SUCH_DICT_NAME * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_dict *this_dict = NULL; struct getdns_dict *this_dict = NULL;
struct getdns_list *list = NULL; struct getdns_list *list = NULL;
@ -40,7 +40,7 @@
GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_list()"); GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_list()");
ASSERT_RC(getdns_dict_get_list(this_dict, NULL, &answer), ASSERT_RC(getdns_dict_get_list(this_dict, NULL, &answer),
GETDNS_RETURN_NO_SUCH_DICT_NAME, "Return code from getdns_dict_get_list()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_dict_get_list()");
DICT_DESTROY(this_dict); DICT_DESTROY(this_dict);
LIST_DESTROY(list); LIST_DESTROY(list);
@ -103,7 +103,7 @@
{ {
/* /*
* answer = NULL * answer = NULL
* expect: GETDNS_RETURN_NO_SUCH_DICT_NAME * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_dict *this_dict = NULL; struct getdns_dict *this_dict = NULL;
struct getdns_list *list = NULL; struct getdns_list *list = NULL;
@ -115,7 +115,7 @@
GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_list()"); GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_list()");
ASSERT_RC(getdns_dict_get_list(this_dict, "list", NULL), ASSERT_RC(getdns_dict_get_list(this_dict, "list", NULL),
GETDNS_RETURN_NO_SUCH_DICT_NAME, "Return code from getdns_dict_get_list()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_dict_get_list()");
DICT_DESTROY(this_dict); DICT_DESTROY(this_dict);
LIST_DESTROY(list); LIST_DESTROY(list);

View File

@ -13,13 +13,13 @@
{ {
/* /*
* this_dict = NULL * this_dict = NULL
* expect = GETDNS_RETURN_NO_SUCH_DICT_NAME * expect = GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_dict *this_dict = NULL; struct getdns_dict *this_dict = NULL;
struct getdns_list *answer = NULL; struct getdns_list *answer = NULL;
ASSERT_RC(getdns_dict_get_names(this_dict, &answer), ASSERT_RC(getdns_dict_get_names(this_dict, &answer),
GETDNS_RETURN_NO_SUCH_DICT_NAME, "Return code from getdns_dict_get_names()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_dict_get_names()");
} }
END_TEST END_TEST
@ -28,14 +28,14 @@
{ {
/* /*
* answer = NULL * answer = NULL
* expect: GETDNS_RETURN_NO_SUCH_DICT_NAME * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_dict *this_dict = NULL; struct getdns_dict *this_dict = NULL;
DICT_CREATE(this_dict); DICT_CREATE(this_dict);
ASSERT_RC(getdns_dict_get_names(this_dict, NULL), ASSERT_RC(getdns_dict_get_names(this_dict, NULL),
GETDNS_RETURN_NO_SUCH_DICT_NAME, "Return code from getdns_dict_get_names()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_dict_get_names()");
DICT_DESTROY(this_dict); DICT_DESTROY(this_dict);
} }

View File

@ -13,7 +13,7 @@
{ {
/* /*
* this_dict = NULL * this_dict = NULL
* expect: GETDNS_RETURN_NO_SUCH_DICT_NAME * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_dict *this_dict = NULL; struct getdns_dict *this_dict = NULL;
struct getdns_bindata bindata = { 8, (void *)"bindata" }; struct getdns_bindata bindata = { 8, (void *)"bindata" };

View File

@ -27,7 +27,7 @@
{ {
/* /*
* name = NULL * name = NULL
* expect: GETDNS_RETURN_NO_SUCH_DICT_NAME * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_dict *this_dict = NULL; struct getdns_dict *this_dict = NULL;

View File

@ -28,7 +28,7 @@
{ {
/* /*
* name = NULL * name = NULL
* expect: GETDNS_RETURN_GENERIC_ERROR * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_context *context = NULL; \ struct getdns_context *context = NULL; \
struct event_base *event_base = NULL; \ struct event_base *event_base = NULL; \
@ -39,7 +39,7 @@
ASSERT_RC(getdns_general(context, NULL, GETDNS_RRTYPE_A, NULL, ASSERT_RC(getdns_general(context, NULL, GETDNS_RRTYPE_A, NULL,
NULL, &transaction_id, callbackfn), NULL, &transaction_id, callbackfn),
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_general()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_general()");
RUN_EVENT_LOOP; RUN_EVENT_LOOP;
CONTEXT_DESTROY; CONTEXT_DESTROY;

View File

@ -27,7 +27,7 @@
{ {
/* /*
* name = NULL * name = NULL
* expect: GETDNS_RETURN_GENERIC_ERROR * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_context *context = NULL; struct getdns_context *context = NULL;
struct getdns_dict *response = NULL; struct getdns_dict *response = NULL;
@ -35,7 +35,7 @@
CONTEXT_CREATE(TRUE); CONTEXT_CREATE(TRUE);
ASSERT_RC(getdns_general_sync(context, NULL, GETDNS_RRTYPE_A, NULL, &response), ASSERT_RC(getdns_general_sync(context, NULL, GETDNS_RRTYPE_A, NULL, &response),
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_general_sync()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_general_sync()");
CONTEXT_DESTROY; CONTEXT_DESTROY;
} }
@ -83,14 +83,14 @@
{ {
/* /*
* response = NULL * response = NULL
* expect: GETDNS_RETURN_GENERIC_ERROR * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_context *context = NULL; struct getdns_context *context = NULL;
CONTEXT_CREATE(TRUE); CONTEXT_CREATE(TRUE);
ASSERT_RC(getdns_general_sync(context, "google.com", GETDNS_RRTYPE_A, NULL, NULL), ASSERT_RC(getdns_general_sync(context, "google.com", GETDNS_RRTYPE_A, NULL, NULL),
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_general_sync()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_general_sync()");
CONTEXT_DESTROY; CONTEXT_DESTROY;
} }

View File

@ -13,14 +13,14 @@
{ {
/* /*
* list = NULL * list = NULL
* expect: GETDNS_RETURN_NO_SUCH_LIST_ITEM * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_list *list = NULL; struct getdns_list *list = NULL;
size_t index = 0; size_t index = 0;
getdns_data_type answer; getdns_data_type answer;
ASSERT_RC(getdns_list_get_data_type(list, index, &answer), ASSERT_RC(getdns_list_get_data_type(list, index, &answer),
GETDNS_RETURN_NO_SUCH_LIST_ITEM, "Return code from getdns_list_get_data_type()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_list_get_data_type()");
} }
END_TEST END_TEST

View File

@ -13,13 +13,13 @@
{ {
/* /*
* list = NULL * list = NULL
* expect = GETDNS_RETURN_NO_SUCH_LIST_ITEM * expect = GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_list *list = NULL; struct getdns_list *list = NULL;
size_t length; size_t length;
ASSERT_RC(getdns_list_get_length(list, &length), ASSERT_RC(getdns_list_get_length(list, &length),
GETDNS_RETURN_NO_SUCH_LIST_ITEM, "Return code from getdns_list_get_length()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_list_get_length()");
} }
END_TEST END_TEST
@ -28,14 +28,14 @@
{ {
/* /*
* answer = NULL * answer = NULL
* expect: GETDNS_RETURN_NO_SUCH_LIST_ITEM * expect: GETDNS_RETURN_INVALID_PARAMETER
*/ */
struct getdns_list *list = NULL; struct getdns_list *list = NULL;
LIST_CREATE(list); LIST_CREATE(list);
ASSERT_RC(getdns_list_get_length(list, NULL), ASSERT_RC(getdns_list_get_length(list, NULL),
GETDNS_RETURN_NO_SUCH_LIST_ITEM, "Return code from getdns_list_get_length()"); GETDNS_RETURN_INVALID_PARAMETER, "Return code from getdns_list_get_length()");
LIST_DESTROY(list); LIST_DESTROY(list);
} }