From 7f632c0640f174bbbc1deb532e3a3977d595d28a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henryk=20Pl=C3=B6tz?= Date: Fri, 3 Oct 2014 20:22:01 +0200 Subject: Apply djbdns-1.05-dnssec.patch SHA1 62e2ce1d31f1fe908fac84fc8bd049a12621810f, contained in tinydnssec-1.05-1.3.tar.bz2 Source was http://www.tinydnssec.org/download/tinydnssec-1.05-1.3.tar.bz2, SHA1 b33d5c3e0de67f6427aad8c00a99580b59804075 --- printtype.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 printtype.c (limited to 'printtype.c') diff --git a/printtype.c b/printtype.c new file mode 100644 index 0000000..ebaa99b --- /dev/null +++ b/printtype.c @@ -0,0 +1,47 @@ +/* (C) 2012 Peter Conrad + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "byte.h" +#include "dns.h" +#include "uint16.h" +#include "printtype.h" + +int printtype(stralloc *out, const char type[2]) { +uint16 u16; + + if (byte_equal(type,2,DNS_T_A)) return stralloc_cats(out,"A"); + if (byte_equal(type,2,DNS_T_NS)) return stralloc_cats(out,"NS"); + if (byte_equal(type,2,DNS_T_CNAME)) return stralloc_cats(out,"CNAME"); + if (byte_equal(type,2,DNS_T_SOA)) return stralloc_cats(out,"SOA"); + if (byte_equal(type,2,DNS_T_PTR)) return stralloc_cats(out,"PTR"); + if (byte_equal(type,2,DNS_T_HINFO)) return stralloc_cats(out,"HINFO"); + if (byte_equal(type,2,DNS_T_MX)) return stralloc_cats(out,"MX"); + if (byte_equal(type,2,DNS_T_TXT)) return stralloc_cats(out,"TXT"); + if (byte_equal(type,2,DNS_T_RP)) return stralloc_cats(out,"RP"); + if (byte_equal(type,2,DNS_T_SIG)) return stralloc_cats(out,"SIG"); + if (byte_equal(type,2,DNS_T_KEY)) return stralloc_cats(out,"KEY"); + if (byte_equal(type,2,DNS_T_AAAA)) return stralloc_cats(out,"AAAA"); + if (byte_equal(type,2,DNS_T_OPT)) return stralloc_cats(out,"OPT"); + if (byte_equal(type,2,DNS_T_DS)) return stralloc_cats(out,"DS"); + if (byte_equal(type,2,DNS_T_RRSIG)) return stralloc_cats(out,"RRSIG"); + if (byte_equal(type,2,DNS_T_DNSKEY)) return stralloc_cats(out,"DNSKEY"); + if (byte_equal(type,2,DNS_T_NSEC3)) return stralloc_cats(out,"NSEC3"); + if (byte_equal(type,2,DNS_T_NSEC3PARAM)) return stralloc_cats(out,"NSEC3PARAM"); + if (byte_equal(type,2,DNS_T_AXFR)) return stralloc_cats(out,"AXFR"); + if (byte_equal(type,2,DNS_T_ANY)) return stralloc_cats(out,"*"); + + uint16_unpack_big(type,&u16); + return stralloc_catulong0(out,u16,0); +} -- cgit v1.2.3