Asterisk - The Open Source Telephony Project GIT-master-7e7a603
test_dns_naptr.c
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2015, Mark Michelson
5 *
6 * Mark Michelson <mmichelson@digium.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19/*** MODULEINFO
20 <depend>TEST_FRAMEWORK</depend>
21 <support_level>core</support_level>
22 ***/
23
24#include "asterisk.h"
25
26#include <arpa/nameser.h>
27
28#include "asterisk/test.h"
29#include "asterisk/module.h"
30#include "asterisk/dns_core.h"
32#include "asterisk/dns_naptr.h"
33#include "asterisk/dns_test.h"
34
36 uint16_t order;
37 uint16_t preference;
41 const char *replacement;
42};
43
44/*!
45 * \brief Given a NAPTR record, generate a binary form, as would appear in DNS RDATA
46 *
47 * This is part of a DNS answer, specific to NAPTR. It consists of all parts of
48 * the NAPTR record, encoded as it should be in a DNS record.
49 *
50 * There is no buffer size passed to this function since we provide
51 * the data ourselves and have sized the buffer to be way larger
52 * than necessary for the tests.
53 *
54 * \param dns_record The NAPTR record to encode
55 * \param buf The buffer to write the record into
56 * \return The number of bytes written to the buffer
57 */
58static int generate_naptr_record(void *dns_record, char *buf)
59{
60 struct naptr_record *record = dns_record;
61 uint16_t net_order = htons(record->order);
62 uint16_t net_preference = htons(record->preference);
63 char *ptr = buf;
64
65 memcpy(ptr, &net_order, sizeof(net_order));
66 ptr += sizeof(net_order);
67
68 memcpy(ptr, &net_preference, sizeof(net_preference));
69 ptr += sizeof(net_preference);
70
71 ptr += ast_dns_test_write_string(&record->flags, ptr);
72 ptr += ast_dns_test_write_string(&record->services, ptr);
73 ptr += ast_dns_test_write_string(&record->regexp, ptr);
74 ptr += ast_dns_test_write_domain(record->replacement, ptr);
75
76 return ptr - buf;
77}
78
79/*!
80 * \brief A pointer to an array of records for a test
81 *
82 * Each test is expected to set this pointer to its local
83 * array of records and then re-set tis pointer to NULL
84 * at the end of the test
85 */
87/*!
88 * \brief The number of records in the test_records array.
89 *
90 * Each test must set this to the appropriate value at the
91 * beginning of the test and must set this back to zero at
92 * the end of the test.
93 */
95/*!
96 * \brief A buffer to place raw DNS records into.
97 *
98 * This buffer is way larger than any DNS records we actually
99 * wish to create during any of the tests, but that's fine.
100 */
101static char ans_buffer[1024];
102
103/*!
104 * \brief Asynchronous NAPTR resolution thread.
105 *
106 * This builds an appropriate DNS response based on the NAPTR
107 * records for a given test. Once the records have been created,
108 * the records are added to the DNS result
109 */
110static void *naptr_thread(void *dns_query)
111{
112 struct ast_dns_query *query = dns_query;
113 int i;
114 int ans_size;
115
118
119 ast_dns_resolver_set_result(query, 0, 0, NOERROR, "goose.feathers", ans_buffer, ans_size);
120
121 for (i = 0; i < num_test_records; ++i) {
122 char record[128];
123 int naptr_size;
124
125 naptr_size = generate_naptr_record(&test_records[i], record);
126 ast_dns_resolver_add_record(query, T_NAPTR, C_IN, 12345, record, naptr_size);
127 }
128
130
131 ao2_ref(query, -1);
132 return NULL;
133}
134
135/*!
136 * \brief Mock NAPTR resolution method.
137 *
138 * This spawns a thread to handle generation of the necessary NAPTR records
139 */
140static int naptr_resolve(struct ast_dns_query *query)
141{
142 pthread_t thread;
143
145}
146
147/*!
148 * \brief A STUB
149 */
150static int naptr_cancel(struct ast_dns_query *query)
151{
152 return 0;
153}
154
155/*!
156 * \brief Mock NAPTR resolver
157 */
159 .name = "naptr_test",
160 .priority = 0,
161 .resolve = naptr_resolve,
162 .cancel = naptr_cancel,
163};
164
165AST_TEST_DEFINE(naptr_resolve_nominal)
166{
168 const struct ast_dns_record *record;
169 struct naptr_record records[] = {
170 /* Incredibly plain record */
171 { 200, 100, {1, "A"}, {4, "BLAH"}, {0, ""}, "goose.down" },
172 /* Records with valid but unusual flags */
173 { 300, 8, {0, ""}, {4, "BLAH"}, {0, ""}, "goose.down" },
174 { 300, 6, {1, "3"}, {4, "BLAH"}, {0, ""}, "goose.down" },
175 { 100, 2, {2, "32"}, {4, "BLAH"}, {0, ""}, "goose.down" },
176 { 400, 100, {3, "A32"}, {4, "BLAH"}, {0, ""}, "goose.down" },
177 /* Records with valid but unusual services */
178 { 100, 700, {0, ""}, {0, ""}, {0, ""}, "goose.down" },
179 { 500, 102, {1, "A"}, {42, "A+B12+C+D+EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"}, {0, ""}, "goose.down" },
180 { 500, 100, {1, "A"}, {14, "A+B12+C+D+EEEE"}, {0, ""}, "goose.down" },
181 /* Records with valid regexes (regexes are always unusual) */
182 { 500, 101, {1, "A"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, "" },
183 { 500, 99, {1, "A"}, {4, "BLAH"}, {15, "0.*0horse.mane0"}, "" },
184 { 10, 100, {1, "A"}, {4, "BLAH"}, {11, "!.*!\\!\\!\\!!"}, "" },
185 { 700, 999, {1, "A"}, {4, "BLAH"}, {30, "!(.)(.)(.)(.)!\\1.m.\\2.n\\3.o\\4!"}, "" },
186 };
187
188 int naptr_record_order[] = { 10, 3, 5, 0, 2, 1, 4, 9, 7, 8, 6, 11};
190 int i;
191
192 switch (cmd) {
193 case TEST_INIT:
194 info->name = "naptr_resolve";
195 info->category = "/main/dns/naptr/";
196 info->summary = "Test nominal resolution of NAPTR records";
197 info->description = "This test defines four valid NAPTR records and\n"
198 "performs a resolution of the domain to which they belong. The test\n"
199 "ensures that all fields of the NAPTR records are parsed correctly\n"
200 "and that the records are returned in sorted order";
201 return AST_TEST_NOT_RUN;
202 case TEST_EXECUTE:
203 break;
204 }
205
208 memset(ans_buffer, 0, sizeof(ans_buffer));
209
211
212 if (ast_dns_resolve("goose.feathers", T_NAPTR, C_IN, &result)) {
213 ast_test_status_update(test, "DNS resolution failed\n");
214 res = AST_TEST_FAIL;
215 goto cleanup;
216 }
217
218 if (!result) {
219 ast_test_status_update(test, "DNS resolution returned no result\n");
220 res = AST_TEST_FAIL;
221 goto cleanup;
222 }
223
224 i = 0;
225 for (record = ast_dns_result_get_records(result); record; record = ast_dns_record_get_next(record)) {
226 if (ast_dns_naptr_get_order(record) != records[naptr_record_order[i]].order) {
227 ast_test_status_update(test, "Expected order %hu, got order %hu from NAPTR record\n",
228 records[naptr_record_order[i]].order, ast_dns_naptr_get_order(record));
229 res = AST_TEST_FAIL;
230 }
231 if (ast_dns_naptr_get_preference(record) != records[naptr_record_order[i]].preference) {
232 ast_test_status_update(test, "Expected preference %hu, got preference %hu from NAPTR record\n",
233 records[naptr_record_order[i]].preference, ast_dns_naptr_get_preference(record));
234 res = AST_TEST_FAIL;
235 }
236 if (strcmp(ast_dns_naptr_get_flags(record), records[naptr_record_order[i]].flags.val)) {
237 ast_test_status_update(test, "Expected flags %s, got flags %s from NAPTR record\n",
238 records[naptr_record_order[i]].flags.val, ast_dns_naptr_get_flags(record));
239 res = AST_TEST_FAIL;
240 }
241 if (strcmp(ast_dns_naptr_get_service(record), records[naptr_record_order[i]].services.val)) {
242 ast_test_status_update(test, "Expected services %s, got services %s from NAPTR record\n",
243 records[naptr_record_order[i]].services.val, ast_dns_naptr_get_service(record));
244 res = AST_TEST_FAIL;
245 }
246 if (strcmp(ast_dns_naptr_get_regexp(record), records[naptr_record_order[i]].regexp.val)) {
247 ast_test_status_update(test, "Expected regexp %s, got regexp %s from NAPTR record\n",
248 records[naptr_record_order[i]].regexp.val, ast_dns_naptr_get_regexp(record));
249 res = AST_TEST_FAIL;
250 }
251 if (strcmp(ast_dns_naptr_get_replacement(record), records[naptr_record_order[i]].replacement)) {
252 ast_test_status_update(test, "Expected replacement %s, got replacement %s from NAPTR record\n",
253 records[naptr_record_order[i]].replacement, ast_dns_naptr_get_replacement(record));
254 res = AST_TEST_FAIL;
255 }
256 ++i;
257 }
258
259 if (i != ARRAY_LEN(records)) {
260 ast_test_status_update(test, "Unexpected number of records returned in NAPTR lookup\n");
261 res = AST_TEST_FAIL;
262 }
263
264cleanup:
265
267
270 memset(ans_buffer, 0, sizeof(ans_buffer));
271
272 return res;
273}
274
275static enum ast_test_result_state off_nominal_test(struct ast_test *test, struct naptr_record *records, int num_records)
276{
279 const struct ast_dns_record *record;
280
282 num_test_records = num_records;
283 memset(ans_buffer, 0, sizeof(ans_buffer));
284
286
287 if (ast_dns_resolve("goose.feathers", T_NAPTR, C_IN, &result)) {
288 ast_test_status_update(test, "Failed to perform DNS resolution, despite using valid inputs\n");
289 res = AST_TEST_FAIL;
290 goto cleanup;
291 }
292
293 if (!result) {
294 ast_test_status_update(test, "Synchronous DNS resolution failed to set a result\n");
295 res = AST_TEST_FAIL;
296 goto cleanup;
297 }
298
300 if (record) {
301 ast_test_status_update(test, "DNS resolution returned records when it was not expected to\n");
302 res = AST_TEST_FAIL;
303 goto cleanup;
304 }
305
306cleanup:
308
311 memset(ans_buffer, 0, sizeof(ans_buffer));
312
313 return res;
314}
315
316AST_TEST_DEFINE(naptr_resolve_off_nominal_length)
317{
318 struct naptr_record records[] = {
319 { 100, 100, {255, "A"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, "" },
320 { 100, 100, {0, "A"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, "" },
321 { 100, 100, {1, "A"}, {255, "BLAH"}, {15, "!.*!horse.mane!"}, "" },
322 { 100, 100, {1, "A"}, {2, "BLAH"}, {15, "!.*!horse.mane!"}, "" },
323 { 100, 100, {1, "A"}, {4, "BLAH"}, {255, "!.*!horse.mane!"}, "" },
324 { 100, 100, {1, "A"}, {4, "BLAH"}, {3, "!.*!horse.mane!"}, "" },
325 { 100, 100, {255, "A"}, {255, "BLAH"}, {255, "!.*!horse.mane!"}, "" },
326 { 100, 100, {0, "A"}, {2, "BLAH"}, {3, "!.*!horse.mane!"}, "" },
327 };
328
329 switch (cmd) {
330 case TEST_INIT:
331 info->name = "naptr_resolve_off_nominal_length";
332 info->category = "/main/dns/naptr/";
333 info->summary = "Test resolution of NAPTR records with off-nominal lengths";
334 info->description = "This test defines a set of records where the strings provided\n"
335 "within the record are valid, but the lengths of the strings in the record are\n"
336 "invalid, either too large or too small. The goal of this test is to ensure that\n"
337 "these invalid lengths result in resolution failures";
338 return AST_TEST_NOT_RUN;
339 case TEST_EXECUTE:
340 break;
341 }
342
344}
345
346AST_TEST_DEFINE(naptr_resolve_off_nominal_flags)
347{
348 struct naptr_record records[] = {
349 /* Non-alphanumeric flag */
350 { 100, 100, {1, "!"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, ""},
351 /* Mix of valid and non-alphanumeric */
352 { 100, 100, {2, "A!"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, ""},
353 { 100, 100, {2, "!A"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, ""},
354 /* Invalid combinations of flags */
355 { 100, 100, {2, "sa"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, ""},
356 { 100, 100, {2, "su"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, ""},
357 { 100, 100, {2, "sp"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, ""},
358 { 100, 100, {2, "as"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, ""},
359 { 100, 100, {2, "au"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, ""},
360 { 100, 100, {2, "ap"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, ""},
361 { 100, 100, {2, "ua"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, ""},
362 { 100, 100, {2, "us"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, ""},
363 { 100, 100, {2, "up"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, ""},
364 { 100, 100, {2, "pa"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, ""},
365 { 100, 100, {2, "ps"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, ""},
366 { 100, 100, {2, "pu"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, ""},
367 };
368
369 switch (cmd) {
370 case TEST_INIT:
371 info->name = "naptr_resolve_off_nominal_flags";
372 info->category = "/main/dns/naptr/";
373 info->summary = "Ensure that NAPTR records with invalid flags are not presented in results";
374 info->description = "This test defines a set of records where the flags provided are\n"
375 "invalid in some way. This may be due to providing non-alphanumeric characters or\n"
376 "by providing clashing flags. The result should be that none of the defined records\n"
377 "are returned by the resolver";
378 return AST_TEST_NOT_RUN;
379 case TEST_EXECUTE:
380 break;
381 }
382
384}
385
386AST_TEST_DEFINE(naptr_resolve_off_nominal_services)
387{
388 struct naptr_record records[] = {
389 { 100, 100, {1, "A"}, {5, "BLAH!"}, {15, "!.*!horse.mane!"}, ""},
390 { 100, 100, {1, "A"}, {5, "BL!AH"}, {15, "!.*!horse.mane!"}, ""},
391 { 100, 100, {1, "A"}, {8, "1SIP+D2U"}, {15, "!.*!horse.mane!"}, ""},
392 { 100, 100, {1, "A"}, {8, "SIP+1D2U"}, {15, "!.*!horse.mane!"}, ""},
393 { 100, 100, {1, "A"}, {4, "+D2U"}, {15, "!.*!horse.mane!"}, ""},
394 { 100, 100, {1, "A"}, {4, "SIP+"}, {15, "!.*!horse.mane!"}, ""},
395 { 100, 100, {1, "A"}, {8, "SIP++D2U"}, {15, "!.*!horse.mane!"}, ""},
396 { 100, 100, {1, "A"}, {37, "SIPSIPSIPSIPSIPSIPSIPSIPSIPSIPSIP+D2U"}, {15, "!.*!horse.mane!"}, ""},
397 { 100, 100, {1, "A"}, {37, "SIP+D2UD2UD2UD2UD2UD2UD2UD2UD2UD2UD2U"}, {15, "!.*!horse.mane!"}, ""},
398 };
399
400 switch (cmd) {
401 case TEST_INIT:
402 info->name = "naptr_resolve_off_nominal_services";
403 info->category = "/main/dns/naptr/";
404 info->summary = "Ensure that NAPTR records with invalid services are not presented in results";
405 info->description = "This test defines a set of records where the services provided are\n"
406 "invalid in some way. This may be due to providing non-alphanumeric characters, providing\n"
407 "protocols or resolution services that start with a non-alphabetic character, or\n"
408 "providing fields that are too long.";
409 return AST_TEST_NOT_RUN;
410 case TEST_EXECUTE:
411 break;
412 }
413
415}
416
417AST_TEST_DEFINE(naptr_resolve_off_nominal_regexp)
418{
419 struct naptr_record records[] = {
420 /* Invalid delim-char */
421 { 100, 100, {1, "A"}, {4, "BLAH"}, {15, "1.*1horse.mane1"}, ""},
422 /* Not enough delim-chars */
423 { 100, 100, {1, "A"}, {4, "BLAH"}, {14, "!.*!horse.mane"}, ""},
424 /* Not enough delim-chars, part 2 */
425 { 100, 100, {1, "A"}, {4, "BLAH"}, {16, "!.*!horse.mane\\!"}, ""},
426 /* Too many delim-chars */
427 { 100, 100, {1, "A"}, {4, "BLAH"}, {15, "!.*!horse!mane!"}, ""},
428 /* Invalid regex flag */
429 { 100, 100, {1, "A"}, {4, "BLAH"}, {16, "!.*!horse.mane!o"}, ""},
430 /* Invalid backreference */
431 { 100, 100, {1, "A"}, {4, "BLAH"}, {13, "!.*!horse.\\0!"}, ""},
432 /* Invalid regex */
433 { 100, 100, {1, "A"}, {4, "BLAH"}, {16, "!(.*!horse.mane!"}, ""},
434 };
435
436 switch (cmd) {
437 case TEST_INIT:
438 info->name = "naptr_resolve_off_nominal_regexp";
439 info->category = "/main/dns/naptr/";
440 info->summary = "Ensure that NAPTR records with invalid regexps are not presented in results";
441 info->description = "This test defines a set of records where the regexps provided are\n"
442 "invalid in some way. The test ensures that none of the invalid records are returned\n"
443 "when performing a NAPTR lookup";
444 return AST_TEST_NOT_RUN;
445 case TEST_EXECUTE:
446 break;
447 }
448
450}
451
452AST_TEST_DEFINE(naptr_resolve_off_nominal_interactions)
453{
454 struct naptr_record records[] = {
455 /* Both regexp and replacement are specified */
456 { 100, 100, {1, "A"}, {4, "BLAH"}, {15, "!.*!horse.mane!"}, "goose.down"},
457 /* XXX RFC 2915 says that a service MUST be present if terminal flags are
458 * specified. However, RFCs 3401-3404 do not specify this behavior, so
459 * I am not putting in a test for it
460 */
461 };
462
463 switch (cmd) {
464 case TEST_INIT:
465 info->name = "naptr_resolve_off_nominal_interactions";
466 info->category = "/main/dns/naptr/";
467 info->summary = "Ensure that NAPTR records with invalid interactions are not presented in results";
468 info->description = "This test defines a set of records where all parts are individually valid,\n"
469 "but when combined do not make sense and are thus invalid.";
470 return AST_TEST_NOT_RUN;
471 case TEST_EXECUTE:
472 break;
473 }
474
476}
477
478static int unload_module(void)
479{
480 AST_TEST_UNREGISTER(naptr_resolve_nominal);
481 AST_TEST_UNREGISTER(naptr_resolve_off_nominal_length);
482 AST_TEST_UNREGISTER(naptr_resolve_off_nominal_flags);
483 AST_TEST_UNREGISTER(naptr_resolve_off_nominal_services);
484 AST_TEST_UNREGISTER(naptr_resolve_off_nominal_regexp);
485 AST_TEST_UNREGISTER(naptr_resolve_off_nominal_interactions);
486
487 return 0;
488}
489
490static int load_module(void)
491{
492 AST_TEST_REGISTER(naptr_resolve_nominal);
493 AST_TEST_REGISTER(naptr_resolve_off_nominal_length);
494 AST_TEST_REGISTER(naptr_resolve_off_nominal_flags);
495 AST_TEST_REGISTER(naptr_resolve_off_nominal_services);
496 AST_TEST_REGISTER(naptr_resolve_off_nominal_regexp);
497 AST_TEST_REGISTER(naptr_resolve_off_nominal_interactions);
498
500}
501
integer order
Definition: analys.c:66
pthread_t thread
Definition: app_sla.c:329
Asterisk main include file. File version handling, generic pbx functions.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
Definition: astobj2.h:480
static int records
Definition: cdr_pgsql.c:78
static PGresult * result
Definition: cel_pgsql.c:84
Core DNS API.
const struct ast_dns_record * ast_dns_record_get_next(const struct ast_dns_record *record)
Get the next DNS record.
Definition: dns_core.c:170
const struct ast_dns_record * ast_dns_result_get_records(const struct ast_dns_result *result)
Get the first record of a DNS Result.
Definition: dns_core.c:102
void ast_dns_result_free(struct ast_dns_result *result)
Free the DNS result information.
Definition: dns_core.c:130
int ast_dns_resolve(const char *name, int rr_type, int rr_class, struct ast_dns_result **result)
Synchronously resolve a DNS query.
Definition: dns_core.c:314
DNS NAPTR Record Parsing API.
const char * ast_dns_naptr_get_replacement(const struct ast_dns_record *record)
Get the replacement value from a NAPTR record.
Definition: dns_naptr.c:624
unsigned short ast_dns_naptr_get_preference(const struct ast_dns_record *record)
Get the preference from a NAPTR record.
Definition: dns_naptr.c:640
const char * ast_dns_naptr_get_flags(const struct ast_dns_record *record)
Get the flags from a NAPTR record.
Definition: dns_naptr.c:600
const char * ast_dns_naptr_get_service(const struct ast_dns_record *record)
Get the service from a NAPTR record.
Definition: dns_naptr.c:608
const char * ast_dns_naptr_get_regexp(const struct ast_dns_record *record)
Get the regular expression from a NAPTR record.
Definition: dns_naptr.c:616
unsigned short ast_dns_naptr_get_order(const struct ast_dns_record *record)
Get the order from a NAPTR record.
Definition: dns_naptr.c:632
DNS Resolver API.
int ast_dns_resolver_set_result(struct ast_dns_query *query, unsigned int secure, unsigned int bogus, unsigned int rcode, const char *canonical, const char *answer, size_t answer_size)
Set result information for a DNS query.
Definition: dns_core.c:456
void ast_dns_resolver_completed(struct ast_dns_query *query)
Mark a DNS query as having been completed.
Definition: dns_core.c:599
int ast_dns_resolver_register(struct ast_dns_resolver *resolver)
Register a DNS resolver.
Definition: dns_core.c:630
int ast_dns_resolver_add_record(struct ast_dns_query *query, int rr_type, int rr_class, int ttl, const char *data, const size_t size)
Add a DNS record to the result of a DNS query.
Definition: dns_core.c:535
void ast_dns_resolver_unregister(struct ast_dns_resolver *resolver)
Unregister a DNS resolver.
Definition: dns_core.c:680
int ast_dns_test_write_domain(const char *string, char *buf)
Write a DNS domain to a buffer.
Definition: dns_test.c:224
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.
Definition: dns_test.c:229
int ast_dns_test_write_string(const struct ast_dns_test_string *string, char *buf)
Write a DNS string to a buffer.
Definition: dns_test.c:219
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
Definition: module.h:567
#define ASTERISK_GPL_KEY
The text the key() function should return.
Definition: module.h:46
@ AST_MODULE_LOAD_SUCCESS
Definition: module.h:70
def info(msg)
static void * cleanup(void *unused)
Definition: pbx_realtime.c:124
#define NULL
Definition: resample.c:96
A DNS query.
Definition: dns_internal.h:137
For AST_LIST.
Definition: dns_internal.h:39
DNS resolver implementation.
Definition: dns_resolver.h:32
const char * name
The name of the resolver implementation.
Definition: dns_resolver.h:34
The result of a DNS query.
Definition: dns_internal.h:117
Representation of a string in DNS.
Definition: dns_test.h:33
const char * val
Definition: dns_test.h:35
struct ast_dns_test_string services
uint16_t preference
struct ast_dns_test_string flags
struct ast_dns_test_string regexp
const char * replacement
uint16_t order
Test Framework API.
@ TEST_INIT
Definition: test.h:200
@ TEST_EXECUTE
Definition: test.h:201
#define AST_TEST_REGISTER(cb)
Definition: test.h:127
#define ast_test_status_update(a, b, c...)
Definition: test.h:129
#define AST_TEST_UNREGISTER(cb)
Definition: test.h:128
ast_test_result_state
Definition: test.h:193
@ AST_TEST_PASS
Definition: test.h:195
@ AST_TEST_FAIL
Definition: test.h:196
@ AST_TEST_NOT_RUN
Definition: test.h:194
static enum ast_test_result_state off_nominal_test(struct ast_test *test, struct naptr_record *records, int num_records)
static int naptr_resolve(struct ast_dns_query *query)
Mock NAPTR resolution method.
static struct ast_dns_resolver naptr_resolver
Mock NAPTR resolver.
static void * naptr_thread(void *dns_query)
Asynchronous NAPTR resolution thread.
static int num_test_records
The number of records in the test_records array.
static int naptr_cancel(struct ast_dns_query *query)
A STUB.
static int generate_naptr_record(void *dns_record, char *buf)
Given a NAPTR record, generate a binary form, as would appear in DNS RDATA.
static struct naptr_record * test_records
A pointer to an array of records for a test.
static char ans_buffer[1024]
A buffer to place raw DNS records into.
static int load_module(void)
AST_TEST_DEFINE(naptr_resolve_nominal)
static int unload_module(void)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:941
#define ast_pthread_create_detached(a, b, c, d)
Definition: utils.h:588
#define ARRAY_LEN(a)
Definition: utils.h:666