Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
#include "asterisk.h"
#include "asterisk/dns_core.h"
#include "asterisk/dns_test.h"
#include "asterisk/utils.h"
Go to the source code of this file.
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. More... | |
int | ast_dns_test_write_domain (const char *string, char *buf) |
Write a DNS domain to a buffer. More... | |
int | ast_dns_test_write_string (const struct ast_dns_test_string *string, char *buf) |
Write a DNS string to a buffer. More... | |
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.
This function takes care of generating the DNS header, question, and answer sections of a DNS response. In order to place test-specific record data into the DNS answers, a callback is provided as a parameter to this function so that the necessary records can be encoded properly by the tests.
There is no buffer size passed to this function. Tests are expected to use a buffer that is sufficiently large for their tests.
query | The DNS query that is being processed |
records | An array of test-specific representations of DNS records |
num_records | The number of elements in the records array |
record_size | The size of each element in the records array |
generate | The test-specific encoder for DNS records |
buffer | The buffer into which to write the DNS response |
Definition at line 229 of file dns_test.c.
Referenced by naptr_thread(), and srv_thread().
int ast_dns_test_write_domain | ( | const char * | string, |
char * | buf | ||
) |
Write a DNS domain to a buffer.
A DNS domain consists of a series of labels separated by dots. Each of these labels gets written as a DNS string. A DNS domain ends with a NULL label, which is essentially a zero-length DNS string.
There is no buffer size passed to this function. Tests are expected to use a buffer that is sufficiently large for their tests.
string | The DNS domain to write |
buf | The buffer to write the domain into |
Definition at line 224 of file dns_test.c.
Referenced by generate_naptr_record(), and generate_srv_record().
int ast_dns_test_write_string | ( | const struct ast_dns_test_string * | string, |
char * | buf | ||
) |
Write a DNS string to a buffer.
This writes the DNS string to the buffer and returns the total number of bytes written to the buffer.
There is no buffer size passed to this function. Tests are expected to use a buffer that is sufficiently large for their tests.
string | The string to write |
buf | The buffer to write the string into |
Definition at line 219 of file dns_test.c.
Referenced by generate_naptr_record().