Asterisk - The Open Source Telephony Project GIT-master-f36a736
Functions
dns_test.c File Reference
#include "asterisk.h"
#include "asterisk/dns_core.h"
#include "asterisk/dns_test.h"
#include "asterisk/utils.h"
Include dependency graph for dns_test.c:

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...
 

Function Documentation

◆ ast_dns_test_generate_result()

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.

Parameters
queryThe DNS query that is being processed
recordsAn array of test-specific representations of DNS records
num_recordsThe number of elements in the records array
record_sizeThe size of each element in the records array
generateThe test-specific encoder for DNS records
bufferThe buffer into which to write the DNS response

Definition at line 229 of file dns_test.c.

231{
232 return 0;
233}

Referenced by naptr_thread(), and srv_thread().

◆ ast_dns_test_write_domain()

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.

Parameters
stringThe DNS domain to write
bufThe buffer to write the domain into
Returns
The number of bytes written to the buffer

Definition at line 224 of file dns_test.c.

225{
226 return 0;
227}

Referenced by generate_naptr_record(), and generate_srv_record().

◆ ast_dns_test_write_string()

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.

Parameters
stringThe string to write
bufThe buffer to write the string into
Returns
The number of bytes written to the buffer

Definition at line 219 of file dns_test.c.

220{
221 return 0;
222}

Referenced by generate_naptr_record().