42 #define DNS_QUERY_SET_EXPECTED_QUERY_COUNT 5
113 ast_log(LOG_ERROR,
"Attempted to add additional query to query set '%p' after resolution has started\n",
170 ast_log(LOG_ERROR,
"Attempted to start asynchronous resolution of query set '%p' when it has already started\n",
224 ast_mutex_destroy(&synchronous->
lock);
225 ast_cond_destroy(&synchronous->
cond);
233 ast_mutex_lock(&synchronous->
lock);
235 ast_cond_signal(&synchronous->
cond);
236 ast_mutex_unlock(&synchronous->
lock);
248 ast_mutex_init(&synchronous->
lock);
249 ast_cond_init(&synchronous->
cond, NULL);
254 ast_mutex_lock(&synchronous->
lock);
256 ast_cond_wait(&synchronous->
cond, &synchronous->
lock);
258 ast_mutex_unlock(&synchronous->
lock);
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
void * ast_dns_query_set_get_data(const struct ast_dns_query_set *query_set)
Retrieve user specific data from a query set.
int ast_query_set_resolve(struct ast_dns_query_set *query_set)
Synchronously resolve queries in a query set.
Asterisk main include file. File version handling, generic pbx functions.
static void dns_query_set_destroy(void *data)
Destructor for DNS query set.
void * user_data
User-specific data.
Structure used for signaling back for synchronous resolution completion.
int rr_type
Resource record type.
static void dns_synchronous_resolve_callback(const struct ast_dns_query_set *query_set)
Callback used to implement synchronous resolution.
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
int ast_dns_query_set_add(struct ast_dns_query_set *query_set, const char *name, int rr_type, int rr_class)
Add a query to a query set.
int rr_class
Resource record class.
struct ast_dns_query_set * ast_dns_query_set_create(void)
Create a query set to hold queries.
char name[0]
The name of what is being resolved.
ast_cond_t cond
Condition used for signaling.
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
struct ast_dns_query * dns_query_alloc(const char *name, int rr_type, int rr_class, ast_dns_resolve_callback callback, void *data)
Allocate a DNS query (but do not start resolution)
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
struct ast_dns_query_set::@214 queries
DNS queries.
#define AST_VECTOR_GET_ADDR(vec, idx)
Get an address of element in a vector.
void * ast_dns_query_get_data(const struct ast_dns_query *query)
Get the user specific data of a DNS query.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
A set of macros to manage forward-linked lists.
static void dns_synchronous_resolve_destroy(void *data)
Destructor for synchronous resolution structure.
#define DNS_QUERY_SET_EXPECTED_QUERY_COUNT
The default number of expected queries to be added to the query set.
void * user_data
User-specific data.
unsigned int completed
Whether the query has completed.
struct ast_dns_query * ast_dns_query_set_get(const struct ast_dns_query_set *query_set, unsigned int index)
Retrieve a query from a query set.
char data[0]
Buffer for NAPTR-specific data.
int(* resolve)(struct ast_dns_query *query)
Perform resolution of a DNS query.
int ast_dns_query_set_resolve_cancel(struct ast_dns_query_set *query_set)
Cancel an asynchronous DNS query set resolution.
Internal DNS structure definitions.
ast_dns_resolve_callback callback
Callback to invoke upon completion.
A DNS query set query, which includes its state.
int queries_completed
The total number of completed queries.
Vector container support.
struct ast_dns_resolver * resolver
The resolver in use for this query.
int in_progress
Whether the query set is in progress or not.
int queries_cancelled
The total number of cancelled queries.
static void dns_query_set_callback(const struct ast_dns_query *query)
Callback invoked upon completion of a DNS query.
unsigned int started
Whether the query started successfully or not.
size_t ast_dns_query_set_num_queries(const struct ast_dns_query_set *query_set)
Retrieve the number of queries in a query set.
ast_dns_query_set_callback callback
Callback to invoke upon completion.
ast_mutex_t lock
Lock used for signaling.
struct ast_dns_query * query
The query itself.
void(* ast_dns_query_set_callback)(const struct ast_dns_query_set *query_set)
Callback invoked when a query set completes.
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
Structure for mutex and tracking information.
int(* cancel)(struct ast_dns_query *query)
Cancel resolution of a DNS query.
void ast_dns_query_set_resolve_async(struct ast_dns_query_set *query_set, ast_dns_query_set_callback callback, void *data)
Asynchronously resolve queries in a query set.