lwtest.c revision cc1eee4f5188a8174f10ab86da273fee50aa481a
/*
* 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 <stdlib.h>
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
static int fails = 0;
static void
if (val != 0) {
exit(1);
}
}
#if 0
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");
}
#endif
static char TESTSTRING[] = "This is a test. This is only a test. !!!";
static lwres_context_t *ctx;
static void
test_noop() {
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
#if 0
unsigned int i;
char outbuf[64];
#endif
int ret;
&res);
{
fails++;
return;
}
#if 0
printf("Returned real name: (%u, %s)\n",
else
printf("\tAddr len %u family %08x %s\n",
}
#endif
}
static void
int ret;
#if 0
unsigned int i;
#endif
unsigned char addrbuf[16];
unsigned int len;
if (af == LWRES_ADDRTYPE_V4) {
len = 4;
} else {
len = 16;
}
{
fails++;
return;
}
#if 0
printf("Returned real name: (%u, %s)\n",
#endif
}
int
main() {
lwres_udp_port = 9210;
test_noop();
test_gnba("0123:4567:89ab:cdef:0123:4567:89ab:cdef",
test_gnba("0123:4567:89ab:cdef:0123:4567:89ab:cde0",
return (fails);
}