aboutsummaryrefslogtreecommitdiff
path: root/printtype.c
diff options
context:
space:
mode:
authorHenryk Plötz <henryk@ploetzli.ch>2014-10-03 20:22:01 +0200
committerHenryk Plötz <henryk@ploetzli.ch>2014-10-03 20:29:44 +0200
commit7f632c0640f174bbbc1deb532e3a3977d595d28a (patch)
tree3df92847b2e58d2ced6daa00222fb77458023593 /printtype.c
parenteaaa5b4f9301ae2e5a29dd77616d8e29fd3b2c28 (diff)
downloadtinydnssec-7f632c0640f174bbbc1deb532e3a3977d595d28a.tar.gz
tinydnssec-7f632c0640f174bbbc1deb532e3a3977d595d28a.tar.bz2
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
Diffstat (limited to 'printtype.c')
-rw-r--r--printtype.c47
1 files changed, 47 insertions, 0 deletions
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 <conrad@quisquis.de>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#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);
+}