66 unsigned short net_num_records = htons(num_records);
70 memcpy(&buf[6], &net_num_records,
sizeof(num_records));
77 0x05, 0x67, 0x6f, 0x6f, 0x73, 0x65,
79 0x08, 0x66, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72, 0x73,
116 0x00, 0x00, 0x30, 0x39,
137 int net_ttl = htonl(ttl);
142 memcpy(&buf[6], &net_ttl,
sizeof(
int));
164 uint8_t
len =
string->len;
165 size_t actual_len = strlen(string->
val);
173 memcpy(&buf[1], string->
val, strlen(string->
val));
176 return actual_len + 1;
208 part =
strsep(©,
".");
212 dns_str.
len = strlen(part);
223 size_t record_size,
record_fn generate,
char *buffer)
231 for (record_iter = records; record_iter < (
char *) records + num_records * record_size; record_iter += record_size) {
232 unsigned short rdlength;
233 unsigned short net_rdlength;
237 rdlength = generate(record_iter, ptr + 2);
238 net_rdlength = htons(rdlength);
239 memcpy(ptr, &net_rdlength, 2);
260 size_t record_size,
record_fn generate,
char *buffer)
Asterisk main include file. File version handling, generic pbx functions.
int ast_dns_test_generate_result(struct ast_dns_query *query, void *records, size_t num_records, size_t record_size, record_fn generate, char *buffer)
Generate a full DNS response for the given DNS records.
Representation of a string in DNS.
int(* record_fn)(void *record, char *buf)
Callback to write specific DNS record to an answer.
static int copy(char *infile, char *outfile)
Utility function to copy a file.
static int generate_dns_question(char *buf)
Generate a DNS question and write it to a buffer.
#define ast_strlen_zero(foo)
#define ast_strdupa(s)
duplicate a string in memory from the stack
static int generate_dns_header(unsigned short num_records, char *buf)
Generate a DNS header and write it to a buffer.
int ast_dns_test_write_domain(const char *string, char *buf)
Write a DNS domain to a buffer.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static int generate_dns_answer(int ttl, char *buf)
Generate a DNS answer and write it to a buffer.
int ast_dns_test_write_string(const struct ast_dns_test_string *string, char *buf)
Write a DNS string to a buffer.
char * strsep(char **str, const char *delims)
const char DNS_QUESTION[]
const char NAPTR_ANSWER[]