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;
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);
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);
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;
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;
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;
}
- 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;
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;
}
- 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 */
- 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;
}
- 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 */
- 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 */
- 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 */
- 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;
}
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);
- 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);
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;
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;
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;
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;
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;
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);
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;
/* 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);
- 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);
- 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->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;
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;
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);
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;
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;
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);
- 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_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;
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;
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_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;