tests_dns: Make DNS tests older nameser.h compatible
authorsnuffy <snuffy22@gmail.com>
Wed, 7 Dec 2016 20:22:33 +0000 (07:22 +1100)
committersnuffy <snuffy22@gmail.com>
Wed, 7 Dec 2016 20:22:33 +0000 (07:22 +1100)
Fix the tests for DNS to use older style nameser.h as
in ASTERISK-26608.

Tested on: OpenBSD 6.0, Debian 8

ASTERISK-26647 #close

Change-Id: I285913c44202537c04b3ed09c015efa6e5f9052d

tests/test_dns.c
tests/test_dns_naptr.c
tests/test_dns_query_set.c
tests/test_dns_recurring.c
tests/test_dns_srv.c

index fbc329b..4c45c84 100644 (file)
@@ -304,10 +304,10 @@ AST_TEST_DEFINE(resolver_set_result)
                unsigned int bogus;
                unsigned int rcode;
        } results[] = {
                unsigned int bogus;
                unsigned int rcode;
        } results[] = {
-               { 0, 0, ns_r_noerror, },
-               { 0, 1, ns_r_noerror, },
-               { 1, 0, ns_r_noerror, },
-               { 0, 0, ns_r_nxdomain, },
+               { 0, 0, NOERROR, },
+               { 0, 1, NOERROR, },
+               { 1, 0, NOERROR, },
+               { 0, 0, NXDOMAIN, },
        };
        int i;
        enum ast_test_result_state res = AST_TEST_PASS;
        };
        int i;
        enum ast_test_result_state res = AST_TEST_PASS;
@@ -373,7 +373,7 @@ AST_TEST_DEFINE(resolver_set_result_off_nominal)
 
        memset(&some_query, 0, sizeof(some_query));
 
 
        memset(&some_query, 0, sizeof(some_query));
 
-       if (!ast_dns_resolver_set_result(&some_query, 1, 1, ns_r_noerror, "asterisk.org",
+       if (!ast_dns_resolver_set_result(&some_query, 1, 1, NOERROR, "asterisk.org",
                                DNS_ANSWER, DNS_ANSWER_SIZE)) {
                ast_test_status_update(test, "Successfully added a result that was both secure and bogus\n");
                result = ast_dns_query_get_result(&some_query);
                                DNS_ANSWER, DNS_ANSWER_SIZE)) {
                ast_test_status_update(test, "Successfully added a result that was both secure and bogus\n");
                result = ast_dns_query_get_result(&some_query);
@@ -381,7 +381,7 @@ AST_TEST_DEFINE(resolver_set_result_off_nominal)
                return AST_TEST_FAIL;
        }
 
                return AST_TEST_FAIL;
        }
 
-       if (!ast_dns_resolver_set_result(&some_query, 0, 0, ns_r_noerror, NULL,
+       if (!ast_dns_resolver_set_result(&some_query, 0, 0, NOERROR, NULL,
                                DNS_ANSWER, DNS_ANSWER_SIZE)) {
                ast_test_status_update(test, "Successfully added result with no canonical name\n");
                result = ast_dns_query_get_result(&some_query);
                                DNS_ANSWER, DNS_ANSWER_SIZE)) {
                ast_test_status_update(test, "Successfully added result with no canonical name\n");
                result = ast_dns_query_get_result(&some_query);
@@ -440,8 +440,8 @@ AST_TEST_DEFINE(resolver_add_record)
                const size_t size;
                int visited;
        } records[] = {
                const size_t size;
                int visited;
        } records[] = {
-               { ns_t_a, ns_c_in, 12345, v4_buf, V4_BUFSIZE, 0, },
-               { ns_t_aaaa, ns_c_in, 12345, v6_buf, V6_BUFSIZE, 0, },
+               { T_A, C_IN, 12345, v4_buf, V4_BUFSIZE, 0, },
+               { T_AAAA, C_IN, 12345, v6_buf, V6_BUFSIZE, 0, },
        };
 
        int num_records_visited = 0;
        };
 
        int num_records_visited = 0;
@@ -464,7 +464,7 @@ AST_TEST_DEFINE(resolver_add_record)
 
        memset(&some_query, 0, sizeof(some_query));
 
 
        memset(&some_query, 0, sizeof(some_query));
 
