int main(int argc, char *argv[]) { lwres_context_t *ctx; const char *file = "/etc/resolv.conf"; int ret; #ifdef USE_ISC_MEM isc_mem_t *mem; isc_result_t result; #endif isc__mem_register(); isc__task_register(); isc__timer_register(); isc__socket_register(); if (argc > 1) { file = argv[1]; } #ifdef USE_ISC_MEM mem = NULL; result = isc_mem_create(0, 0, &mem); INSIST(result == ISC_R_SUCCESS); #endif ctx = NULL; #ifdef USE_ISC_MEM ret = lwres_context_create(&ctx, mem, mem_alloc, mem_free, 0); #else ret = lwres_context_create(&ctx, NULL, NULL, NULL, 0); #endif CHECK(ret, "lwres_context_create"); lwres_conf_init(ctx); if (lwres_conf_parse(ctx, file) == 0) { lwres_conf_print(ctx, stderr); } else { perror("lwres_conf_parse"); } lwres_conf_clear(ctx); lwres_context_destroy(&ctx); #ifdef USE_ISC_MEM isc_mem_stats(mem, stdout); isc_mem_destroy(&mem); #endif return (0); }
int main(int argc, char *argv[]) { int ret; #ifdef USE_ISC_MEM isc_mem_t *mem; isc_result_t result; #endif (void)argc; (void)argv; #ifdef USE_ISC_MEM mem = NULL; result = isc_mem_create(0, 0, &mem); INSIST(result == ISC_R_SUCCESS); #endif ctx = NULL; #ifdef USE_ISC_MEM ret = lwres_context_create(&ctx, mem, mem_alloc, mem_free, 0); #else ret = lwres_context_create(&ctx, NULL, NULL, NULL, 0); #endif CHECK(ret, "lwres_context_create"); ret = lwres_conf_parse(ctx, "/etc/resolv.conf"); CHECK(ret, "lwres_conf_parse"); lwres_conf_print(ctx, stdout); test_noop(); /* * The following comments about tests all assume your search path is * nominum.com isc.org flame.org * and ndots is the default of 1. */ test_gabn("alias-05.test"); /* exact, then search. */ test_gabn("f.root-servers.net."); test_gabn("poofball.flame.org."); test_gabn("foo.ip6.int."); test_gabn("notthereatall.flame.org"); /* exact, then search (!found)*/ test_gabn("shell"); /* search (found in nominum.com), then exact */ test_gabn("kechara"); /* search (found in flame.org), then exact */ test_gabn("lkasdjlaksjdlkasjdlkasjdlkasjd"); /* search, exact(!found)*/ test_gnba("198.133.199.1", LWRES_ADDRTYPE_V4); test_gnba("204.152.184.79", LWRES_ADDRTYPE_V4); test_gnba("3ffe:8050:201:1860:42::1", LWRES_ADDRTYPE_V6); lwres_conf_clear(ctx); lwres_context_destroy(&ctx); #ifdef USE_ISC_MEM isc_mem_stats(mem, stdout); isc_mem_destroy(&mem); #endif return (0); }