30 #include <netinet/in.h> 41 const char *end_of_record = data + size;
46 while (data < end_of_record) {
47 uint8_t byte_count = (uint8_t) *data;
49 data += byte_count + 1;
52 if (data != end_of_record) {
77 struct ast_vector_string *strings;
81 const char *end_of_record = data + size;
85 strings =
ast_malloc(
sizeof(
struct ast_vector_const_string));
95 while (data < end_of_record) {
97 uint8_t bytes = (uint8_t) *data;
105 memcpy(s, &data[1], bytes);
115 if (data != end_of_record) {
struct ast_dns_record generic
Generic DNS record information.
Asterisk main include file. File version handling, generic pbx functions.
const char * ast_dns_record_get_data(const struct ast_dns_record *record)
Retrieve the raw DNS record.
char * data_ptr
pointer to record-specific data.
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
size_t ast_dns_record_get_data_size(const struct ast_dns_record *record)
Retrieve the size of the raw DNS record.
void ast_dns_txt_free_strings(struct ast_vector_string *strings)
Free strings returned by ast_dns_txt_get_strings.
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.
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
#define ast_malloc(len)
A wrapper for malloc()
char data[0]
The raw DNS record.
char data[0]
The raw DNS record.
DNS TXT Record Parsing API.
struct ast_vector_string * ast_dns_txt_get_strings(const struct ast_dns_record *record)
Get the character strings from this TXT record.
Internal DNS structure definitions.
size_t ast_dns_txt_get_count(const struct ast_dns_record *record)
Get the number of character strings in a TXT record.
#define ast_calloc(num, len)
A wrapper for calloc()
#define AST_VECTOR_PTR_FREE(vec)
Deallocates this vector pointer.
size_t count
The number of character strings in the TXT record.
int ast_dns_record_get_rr_type(const struct ast_dns_record *record)
Get the resource record type of a DNS record.
#define AST_VECTOR_CALLBACK_VOID(vec, callback,...)
Execute a callback on every element in a vector disregarding callback return.