Asterisk - The Open Source Telephony Project
18.5.0
|
Internal DNS structure definitions. More...
Go to the source code of this file.
Data Structures | |
struct | ast_dns_naptr_record |
A NAPTR record. More... | |
struct | ast_dns_query |
A DNS query. More... | |
struct | ast_dns_query_active |
An active DNS query. More... | |
struct | ast_dns_query_recurring |
A recurring DNS query. More... | |
struct | ast_dns_query_set |
A set of DNS queries. More... | |
struct | ast_dns_record |
For AST_LIST. More... | |
struct | ast_dns_result |
The result of a DNS query. More... | |
struct | ast_dns_srv_record |
An SRV record. More... | |
struct | ast_dns_txt_record |
A TXT record. More... | |
struct | dns_query_set_query |
A DNS query set query, which includes its state. More... | |
struct | ast_dns_result::dns_records |
Records returned. More... | |
Functions | |
struct ast_sched_context * | ast_dns_get_sched (void) |
Retrieve the DNS scheduler context. More... | |
char * | dns_find_record (const char *record, size_t record_size, const char *response, size_t response_size) |
Find the location of a DNS record within the entire DNS answer. More... | |
struct ast_dns_record * | dns_naptr_alloc (struct ast_dns_query *query, const char *data, const size_t size) |
Allocate and parse a DNS NAPTR record. More... | |
void | dns_naptr_sort (struct ast_dns_result *result) |
Sort the NAPTR records on a result. More... | |
int | dns_parse_short (unsigned char *cur, uint16_t *val) |
Parse a 16-bit unsigned value from a DNS record. More... | |
int | dns_parse_string (char *cur, uint8_t *size, char **val) |
Parse a DNS string from a DNS record. More... | |
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) More... | |
struct ast_dns_record * | dns_srv_alloc (struct ast_dns_query *query, const char *data, const size_t size) |
Allocate and parse a DNS SRV record. More... | |
void | dns_srv_sort (struct ast_dns_result *result) |
Sort the SRV records on a result. More... | |
struct ast_dns_record * | dns_txt_alloc (struct ast_dns_query *query, const char *data, const size_t size) |
Allocate and parse a DNS TXT record. More... | |
Internal DNS structure definitions.
Definition in file dns_internal.h.
struct ast_sched_context* ast_dns_get_sched | ( | void | ) |
Retrieve the DNS scheduler context.
Definition at line 52 of file dns_core.c.
References sched.
Referenced by ast_dns_resolve_recurring(), ast_dns_resolve_recurring_cancel(), and dns_query_recurring_resolution_callback().
char* dns_find_record | ( | const char * | record, |
size_t | record_size, | ||
const char * | response, | ||
size_t | response_size | ||
) |
Find the location of a DNS record within the entire DNS answer.
The DNS record that has been returned by the resolver may be a copy of the record that was found in the complete DNS response. If so, then some DNS record types (specifically those that parse domains) will need to locate the DNS record within the complete DNS response. This is so that if the domain contains pointers to other sections of the DNS response, then the referenced domains may be located.
record | The DNS record returned by a resolver implementation |
record_size | The size of the DNS record in bytes |
response | The complete DNS answer |
response_size | The size of the complete DNS response |
Definition at line 701 of file dns_core.c.
References ast_assert, and NULL.
Referenced by dns_naptr_alloc(), and dns_srv_alloc().
struct ast_dns_record* dns_naptr_alloc | ( | struct ast_dns_query * | query, |
const char * | data, | ||
const size_t | size | ||
) |
Allocate and parse a DNS NAPTR record.
query | The DNS query |
data | This specific NAPTR record |
size | The size of the NAPTR record |
non-NULL | success |
NULL | failure |
Definition at line 380 of file dns_naptr.c.
References ast_dns_result::answer, ast_dns_result::answer_size, ast_assert, ast_calloc, ast_log, ast_dns_naptr_record::data, ast_dns_record::data_ptr, dns_find_record(), dns_parse_short(), dns_parse_string(), errno, ast_dns_naptr_record::flags, FLAGS_INVALID, ast_dns_naptr_record::generic, interpret_flags(), LOG_ERROR, NULL, order, ast_dns_naptr_record::order, PAST_END_OF_RECORD, ast_dns_naptr_record::preference, ast_dns_naptr_record::regexp, regexp_invalid(), ast_dns_naptr_record::replacement, ast_dns_query::result, ast_dns_naptr_record::service, and services_invalid().
void dns_naptr_sort | ( | struct ast_dns_result * | result | ) |
Sort the NAPTR records on a result.
result | The DNS result |
Definition at line 551 of file dns_naptr.c.
References ast_alloca, AST_LIST_INSERT_TAIL, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, compare_order(), compare_preference(), order, ast_dns_naptr_record::order, records, and ast_dns_result::records.
int dns_parse_short | ( | unsigned char * | cur, |
uint16_t * | val | ||
) |
Parse a 16-bit unsigned value from a DNS record.
cur | Pointer to the location of the 16-bit value in the DNS record | |
[out] | val | The parsed 16-bit unsigned integer |
Definition at line 722 of file dns_core.c.
Referenced by dns_naptr_alloc(), and dns_srv_alloc().
int dns_parse_string | ( | char * | cur, |
uint8_t * | size, | ||
char ** | val | ||
) |
Parse a DNS string from a DNS record.
A DNS string consists of an 8-bit size, followed by the string value (not NULL-terminated).
cur | Pointer to the location of the DNS string | |
[out] | size | The parsed size of the DNS string |
[out] | val | The contained string (not NULL-terminated) |
Definition at line 734 of file dns_core.c.
Referenced by dns_naptr_alloc().
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)
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 |
NULL | failure |
Definition at line 193 of file dns_core.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_bump, ao2_ref, ast_log, AST_RWLIST_FIRST, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_strlen_zero, ast_dns_query::callback, dns_query_destroy(), LOG_ERROR, LOG_WARNING, ast_dns_query::name, NULL, ast_dns_query::resolver, ast_dns_query::rr_class, ast_dns_query::rr_type, and ast_dns_query::user_data.
Referenced by ast_dns_query_set_add(), ast_dns_resolve_async(), and dns_query_recurring_resolution_callback().
struct ast_dns_record* dns_srv_alloc | ( | struct ast_dns_query * | query, |
const char * | data, | ||
const size_t | size | ||
) |
Allocate and parse a DNS SRV record.
query | The DNS query |
data | This specific SRV record |
size | The size of the SRV record |
non-NULL | success |
NULL | failure |
Definition at line 42 of file dns_srv.c.
References ast_dns_result::answer, ast_dns_result::answer_size, ast_assert, ast_calloc, ast_copy_string(), ast_log, ast_dns_srv_record::data, ast_dns_record::data_ptr, dns_find_record(), dns_parse_short(), errno, ast_dns_srv_record::generic, host, ast_dns_srv_record::host, LOG_ERROR, NULL, ast_dns_srv_record::port, priority, ast_dns_srv_record::priority, ast_dns_query::result, ast_dns_srv_record::weight, and weight.
void dns_srv_sort | ( | struct ast_dns_result * | result | ) |
Sort the SRV records on a result.
result | The DNS result |
Definition at line 113 of file dns_srv.c.
References AST_LIST_APPEND_LIST, AST_LIST_FIRST, AST_LIST_HEAD_NOLOCK_INIT_VALUE, AST_LIST_INSERT_HEAD, AST_LIST_INSERT_TAIL, AST_LIST_MOVE_CURRENT, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_random(), priority, ast_dns_result::records, weight, and ast_dns_srv_record::weight_sum.
struct ast_dns_record* dns_txt_alloc | ( | struct ast_dns_query * | query, |
const char * | data, | ||
const size_t | size | ||
) |
Allocate and parse a DNS TXT record.
query | The DNS query |
data | This specific TXT record |
size | The size of the TXT record |
non-NULL | success |
NULL | failure |
Definition at line 38 of file dns_txt.c.
References ast_calloc, ast_dns_txt_record::count, ast_dns_txt_record::data, ast_dns_record::data_ptr, ast_dns_txt_record::generic, and NULL.