Asterisk - The Open Source Telephony Project
18.5.0
|
The default DNS resolver for Asterisk. More...
#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/astobj2.h"
#include "asterisk/dns.h"
#include "asterisk/dns_core.h"
#include "asterisk/dns_resolver.h"
#include "asterisk/linkedlists.h"
#include "asterisk/taskprocessor.h"
#include "asterisk/utils.h"
Go to the source code of this file.
Macros | |
#define | DNS_SYSTEM_RESOLVER_FAILURE -1 |
Resolver return code upon failure. More... | |
#define | DNS_SYSTEM_RESOLVER_PRIORITY INT_MAX |
The consideration priority for this resolver implementation. More... | |
#define | DNS_SYSTEM_RESOLVER_SUCCESS 0 |
Resolver return code upon success. More... | |
Functions | |
int | ast_dns_system_resolver_init (void) |
Initializes the resolver. More... | |
static int | dns_system_resolver_add_record (void *context, unsigned char *record, int record_len, int ttl) |
Callback to handle processing resource records. More... | |
static int | dns_system_resolver_cancel (struct ast_dns_query *query) |
Cancels processing resolution for a given query. More... | |
static void | dns_system_resolver_destroy (void) |
Destructor. More... | |
static int | dns_system_resolver_process_query (void *data) |
Callback to handle processing the query from the ast_taskprocessor instance. More... | |
static int | dns_system_resolver_resolve (struct ast_dns_query *query) |
Resolves a DNS query. More... | |
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. More... | |
Variables | |
struct ast_dns_resolver | dns_system_resolver_base |
The base definition for the dns_system_resolver. More... | |
static struct ast_taskprocessor * | dns_system_resolver_tp |
The task processor to use for making DNS searches asynchronous. More... | |
The default DNS resolver for Asterisk.
Definition in file dns_system_resolver.c.
#define DNS_SYSTEM_RESOLVER_FAILURE -1 |
Resolver return code upon failure.
Definition at line 46 of file dns_system_resolver.c.
Referenced by ast_dns_system_resolver_init(), and dns_system_resolver_cancel().
#define DNS_SYSTEM_RESOLVER_PRIORITY INT_MAX |
The consideration priority for this resolver implementation.
Definition at line 40 of file dns_system_resolver.c.
#define DNS_SYSTEM_RESOLVER_SUCCESS 0 |
Resolver return code upon success.
Definition at line 43 of file dns_system_resolver.c.
Referenced by ast_dns_system_resolver_init(), and dns_system_resolver_set_response().
int ast_dns_system_resolver_init | ( | void | ) |
Initializes the resolver.
0 | on success |
-1 | on failure |
Definition at line 243 of file dns_system_resolver.c.
References ast_dns_resolver_register(), ast_register_cleanup(), ast_taskprocessor_get(), dns_system_resolver_destroy(), DNS_SYSTEM_RESOLVER_FAILURE, DNS_SYSTEM_RESOLVER_SUCCESS, and TPS_REF_DEFAULT.
Referenced by asterisk_daemon().
|
static |
Callback to handle processing resource records.
Adds an individual resource record discovered with ast_search_dns_ex to the ast_dns_query currently being resolved.
Definition at line 84 of file dns_system_resolver.c.
References ast_dns_query_get_rr_class(), ast_dns_query_get_rr_type(), ast_dns_resolver_add_record(), and context.
Referenced by dns_system_resolver_process_query().
|
static |
Cancels processing resolution for a given query.
Definition at line 110 of file dns_system_resolver.c.
References DNS_SYSTEM_RESOLVER_FAILURE.
|
static |
Destructor.
Definition at line 120 of file dns_system_resolver.c.
References ast_dns_resolver_unregister(), and ast_taskprocessor_unreference().
Referenced by ast_dns_system_resolver_init().
|
static |
Callback to handle processing the query from the ast_taskprocessor instance.
Definition at line 140 of file dns_system_resolver.c.
References ao2_ref, ast_debug, ast_dns_query_get_name(), ast_dns_query_get_rr_class(), ast_dns_query_get_rr_type(), ast_dns_resolver_completed(), AST_DNS_SEARCH_FAILURE, AST_DNS_SEARCH_NO_RECORDS, ast_search_dns_ex(), dns_system_resolver_add_record(), and dns_system_resolver_set_response().
Referenced by dns_system_resolver_resolve().
|
static |
Resolves a DNS query.
Definition at line 180 of file dns_system_resolver.c.
References ao2_bump, ao2_ref, ast_dns_query_get_name(), ast_log, ast_taskprocessor_push(), dns_system_resolver_process_query(), and LOG_ERROR.
|
static |
Callback to handle initializing the results field.
Definition at line 210 of file dns_system_resolver.c.
References ast_dns_query_get_name(), ast_dns_query_get_result(), ast_dns_resolver_set_result(), ast_log, context, DNS_SYSTEM_RESOLVER_SUCCESS, and LOG_ERROR.
Referenced by dns_system_resolver_process_query().
struct ast_dns_resolver dns_system_resolver_base |
The base definition for the dns_system_resolver.
Definition at line 61 of file dns_system_resolver.c.
|
static |
The task processor to use for making DNS searches asynchronous.
Definition at line 58 of file dns_system_resolver.c.