/*
* Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2001 Internet Software Consortium.
*
* 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: wire_test.c,v 1.67 2007/06/19 23:46:59 tbox Exp $ */
#include <config.h>
#include <stdlib.h>
#include <isc/commandline.h>
#include "printmsg.h"
int parseflags = 0;
static void
static inline void
if (result != ISC_R_SUCCESS) {
exit(1);
}
}
static int
fromhex(char c) {
if (c >= '0' && c <= '9')
return (c - '0');
else if (c >= 'a' && c <= 'f')
return (c - 'a' + 10);
else if (c >= 'A' && c <= 'F')
return (c - 'A' + 10);
printf("bad input format: %02x\n", c);
exit(3);
/* NOTREACHED */
}
static void
usage(void) {
}
int
unsigned char *bp;
int n;
FILE *f;
unsigned char b[64 * 1024];
char s[4000];
int ch;
switch (ch) {
case 'p':
break;
case 'b':
break;
case 's':
break;
case 'r':
break;
case 't':
break;
default:
usage();
exit(1);
}
}
if (argc > 1) {
if (f == NULL) {
printf("fopen failed\n");
exit(1);
}
} else
f = stdin;
bp = b;
rp = s;
wp = s;
len = 0;
while (*rp != '\0') {
if (*rp == '#')
break;
len++;
}
rp++;
}
if (len == 0U)
break;
if (len % 2 != 0U) {
exit(1);
}
if (len > sizeof(b) * 2) {
printf("input too long\n");
exit(2);
}
rp = s;
for (i = 0; i < len; i += 2) {
n *= 16;
*bp++ = n;
}
}
if (need_close)
fclose(f);
if (tcp) {
unsigned char *p = b;
while (p < bp) {
unsigned int len;
if (p + 2 > bp) {
printf("premature end of packet\n");
exit(1);
}
printf("premature end of packet\n");
exit(1);
}
p += 2 + len;
}
} else {
isc_buffer_init(&source, b, sizeof(b));
}
if (printmemstats)
return (0);
}
static void
int i;
if (result == DNS_R_RECOVERABLE)
if (printmemstats)
if (dorender) {
/*
* XXXMLG
* Changing this here is a hack, and should not be done in
* reasonable application code, ever.
*/
for (i = 0; i < DNS_SECTION_MAX; i++)
DNS_SECTION_QUESTION, 0);
"dns_message_rendersection(QUESTION) failed");
DNS_SECTION_ANSWER, 0);
"dns_message_rendersection(ANSWER) failed");
"dns_message_rendersection(AUTHORITY) failed");
"dns_message_rendersection(ADDITIONAL) failed");
printf("Message rendered.\n");
if (printmemstats)
&message);
}
}