sdig.c revision 8dec0e1a3e0de78f2b20b328128eb603f807a299
/*
* Copyright (C) 1999 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 <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h> /* XXXRTH */
extern int h_errno;
#include <isc/assertions.h>
#include <isc/sockaddr.h>
#include <dns/fixedname.h>
#include <dns/rdataset.h>
#include <dns/rdataclass.h>
#include <dns/rdatatype.h>
#include "printmsg.h"
static void
exit(1);
}
static inline void
if (result != ISC_R_SUCCESS)
}
static void
usage() {
"usage: sdig [@server] [-p port] [+vc] name [type] [class]\n");
exit(1);
}
static void
{
}
static void
hex_dump(isc_buffer_t *b)
{
unsigned int len;
isc_region_t r;
isc_buffer_remaining(b, &r);
printf("\n");
}
if (len % 16 != 0)
printf("\n");
}
static void
else {
fatal("gethostbyname() failed, h_errno = %d",
h_errno);
port);
}
}
static void
isc_buffer_t b;
(void)task;
isc_buffer_add(&b, sevent->n);
if (result != ISC_R_SUCCESS)
hex_dump(&b);
}
static void
(void)task;
}
int
char *server;
unsigned int port;
isc_buffer_t b, b2;
isc_region_t r;
unsigned char *data[512];
unsigned char *data2[512];
int i;
/*
* Initialize.
*/
result = isc_app_start();
if (isc_net_probeipv6() == ISC_R_SUCCESS)
server = "localhost";
port = 5544;
printf("\n; <<>> sdig <<>>");
for (i = 1; i < argc; i++) {
}
printf("\n");
if (argc < 2)
usage();
argv++;
argc--;
fatal("TCP transport not yet implemented");
} else {
if (!have_name) {
isc_buffer_add(&b, len);
NULL);
} else {
rdtype);
} else {
&tr) !=
fatal("unknown class "
"or type %s", argv[0]);
}
}
}
}
if (!have_name)
usage();
if (!have_type)
0, 0);
isc_buffer_available(&b2, &r);
isc_buffer_used(&b, &r);
isc_app_run();
return (0);
}