wire_test.c revision 2a49f6bbfeb3f801ada23d525342c3b6b9a8e655
/*
* Copyright (C) 2004, 2005, 2007, 2015 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.
*/
#include <config.h>
#include <stdlib.h>
#include <isc/commandline.h>
int parseflags = 0;
static void
static isc_result_t
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);
exit(3);
/* NOTREACHED */
}
static void
usage(void) {
}
static isc_result_t
isc_buffer_t b;
int len = 1024;
do {
break;
}
0, &b);
if (result == ISC_R_NOSPACE) {
len *= 2;
} else if (result == ISC_R_SUCCESS)
} while (result == ISC_R_NOSPACE);
return (result);
}
int
unsigned char *bp;
int n;
FILE *f;
unsigned char b[64 * 1024];
char s[4000];
int ch;
switch (ch) {
case 'b':
break;
case 'd':
break;
case 'p':
break;
case 'r':
break;
case 's':
break;
case 't':
break;
default:
usage();
exit(1);
}
}
if (argc >= 1) {
if (f == NULL) {
exit(1);
}
} else
f = stdin;
bp = b;
if (rawdata) {
bp++;
} else {
rp = s;
wp = s;
len = 0;
while (*rp != '\0') {
if (*rp == '#')
break;
len++;
}
rp++;
}
if (len == 0U)
break;
if (len % 2 != 0U) {
(unsigned long)len);
exit(1);
}
if (len > sizeof(b) * 2) {
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 tcplen;
if (p + 2 > bp) {
exit(1);
}
exit(1);
}
p += 2 + tcplen;
}
} 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);
}
}