res_debug.c revision 7257d1b4d25bfac0c802847390e98a464fd787ac
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
extern char *inet_ntoa();
char *_res_opcodes[] = {
"QUERY",
"IQUERY",
"CQUERYM",
"CQUERYU",
"4",
"5",
"6",
"7",
"8",
"UPDATEA",
"UPDATED",
"UPDATEDA",
"UPDATEM",
"UPDATEMA",
"ZONEINIT",
"ZONEREF",
};
char *_res_resultcodes[] = {
"NOERROR",
"FORMERR",
"SERVFAIL",
"NXDOMAIN",
"NOTIMP",
"REFUSED",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13",
"14",
"NOCHANGE",
};
void
char *msg;
{
}
/*
* Print the contents of a query.
* This is intended to be primarily a debugging routine.
*/
void
char *msg;
{
register char *cp;
register int n;
/*
* Print header fields.
*/
/*
* Print question records.
*/
while (--n >= 0) {
return;
}
}
/*
* Print authoritative answer records
*/
while (--n >= 0) {
return;
}
}
/*
* print name server records
*/
while (--n >= 0) {
return;
}
}
/*
* print additional records
*/
while (--n >= 0) {
return;
}
}
}
char *
{
int n;
return (NULL);
if (name[0] == '\0') {
name[0] = '.';
}
return (cp + n);
}
/*
* Print resource record fields in human readable form.
*/
char *
{
return (NULL); /* compression error */
/*
* Print type specific data, if appropriate
*/
switch (type) {
case T_A:
switch (class) {
case C_IN:
case C_HS:
#ifdef SYSV
#else
#endif
if (dlen == 4) {
} else if (dlen == 7) {
}
break;
default:
}
break;
case T_CNAME:
case T_MB:
case T_MG:
case T_MR:
case T_NS:
case T_PTR:
break;
case T_HINFO:
if (n = *cp++) {
cp += n;
}
if (n = *cp++) {
cp += n;
}
break;
case T_SOA:
break;
case T_MX:
break;
case T_TXT:
if (n = (unsigned char) *cp++) {
if (*cp == '\n') {
} else
}
}
break;
case T_MINFO:
break;
case T_UINFO:
break;
case T_UID:
case T_GID:
if (dlen == 4) {
cp += sizeof (int);
}
break;
case T_WKS:
break;
#ifdef SYSV
#else
#endif
n = 0;
c = *cp++;
do {
if (c & 0200)
c <<= 1;
} while (++n & 07);
}
break;
#ifdef ALLOW_T_UNSPEC
case T_UNSPEC:
{
int NumBytes = 8;
char *DataPtr;
int i;
NumBytes);
}
break;
#endif /* ALLOW_T_UNSPEC */
default:
}
}
return (cp);
}
static char nbuf[40];
/*
* Return a string for the type
*/
char *
int type;
{
switch (type) {
case T_A:
return ("A");
case T_NS: /* authoritative server */
return ("NS");
case T_CNAME: /* canonical name */
return ("CNAME");
case T_SOA: /* start of authority zone */
return ("SOA");
case T_MB: /* mailbox domain name */
return ("MB");
case T_MG: /* mail group member */
return ("MG");
case T_MR: /* mail rename name */
return ("MR");
case T_NULL: /* null resource record */
return ("NULL");
case T_WKS: /* well known service */
return ("WKS");
case T_PTR: /* domain name pointer */
return ("PTR");
case T_HINFO: /* host information */
return ("HINFO");
case T_MINFO: /* mailbox information */
return ("MINFO");
case T_MX: /* mail routing info */
return ("MX");
case T_TXT: /* text */
return ("TXT");
case T_AXFR: /* zone transfer */
return ("AXFR");
case T_MAILB: /* mail box */
return ("MAILB");
case T_MAILA: /* mail address */
return ("MAILA");
case T_ANY: /* matches any type */
return ("ANY");
case T_UINFO:
return ("UINFO");
case T_UID:
return ("UID");
case T_GID:
return ("GID");
#ifdef ALLOW_T_UNSPEC
case T_UNSPEC:
return ("UNSPEC");
#endif /* ALLOW_T_UNSPEC */
default:
return (nbuf);
}
}
/*
* Return a mnemonic for class
*/
char *
int class;
{
switch (class) {
case C_IN: /* internet class */
return ("IN");
case C_HS: /* hesiod class */
return ("HS");
case C_ANY: /* matches any class */
return ("ANY");
default:
return (nbuf);
}
}
/*
* Return a mnemonic for a time to live
*/
char *
{
register char *p;
if (value == 0) {
return (nbuf);
}
value /= 60;
value /= 60;
value /= 24;
p = nbuf;
if (value) {
while (*++p);
}
if (hours) {
if (value)
*p++ = ' ';
while (*++p);
}
if (mins) {
*p++ = ' ';
while (*++p);
}
*p++ = ' ';
}
return (nbuf);
}