-       if (ast_dns_resolver_set_result(&some_query, 0, 0, ns_r_noerror, "asterisk.org",
+       if (ast_dns_resolver_set_result(&some_query, 0, 0, NOERROR, "asterisk.org",
                                DNS_ANSWER, DNS_ANSWER_SIZE)) {
                ast_test_status_update(test, "Unable to set result for DNS query\n");
                return AST_TEST_FAIL;
                                DNS_ANSWER, DNS_ANSWER_SIZE)) {
                ast_test_status_update(test, "Unable to set result for DNS query\n");
                return AST_TEST_FAIL;
@@ -578,12 +578,12 @@ AST_TEST_DEFINE(resolver_add_record_off_nominal)
        inet_ntop(AF_INET, V4, v4_buf, V4_BUFSIZE);
 
        /* Add record before setting result */
        inet_ntop(AF_INET, V4, v4_buf, V4_BUFSIZE);
 
        /* Add record before setting result */
-       if (!ast_dns_resolver_add_record(&some_query, ns_t_a, ns_c_in, 12345, v4_buf, V4_BUFSIZE)) {
+       if (!ast_dns_resolver_add_record(&some_query, T_A, C_IN, 12345, v4_buf, V4_BUFSIZE)) {
                ast_test_status_update(test, "Successfully added DNS record to query before setting a result\n");
                return AST_TEST_FAIL;
        }
 
                ast_test_status_update(test, "Successfully added DNS record to query before setting a result\n");
                return AST_TEST_FAIL;
        }
 
-       if (ast_dns_resolver_set_result(&some_query, 0, 0, ns_r_noerror, "asterisk.org",
+       if (ast_dns_resolver_set_result(&some_query, 0, 0, NOERROR, "asterisk.org",
                                DNS_ANSWER, DNS_ANSWER_SIZE)) {
                ast_test_status_update(test, "Unable to set result for DNS query\n");
                return AST_TEST_FAIL;
                                DNS_ANSWER, DNS_ANSWER_SIZE)) {
                ast_test_status_update(test, "Unable to set result for DNS query\n");
                return AST_TEST_FAIL;
@@ -593,41 +593,41 @@ AST_TEST_DEFINE(resolver_add_record_off_nominal)
        result = ast_dns_query_get_result(&some_query);
 
        /* Invalid RR types */
        result = ast_dns_query_get_result(&some_query);
 
        /* Invalid RR types */
-       if (!ast_dns_resolver_add_record(&some_query, -1, ns_c_in, 12345, v4_buf, V4_BUFSIZE)) {
+       if (!ast_dns_resolver_add_record(&some_query, -1, C_IN, 12345, v4_buf, V4_BUFSIZE)) {
                ast_test_status_update(test, "Successfully added DNS record with negative RR type\n");
                return AST_TEST_FAIL;
        }
 
                ast_test_status_update(test, "Successfully added DNS record with negative RR type\n");
                return AST_TEST_FAIL;
        }
 
-       if (!ast_dns_resolver_add_record(&some_query, ns_t_max + 1, ns_c_in, 12345, v4_buf, V4_BUFSIZE)) {
+       if (!ast_dns_resolver_add_record(&some_query, 65536 + 1, C_IN, 12345, v4_buf, V4_BUFSIZE)) {
                ast_test_status_update(test, "Successfully added DNS record with too large RR type\n");
                return AST_TEST_FAIL;
        }
 
        /* Invalid RR classes */
                ast_test_status_update(test, "Successfully added DNS record with too large RR type\n");
                return AST_TEST_FAIL;
        }
 
        /* Invalid RR classes */
-       if (!ast_dns_resolver_add_record(&some_query, ns_t_a, -1, 12345, v4_buf, V4_BUFSIZE)) {
+       if (!ast_dns_resolver_add_record(&some_query, T_A, -1, 12345, v4_buf, V4_BUFSIZE)) {
                ast_test_status_update(test, "Successfully added DNS record with negative RR class\n");
                return AST_TEST_FAIL;
        }
 
                ast_test_status_update(test, "Successfully added DNS record with negative RR class\n");
                return AST_TEST_FAIL;
        }
 
-       if (!ast_dns_resolver_add_record(&some_query, ns_t_a, ns_c_max + 1, 12345, v4_buf, V4_BUFSIZE)) {
+       if (!ast_dns_resolver_add_record(&some_query, T_A, 65536 + 1, 12345, v4_buf, V4_BUFSIZE)) {
                ast_test_status_update(test, "Successfully added DNS record with too large RR class\n");
                return AST_TEST_FAIL;
        }
 
        /* Invalid TTL */
                ast_test_status_update(test, "Successfully added DNS record with too large RR class\n");
                return AST_TEST_FAIL;
        }
 
        /* Invalid TTL */
-       if (!ast_dns_resolver_add_record(&some_query, ns_t_a, ns_c_in, -1, v4_buf, V4_BUFSIZE)) {
+       if (!ast_dns_resolver_add_record(&some_query, T_A, C_IN, -1, v4_buf, V4_BUFSIZE)) {
                ast_test_status_update(test, "Successfully added DNS record with negative TTL\n");
                return AST_TEST_FAIL;
        }
 
        /* No data */
                ast_test_status_update(test, "Successfully added DNS record with negative TTL\n");
                return AST_TEST_FAIL;
        }
 
        /* No data */
-       if (!ast_dns_resolver_add_record(&some_query, ns_t_a, ns_c_in, 12345, NULL, 0)) {
+       if (!ast_dns_resolver_add_record(&some_query, T_A, C_IN, 12345, NULL, 0)) {
                ast_test_status_update(test, "Successfully added a DNS record with no data\n");
                return AST_TEST_FAIL;
        }
 
        /* Lie about the length */
                ast_test_status_update(test, "Successfully added a DNS record with no data\n");
                return AST_TEST_FAIL;
        }
 
        /* Lie about the length */
-       if (!ast_dns_resolver_add_record(&some_query, ns_t_a, ns_c_in, 12345, v4_buf, 0)) {
+       if (!ast_dns_resolver_add_record(&some_query, T_A, C_IN, 12345, v4_buf, 0)) {
                ast_test_status_update(test, "Successfully added a DNS record with length zero\n");
                return AST_TEST_FAIL;
        }
                ast_test_status_update(test, "Successfully added a DNS record with length zero\n");
                return AST_TEST_FAIL;
        }
@@ -693,10 +693,10 @@ static void *resolution_thread(void *dns_query)
                return NULL;
        }
 
                return NULL;
        }
 
-       ast_dns_resolver_set_result(query, 0, 0, ns_r_noerror, "asterisk.org", DNS_ANSWER, DNS_ANSWER_SIZE);
+       ast_dns_resolver_set_result(query, 0, 0, NOERROR, "asterisk.org", DNS_ANSWER, DNS_ANSWER_SIZE);
 
        inet_pton(AF_INET, V4, v4_buf);
 
        inet_pton(AF_INET, V4, v4_buf);
-       ast_dns_resolver_add_record(query, ns_t_a, ns_c_in, 12345, v4_buf, V4_BUFSIZE);
+       ast_dns_resolver_add_record(query, T_A, C_IN, 12345, v4_buf, V4_BUFSIZE);
 
        test_resolver_data.resolution_complete = 1;
        ast_dns_resolver_completed(query);
 
        test_resolver_data.resolution_complete = 1;
        ast_dns_resolver_completed(query);
@@ -806,7 +806,7 @@ AST_TEST_DEFINE(resolver_resolve_sync)
 
        resolver_data_init();
 
 
        resolver_data_init();
 
-       if (ast_dns_resolve("asterisk.org", ns_t_a, ns_c_in, &result)) {
+       if (ast_dns_resolve("asterisk.org", T_A, C_IN, &result)) {
                ast_test_status_update(test, "Resolution of address failed\n");
                res = AST_TEST_FAIL;
                goto cleanup;
                ast_test_status_update(test, "Resolution of address failed\n");
                res = AST_TEST_FAIL;
                goto cleanup;
@@ -876,12 +876,12 @@ AST_TEST_DEFINE(resolver_resolve_sync_off_nominal)
                int rr_class;
                struct ast_dns_result **result;
        } resolves [] = {
                int rr_class;
                struct ast_dns_result **result;
        } resolves [] = {
-               { NULL,           ns_t_a,       ns_c_in,      &result },
-               { "asterisk.org", -1,           ns_c_in,      &result },
-               { "asterisk.org", ns_t_max + 1, ns_c_in,      &result },
-               { "asterisk.org", ns_t_a,       -1,           &result },
-               { "asterisk.org", ns_t_a,       ns_c_max + 1, &result },
-               { "asterisk.org", ns_t_a,       ns_c_in,      NULL },
+               { NULL,           T_A,       C_IN,      &result },
+               { "asterisk.org", -1,        C_IN,      &result },
+               { "asterisk.org", 65536 + 1, C_IN,      &result },
+               { "asterisk.org", T_A,       -1,        &result },
+               { "asterisk.org", T_A,       65536 + 1, &result },
+               { "asterisk.org", T_A,       C_IN,      NULL },
        };
 
        int i;
        };
 
        int i;
@@ -929,7 +929,7 @@ AST_TEST_DEFINE(resolver_resolve_sync_off_nominal)
                return AST_TEST_FAIL;
        }
 
                return AST_TEST_FAIL;
        }
 
