lwres_test.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2000, 2001, 2004, 2005, 2007, 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: lwres_test.c,v 1.31 2007/06/19 23:46:59 tbox Exp $ */
#include <config.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#define USE_ISC_MEM
static inline void
if (val != 0) {
exit(1);
}
}
static void
unsigned char *p;
unsigned int cnt;
p = base;
cnt = 0;
if (cnt % 16 == 0)
printf("%p: ", p);
else if (cnt % 8 == 0)
printf(" |");
printf(" %02x", *p++);
cnt++;
if (cnt % 16 == 0)
printf("\n");
}
if (cnt % 16 != 0)
printf("\n");
}
static const char *TESTSTRING = "This is a test. This is only a test. !!!";
static lwres_context_t *ctx;
static void
test_noop(void) {
int ret;
/* XXXDCL maybe "nooprequest.data" should be const. */
/*
* Now, parse it into a new structure.
*/
lwres_buffer_first(&b);
nooprequest2 = NULL;
nooprequest.datalength) == 0);
b.length = 0;
/* XXXDCL maybe "noopresponse.data" should be const. */
/*
* Now, parse it into a new structure.
*/
lwres_buffer_first(&b);
noopresponse.datalength) == 0);
b.length = 0;
}
static void
int ret;
unsigned int i;
char outbuf[64];
&res);
if (ret != 0) {
printf("FAILURE!\n");
return;
}
printf("Returned real name: (%u, %s)\n",
else
printf("\tAddr len %u family %08x %s\n",
}
}
static void
int ret;
unsigned int i;
unsigned char addrbuf[16];
unsigned int len;
if (af == LWRES_ADDRTYPE_V4) {
len = 4;
} else {
len = 16;
}
printf("Returned real name: (%u, %s)\n",
}
#ifdef USE_ISC_MEM
/*
* Wrappers around our memory management stuff, for the lwres functions.
*/
static void *
}
static void
}
#endif
int
int ret;
#ifdef USE_ISC_MEM
#endif
(void)argc;
(void)argv;
#ifdef USE_ISC_MEM
#endif
#ifdef USE_ISC_MEM
#else
#endif
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("f.root-servers.net.");
test_gabn("poofball.flame.org.");
test_gabn("foo.ip6.int.");
#ifdef USE_ISC_MEM
#endif
return (0);
}