lwres_test.c revision 7df0472d8a76c83d2137bd9549414a30787d58cf
/*
* Copyright (C) 2000 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include <config.h>
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/assertions.h>
#include <lwres/lwbuffer.h>
#include <lwres/lwpacket.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 char *TESTSTRING = "This is a test. This is only a test. !!!";
static lwres_context_t *ctx;
static void
test_noop(void)
{
int ret;
/*
* Now, parse it into a new structure.
*/
lwres_buffer_first(&b);
nooprequest2 = NULL;
nooprequest.datalength) == 0);
b.length = 0;
/*
* 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);
}