-       if (!ast_dns_resolve("asterisk.org", ns_t_a, ns_c_in, &result)) {
+       if (!ast_dns_resolve("asterisk.org", T_A, C_IN, &result)) {
                ast_test_status_update(test, "DNS resolution succeeded when we expected it not to\n");
                ast_dns_resolver_unregister(&terrible_resolver);
                return AST_TEST_FAIL;
                ast_test_status_update(test, "DNS resolution succeeded when we expected it not to\n");
                ast_dns_resolver_unregister(&terrible_resolver);
                return AST_TEST_FAIL;
@@ -1052,7 +1052,7 @@ AST_TEST_DEFINE(resolver_resolve_async)
                goto cleanup;
        }
 
                goto cleanup;
        }
 
-       active = ast_dns_resolve_async("asterisk.org", ns_t_a, ns_c_in, async_callback, async_data);
+       active = ast_dns_resolve_async("asterisk.org", T_A, C_IN, async_callback, async_data);
        if (!active) {
                ast_test_status_update(test, "Asynchronous resolution of address failed\n");
                res = AST_TEST_FAIL;
        if (!active) {
                ast_test_status_update(test, "Asynchronous resolution of address failed\n");
                res = AST_TEST_FAIL;
@@ -1133,12 +1133,12 @@ AST_TEST_DEFINE(resolver_resolve_async_off_nominal)
                int rr_class;
                ast_dns_resolve_callback callback;
        } resolves [] = {
                int rr_class;
                ast_dns_resolve_callback callback;
        } resolves [] = {
-               { NULL,           ns_t_a,       ns_c_in,      stub_callback },
-               { "asterisk.org", -1,           ns_c_in,      stub_callback },
-               { "asterisk.org", ns_t_max + 1, ns_c_in,      stub_callback },
-               { "asterisk.org", ns_t_a,       -1,           stub_callback },
-               { "asterisk.org", ns_t_a,       ns_c_max + 1, stub_callback },
-               { "asterisk.org", ns_t_a,       ns_c_in,      NULL },
+               { NULL,           T_A,       C_IN,      stub_callback },
+               { "asterisk.org", -1,        C_IN,      stub_callback },
+               { "asterisk.org", 65536 + 1, C_IN,      stub_callback },
+               { "asterisk.org", T_A,       -1,        stub_callback },
+               { "asterisk.org", T_A,       65536 + 1, stub_callback },
+               { "asterisk.org", T_A,       C_IN,      NULL },
        };
 
        struct ast_dns_query_active *active;
        };
 
        struct ast_dns_query_active *active;
