Asterisk - The Open Source Telephony Project
18.5.0
|
DNS Resolver API. More...
Go to the source code of this file.
Data Structures | |
struct | ast_dns_resolver |
DNS resolver implementation. More... | |
Functions | |
int | ast_dns_resolver_add_record (struct ast_dns_query *query, int rr_type, int rr_class, int ttl, const char *data, const size_t size) |
Add a DNS record to the result of a DNS query. More... | |
void | ast_dns_resolver_completed (struct ast_dns_query *query) |
Mark a DNS query as having been completed. More... | |
void * | ast_dns_resolver_get_data (const struct ast_dns_query *query) |
Retrieve resolver specific data. More... | |
int | ast_dns_resolver_register (struct ast_dns_resolver *resolver) |
Register a DNS resolver. More... | |
int | ast_dns_resolver_set_data (struct ast_dns_query *query, void *data) |
Set resolver specific data on a query. More... | |
int | ast_dns_resolver_set_result (struct ast_dns_query *query, unsigned int secure, unsigned int bogus, unsigned int rcode, const char *canonical, const char *answer, size_t answer_size) |
Set result information for a DNS query. More... | |
void | ast_dns_resolver_unregister (struct ast_dns_resolver *resolver) |
Unregister a DNS resolver. More... | |
DNS Resolver API.
Definition in file dns_resolver.h.
int ast_dns_resolver_add_record | ( | struct ast_dns_query * | query, |
int | rr_type, | ||
int | rr_class, | ||
int | ttl, | ||
const char * | data, | ||
const size_t | size | ||
) |
Add a DNS record to the result of a DNS query.
query | The DNS query |
rr_type | Resource record type |
rr_class | Resource record class |
ttl | TTL of the record |
data | The raw DNS record |
size | The size of the raw DNS record |
0 | success |
-1 | failure |
Definition at line 535 of file dns_core.c.
References allocate_dns_record(), ast_debug, AST_LIST_INSERT_TAIL, ast_dns_record::data_len, ast_dns_record::data_ptr, ast_dns_record::list, ast_dns_result::records, ast_dns_query::result, ast_dns_record::rr_class, ast_dns_record::rr_type, and ast_dns_record::ttl.
Referenced by AST_TEST_DEFINE(), dns_system_resolver_add_record(), naptr_thread(), resolution_thread(), srv_thread(), and unbound_resolver_callback().
void ast_dns_resolver_completed | ( | struct ast_dns_query * | query | ) |
Mark a DNS query as having been completed.
query | The DNS query |
Definition at line 599 of file dns_core.c.
References ast_dns_query_get_rr_type(), ast_dns_query::callback, ast_dns_query::result, and sort_result().
Referenced by dns_system_resolver_process_query(), naptr_thread(), resolution_thread(), srv_thread(), and unbound_resolver_callback().
void* ast_dns_resolver_get_data | ( | const struct ast_dns_query * | query | ) |
Retrieve resolver specific data.
query | The DNS query |
Definition at line 451 of file dns_core.c.
References ast_dns_query::resolver_data.
Referenced by AST_TEST_DEFINE(), and unbound_resolver_cancel().
int ast_dns_resolver_register | ( | struct ast_dns_resolver * | resolver | ) |
Register a DNS resolver.
resolver | A DNS resolver implementation |
0 | success |
-1 | failure |
Definition at line 630 of file dns_core.c.
References AST_LIST_TRAVERSE, ast_log, AST_RWLIST_INSERT_BEFORE_CURRENT, AST_RWLIST_INSERT_TAIL, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strlen_zero, ast_verb, ast_dns_resolver::cancel, LOG_ERROR, ast_dns_resolver::name, ast_dns_resolver::priority, and ast_dns_resolver::resolve.
Referenced by ast_dns_system_resolver_init(), AST_TEST_DEFINE(), invalid_record_test(), load_module(), nominal_test(), off_nominal_test(), and query_set_test().
int ast_dns_resolver_set_data | ( | struct ast_dns_query * | query, |
void * | data | ||
) |
Set resolver specific data on a query.
query | The DNS query |
data | The resolver specific data |
0 | success |
-1 | failure, resolver data is already set |
Definition at line 440 of file dns_core.c.
References ao2_bump, and ast_dns_query::resolver_data.
Referenced by AST_TEST_DEFINE(), and unbound_resolver_resolve().
int ast_dns_resolver_set_result | ( | struct ast_dns_query * | query, |
unsigned int | secure, | ||
unsigned int | bogus, | ||
unsigned int | rcode, | ||
const char * | canonical, | ||
const char * | answer, | ||
size_t | answer_size | ||
) |
Set result information for a DNS query.
query | The DNS query |
result | Whether the result is secured or not |
bogus | Whether the result is bogus or not |
rcode | Optional response code |
canonical | The canonical name |
answer | The raw DNS answer |
answer_size | The size of the raw DNS answer |
Zero-sized and NULL answers are permitted by this function. This may be necessary if the query fails at an early stage and no actual DNS response has been received from a DNS server.
0 | success |
-1 | failure |
Definition at line 456 of file dns_core.c.
References ast_dns_result::answer, ast_dns_result::answer_size, ast_calloc, ast_debug, ast_dns_result_free(), ast_strlen_zero, ast_dns_result::bogus, ast_dns_result::buf, ast_dns_result::canonical, ast_dns_result::rcode, ast_dns_query::result, and ast_dns_result::secure.
Referenced by AST_TEST_DEFINE(), dns_system_resolver_set_response(), naptr_thread(), resolution_thread(), srv_thread(), and unbound_resolver_callback().
void ast_dns_resolver_unregister | ( | struct ast_dns_resolver * | resolver | ) |
Unregister a DNS resolver.
resolver | A DNS resolver implementation |
Definition at line 680 of file dns_core.c.
References AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, and ast_dns_resolver::name.
Referenced by AST_TEST_DEFINE(), dns_system_resolver_destroy(), invalid_record_test(), nominal_test(), off_nominal_test(), and query_set_test().