Asterisk - The Open Source Telephony Project
18.5.0
|
DNS SRV Record Support. More...
#include "asterisk.h"
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
#include "asterisk/dns_core.h"
#include "asterisk/dns_srv.h"
#include "asterisk/linkedlists.h"
#include "asterisk/dns_internal.h"
#include "asterisk/utils.h"
Go to the source code of this file.
Functions | |
const char * | ast_dns_srv_get_host (const struct ast_dns_record *record) |
Get the hostname from an SRV record. More... | |
unsigned short | ast_dns_srv_get_port (const struct ast_dns_record *record) |
Get the port from an SRV record. More... | |
unsigned short | ast_dns_srv_get_priority (const struct ast_dns_record *record) |
Get the priority from an SRV record. More... | |
unsigned short | ast_dns_srv_get_weight (const struct ast_dns_record *record) |
Get the weight from an SRV record. 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... | |
DNS SRV Record Support.
Definition in file dns_srv.c.
const char* ast_dns_srv_get_host | ( | const struct ast_dns_record * | record | ) |
Get the hostname from an SRV record.
record | The DNS record |
Definition at line 188 of file dns_srv.c.
References ast_assert, ast_dns_record_get_rr_type(), and ast_dns_srv_record::host.
Referenced by AST_TEST_DEFINE(), nominal_test(), and sip_resolve_callback().
unsigned short ast_dns_srv_get_port | ( | const struct ast_dns_record * | record | ) |
Get the port from an SRV record.
record | The DNS record |
Definition at line 212 of file dns_srv.c.
References ast_assert, ast_dns_record_get_rr_type(), and ast_dns_srv_record::port.
Referenced by AST_TEST_DEFINE(), nominal_test(), and sip_resolve_callback().
unsigned short ast_dns_srv_get_priority | ( | const struct ast_dns_record * | record | ) |
Get the priority from an SRV record.
record | The DNS record |
Definition at line 196 of file dns_srv.c.
References ast_assert, ast_dns_record_get_rr_type(), and ast_dns_srv_record::priority.
Referenced by AST_TEST_DEFINE(), and nominal_test().
unsigned short ast_dns_srv_get_weight | ( | const struct ast_dns_record * | record | ) |
Get the weight from an SRV record.
record | The DNS record |
Definition at line 204 of file dns_srv.c.
References ast_assert, ast_dns_record_get_rr_type(), and ast_dns_srv_record::weight.
Referenced by AST_TEST_DEFINE(), and nominal_test().
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.