@@ -1184,7 +1184,7 @@ AST_TEST_DEFINE(resolver_resolve_async_off_nominal)
                return AST_TEST_FAIL;
        }
 
                return AST_TEST_FAIL;
        }
 
-       active = ast_dns_resolve_async("asterisk.org", ns_t_a, ns_c_in, stub_callback, NULL);
+       active = ast_dns_resolve_async("asterisk.org", T_A, C_IN, stub_callback, NULL);
 
        ast_dns_resolver_unregister(&terrible_resolver);
 
 
        ast_dns_resolver_unregister(&terrible_resolver);
 
@@ -1234,7 +1234,7 @@ AST_TEST_DEFINE(resolver_resolve_async_cancel)
                goto cleanup;
        }
 
                goto cleanup;
        }
 
-       active = ast_dns_resolve_async("asterisk.org", ns_t_a, ns_c_in, async_callback, async_data);
+       active = ast_dns_resolve_async("asterisk.org", T_A, C_IN, async_callback, async_data);
        if (!active) {
                ast_test_status_update(test, "Asynchronous resolution of address failed\n");
                res = AST_TEST_FAIL;
        if (!active) {
                ast_test_status_update(test, "Asynchronous resolution of address failed\n");
                res = AST_TEST_FAIL;
index 96c745d..dc9e908 100644 (file)
@@ -116,14 +116,14 @@ static void *naptr_thread(void *dns_query)
        ans_size = ast_dns_test_generate_result(query, test_records, num_test_records,
                        sizeof(struct naptr_record), generate_naptr_record, ans_buffer);
 
        ans_size = ast_dns_test_generate_result(query, test_records, num_test_records,
                        sizeof(struct naptr_record), generate_naptr_record, ans_buffer);
 
-       ast_dns_resolver_set_result(query, 0, 0, ns_r_noerror, "goose.feathers", ans_buffer, ans_size);
+       ast_dns_resolver_set_result(query, 0, 0, NOERROR, "goose.feathers", ans_buffer, ans_size);
 
        for (i = 0; i < num_test_records; ++i) {
                char record[128];
                int naptr_size;
 
                naptr_size = generate_naptr_record(&test_records[i], record);
 
        for (i = 0; i < num_test_records; ++i) {
                char record[128];
                int naptr_size;
 
                naptr_size = generate_naptr_record(&test_records[i], record);
-               ast_dns_resolver_add_record(query, ns_t_naptr, ns_c_in, 12345, record, naptr_size);
+               ast_dns_resolver_add_record(query, T_NAPTR, C_IN, 12345, record, naptr_size);
        }
 
        ast_dns_resolver_completed(query);
        }
 
        ast_dns_resolver_completed(query);
@@ -209,7 +209,7 @@ AST_TEST_DEFINE(naptr_resolve_nominal)
 
        ast_dns_resolver_register(&naptr_resolver);
 
 
        ast_dns_resolver_register(&naptr_resolver);
 
-       if (ast_dns_resolve("goose.feathers", ns_t_naptr, ns_c_in, &result)) {
+       if (ast_dns_resolve("goose.feathers", T_NAPTR, C_IN, &result)) {
                ast_test_status_update(test, "DNS resolution failed\n");
                res = AST_TEST_FAIL;
                goto cleanup;
                ast_test_status_update(test, "DNS resolution failed\n");
                res = AST_TEST_FAIL;
                goto cleanup;
@@ -284,7 +284,7 @@ static enum ast_test_result_state off_nominal_test(struct ast_test *test, struct
 
        ast_dns_resolver_register(&naptr_resolver);
 
 
        ast_dns_resolver_register(&naptr_resolver);
 
-       if (ast_dns_resolve("goose.feathers", ns_t_naptr, ns_c_in, &result)) {
+       if (ast_dns_resolve("goose.feathers", T_NAPTR, C_IN, &result)) {
                ast_test_status_update(test, "Failed to perform DNS resolution, despite using valid inputs\n");
                res = AST_TEST_FAIL;
                goto cleanup;
                ast_test_status_update(test, "Failed to perform DNS resolution, despite using valid inputs\n");
                res = AST_TEST_FAIL;
                goto cleanup;
index aeb61c7..d1e9683 100644 (file)
@@ -94,7 +94,7 @@ static void *resolution_thread(void *dns_query)
 
        ast_assert(qsdata != NULL);
 
 
        ast_assert(qsdata != NULL);
 
-       ast_dns_resolver_set_result(query, 0, 0, ns_r_noerror, "asterisk.org", DNS_ANSWER, DNS_ANSWER_SIZE);
+       ast_dns_resolver_set_result(query, 0, 0, NOERROR, "asterisk.org", DNS_ANSWER, DNS_ANSWER_SIZE);
        ast_dns_resolver_completed(query);
 
        ao2_ref(query, -1);
        ast_dns_resolver_completed(query);
 
        ao2_ref(query, -1);
@@ -210,7 +210,7 @@ static enum ast_test_result_state query_set_test(struct ast_test *test, int reso
        qsdata->cancel_allowed = cancel;
 
        for (idx = 0; idx < total; ++idx) {
        qsdata->cancel_allowed = cancel;
 
        for (idx = 0; idx < total; ++idx) {
-               if (ast_dns_query_set_add(query_set, "asterisk.org", ns_t_a, ns_c_in)) {
+               if (ast_dns_query_set_add(query_set, "asterisk.org", T_A, C_IN)) {
                        ast_test_status_update(test, "Failed to add query to DNS query set\n");
                        res = AST_TEST_FAIL;
                        goto cleanup;
                        ast_test_status_update(test, "Failed to add query to DNS query set\n");
                        res = AST_TEST_FAIL;
                        goto cleanup;
@@ -269,11 +269,11 @@ static enum ast_test_result_state query_set_test(struct ast_test *test, int reso
                        ast_test_status_update(test, "Query did not have expected name\n");
                        res = AST_TEST_FAIL;
                }
                        ast_test_status_update(test, "Query did not have expected name\n");
                        res = AST_TEST_FAIL;
                }
-               if (ast_dns_query_get_rr_type(query) != ns_t_a) {
+               if (ast_dns_query_get_rr_type(query) != T_A) {
                        ast_test_status_update(test, "Query did not have expected type\n");
                        res = AST_TEST_FAIL;
                }
                        ast_test_status_update(test, "Query did not have expected type\n");
                        res = AST_TEST_FAIL;
                }
-               if (ast_dns_query_get_rr_class(query) != ns_c_in) {
+               if (ast_dns_query_get_rr_class(query) != C_IN) {
                        ast_test_status_update(test, "Query did not have expected class\n");
                        res = AST_TEST_FAIL;
                }
                        ast_test_status_update(test, "Query did not have expected class\n");
                        res = AST_TEST_FAIL;
                }
index d1add6e..2596e43 100644 (file)
@@ -129,13 +129,13 @@ static void *resolution_thread(void *dns_query)
        /* When the query isn't canceled, we set the TTL of the results based on what
         * we've been told to set it to
         */
        /* When the query isn't canceled, we set the TTL of the results based on what
         * we've been told to set it to
         */
-       ast_dns_resolver_set_result(query, 0, 0, ns_r_noerror, "asterisk.org", DNS_ANSWER, DNS_ANSWER_SIZE);
+       ast_dns_resolver_set_result(query, 0, 0, NOERROR, "asterisk.org", DNS_ANSWER, DNS_ANSWER_SIZE);
 
        inet_pton(AF_INET, ADDR1, addr1_buf);
 
        inet_pton(AF_INET, ADDR1, addr1_buf);
-       ast_dns_resolver_add_record(query, ns_t_a, ns_c_in, rdata->ttl1, addr1_buf, ADDR1_BUFSIZE);
+       ast_dns_resolver_add_record(query, T_A, C_IN, rdata->ttl1, addr1_buf, ADDR1_BUFSIZE);
 
        inet_pton(AF_INET, ADDR2, addr2_buf);
 
        inet_pton(AF_INET, ADDR2, addr2_buf);
-       ast_dns_resolver_add_record(query, ns_t_a, ns_c_in, rdata->ttl2, addr2_buf, ADDR2_BUFSIZE);
+       ast_dns_resolver_add_record(query, T_A, C_IN, rdata->ttl2, addr2_buf, ADDR2_BUFSIZE);
 
        ++rdata->complete_resolutions;
 
 
        ++rdata->complete_resolutions;
 
@@ -308,7 +308,7 @@ AST_TEST_DEFINE(recurring_query)
        rdata->ttl1 = 5;
        rdata->ttl2 = 20;
 
        rdata->ttl1 = 5;
        rdata->ttl2 = 20;
 
-       recurring_query = ast_dns_resolve_recurring("asterisk.org", ns_t_a, ns_c_in, async_callback, rdata);
+       recurring_query = ast_dns_resolve_recurring("asterisk.org", T_A, C_IN, async_callback, rdata);
        if (!recurring_query) {
                ast_test_status_update(test, "Failed to create recurring DNS query\n");
                res = AST_TEST_FAIL;
        if (!recurring_query) {
                ast_test_status_update(test, "Failed to create recurring DNS query\n");
                res = AST_TEST_FAIL;
@@ -382,12 +382,12 @@ AST_TEST_DEFINE(recurring_query_off_nominal)
                int rr_class;
                ast_dns_resolve_callback callback;
        } resolves [] = {
                int rr_class;
                ast_dns_resolve_callback callback;
        } resolves [] = {
-               { NULL,           ns_t_a,       ns_c_in,      stub_callback },
-               { "asterisk.org", -1,           ns_c_in,      stub_callback },
-               { "asterisk.org", ns_t_max + 1, ns_c_in,      stub_callback },
-               { "asterisk.org", ns_t_a,       -1,           stub_callback },
-               { "asterisk.org", ns_t_a,       ns_c_max + 1, stub_callback },
-               { "asterisk.org", ns_t_a,       ns_c_in,      NULL },
+               { NULL,           T_A,       C_IN,      stub_callback },
+               { "asterisk.org", -1,        C_IN,      stub_callback },
+               { "asterisk.org", 65536 + 1, C_IN,      stub_callback },
+               { "asterisk.org", T_A,       -1,        stub_callback },
+               { "asterisk.org", T_A,       65536 + 1, stub_callback },
+               { "asterisk.org", T_A,       C_IN,      NULL },
        };
        int i;
        enum ast_test_result_state res = AST_TEST_PASS;
        };
        int i;
        enum ast_test_result_state res = AST_TEST_PASS;
@@ -432,7 +432,7 @@ AST_TEST_DEFINE(recurring_query_off_nominal)
                return AST_TEST_FAIL;
        }
 
                return AST_TEST_FAIL;
        }
 
-       recurring = ast_dns_resolve_recurring("asterisk.org", ns_t_a, ns_c_in, stub_callback, NULL);
+       recurring = ast_dns_resolve_recurring("asterisk.org", T_A, C_IN, stub_callback, NULL);
 
        ast_dns_resolver_unregister(&terrible_resolver);
 
 
        ast_dns_resolver_unregister(&terrible_resolver);
 
@@ -483,7 +483,7 @@ AST_TEST_DEFINE(recurring_query_cancel_between)
        rdata->ttl1 = 5;
        rdata->ttl2 = 20;
 
        rdata->ttl1 = 5;
        rdata->ttl2 = 20;
 
-       recurring_query = ast_dns_resolve_recurring("asterisk.org", ns_t_a, ns_c_in, async_callback, rdata);
+       recurring_query = ast_dns_resolve_recurring("asterisk.org", T_A, C_IN, async_callback, rdata);
        if (!recurring_query) {
                ast_test_status_update(test, "Unable to make recurring query\n");
                res = AST_TEST_FAIL;
        if (!recurring_query) {
                ast_test_status_update(test, "Unable to make recurring query\n");
                res = AST_TEST_FAIL;
@@ -566,7 +566,7 @@ AST_TEST_DEFINE(recurring_query_cancel_during)
        rdata->ttl1 = 5;
        rdata->ttl2 = 20;
 
        rdata->ttl1 = 5;
        rdata->ttl2 = 20;
 
-       recurring_query = ast_dns_resolve_recurring("asterisk.org", ns_t_a, ns_c_in, async_callback, rdata);
+       recurring_query = ast_dns_resolve_recurring("asterisk.org", T_A, C_IN, async_callback, rdata);
        if (!recurring_query) {
                ast_test_status_update(test, "Failed to make recurring DNS query\n");
                res = AST_TEST_FAIL;
        if (!recurring_query) {
                ast_test_status_update(test, "Failed to make recurring DNS query\n");
                res = AST_TEST_FAIL;
index 2e89dab..db71beb 100644 (file)
@@ -87,14 +87,14 @@ static void *srv_thread(void *dns_query)
        ans_size = ast_dns_test_generate_result(query, test_records, num_test_records,
                        sizeof(struct srv_record), generate_srv_record, ans_buffer);
 
        ans_size = ast_dns_test_generate_result(query, test_records, num_test_records,
                        sizeof(struct srv_record), generate_srv_record, ans_buffer);
 
-       ast_dns_resolver_set_result(query, 0, 0, ns_r_noerror, "goose.feathers", ans_buffer, ans_size);
+       ast_dns_resolver_set_result(query, 0, 0, NOERROR, "goose.feathers", ans_buffer, ans_size);
 
        for (i = 0; i < num_test_records; ++i) {
                char record[128];
                int srv_size;
 
                srv_size = generate_srv_record(&test_records[i], record);
 
        for (i = 0; i < num_test_records; ++i) {
                char record[128];
                int srv_size;
 
                srv_size = generate_srv_record(&test_records[i], record);
-               ast_dns_resolver_add_record(query, ns_t_srv, ns_c_in, 12345, record, srv_size);
+               ast_dns_resolver_add_record(query, T_SRV, C_IN, 12345, record, srv_size);
        }
 
        ast_dns_resolver_completed(query);
        }
 
        ast_dns_resolver_completed(query);
@@ -136,7 +136,7 @@ static enum ast_test_result_state nominal_test(struct ast_test *test, struct srv
 
        ast_dns_resolver_register(&srv_resolver);
 
 
        ast_dns_resolver_register(&srv_resolver);
 
-       if (ast_dns_resolve("goose.feathers", ns_t_srv, ns_c_in, &result)) {
+       if (ast_dns_resolve("goose.feathers", T_SRV, C_IN, &result)) {
                ast_test_status_update(test, "DNS resolution failed\n");
                res = AST_TEST_FAIL;
                goto cleanup;
                ast_test_status_update(test, "DNS resolution failed\n");
                res = AST_TEST_FAIL;
                goto cleanup;
@@ -295,7 +295,7 @@ AST_TEST_DEFINE(srv_resolve_same_priority_different_weights)
 
                memset(ans_buffer, 0, sizeof(ans_buffer));
 
 
                memset(ans_buffer, 0, sizeof(ans_buffer));
 
-               if (ast_dns_resolve("goose.feathers", ns_t_srv, ns_c_in, &result)) {
+               if (ast_dns_resolve("goose.feathers", T_SRV, C_IN, &result)) {
                        ast_test_status_update(test, "DNS resolution failed\n");
                        res = AST_TEST_FAIL;
                        goto cleanup;
                        ast_test_status_update(test, "DNS resolution failed\n");
                        res = AST_TEST_FAIL;
                        goto cleanup;
@@ -385,7 +385,7 @@ AST_TEST_DEFINE(srv_resolve_different_priorities_different_weights)
 
                memset(ans_buffer, 0, sizeof(ans_buffer));
 
 
                memset(ans_buffer, 0, sizeof(ans_buffer));
 
-               if (ast_dns_resolve("goose.feathers", ns_t_srv, ns_c_in, &result)) {
+               if (ast_dns_resolve("goose.feathers", T_SRV, C_IN, &result)) {
                        ast_test_status_update(test, "DNS resolution failed\n");
                        res = AST_TEST_FAIL;
                        goto cleanup;
                        ast_test_status_update(test, "DNS resolution failed\n");
                        res = AST_TEST_FAIL;
                        goto cleanup;
@@ -462,7 +462,7 @@ static enum ast_test_result_state invalid_record_test(struct ast_test *test, str
 
        ast_dns_resolver_register(&srv_resolver);
 
 
        ast_dns_resolver_register(&srv_resolver);
 
-       if (ast_dns_resolve("goose.feathers", ns_t_srv, ns_c_in, &result)) {
+       if (ast_dns_resolve("goose.feathers", T_SRV, C_IN, &result)) {
                ast_test_status_update(test, "DNS resolution failed\n");
                res = AST_TEST_FAIL;
                goto cleanup;
                ast_test_status_update(test, "DNS resolution failed\n");
                res = AST_TEST_FAIL;
                goto cleanup;