lwres_test.c revision dafcb997e390efa4423883dafd100c975c4095d6
/*
* Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000, 2001 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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.
*/
/* $Id: lwres_test.c,v 1.27 2004/03/05 04:58:38 marka 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);
}