Asterisk - The Open Source Telephony Project
18.5.0
|
DNS Query Set API. More...
Go to the source code of this file.
Typedefs | |
typedef void(* | ast_dns_query_set_callback) (const struct ast_dns_query_set *query_set) |
Callback invoked when a query set completes. More... | |
Functions | |
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. More... | |
struct ast_dns_query_set * | ast_dns_query_set_create (void) |
Create a query set to hold queries. More... | |
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. More... | |
void * | ast_dns_query_set_get_data (const struct ast_dns_query_set *query_set) |
Retrieve user specific data from a query set. More... | |
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. More... | |
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. More... | |
int | ast_dns_query_set_resolve_cancel (struct ast_dns_query_set *query_set) |
Cancel an asynchronous DNS query set resolution. More... | |
int | ast_query_set_resolve (struct ast_dns_query_set *query_set) |
Synchronously resolve queries in a query set. More... | |
DNS Query Set API.
Definition in file dns_query_set.h.
typedef void(* ast_dns_query_set_callback) (const struct ast_dns_query_set *query_set) |
Callback invoked when a query set completes.
query_set | The DNS query set that was invoked |
Definition at line 39 of file dns_query_set.h.
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.
query_set | A DNS query set |
name | The name of what to resolve |
rr_type | Resource record type |
rr_class | Resource record class |
0 | success |
-1 | failure |
Definition at line 105 of file dns_query_set.c.
References ao2_ref, ast_assert, ast_log, AST_VECTOR_APPEND, dns_query_alloc(), dns_query_set_callback(), ast_dns_query_set::in_progress, LOG_ERROR, NULL, dns_query_set_query::query, and dns_query_set_query::started.
Referenced by ast_dns_resolve_ipv6_and_ipv4(), query_set_test(), and sip_resolve_add().
struct ast_dns_query_set* ast_dns_query_set_create | ( | void | ) |
Create a query set to hold queries.
non-NULL | success |
NULL | failure |
Definition at line 60 of file dns_query_set.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_ref, AST_VECTOR_INIT, dns_query_set_destroy(), DNS_QUERY_SET_EXPECTED_QUERY_COUNT, and NULL.
Referenced by ast_dns_resolve_ipv6_and_ipv4(), query_set_test(), and sip_resolve_add().
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.
query_set | A DNS query set |
index | The index of the query to retrieve |
non-NULL | success |
NULL | failure |
Definition at line 144 of file dns_query_set.c.
References AST_VECTOR_GET_ADDR, AST_VECTOR_SIZE, NULL, and ast_dns_query_set::queries_completed.
Referenced by ast_dns_resolve_ipv6_and_ipv4(), query_set_test(), and sip_resolve_callback().
void* ast_dns_query_set_get_data | ( | const struct ast_dns_query_set * | query_set | ) |
Retrieve user specific data from a query set.
query_set | A DNS query set |
Definition at line 159 of file dns_query_set.c.
References ast_dns_query_set::user_data.
Referenced by dns_synchronous_resolve_callback(), query_set_callback(), and sip_resolve_callback().
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.
query_set | A DNS query set |
Definition at line 139 of file dns_query_set.c.
References AST_VECTOR_SIZE.
Referenced by ast_dns_resolve_ipv6_and_ipv4(), query_set_test(), and sip_resolve_callback().
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.
query_set | The query set |
callback | The callback to invoke upon completion |
data | User data to make available on the query set |
Definition at line 164 of file dns_query_set.c.
References ao2_bump, ao2_cleanup, ao2_ref, ast_assert, ast_log, AST_VECTOR_GET_ADDR, AST_VECTOR_SIZE, ast_dns_query::callback, ast_dns_query_set::callback, dns_synchronous_resolve::completed, dns_synchronous_resolve::cond, dns_query_set_callback(), ast_dns_query_set::in_progress, dns_synchronous_resolve::lock, LOG_ERROR, NULL, dns_query_set_query::query, ast_dns_resolver::resolve, ast_dns_query::resolver, dns_query_set_query::started, ast_dns_query::user_data, and ast_dns_query_set::user_data.
Referenced by ast_query_set_resolve(), query_set_test(), sip_resolve(), and sip_resolve_callback().
int ast_dns_query_set_resolve_cancel | ( | struct ast_dns_query_set * | query_set | ) |
Cancel an asynchronous DNS query set resolution.
query_set | The DNS query set |
0 | success (all queries have been cancelled) |
-1 | failure (some queries could not be cancelled) |
Definition at line 265 of file dns_query_set.c.
References AST_VECTOR_GET_ADDR, AST_VECTOR_SIZE, ast_dns_resolver::cancel, dns_query_set_callback(), ast_dns_query_set::queries_cancelled, dns_query_set_query::query, ast_dns_query::resolver, and dns_query_set_query::started.
Referenced by query_set_test().
int ast_query_set_resolve | ( | struct ast_dns_query_set * | query_set | ) |
Synchronously resolve queries in a query set.
query_set | The query set |
0 | success |
-1 | failure |
Definition at line 239 of file dns_query_set.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_ref, ast_cond_init, ast_cond_wait, ast_dns_query_set_resolve_async(), ast_mutex_init, ast_mutex_lock, ast_mutex_unlock, dns_synchronous_resolve::completed, dns_synchronous_resolve::cond, dns_synchronous_resolve_callback(), dns_synchronous_resolve_destroy(), dns_synchronous_resolve::lock, and NULL.
Referenced by ast_dns_resolve_ipv6_and_ipv4().