#include <cassert>
#include <cstring>
#include "dnsutil.h"
#include "wwwi/string.h"
const char *GetClassName(RRClass i_rrClass) {
switch(i_rrClass) {
case CL_IN: return "IN";
case CL_CS: return "CS";
case CL_CH: return "CH";
case CL_HS: return "HS";
case CL_QANY: return "(ANY)";
}
assert(0);
return "(Unknown Class)";
}
const char *GetOpcodeName(Opcode i_op) {
switch(i_op) {
case OPCODE_QUERY: return "QUERY";
case OPCODE_IQUERY: return "IQUERY";
case OPCODE_STATUS: return "STATUS";
case OPCODE_NOTIFY: return "NOTIFY";
case OPCODE_UPDATE: return "UPDATE";
}
assert(0);
return "(Unknown Opcode)";
}
const char *GetRCodeName(RCode i_rc) {
switch(i_rc) {
case RCODE_NOERROR: return "NOERROR";
case RCODE_FORMERR: return "FORMERR";
case RCODE_SERVFAIL: return "SERVFAIL";
case RCODE_NXDOMAIN: return "NXDOMAIN";
case RCODE_NOTIMP: return "NOTIMP";
case RCODE_REFUSED: return "REFUSED";
case RCODE_YXDOMAIN: return "YXDOMAIN";
case RCODE_YXRRSET: return "YXRRSET";
case RCODE_NXRRSET: return "NXRRSET";
case RCODE_NOTAUTH: return "NOTAUTH";
case RCODE_NOTZONE: return "NOTZONE";
default: return "RCODE_UNKNOWN";
}
}
#define RRTX(XXX) case TY_##XXX: return #XXX;
const char *GetTypeName(RRType i_ty) {
switch(i_ty) {
RRTX(A);
RRTX(NS);
RRTX(MD);
RRTX(MF);
RRTX(CNAME);
RRTX(SOA);
RRTX(MB);
RRTX(MG);
RRTX(MR);
RRTX(NULL);
RRTX(OPT);
RRTX(WKS);
RRTX(PTR);
RRTX(HINFO);
RRTX(MINFO);
RRTX(MX);
RRTX(TXT);
RRTX(AAAA);
case TY_QIXFR: return "(IXFR)";
case TY_QAXFR: return "(AXFR)";
case TY_QMAILB: return "(MAILB)";
case TY_QMAILA: return "(MAILA)";
case TY_QANY: return "(ANY)";
}
assert(0);
return "(Unknown Type)";
}