Asterisk - The Open Source Telephony Project GIT-master-0bf3178
|
DNS support for Asterisk. More...
Go to the source code of this file.
Enumerations | |
enum | ast_dns_search_result { AST_DNS_SEARCH_FAILURE = -1 , AST_DNS_SEARCH_NO_RECORDS = 0 , AST_DNS_SEARCH_SUCCESS = 1 } |
DNS search return values. More... | |
Functions | |
struct ao2_container * | ast_dns_get_nameservers (void) |
Retrieve the configured nameservers of the system. More... | |
int | ast_search_dns (void *context, const char *dname, int class, int type, int(*callback)(void *context, unsigned char *answer, int len, unsigned char *fullanswer)) |
Perform DNS lookup (used by DNS, enum and SRV lookups) More... | |
enum ast_dns_search_result | ast_search_dns_ex (void *context, const char *dname, int rr_class, int rr_type, int(*response_handler)(void *context, unsigned char *dns_response, int dns_response_len, int rcode), int(*record_handler)(void *context, unsigned char *record, int record_len, int ttl)) |
Extended version of the DNS search function. More... | |
DNS support for Asterisk.
Definition in file dns.h.
struct ao2_container * ast_dns_get_nameservers | ( | void | ) |
Retrieve the configured nameservers of the system.
Definition at line 581 of file dns.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ast_debug, ast_mutex_lock, ast_mutex_unlock, ast_str_container_add(), ast_str_container_alloc_options(), NULL, and state.
Referenced by system_create_resolver_and_set_nameservers().
int ast_search_dns | ( | void * | context, |
const char * | dname, | ||
int | class, | ||
int | type, | ||
int(*)(void *context, unsigned char *answer, int len, unsigned char *fullanswer) | callback | ||
) |
Perform DNS lookup (used by DNS, enum and SRV lookups)
context | Void pointer containing data to use in the callback function. |
dname | Domain name to lookup (host, SRV domain, TXT record name). |
class | Record Class (see "man res_search"). |
type | Record type (see "man res_search"). |
callback | Callback function for handling the discovered resource records from the DNS search. len gets the length of the full DNS response. |
-1 | on search failure |
0 | on no records found |
1 | on success |
Perform DNS lookup (used by DNS, enum and SRV lookups)
Definition at line 491 of file dns.c.
References answer(), ast_debug, ast_log, ast_mutex_lock, ast_mutex_unlock, voicemailpwcheck::context, dns_parse_answer(), LOG_WARNING, MAX_SIZE, and type.
Referenced by ast_get_enum(), ast_get_srv(), ast_get_txt(), ast_srv_lookup(), blr_ebl(), and blr_txt().
enum ast_dns_search_result ast_search_dns_ex | ( | void * | context, |
const char * | dname, | ||
int | rr_class, | ||
int | rr_type, | ||
int(*)(void *context, unsigned char *dns_response, int dns_response_len, int rcode) | response_handler, | ||
int(*)(void *context, unsigned char *record, int record_len, int ttl) | record_handler | ||
) |
Extended version of the DNS search function.
Performs a DNS lookup, (used by DNS, enum and SRV lookups), parses the results and notifies the observer with the response and discovered records via invoking the provided callbacks (used by ast_dns_system_resolver).
context | Void pointer containing data to use in the handler functions. |
dname | Domain name to lookup (host, SRV domain, TXT record name). |
rr_class | Record Class (see "man res_search"). |
rr_type | Record type (see "man res_search"). |
response_handler | Callback function for handling the DNS response. Invoked upon completion of the DNS search. |
record_handler | Callback function for handling the discovered resource records from the DNS search. Invoked n times, where n is the number of records discovered while parsing the DNS response. |
AST_DNS_SEARCH_FAILURE | on search failure |
AST_DNS_SEARCH_NO_RECORDS | on no records found |
AST_DNS_SEARCH_SUCCESS | on success |
Definition at line 536 of file dns.c.
References ast_assert, ast_debug, AST_DNS_SEARCH_FAILURE, AST_DNS_SEARCH_NO_RECORDS, ast_log, voicemailpwcheck::context, dns_parse_answer_ex(), dns_search_res(), LOG_WARNING, MAX_SIZE, and NULL.
Referenced by dns_system_resolver_process_query().