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",
223 (
const char*) dns_response,
228 ast_log(
LOG_ERROR,
"Could not instantiate the results field for query: '%s'\n",
Prototypes for public functions only of internal interest,.
Asterisk main include file. File version handling, generic pbx functions.
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
DNS support for Asterisk.
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.
ast_dns_search_result
DNS search return values.
@ AST_DNS_SEARCH_NO_RECORDS
int ast_dns_query_get_rr_type(const struct ast_dns_query *query)
Get the record resource type of 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.
struct ast_dns_result * ast_dns_query_get_result(const struct ast_dns_query *query)
Get the result information for 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_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.
void ast_dns_resolver_completed(struct ast_dns_query *query)
Mark a DNS query as having been completed.
int ast_dns_resolver_register(struct ast_dns_resolver *resolver)
Register a DNS resolver.
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.
void ast_dns_resolver_unregister(struct ast_dns_resolver *resolver)
Unregister a DNS resolver.
static struct ast_taskprocessor * dns_system_resolver_tp
The task processor to use for making DNS searches asynchronous.
static int dns_system_resolver_process_query(void *data)
Callback to handle processing the query from the ast_taskprocessor instance.
#define DNS_SYSTEM_RESOLVER_FAILURE
Resolver return code upon failure.
static int dns_system_resolver_add_record(void *context, unsigned char *record, int record_len, int ttl)
Callback to handle processing resource records.
static void dns_system_resolver_destroy(void)
Destructor.
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.
static int dns_system_resolver_resolve(struct ast_dns_query *query)
Resolves a DNS query.
#define DNS_SYSTEM_RESOLVER_PRIORITY
The consideration priority for this resolver implementation.
#define DNS_SYSTEM_RESOLVER_SUCCESS
Resolver return code upon success.
int ast_dns_system_resolver_init(void)
Initializes the resolver.
struct ast_dns_resolver dns_system_resolver_base
The base definition for the dns_system_resolver.
static int dns_system_resolver_cancel(struct ast_dns_query *query)
Cancels processing resolution for a given query.
#define ast_debug(level,...)
Log a DEBUG message.
A set of macros to manage forward-linked lists.
DNS resolver implementation.
const char * name
The name of the resolver implementation.
A ast_taskprocessor structure is a singleton by name.
An API for managing task processing threads that can be shared across modules.
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.
void * ast_taskprocessor_unreference(struct ast_taskprocessor *tps)
Unreference the specified taskprocessor and its reference count will decrement.
@ TPS_REF_DEFAULT
return a reference to a taskprocessor, create one if it does not exist
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.