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.
int ast_dns_test_write_domain (const char *string, char *buf)
 Write a DNS domain 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.


Function Documentation

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:
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 259 of file dns_test.c.

Referenced by naptr_thread(), and srv_thread().

00261 {
00262    return 0;
00263 }

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:
string The DNS domain to write
buf The buffer to write the domain into
Returns:
The number of bytes written to the buffer

Definition at line 254 of file dns_test.c.

Referenced by generate_naptr_record(), and generate_srv_record().

00255 {
00256    return 0;
00257 }

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:
string The string to write
buf The buffer to write the string into
Returns:
The number of bytes written to the buffer

Definition at line 249 of file dns_test.c.

Referenced by generate_naptr_record().

00250 {
00251    return 0;
00252 }


Generated on Thu Apr 16 06:30:44 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6