Asterisk - The Open Source Telephony Project
18.5.0
|
DNS Recurring Query Support. More...
#include "asterisk.h"
#include "asterisk/astobj2.h"
#include "asterisk/linkedlists.h"
#include "asterisk/sched.h"
#include "asterisk/strings.h"
#include "asterisk/dns_core.h"
#include "asterisk/dns_recurring.h"
#include "asterisk/dns_internal.h"
#include <arpa/nameser.h>
Go to the source code of this file.
Functions | |
struct ast_dns_query_recurring * | ast_dns_resolve_recurring (const char *name, int rr_type, int rr_class, ast_dns_resolve_callback callback, void *data) |
Asynchronously resolve a DNS query, and continue resolving it according to the lowest TTL available. More... | |
int | ast_dns_resolve_recurring_cancel (struct ast_dns_query_recurring *recurring) |
Cancel an asynchronous recurring DNS resolution. More... | |
static void | dns_query_recurring_destroy (void *data) |
Destructor for a DNS query. More... | |
static void | dns_query_recurring_resolution_callback (const struct ast_dns_query *query) |
Query resolution callback. More... | |
static int | dns_query_recurring_scheduled_callback (const void *data) |
Scheduled recurring query callback. More... | |
DNS Recurring Query Support.
Definition in file dns_recurring.c.
struct ast_dns_query_recurring* ast_dns_resolve_recurring | ( | const char * | name, |
int | rr_type, | ||
int | rr_class, | ||
ast_dns_resolve_callback | callback, | ||
void * | data | ||
) |
Asynchronously resolve a DNS query, and continue resolving it according to the lowest TTL available.
name | The name of what to resolve |
rr_type | Resource record type |
rr_class | Resource record class |
callback | The callback to invoke upon completion |
data | User data to make available on the query |
non-NULL | success - query has been sent for resolution |
NULL | failure |
Definition at line 109 of file dns_recurring.c.
References ast_dns_query_recurring::active, ao2_alloc, ao2_bump, ao2_ref, ast_dns_get_sched(), ast_dns_resolve_async(), ast_strlen_zero, ast_dns_query_recurring::callback, dns_query_recurring_destroy(), dns_query_recurring_resolution_callback(), ast_dns_query_recurring::name, NULL, ast_dns_query_recurring::rr_class, ast_dns_query_recurring::rr_type, ast_dns_query_recurring::timer, and ast_dns_query_recurring::user_data.
Referenced by AST_TEST_DEFINE().
int ast_dns_resolve_recurring_cancel | ( | struct ast_dns_query_recurring * | recurring | ) |
Cancel an asynchronous recurring DNS resolution.
query | The DNS query returned from ast_dns_resolve_recurring |
0 | success - any active query has been cancelled and the query will no longer occur |
-1 | failure - an active query was in progress and could not be cancelled |
Definition at line 138 of file dns_recurring.c.
References ast_dns_query_recurring::active, ao2_lock, ao2_ref, ao2_replace, ao2_unlock, ast_dns_get_sched(), ast_dns_resolve_cancel(), AST_SCHED_DEL_UNREF, ast_dns_query_recurring::cancelled, NULL, and ast_dns_query_recurring::timer.
Referenced by AST_TEST_DEFINE().
|
static |
Destructor for a DNS query.
Definition at line 43 of file dns_recurring.c.
References ao2_cleanup, dns_query_recurring_resolution_callback(), and ast_dns_query_recurring::user_data.
Referenced by ast_dns_resolve_recurring().
|
static |
Query resolution callback.
Definition at line 71 of file dns_recurring.c.
References ast_dns_query_recurring::active, ao2_bump, ao2_lock, ao2_ref, ao2_replace, ao2_unlock, ast_dns_get_sched(), ast_dns_query_get_data(), ast_dns_query_get_result(), ast_dns_result_get_lowest_ttl(), ast_sched_add(), ast_dns_query::callback, ast_dns_query_recurring::callback, ast_dns_query_recurring::cancelled, dns_query_alloc(), dns_query_recurring_scheduled_callback(), MIN, ast_dns_query::name, NULL, result, ast_dns_query::result, ast_dns_query::rr_class, ast_dns_query::rr_type, ast_dns_query_recurring::timer, and ast_dns_query_recurring::user_data.
Referenced by ast_dns_resolve_recurring(), dns_query_recurring_destroy(), and dns_query_recurring_scheduled_callback().
|
static |
Scheduled recurring query callback.
Definition at line 53 of file dns_recurring.c.
References ast_dns_query_recurring::active, ao2_lock, ao2_ref, ao2_unlock, ast_dns_resolve_async(), ast_dns_query_recurring::cancelled, dns_query_recurring_resolution_callback(), ast_dns_query_recurring::name, ast_dns_query_recurring::rr_class, ast_dns_query_recurring::rr_type, and ast_dns_query_recurring::timer.
Referenced by dns_query_recurring_resolution_callback().