int ttl = 0;
const struct ast_dns_record *record;
- if (ast_dns_result_get_rcode(result) == ns_r_nxdomain) {
+ if (ast_dns_result_get_rcode(result) == NXDOMAIN) {
return 0;
}
if (ast_strlen_zero(name)) {
ast_log(LOG_WARNING, "Could not perform asynchronous resolution, no name provided\n");
return NULL;
- } else if (rr_type > ns_t_max) {
+ } else if (rr_type > 65536) {
ast_log(LOG_WARNING, "Could not perform asynchronous resolution of '%s', resource record type '%d' exceeds maximum\n",
name, rr_type);
return NULL;
ast_log(LOG_WARNING, "Could not perform asynchronous resolution of '%s', invalid resource record type '%d'\n",
name, rr_type);
return NULL;
- } else if (rr_class > ns_c_max) {
+ } else if (rr_class > 65536) {
ast_log(LOG_WARNING, "Could not perform asynchronous resolution of '%s', resource record class '%d' exceeds maximum\n",
name, rr_class);
return NULL;
if (ast_strlen_zero(name)) {
ast_log(LOG_WARNING, "Could not perform synchronous resolution, no name provided\n");
return -1;
- } else if (rr_type > ns_t_max) {
+ } else if (rr_type > 65536) {
ast_log(LOG_WARNING, "Could not perform synchronous resolution of '%s', resource record type '%d' exceeds maximum\n",
name, rr_type);
return -1;
ast_log(LOG_WARNING, "Could not perform synchronous resolution of '%s', invalid resource record type '%d'\n",
name, rr_type);
return -1;
- } else if (rr_class > ns_c_max) {
+ } else if (rr_class > 65536) {
ast_log(LOG_WARNING, "Could not perform synchronous resolution of '%s', resource record class '%d' exceeds maximum\n",
name, rr_class);
return -1;
typedef struct ast_dns_record *(*dns_alloc_fn)(struct ast_dns_query *query, const char *data, const size_t size);
static dns_alloc_fn dns_alloc_table [] = {
- [ns_t_naptr] = dns_naptr_alloc,
- [ns_t_srv] = dns_srv_alloc,
+ [T_NAPTR] = dns_naptr_alloc,
+ [T_SRV] = dns_srv_alloc,
};
static struct ast_dns_record *allocate_dns_record(int rr_type, struct ast_dns_query *query, const char *data, const size_t size)
ast_debug(2, "Query '%p': Could not add record, invalid resource record type '%d'\n",
query, rr_type);
return -1;
- } else if (rr_type > ns_t_max) {
+ } else if (rr_type > 65536) {
ast_debug(2, "Query '%p': Could not add record, resource record type '%d' exceeds maximum\n",
query, rr_type);
return -1;
ast_debug(2, "Query '%p': Could not add record, invalid resource record class '%d'\n",
query, rr_class);
return -1;
- } else if (rr_class > ns_c_max) {
+ } else if (rr_class > 65536) {
ast_debug(2, "Query '%p': Could not add record, resource record class '%d' exceeds maximum\n",
query, rr_class);
return -1;
typedef void (*dns_sort_fn)(struct ast_dns_result *result);
static dns_sort_fn dns_sort_table [] = {
- [ns_t_naptr] = dns_naptr_sort,
- [ns_t_srv] = dns_srv_sort,
+ [T_NAPTR] = dns_naptr_sort,
+ [T_SRV] = dns_srv_sort,
};
static void sort_result(int rr_type, struct ast_dns_result *result)
return -1;
}
- return sip_resolve_add(resolve, ast_dns_naptr_get_replacement(record), ns_t_srv, ns_c_in,
+ return sip_resolve_add(resolve, ast_dns_naptr_get_replacement(record), T_SRV, C_IN,
transport, 0);
}
target = AST_VECTOR_GET_ADDR(&resolving, idx);
for (record = ast_dns_result_get_records(result); record; record = ast_dns_record_get_next(record)) {
- if (ast_dns_record_get_rr_type(record) == ns_t_a ||
- ast_dns_record_get_rr_type(record) == ns_t_aaaa) {
+ if (ast_dns_record_get_rr_type(record) == T_A ||
+ ast_dns_record_get_rr_type(record) == T_AAAA) {
/* If NAPTR or SRV records exist the subsequent results from them take preference */
if (have_naptr || have_srv) {
ast_debug(2, "[%p] %s record being skipped on target '%s' because NAPTR or SRV record exists\n",
- resolve, ast_dns_record_get_rr_type(record) == ns_t_a ? "A" : "AAAA",
+ resolve, ast_dns_record_get_rr_type(record) == T_A ? "A" : "AAAA",
ast_dns_query_get_name(query));
continue;
}
resolve->addresses.entry[address_count].type = target->transport;
/* Populate address information for the new address entry */
- if (ast_dns_record_get_rr_type(record) == ns_t_a) {
+ if (ast_dns_record_get_rr_type(record) == T_A) {
ast_debug(2, "[%p] A record received on target '%s'\n", resolve, ast_dns_query_get_name(query));
resolve->addresses.entry[address_count].addr_len = sizeof(pj_sockaddr_in);
pj_sockaddr_init(pj_AF_INET(), &resolve->addresses.entry[address_count].addr, NULL,
}
address_count++;
- } else if (ast_dns_record_get_rr_type(record) == ns_t_srv) {
+ } else if (ast_dns_record_get_rr_type(record) == T_SRV) {
if (have_naptr) {
ast_debug(2, "[%p] SRV record being skipped on target '%s' because NAPTR record exists\n",
resolve, ast_dns_query_get_name(query));
/* If an explicit IPv6 target transport has been requested look for only AAAA records */
if (target->transport & PJSIP_TRANSPORT_IPV6) {
- sip_resolve_add(resolve, ast_dns_srv_get_host(record), ns_t_aaaa, ns_c_in, target->transport,
+ sip_resolve_add(resolve, ast_dns_srv_get_host(record), T_AAAA, C_IN, target->transport,
ast_dns_srv_get_port(record));
have_srv = 1;
} else if (sip_transport_is_available(target->transport + PJSIP_TRANSPORT_IPV6)) {
- sip_resolve_add(resolve, ast_dns_srv_get_host(record), ns_t_aaaa, ns_c_in, target->transport + PJSIP_TRANSPORT_IPV6,
+ sip_resolve_add(resolve, ast_dns_srv_get_host(record), T_AAAA, C_IN, target->transport + PJSIP_TRANSPORT_IPV6,
ast_dns_srv_get_port(record));
have_srv = 1;
}
if (!(target->transport & PJSIP_TRANSPORT_IPV6) &&
sip_transport_is_available(target->transport)) {
- sip_resolve_add(resolve, ast_dns_srv_get_host(record), ns_t_a, ns_c_in, target->transport,
+ sip_resolve_add(resolve, ast_dns_srv_get_host(record), T_A, C_IN, target->transport,
ast_dns_srv_get_port(record));
have_srv = 1;
}
- } else if (ast_dns_record_get_rr_type(record) == ns_t_naptr) {
+ } else if (ast_dns_record_get_rr_type(record) == T_NAPTR) {
int added = -1;
ast_debug(2, "[%p] NAPTR record received on target '%s'\n", resolve, ast_dns_query_get_name(query));
* explicitly and only looks for IPv6 records.
*/
- res |= sip_resolve_add(resolve, host, ns_t_naptr, ns_c_in, type, 0);
+ res |= sip_resolve_add(resolve, host, T_NAPTR, C_IN, type, 0);
if (type == PJSIP_TRANSPORT_UNSPECIFIED ||
(type == PJSIP_TRANSPORT_TLS && sip_transport_is_available(PJSIP_TRANSPORT_TLS)) ||
(type == PJSIP_TRANSPORT_TLS6 && sip_transport_is_available(PJSIP_TRANSPORT_TLS6))) {
snprintf(srv, sizeof(srv), "_sips._tcp.%s", host);
- res |= sip_resolve_add(resolve, srv, ns_t_srv, ns_c_in,
+ res |= sip_resolve_add(resolve, srv, T_SRV, C_IN,
type == PJSIP_TRANSPORT_UNSPECIFIED ? PJSIP_TRANSPORT_TLS : type, 0);
}
if (type == PJSIP_TRANSPORT_UNSPECIFIED ||
(type == PJSIP_TRANSPORT_TCP && sip_transport_is_available(PJSIP_TRANSPORT_TCP)) ||
(type == PJSIP_TRANSPORT_TCP6 && sip_transport_is_available(PJSIP_TRANSPORT_TCP6))) {
snprintf(srv, sizeof(srv), "_sip._tcp.%s", host);
- res |= sip_resolve_add(resolve, srv, ns_t_srv, ns_c_in,
+ res |= sip_resolve_add(resolve, srv, T_SRV, C_IN,
type == PJSIP_TRANSPORT_UNSPECIFIED ? PJSIP_TRANSPORT_TCP : type, 0);
}
if (type == PJSIP_TRANSPORT_UNSPECIFIED ||
(type == PJSIP_TRANSPORT_UDP && sip_transport_is_available(PJSIP_TRANSPORT_UDP)) ||
(type == PJSIP_TRANSPORT_UDP6 && sip_transport_is_available(PJSIP_TRANSPORT_UDP6))) {
snprintf(srv, sizeof(srv), "_sip._udp.%s", host);
- res |= sip_resolve_add(resolve, srv, ns_t_srv, ns_c_in,
+ res |= sip_resolve_add(resolve, srv, T_SRV, C_IN,
type == PJSIP_TRANSPORT_UNSPECIFIED ? PJSIP_TRANSPORT_UDP : type, 0);
}
}
if ((type == PJSIP_TRANSPORT_UNSPECIFIED && sip_transport_is_available(PJSIP_TRANSPORT_UDP6)) ||
sip_transport_is_available(type + PJSIP_TRANSPORT_IPV6)) {
- res |= sip_resolve_add(resolve, host, ns_t_aaaa, ns_c_in, (type == PJSIP_TRANSPORT_UNSPECIFIED ? PJSIP_TRANSPORT_UDP6 : type + PJSIP_TRANSPORT_IPV6), target->addr.port);
+ res |= sip_resolve_add(resolve, host, T_AAAA, C_IN, (type == PJSIP_TRANSPORT_UNSPECIFIED ? PJSIP_TRANSPORT_UDP6 : type + PJSIP_TRANSPORT_IPV6), target->addr.port);
}
if ((type == PJSIP_TRANSPORT_UNSPECIFIED && sip_transport_is_available(PJSIP_TRANSPORT_UDP)) ||
sip_transport_is_available(type)) {
- res |= sip_resolve_add(resolve, host, ns_t_a, ns_c_in, (type == PJSIP_TRANSPORT_UNSPECIFIED ? PJSIP_TRANSPORT_UDP : type), target->addr.port);
+ res |= sip_resolve_add(resolve, host, T_A, C_IN, (type == PJSIP_TRANSPORT_UNSPECIFIED ? PJSIP_TRANSPORT_UDP : type), target->addr.port);
}
if (res) {