40 #define DNS_SYSTEM_RESOLVER_PRIORITY INT_MAX 43 #define DNS_SYSTEM_RESOLVER_SUCCESS 0 46 #define DNS_SYSTEM_RESOLVER_FAILURE -1 154 ast_debug(1,
"DNS search failed for query: '%s'\n",
157 ast_debug(1,
"DNS search failed to yield any results for query: '%s'\n",
222 (
const char*) dns_response,
227 ast_log(
LOG_ERROR,
"Could not instantiate the results field for query: '%s'\n",
257 if (!dns_system_resolver_tp) {
Asterisk main include file. File version handling, generic pbx functions.
char data[0]
Additional data.
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.
const char * ast_dns_query_get_name(const struct ast_dns_query *query)
Get the name queried in a DNS query.
int ast_dns_query_get_rr_class(const struct ast_dns_query *query)
Get the record resource class of a DNS query.
void ast_dns_resolver_unregister(struct ast_dns_resolver *resolver)
Unregister a DNS resolver.
struct ast_taskprocessor * ast_taskprocessor_get(const char *name, enum ast_tps_options create)
Get a reference to a taskprocessor with the specified name and create the taskprocessor if necessary...
static int dns_system_resolver_resolve(struct ast_dns_query *query)
Resolves a DNS query.
return a reference to a taskprocessor, create one if it does not exist
#define DNS_SYSTEM_RESOLVER_SUCCESS
Resolver return code upon success.
static int dns_system_resolver_set_response(void *context, unsigned char *dns_response, int dns_response_len, int rcode)
Callback to handle initializing the results field.
const char * name
The name of the resolver implementation.
#define ast_debug(level,...)
Log a DEBUG message.
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
ast_dns_search_result
DNS search return values.
int ast_dns_resolver_register(struct ast_dns_resolver *resolver)
Register a DNS resolver.
#define ao2_ref(o, delta)
A set of macros to manage forward-linked lists.
int ast_dns_system_resolver_init(void)
Initializes the resolver.
static void dns_system_resolver_destroy(void)
Destructor.
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.
void ast_dns_resolver_completed(struct ast_dns_query *query)
Mark a DNS query as having been completed.
static int dns_system_resolver_add_record(void *context, unsigned char *record, int record_len, int ttl)
Callback to handle processing resource records.
struct ast_dns_result * ast_dns_query_get_result(const struct ast_dns_query *query)
Get the result information for a DNS query.
DNS resolver implementation.
static int dns_system_resolver_cancel(struct ast_dns_query *query)
Cancels processing resolution for a given query.
#define DNS_SYSTEM_RESOLVER_PRIORITY
The consideration priority for this resolver implementation.
static int dns_system_resolver_process_query(void *data)
Callback to handle processing the query from the ast_taskprocessor instance.
Prototypes for public functions only of internal interest,.
struct ast_dns_resolver dns_system_resolver_base
The base definition for the dns_system_resolver.
An API for managing task processing threads that can be shared across modules.
int ast_dns_query_get_rr_type(const struct ast_dns_query *query)
Get the record resource type of a DNS query.
#define DNS_SYSTEM_RESOLVER_FAILURE
Resolver return code upon failure.
A ast_taskprocessor structure is a singleton by name.
int ast_taskprocessor_push(struct ast_taskprocessor *tps, int(*task_exe)(void *datap), void *datap) attribute_warn_unused_result
Push a task into the specified taskprocessor queue and signal the taskprocessor thread.
void * ast_taskprocessor_unreference(struct ast_taskprocessor *tps)
Unreference the specified taskprocessor and its reference count will decrement.
static struct ast_taskprocessor * dns_system_resolver_tp
The task processor to use for making DNS searches asynchronous.
static char context[AST_MAX_CONTEXT]
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.
DNS support for Asterisk.