diff --git a/.gitignore b/.gitignore
index fa771c69169d3d4ea3163b7d67cd1c766cf10413..1e704bbdf82783c3f14e09064e8cd1500ce89413 100644
--- a/.gitignore
+++ b/.gitignore
@@ -51,3 +51,6 @@ m4/ltversion.m4
 m4/lt~obsolete.m4
 src/unittests-xfr
 INSTALL
+/doc/html
+/doc/*.st
+/doc/*.sts
diff --git a/Doxy.page.h b/Doxy.page.h
index 9d730240c9951e9e94c2000918212960bed6f6c2..9d1de62edc1a2525adffe2d18b2e72cdc06f08f4 100644
--- a/Doxy.page.h
+++ b/Doxy.page.h
@@ -1,23 +1,25 @@
 /*!
 
-\defgroup server            Server control module.
-\defgroup threading         Threading API.
-\defgroup network           Socket API.
-\defgroup config            Server configuration.
-\defgroup query_processing  DNS query processing.
-\defgroup utils             Utilities, constants and macros.
-\defgroup debugging         Server debugging API.
-\defgroup logging           Server logging API.
-\defgroup statistics        Statistics module (optional).
+\defgroup server            Server control module
+\defgroup threading         Threading API
+\defgroup network           Socket API
+\defgroup config            Server configuration
+\defgroup query_processing  DNS query processing
+\defgroup utils             Utilities, constants and macros
+\defgroup debugging         Server debugging API
+\defgroup logging           Server logging API
+\defgroup statistics        Statistics module (optional)
 \defgroup libknot           libknot - library of DNS-related functions
-\defgroup hashing           Hash table and functions.
-\defgroup common_lib        Common library.
-\defgroup alloc             Memory allocation.
-\defgroup tests             Unit tests.
+\defgroup hashing           Hash table and functions
+\defgroup common_lib        Common library
+\defgroup alloc             Memory allocation
+\defgroup tests             Unit tests
 \defgroup zoneparser        Zone compiler utility
 \defgroup ctl               Control utility
 \defgroup zone-load-dump    Zone loading and dumping
 \defgroup xfr               Zone transfers
+\defgroup zone_scanner      Zone scanner (core)
+\defgroup zone_scanner_test Zone scanner testing environment
 
 \mainpage Knot API documentation.
 
@@ -76,6 +78,8 @@ $ make pdf
 <h2>Zone processing</h2>
 - \ref zoneparser
 - \ref zone-load-dump
+- \ref zone_scanner
+- \ref zone_scanner_test
 
 <h2>Common library</h2>
 - \ref common_lib
diff --git a/Doxyfile b/Doxyfile
index 1a5bb0a1e8a40f988379d794d6147342207b2ac2..add27a6ee335b848ed5d70f55421661ce3fa95ef 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -596,6 +596,7 @@ INPUT                  = src/common \
                          src/common \
                          src/knot \
                          src/zcompile \
+                         src/zscanner \
                          Doxy.page.h
 
 # This tag can be used to specify the character encoding of the source files 
diff --git a/Knot.files b/Knot.files
index 11b6bc175ab0bb7a5d868731a13866ccca748cfe..a1996293d31d8265e4f9b9639ef8729960a07b28 100644
--- a/Knot.files
+++ b/Knot.files
@@ -76,8 +76,6 @@ src/common/lists.h
 src/common/lists.c
 src/common/heap.h
 src/common/heap.c
-src/common/base32.h
-src/common/base32.c
 src/common/print.c
 src/common/print.h
 src/common/latency.c
@@ -192,6 +190,10 @@ src/tests/common/slab_tests.c
 src/tests/common/slab_tests.h
 src/tests/common/fdset_tests.c
 src/tests/common/fdset_tests.h
+src/tests/common/base64_tests.c
+src/tests/common/base64_tests.h
+src/tests/common/base32hex_tests.c
+src/tests/common/base32hex_tests.h
 src/tests/knot/dthreads_tests.c
 src/tests/knot/dthreads_tests.h
 src/tests/knot/conf_tests.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 347635bcfc816e276c76894e9b019fe8beeacb71..724e34e68b0b1f36f4628370fc43c493bec585c9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,7 +11,7 @@ libknotd_la_YFLAGS = -pcf_ -d
 libknotd_la_LFLAGS = # TODO: reentrant parser, prefix
 
 zscanner/scanner.c: zscanner/scanner.rl zscanner/scanner_body.rl
-	$(RAGEL) -s -o zscanner/scanner.c zscanner/scanner.rl
+	$(RAGEL) -G2 -s -o zscanner/scanner.c zscanner/scanner.rl
 
 knot_zcompile_SOURCES =				\
 	libknot/rrset.c				\
diff --git a/src/common/descriptor_new.c b/src/common/descriptor_new.c
index 57c2b72d199b55e61bf627dea92d10cb2c6de7cb..bde684de25200ca3dcfe97f8ede534eb8b7507d9 100644
--- a/src/common/descriptor_new.c
+++ b/src/common/descriptor_new.c
@@ -48,11 +48,10 @@ static const rdata_descriptor_t rdata_descriptors[] = {
 				       KNOT_RDATA_WF_END } },
 	[KNOT_RRTYPE_RT]         = { { 2, KNOT_RDATA_WF_COMPRESSED_DNAME,
 				       KNOT_RDATA_WF_END } },
-	[KNOT_RRTYPE_KEY]        = { { 4, KNOT_RDATA_WF_REMAINDER,
+	[KNOT_RRTYPE_KEY]        = { { KNOT_RDATA_WF_REMAINDER,
 				       KNOT_RDATA_WF_END } },
 	[KNOT_RRTYPE_AAAA]       = { { 16, KNOT_RDATA_WF_END } },
-	[KNOT_RRTYPE_LOC]        = { { 16,
-				       KNOT_RDATA_WF_END } },
+	[KNOT_RRTYPE_LOC]        = { { 16, KNOT_RDATA_WF_END } },
 	[KNOT_RRTYPE_SRV]        = { { 6, KNOT_RDATA_WF_UNCOMPRESSED_DNAME,
 				       KNOT_RDATA_WF_END } },
 	[KNOT_RRTYPE_NAPTR]      = { { KNOT_RDATA_WF_NAPTR_HEADER,
@@ -60,7 +59,7 @@ static const rdata_descriptor_t rdata_descriptors[] = {
 				       KNOT_RDATA_WF_END } },
 	[KNOT_RRTYPE_KX]         = { { 2, KNOT_RDATA_WF_COMPRESSED_DNAME,
 				       KNOT_RDATA_WF_END } },
-	[KNOT_RRTYPE_CERT]       = { { 5, KNOT_RDATA_WF_REMAINDER,
+	[KNOT_RRTYPE_CERT]       = { { KNOT_RDATA_WF_REMAINDER,
 				       KNOT_RDATA_WF_END } },
 	[KNOT_RRTYPE_DNAME]      = { { KNOT_RDATA_WF_UNCOMPRESSED_DNAME,
 				       KNOT_RDATA_WF_END } },
@@ -68,27 +67,27 @@ static const rdata_descriptor_t rdata_descriptors[] = {
 				       KNOT_RDATA_WF_END } },
 	[KNOT_RRTYPE_APL]        = { { KNOT_RDATA_WF_REMAINDER,
 				       KNOT_RDATA_WF_END } },
-	[KNOT_RRTYPE_DS]         = { { 4, KNOT_RDATA_WF_REMAINDER,
+	[KNOT_RRTYPE_DS]         = { { KNOT_RDATA_WF_REMAINDER,
 				       KNOT_RDATA_WF_END } },
-	[KNOT_RRTYPE_SSHFP]      = { { 2, KNOT_RDATA_WF_REMAINDER,
+	[KNOT_RRTYPE_SSHFP]      = { { KNOT_RDATA_WF_REMAINDER,
 				       KNOT_RDATA_WF_END } },
-	[KNOT_RRTYPE_IPSECKEY]   = { { 2, KNOT_RDATA_WF_REMAINDER,
+	[KNOT_RRTYPE_IPSECKEY]   = { { KNOT_RDATA_WF_REMAINDER,
 				       KNOT_RDATA_WF_END } },
-	[KNOT_RRTYPE_RRSIG]      = { { 20, KNOT_RDATA_WF_LITERAL_DNAME,
+	[KNOT_RRTYPE_RRSIG]      = { { 18, KNOT_RDATA_WF_LITERAL_DNAME,
 				       KNOT_RDATA_WF_REMAINDER,
 				       KNOT_RDATA_WF_END } },
 	[KNOT_RRTYPE_NSEC]       = { { KNOT_RDATA_WF_LITERAL_DNAME,
 				       KNOT_RDATA_WF_REMAINDER,
 				       KNOT_RDATA_WF_END } },
-	[KNOT_RRTYPE_DNSKEY]     = { { 4, KNOT_RDATA_WF_REMAINDER,
+	[KNOT_RRTYPE_DNSKEY]     = { { KNOT_RDATA_WF_REMAINDER,
 				       KNOT_RDATA_WF_END } },
 	[KNOT_RRTYPE_DHCID]      = { { KNOT_RDATA_WF_REMAINDER,
 				       KNOT_RDATA_WF_END } },
-	[KNOT_RRTYPE_NSEC3]      = { { 4, KNOT_RDATA_WF_REMAINDER,
+	[KNOT_RRTYPE_NSEC3]      = { { KNOT_RDATA_WF_REMAINDER,
 				       KNOT_RDATA_WF_END } },
-	[KNOT_RRTYPE_NSEC3PARAM] = { { 4, KNOT_RDATA_WF_REMAINDER,
+	[KNOT_RRTYPE_NSEC3PARAM] = { { KNOT_RDATA_WF_REMAINDER,
 				       KNOT_RDATA_WF_END } },
-	[KNOT_RRTYPE_TLSA]       = { { 3, KNOT_RDATA_WF_REMAINDER,
+	[KNOT_RRTYPE_TLSA]       = { { KNOT_RDATA_WF_REMAINDER,
 				       KNOT_RDATA_WF_END } },
 	[KNOT_RRTYPE_SPF]        = { { KNOT_RDATA_WF_REMAINDER,
 				       KNOT_RDATA_WF_END } },
diff --git a/src/common/errcode.c b/src/common/errcode.c
index df8ebef44f50fcb034c3811990c6f315bd4ddd83..885fbb71421f3b3ecc45dd682646c8865b25153c 100644
--- a/src/common/errcode.c
+++ b/src/common/errcode.c
@@ -69,7 +69,7 @@ const error_table_t knot_error_msgs[] = {
 	{KNOT_EIXFRSPACE, "IXFR reply did not fit in."},
 	{KNOT_ECNAME, "CNAME loop found in zone."},
 	{KNOT_ENODIFF, "Cannot create zone diff."},
-	{KNOT_EDSDIGESTLEN, "DS digest length does not match digest type." },
+	{KNOT_EDSDIGESTLEN, "DS digest length does not match digest type."},
 
 	/* Zone file loader errors. */
 	{FLOADER_EFSTAT, "Fstat error!"},
@@ -77,7 +77,6 @@ const error_table_t knot_error_msgs[] = {
 	{FLOADER_EEMPTY, "Empty zone file!"},
 	{FLOADER_EDEFAULTS, "Zone defaults processing error!"},
 	{FLOADER_EMMAP, "Mmap error!"},
-	{FLOADER_EOVERLAPPING, "Insufficient block overlapping!"},
 	{FLOADER_EMUNMAP, "Munmap error!"},
 	{FLOADER_ESCANNER, "Zone processing error!"},
 
@@ -103,6 +102,7 @@ const error_table_t knot_error_msgs[] = {
 	{ZSCANNER_EBAD_IPV4, "Bad IPv4 address!"},
 	{ZSCANNER_EBAD_IPV6, "Bad IPv6 address!"},
 	{ZSCANNER_EBAD_GATEWAY, "Bad gateway!"},
+	{ZSCANNER_EBAD_GATEWAY_KEY, "Bad gateway key!"},
 	{ZSCANNER_EBAD_APL, "Bad adress prefix list!"},
 	{ZSCANNER_EBAD_RDATA, "Bad record data!"},
 	{ZSCANNER_EBAD_HEX_RDATA, "Bad record data in hex format!"},
@@ -131,4 +131,5 @@ const error_table_t knot_error_msgs[] = {
 	{ZSCANNER_ECANNOT_TEXT_DATA, "Unable to process text form for this type!"},
 	{ZSCANNER_EBAD_HEX_DATA, "Bad hexadecimal rdata format!"},
 	{ZSCANNER_EBAD_LOC_DATA, "Bad zone location data!"},
+	{ZSCANNER_EUNKNOWN_BLOCK, "Unknown rdata block!"},
 };
diff --git a/src/common/errcode.h b/src/common/errcode.h
index 163e27fd6eaaf6458fa7d69ada5f184d00d8b573..d55cd425048f74616edccdae999d47448f78ac6d 100644
--- a/src/common/errcode.h
+++ b/src/common/errcode.h
@@ -117,11 +117,12 @@ enum knot_error {
 	ZSCANNER_EBAD_IPV4,
 	ZSCANNER_EBAD_IPV6,
 	ZSCANNER_EBAD_GATEWAY,
+	ZSCANNER_EBAD_GATEWAY_KEY,
+	ZSCANNER_EBAD_BASE64_CHAR,
 	ZSCANNER_EBAD_APL,
 	ZSCANNER_EBAD_RDATA,
 	ZSCANNER_EBAD_HEX_RDATA,
 	ZSCANNER_EBAD_HEX_CHAR,
-	ZSCANNER_EBAD_BASE64_CHAR,
 	ZSCANNER_EBAD_BASE32HEX_CHAR,
 	ZSCANNER_EBAD_REST,
 	ZSCANNER_EBAD_TIMESTAMP_CHAR,
@@ -145,6 +146,7 @@ enum knot_error {
 	ZSCANNER_ECANNOT_TEXT_DATA,
 	ZSCANNER_EBAD_HEX_DATA,
 	ZSCANNER_EBAD_LOC_DATA,
+	ZSCANNER_EUNKNOWN_BLOCK,
 };
 
 /*! \brief Table linking error messages to error codes. */
diff --git a/src/libknot/rrset.c b/src/libknot/rrset.c
index cf766ae1f1344b845ece197ccc95d9d9fc4dc4a2..d28eeb683d31382ba13e10a743053f4c16295f3c 100644
--- a/src/libknot/rrset.c
+++ b/src/libknot/rrset.c
@@ -1595,7 +1595,34 @@ uint8_t *knot_rrset_rdata_prealloc(const knot_rrset_t *rrset)
 	 * Length of data can be sometimes guessed
 	 * easily. Well, for some types anyway.
 	 */
-	size_t rdata_size = 1000;
+	rdata_descriptor_t *desc = get_rdata_descriptor(rrset->type);
+	assert(desc);
+	size_t rdata_size = 0;
+	for (int i = 0; desc->block_types[i] != KNOT_RDATA_WF_END; i++) {
+		int item = desc->block_types[i];
+		if (descriptor_item_is_fixed(item)) {
+			rdata_size += item;
+		} else if (descriptor_item_is_dname(item)) {
+			rdata_size += sizeof(knot_dname_t *);
+		} else if (descriptor_item_is_remainder(item)) {
+			//TODO
+			switch(rrset->type) {
+				KNOT_RRTYPE_DS:
+					rdata_size += 64;
+				break;
+				KNOT_RRTYPE_RRSIG:
+					rdata_size += 256;
+				break;
+				KNOT_RRTYPE_DNSKEY:
+					rdata_size += 1024;
+				break;
+				default:
+					rdata_size += 512;
+			} //switch
+		} else {
+			assert(0);
+		}
+	}
 	
 	uint8_t *ret = malloc(rdata_size);
 	if (ret == NULL) {
diff --git a/src/zcompile/zcompile.c b/src/zcompile/zcompile.c
index 8828ee7ee7fc3eeed025047612fc1596030b2984..23447e90cfe2c2cc5fb8bb356f47aabe4ea0ac31 100644
--- a/src/zcompile/zcompile.c
+++ b/src/zcompile/zcompile.c
@@ -47,10 +47,10 @@
 #include "libknot/util/utils.h"
 #include "zscanner/file_loader.h"
 
-#define dbg_zp_detail printf
-#define dbg_zp printf
+//#define dbg_zp_detail printf
+//#define dbg_zp printf
 
-#define dbg_zp_exec_detail(cmds) do { cmds } while (0)
+//#define dbg_zp_exec_detail(cmds) do { cmds } while (0)
 
 
 struct parser {
@@ -221,7 +221,7 @@ static void process_rrsigs_in_node(parser_t *parser,
 
 void process_error(const scanner_t *scanner)
 {
-	fprintf(stderr, "GODS! There's been an error!\n");
+	fprintf(stderr, "There's been an error!\n");
 }
 
 int add_rdata_to_rr(knot_rrset_t *rrset, const scanner_t *scanner)
diff --git a/src/zscanner/NOTES b/src/zscanner/NOTES
index 8fde46d66d50fbabf4427412a1a0dda491c5e51a..ba7d69f16c49703b0064b2a796984b46ed602abd 100644
--- a/src/zscanner/NOTES
+++ b/src/zscanner/NOTES
@@ -1,4 +1,4 @@
-- the new-line character is appended to each zone file before processing (for simplicity)
+- the newline character is appended to each zone file during processing (for simplicity)
 - the class IN is supported only (CLASS12345 notation is not supported too)
 - domain names can contain alphanumeric, '-', '_' and '/' characters
 - \x and \DDD notations are allowed in domain names and text strings only
@@ -10,4 +10,4 @@
 - items parts lengths must be multiples of 2 for HEX, 4 for base64 and 8 for base32hex blocks (but DHCID example from RFC is more general!)
 - NSEC3 hash is with padding (but RFC 5155 section 3.3 says "unpadded")
 - date version of timestamp in RRSIG is limited to the end of the year 2105 (for better checking of 32bit integer)
-- algorithm and certificate mnemonics aren't supported
+- algorithm, certificate and flags (in KEY) mnemonics aren't supported
diff --git a/src/zscanner/file_loader.c b/src/zscanner/file_loader.c
index 6aceb95330be5aa54ba408bfe8536371bbf2fc87..01a3d98b990696089a740ab0ede1a55bdb2174c4 100644
--- a/src/zscanner/file_loader.c
+++ b/src/zscanner/file_loader.c
@@ -16,27 +16,38 @@
 
 #include "zscanner/file_loader.h"
 
-#include <inttypes.h>		// PRIu64
-#include <unistd.h>		// sysconf
-#include <stdio.h>		// sprintf
-#include <stdlib.h>		// free
-#include <stdbool.h>		// bool
-#include <string.h>		// strlen
-#include <fcntl.h>		// open
-#include <sys/stat.h>		// fstat
-#include <sys/mman.h>		// mmap
-
-#include "common/errcode.h"	// error codes
-
-#define BLOCK_SIZE		      30000000  // In bytes.
-#define BLOCK_OVERLAPPING_SIZE		100000  // In bytes.
-
-
+#include <inttypes.h>			// PRIu64
+#include <unistd.h>			// sysconf
+#include <stdio.h>			// sprintf
+#include <stdlib.h>			// free
+#include <stdbool.h>			// bool
+#include <string.h>			// strlen
+#include <fcntl.h>			// open
+#include <sys/stat.h>			// fstat
+#include <sys/mman.h>			// mmap
+
+#include "common/errcode.h"		// error codes
+
+/*! \brief Mmap block size in bytes. */
+#define BLOCK_SIZE      30000000
+
+/*!
+ * \brief Processes zone settings block.
+ *
+ * Before zone file processing via scanner it's necessary to process first
+ * settings block using this function. Settings block contains ORIGIN and
+ * TTL directive.
+ *
+ * \param fl		File loader structure.
+ *
+ * \retval  0		if success.
+ * \retval -1		if error.
+ */
 static int load_settings(file_loader_t *fl)
 {
-	int	  ret;
-	scanner_t *settings_scanner;
-	char	  *settings_name;
+	int		ret;
+	char		*settings_name;
+	scanner_t	*settings_scanner;
 
 	// Creating name for zone defaults.
 	settings_name = malloc(strlen(fl->file_name) + 100);
@@ -105,7 +116,7 @@ file_loader_t* file_loader_create(const char	 *file_name,
 	// Creating zone scanner.
 	fl->scanner = scanner_create(file_name);
 
-	// Setting processing functions.
+	// Setting processing functions and data pointer.
 	fl->scanner->process_record = process_record;
 	fl->scanner->process_error  = process_error;
 	fl->scanner->data = data;
@@ -140,17 +151,16 @@ void file_loader_free(file_loader_t *fl)
 
 int file_loader_process(file_loader_t *fl)
 {
-	struct stat file_stat;
-
-	int	 ret;
-	char	 *data;
-	bool	 is_last_block;
-	long	 page_size;
-	uint64_t n_blocks, block_id;
-	uint64_t block_size, overlapping_size;
-	// Start means first valid character; end means first invalid character.
-	uint64_t block_start_position, block_end_position;
-	uint64_t scanner_start_position, scanner_end_position;
+	int		ret;
+	char		*data;		// Mmaped data.
+	bool		is_last_block;
+	long		page_size;
+	uint64_t	n_blocks;
+	uint64_t	block_id;
+	uint64_t	default_block_size;
+	uint64_t	scanner_start;	// Current block start to scan.
+	uint64_t	block_size;	// Current block size to scan.
+	struct stat	file_stat;
 
 	// Last block - secure termination of zone file.
 	char *zone_termination = "\n";
@@ -174,13 +184,10 @@ int file_loader_process(file_loader_t *fl)
 	}
 
 	// Block size adjustment to multiple of page size.
-	block_size = (BLOCK_SIZE / page_size) * page_size;
-
-	// Overlapping size adjustment to multiple of page size.
-	overlapping_size = (BLOCK_OVERLAPPING_SIZE / page_size) * page_size;
+	default_block_size = (BLOCK_SIZE / page_size) * page_size;
 
 	// Number of blocks which cover the whole file (ceiling operation).
-	n_blocks = 1 + ((file_stat.st_size - 1) / block_size);
+	n_blocks = 1 + ((file_stat.st_size - 1) / default_block_size);
 
 	// Process settings using scanner (like initial ORIGIN and TTL).
 	ret = load_settings(fl);
@@ -191,51 +198,35 @@ int file_loader_process(file_loader_t *fl)
 
 	// Loop over zone file blocks.
 	for (block_id = 0; block_id < n_blocks; block_id++) {
-		block_start_position   =  block_id      * block_size;
-		block_end_position     = (block_id + 1) * block_size;
-		scanner_start_position = 0;
-		scanner_end_position   = block_size;
-		is_last_block	       = false;
-
-		// Non-first block overlaps previous block - can be useful.
-		if (block_id > 0) {
-			block_start_position  -= overlapping_size;
-			scanner_start_position = overlapping_size;
-			scanner_end_position  += overlapping_size;
-		}
+		scanner_start = block_id * default_block_size;
+		is_last_block = false;
+		block_size = default_block_size;
 
 		// The last block is probably shorter.
 		if (block_id == (n_blocks - 1)) {
-			block_end_position   = file_stat.st_size;
-			scanner_end_position =
-				block_end_position - block_start_position;
-			is_last_block	     = true;
+			block_size = file_stat.st_size - scanner_start;
+			is_last_block = true;
 		}
 
 		// Zone file block mapping.
 		data = mmap(0,
-			    block_end_position - block_start_position,
+			    block_size,
 			    PROT_READ,
 			    MAP_SHARED,
 			    fl->fd,
-			    block_start_position);
+			    scanner_start);
 
 		if (data == MAP_FAILED) {
 			return FLOADER_EMMAP;
 		}
 
-		// Check for sufficient block overlapping.
-		if (fl->scanner->token_shift > overlapping_size) {
-			return FLOADER_EOVERLAPPING;
-		};
-
 		// Scan zone file.
-		ret = scanner_process(data + scanner_start_position,
-				      data + scanner_end_position,
+		ret = scanner_process(data,
+				      data + block_size,
 				      false,
 				      fl->scanner);
 
-		// Artificial last block containing termination only.
+		// Artificial last block containing newline char only.
 		if (is_last_block == true && fl->scanner->stop == 0) {
 			ret = scanner_process(zone_termination,
 		  			      zone_termination + 1,
@@ -244,7 +235,7 @@ int file_loader_process(file_loader_t *fl)
 		}
 
 		// Zone file block unmapping.
-		if (munmap(data, block_end_position - block_start_position) == -1) {
+		if (munmap(data, block_size) == -1) {
 			return FLOADER_EMUNMAP;
 		}
 	}
diff --git a/src/zscanner/file_loader.h b/src/zscanner/file_loader.h
index 70f0966aa62ba0d11f91c7ce7c7995591999ae59..f500ea1d917767c353692b94f421056164091f82 100644
--- a/src/zscanner/file_loader.h
+++ b/src/zscanner/file_loader.h
@@ -32,23 +32,41 @@
 #include "common/descriptor_new.h"	// KNOT_CLASS_IN
 #include "zscanner/scanner.h"		// scanner_t
 
+/*! \brief Settings block size in bytes. */
 #define SETTINGS_BUFFER_LENGTH		 1024
-
+/*! \brief Default ttl value. */
 #define DEFAULT_TTL			 3600
+/*! \brief Default class value. */
 #define DEFAULT_CLASS		KNOT_CLASS_IN
 
-
-/*!
- * \brief Structure for zone file loader (each include file has one).
- */
+/*! \brief Structure for zone file loader (each included file has one). */
 typedef struct {
-	int	  fd;		/*!< File descriptor. */
-	char	  *file_name;	/*!< Zone file name. */
-	scanner_t *scanner;	/*!< Zone scanner data. */
+	/*!< File descriptor. */
+	int	  fd;
+	/*!< Zone file name this loader belongs to. */
+	char	  *file_name;
+	/*!< Zone scanner context stucture. */
+	scanner_t *scanner;
+	/*!< Zone settings buffer. */
 	char	  settings_buffer[SETTINGS_BUFFER_LENGTH];
+	/*!< Length of zone settings buffer. */
 	uint32_t  settings_length;
 } file_loader_t;
 
+/*!
+ * \brief Creates file loader structure.
+ *
+ * \param file_name		Name of file to process.
+ * \param zone_origin		Initial zone origin (used in settings block).
+ * \param default_class		Default class value.
+ * \param default_ttl		Default ttl value (used in settings block).
+ * \param process_record	Processing callback function.
+ * \param process_error 	Error callback function.
+ * \param data			Arbitrary data useful in callback functions.
+ *
+ * \retval file_loader		if success.
+ * \retval 0			if error.
+ */
 file_loader_t* file_loader_create(const char	 *file_name,
 				  const char	 *zone_origin,
 				  const uint16_t default_class,
@@ -57,8 +75,28 @@ file_loader_t* file_loader_create(const char	 *file_name,
 				  void (*process_error)(const scanner_t *),
 				  void *data);
 
+/*!
+ * \brief Destroys file loader structure.
+ *
+ * \param file_loader	File loader structure.
+ */
 void file_loader_free(file_loader_t *file_loader);
 
+/*!
+ * \brief Processes zone file.
+ *
+ * Launches zone file processing using zone scanner. For each correctly
+ * recognized record data process_record callback function is called. If any
+ * syntax error occures, then process_error callback function is called.
+ *
+ * \note Zone scanner error code and other information are stored in
+ * fl.scanner context.
+ *
+ * \param file_loader	File loader structure.
+ *
+ * \retval KNOT_EOK	if success.
+ * \retval error_code   if error.
+ */
 int file_loader_process(file_loader_t *file_loader);
 
 
diff --git a/src/zscanner/scanner.h b/src/zscanner/scanner.h
index 64c65a0a498cea5164397741727052ebd3f4e472..06b6a2e74d2c06d17a54b76c1474ce967b3089c3 100644
--- a/src/zscanner/scanner.h
+++ b/src/zscanner/scanner.h
@@ -27,45 +27,56 @@
 #ifndef _ZSCANNER__SCANNER_H_
 #define _ZSCANNER__SCANNER_H_
 
-#include <stdint.h>		// uint32_t
-#include <stdbool.h>		// bool
-#include <arpa/inet.h>		// htons
+#include <stdint.h>			// uint32_t
+#include <stdbool.h>			// bool
+#include <arpa/inet.h>			// htons
 
+/*! \brief Maximal length of rdata. */
 #define MAX_RDATA_LENGTH	       65535
+/*! \brief Maximal length of rdata item. */
 #define MAX_ITEM_LENGTH			 255
+/*! \brief Maximal length of domain name. */
 #define MAX_DNAME_LENGTH		 255
+/*! \brief Maximal length of domain name label. */
 #define MAX_LABEL_LENGTH		  63
+/*! \brief Maximal number or rdata items. */
 #define MAX_RDATA_ITEMS			  64
 
+/*! \brief Number of bitmap windows. */
 #define BITMAP_WINDOWS			 256
 
+/*! \brief Length of ipv4 address in wire format. */
 #define INET4_ADDR_LENGTH		   4
+/*! \brief Length of ipv6 address in wire format. */
 #define INET6_ADDR_LENGTH		  16
 
-#define RAGEL_STACK_SIZE		  16 // Each nested call needs one.
+/*! \brief Ragel call stack size (see Ragel internals). */
+#define RAGEL_STACK_SIZE		  16
 
+/*! \brief ASCII value of '0' character. */
 #define ASCII_0				  48
 
-#define LOC_LAT_ZERO	(uint32_t)2147483648 // 2^31 - equator.
-#define LOC_LONG_ZERO	(uint32_t)2147483648 // 2^31 - meridian.
-#define LOC_ALT_ZERO	(uint32_t)  10000000 // Base altitude.
-
-
-// Forward declaration for function arguments inside structure.
-struct scanner;
-typedef struct scanner scanner_t;
+/*! \brief Latitude value for equator (2^31). */
+#define LOC_LAT_ZERO	(uint32_t)2147483648
+/*! \brief Longitude value for meridian (2^31). */
+#define LOC_LONG_ZERO	(uint32_t)2147483648
+/*! \brief Zero level altitude value. */
+#define LOC_ALT_ZERO	  (uint32_t)10000000
 
+/*! \brief Auxiliary structure for storing bitmap window items (see RFC4034). */
 typedef struct {
 	uint8_t bitmap[32];
 	uint8_t length;
 } window_t;
 
+/*! \brief Auxiliary structure for storing one APL record (see RFC3123). */
 typedef struct {
 	uint8_t  excl_flag;
 	uint16_t addr_family;
 	uint8_t  prefix_length;
 } apl_t;
 
+/*! \brief Auxiliary structure for storing LOC information (see RFC1876). */
 typedef struct {
 	uint32_t d1, d2;
 	uint32_t m1, m2;
@@ -77,90 +88,173 @@ typedef struct {
 
 /*!
  * \brief Context structure for Ragel scanner.
+ *
+ * This structure contains folowing items:
+ *  - Copies of Ragel internal variables. The scanner is called many times
+ *    for each block of zone file. So it is necessary to preserve internal
+ *    values between subsequent scanner callings.
+ *  - Auxiliary variables which are used during processing zone data.
+ *  - Zone file and error information.
+ *  - Pointers to callback functions and pointer to any arbitrary data which
+ *    can be used in callback functions.
+ *  - Output variables containing all parts of zone record. These data are
+ *    usefull during processing via callback function.
  */
+typedef struct scanner scanner_t; // Forward declaration due to arguments.
 struct scanner {
-	/*!< Scanner internals (See Ragel manual). */
+	/*! Current state (Ragel internals). */
 	int	 cs;
+	/*! Stack top (Ragel internals). */
 	int	 top;
+	/*! Call stack (Ragel internals). */
 	int	 stack[RAGEL_STACK_SIZE];
 
-	/*!< Data start shift of incompletely scanned token. */
-	uint32_t token_shift;
-	uint32_t r_data_tail; /*!< Position of actual r_data byte. */
-
-	/*!< Zone file name. */
+	/*! Zone file name. */
 	char     *file_name;
-	/*!< Zone file line counter. */
+	/*! Zone file line counter. */
 	uint64_t line_counter;
 
+	/*! Last occured error/warning code. */
 	int      error_code;
+	/*! Errors/warnings counter. */
 	uint64_t error_counter;
+	/*!
+	 * Indicates serious warning which is considered as an error and
+	 * forces zone processing to stop.
+	 */
 	bool     stop;
 
+	/*! Callback function for correct zone record. */
 	void (*process_record)(const scanner_t *);
+	/*! Callback function for wrong situations. */
 	void (*process_error)(const scanner_t *);
+	/*! Arbitrary data useful inside callback functions. */
 	void *data;
 
-	/*!< Indicates if actual record is multiline. */
+	/*! Indicates whether current record is multiline. */
 	bool     multiline;
-	/*!< Auxiliary number for all numeric operations. */
+	/*! Auxiliary number for all numeric operations. */
 	uint64_t number64;
-	/*!< Auxiliary variables for time and float numeric operations. */
+	/*! Auxiliary variable for time and other numeric operations. */
 	uint64_t number64_tmp;
+	/*! Auxiliary variable for float numeric operations. */
 	uint32_t decimals;
+	/*! Auxiliary variable for float numeric operations. */
 	uint32_t decimal_counter;
 
-	/*!< Auxiliary variable for item length (label, base64, ...). */
+	/*! Auxiliary variable for item length (label, base64, ...). */
 	uint32_t item_length;
-	/*!< Auxiliary index for item length position in array. */
+	/*! Auxiliary index for item length position in array. */
 	uint32_t item_length_position;
-	/*!< Auxiliary pointer to item length. */
+	/*! Auxiliary pointer to item length. */
 	uint8_t *item_length_location;
-	/*!< Auxiliary buffer for data storing. */
+	/*! Auxiliary buffer for data storing. */
 	uint8_t  buffer[MAX_RDATA_LENGTH];
-	/*!< Auxiliary buffer length. */
+	/*! Auxiliary buffer length. */
 	uint32_t buffer_length;
-
+	/*! Auxiliary buffer for current included file name. */
 	char     include_filename[MAX_RDATA_LENGTH + 1];
 
-	/*!< Bitmap window blocks. */
+	/*! Auxiliary array of bitmap window blocks. */
 	window_t windows[BITMAP_WINDOWS];
-	/*!< Last window block which is used (-1 means any window). */
+	/*! Last window block which is used (-1 means no window). */
 	int16_t  last_window;
-
+	/*! Auxiliary apl structure. */
 	apl_t    apl;
+	/*! Auxiliary loc structure. */
 	loc_t    loc;
 
-	uint8_t  *dname;  /*!< Pointer to actual dname (origin/owner/rdata). */
-	uint32_t *dname_length; /*!< Pointer to actual dname length. */
-	uint32_t dname_tmp_length; /*!< Temporary dname length which is copied to dname_length after dname processing. */
+	/*! Pointer to the actual dname storage (origin/owner/rdata). */
+	uint8_t  *dname;
+	/*! Pointer to the actual dname length storage. */
+	uint32_t *dname_length;
+	/*!
+	 * Temporary dname length which is copied to dname_length after
+	 * dname processing.
+	 */
+	uint32_t dname_tmp_length;
+	/*! Position of the last free r_data byte. */
+	uint32_t r_data_tail;
 
-	uint8_t  zone_origin[MAX_DNAME_LENGTH]; /*!< Wire format of the origin. */
+	/*! Wire format of the current origin (ORIGIN directive sets this). */
+	uint8_t  zone_origin[MAX_DNAME_LENGTH];
+	/*! Length of the current origin. */
 	uint32_t zone_origin_length;
+	/*! Value of the default class. */
 	uint16_t default_class;
+	/*! Value of the current default ttl (TTL directive sets this). */
 	uint32_t default_ttl;
 
-	// Dname overflow check is after (relative + origin) check.
+	/*!
+	 * Owner of the current record.
+	 *
+	 * \note The double length of the r_owner is due to dname length
+	 *       check is after concatenation of relative and origin dnames.
+	 */
 	uint8_t  r_owner[2 * MAX_DNAME_LENGTH];
+	/*! Length of the current record owner. */
 	uint32_t r_owner_length;
+	/*! Class of the current record. */
 	uint16_t r_class;
+	/*! TTL of the current record. */
 	uint32_t r_ttl;
+	/*! Type of the current record data. */
 	uint16_t r_type;
+	/*! Current rdata. */
 	uint8_t  r_data[MAX_RDATA_LENGTH];
+	/*! Length of the current rdata. */
 	uint32_t r_data_length;
+	/*! Indexes of the current rdata blocks. */
 	uint16_t r_data_blocks[MAX_RDATA_ITEMS];
+	/*! Number or the current rdata blocks. */
 	uint32_t r_data_blocks_count;
-	/* Eexample: MX 1 .
-	 *           rdata = 000100
-	 *           r_data_blocks_count = 2
-	 *           r_data_blocks = [0, 2, 3]
+
+	/*
+	 * Example: a. IN 60 MX 1 b.
+	 *
+	 *          r_owner = 016100
+	 *          r_owner_length = 3
+	 *          r_class = 1
+	 *          r_ttl = 60
+	 *          r_type = 15
+	 *          r_data = 0001016200
+	 *          r_data_length = 5
+	 *          r_data_blocks_count = 2
+	 *          r_data_blocks = [0, 2, 5]
 	 */
 };
 
+/*!
+ * \brief Creates zone scanner structure.
+ *
+ * \param file_name	Zone file name.
+ *
+ * \retval scanner	if success.
+ * \retval 0		if error.
+ */
 scanner_t* scanner_create(const char *file_name);
 
+/*!
+ * \brief Destroys zone scanner structure.
+ *
+ * \param scanner	Zone scanner structure.
+ */
 void scanner_free(scanner_t *scanner);
 
+/*!
+ * \brief Executes zone scanner on data block.
+ *
+ * \note Zone scanner error code and other information are stored in
+ *       the scanner structure.
+ *
+ * \param start		First byte of the zone data to scan.
+ * \param end		Last byte of the zone data to scan.
+ * \param is_last_block	Indicates if current block is last.
+ * \param scanner	Zone scanner structure.
+ *
+ * \retval  0		if success.
+ * \retval -1		if error.
+ */
 int scanner_process(char      *start,
 		    char      *end,
 		    bool      is_last_block,
diff --git a/src/zscanner/scanner.rl b/src/zscanner/scanner.rl
index 497fbaf398e5d7db59401f5c8070db42a281c9bf..00cea8d9db3ddf92ea7189140f5fb0d84a538964 100644
--- a/src/zscanner/scanner.rl
+++ b/src/zscanner/scanner.rl
@@ -31,16 +31,30 @@
 #include "zscanner/file_loader.h"	// file_loader
 #include "zscanner/scanner_functions.h"	// Base64
 
+/*! \brief Shorthand for setting warning data. */
 #define SCANNER_WARNING(code) { s->error_code = code; }
+/*! \brief Shorthand for setting error data. */
 #define SCANNER_ERROR(code)   { s->error_code = code; s->stop = true; }
 
-
-inline void type_num(const uint16_t type, uint8_t *rdata_tail)
+/*!
+ * \brief Writes record type number to r_data.
+ *
+ * \param type		Type number.
+ * \param rdata_tail	Position where to write type number to.
+ */
+static inline void type_num(const uint16_t type, uint8_t **rdata_tail)
 {
-	*((uint16_t *)rdata_tail) = htons(type);
+	*((uint16_t *)*rdata_tail) = htons(type);
+	*rdata_tail += 2;
 }
 
-inline void window_add_bit(const uint16_t type, scanner_t *s) {
+/*!
+ * \brief Sets bit to bitmap window.
+ *
+ * \param type		Type number.
+ * \param s		Scanner context.
+ */
+static inline void window_add_bit(const uint16_t type, scanner_t *s) {
 	uint8_t win      = type / 256;
 	uint8_t bit_pos  = type % 256;
 	uint8_t byte_pos = bit_pos / 8;
@@ -94,8 +108,7 @@ int scanner_process(char      *start,
 {
 	// Necessary scanner variables.
 	int  stack[RAGEL_STACK_SIZE];
-	char *ts = NULL, *eof = NULL;
-	char *p = start, *pe = end;
+	char *p = start, *pe = end, *eof = NULL;
 
 	// Auxiliary variables which are used in scanner body.
 	struct in_addr  addr4;
@@ -115,11 +128,6 @@ int scanner_process(char      *start,
 	int top = s->top;
 	memcpy(stack, s->stack, sizeof(stack));
 
-	// Applying unprocessed token shift.
-	if (s->token_shift > 0) {
-		ts = start - s->token_shift;
-	}
-
 	// End of file check.
 	if (is_last_block == true) {
 		eof = pe;
@@ -163,13 +171,6 @@ int scanner_process(char      *start,
 	// Storing r_data pointer.
 	s->r_data_tail = rdata_tail - s->r_data;
 
-	// Storing unprocessed token shift.
-	if (ts != NULL) {
-		s->token_shift = pe - ts;
-	} else {
-		s->token_shift = 0;
-	}
-
 	// Check if any errors has occured.
 	if (s->error_counter > 0) {
 		return -1;
diff --git a/src/zscanner/scanner_body.rl b/src/zscanner/scanner_body.rl
index 00235830b8b96e80138600d641cc0850419ae11a..0c5162c8126f5da5a6791035584da33e008d1635 100644
--- a/src/zscanner/scanner_body.rl
+++ b/src/zscanner/scanner_body.rl
@@ -116,7 +116,8 @@
 	}
 	action _label_exit {
 		if (s->dname_tmp_length < MAX_DNAME_LENGTH) {
-			(s->dname)[s->item_length_position] = (uint8_t)(s->item_length);
+			(s->dname)[s->item_length_position] =
+				(uint8_t)(s->item_length);
 		} else {
 			SCANNER_WARNING(ZSCANNER_EDNAME_OVERFLOW);
 			fhold; fgoto err_line;
@@ -137,7 +138,8 @@
 		(s->dname)[s->dname_tmp_length] += digit_to_num[(uint8_t)fc];
 	}
 	action _label_dec_exit {
-		(s->dname)[s->dname_tmp_length] = (s->dname)[s->dname_tmp_length];
+		(s->dname)[s->dname_tmp_length] =
+			(s->dname)[s->dname_tmp_length];
 		s->dname_tmp_length++;
 	}
 	action _label_dec_error {
@@ -217,7 +219,8 @@
 	}
 
 	action _separate {
-		s->r_data_blocks[++(s->r_data_blocks_count)] = rdata_tail - s->r_data;
+		s->r_data_blocks[++(s->r_data_blocks_count)] =
+			rdata_tail - s->r_data;
 	}
 
 	# Rdata blocks dividing.
@@ -469,11 +472,16 @@
 			errno = 0;
 			s->number64 = strtoul((char *)(s->buffer), NULL,  10);
 
-			if (errno == 0) {
+			if (errno != 0) {
+				SCANNER_WARNING(ZSCANNER_EBAD_TIMESTAMP);
+				fhold; fgoto err_line;
+			}
+
+			if (s->number64 <= UINT32_MAX) {
 				*((uint32_t *)rdata_tail) = htonl((uint32_t)s->number64);
 				rdata_tail += 4;
 			} else {
-				SCANNER_WARNING(ZSCANNER_EBAD_TIMESTAMP);
+				SCANNER_WARNING(ZSCANNER_ENUMBER32_OVERFLOW);
 				fhold; fgoto err_line;
 			}
 		} else {
@@ -803,32 +811,6 @@
 	ipv6_addr_write = ipv6_addr %_ipv6_addr_write;
 	# END
 
-	# BEGIN - Gateway
-	action _write_0 {
-		*(rdata_tail++) = 0;
-	}
-	action _write_1 {
-		*(rdata_tail++) = 1;
-	}
-	action _write_2 {
-		*(rdata_tail++) = 2;
-	}
-	action _write_3 {
-		*(rdata_tail++) = 3;
-	}
-	action _gateway_error {
-		SCANNER_WARNING(ZSCANNER_EBAD_GATEWAY);
-		fhold; fgoto err_line;
-	}
-
-	gateway =
-		( ('0' $_write_0 . sep . num8 . sep . '.')
-		| ('1' $_write_1 . sep . num8 . sep . ipv4_addr_write)
-		| ('2' $_write_2 . sep . num8 . sep . ipv6_addr_write)
-		| ('3' $_write_3 . sep . num8 . sep . r_dname)
-		) $!_gateway_error;
-	# END
-
 	# BEGIN - apl record processing
 	action _apl_init {
 		memset(&(s->apl), 0, sizeof(s->apl));
@@ -843,10 +825,11 @@
 		s->apl.addr_family = 2;
 	}
 	action _apl_prefix_length {
-		if (s->number64 <= UINT8_MAX) {
+		if ((s->apl.addr_family == 1 && s->number64 <= 32) ||
+		    (s->apl.addr_family == 2 && s->number64 <= 128)) {
 			s->apl.prefix_length = (uint8_t)(s->number64);
 		} else {
-			SCANNER_WARNING(ZSCANNER_ENUMBER8_OVERFLOW);
+			SCANNER_WARNING(ZSCANNER_EBAD_APL);
 			fhold; fgoto err_line;
 		}
 	}
@@ -881,7 +864,8 @@
 				// Apply mask on last byte if not precise prefix.
 				// (Bind does't do this).
 				s->buffer[s->number64 - 1] &=
-					((uint8_t)255 << (8 - s->apl.prefix_length % 8));
+					((uint8_t)255 << (s->number64 * 8 -
+					                  s->apl.prefix_length));
 				break;
 			}
 			s->number64--;
@@ -1013,7 +997,7 @@
 
 	# Base64 array with possibility of inside white spaces and multiline.
 	base64_ := (base64_quartet+ . sep?)+ $!_base64_char_error
-			   %_ret . end_wchar;
+	           %_ret . end_wchar;
 	base64 = base64_char ${ fhold; fcall base64_; };
 	# END
 
@@ -1107,53 +1091,84 @@
 
 	# Continuous base32hex (with padding!) array with forward length processing.
 	hash = base32hex_octet+ >_item_length_init %_item_length_exit
-		   $!_base32hex_char_error;
+	       $!_base32hex_char_error;
 	# END
 
-	# BEGIN - Type processing
-	action _type_exit {
-		rdata_tail += 2;
+	# BEGIN - Gateway
+	action _write_0 {
+		*(rdata_tail++) = 0;
+	}
+	action _write_1 {
+		*(rdata_tail++) = 1;
+	}
+	action _write_2 {
+		*(rdata_tail++) = 2;
 	}
+	action _write_3 {
+		*(rdata_tail++) = 3;
+	}
+	action _gateway_error {
+		SCANNER_WARNING(ZSCANNER_EBAD_GATEWAY);
+		fhold; fgoto err_line;
+	}
+	action _gateway_key_error {
+		SCANNER_WARNING(ZSCANNER_EBAD_GATEWAY_KEY);
+		fhold; fgoto err_line;
+	}
+
+	gateway = (( ('0' $_write_0 . sep . num8 . sep . '.')
+	           | ('1' $_write_1 . sep . num8 . sep . ipv4_addr_write)
+	           | ('2' $_write_2 . sep . num8 . sep . ipv6_addr_write)
+	           | ('3' $_write_3 . sep . num8 . sep . r_dname)
+	           ) $!_gateway_error .
+	           # If algorithm is 0 then key isn't present and vice versa.
+	           ( ((sep . base64) when { s->number64 != 0 })
+	           | ((sep?)         when { s->number64 == 0 }) # remove blank space
+	           ) $!_gateway_key_error
+	          );
+	# END
+
+	# BEGIN - Type processing
 	action _type_error {
 		SCANNER_WARNING(ZSCANNER_EUNSUPPORTED_TYPE);
 		fhold; fgoto err_line;
 	}
 
 	type_num =
-	    ( "A"i          %{ type_num(KNOT_RRTYPE_A, rdata_tail); }
-	    | "NS"i         %{ type_num(KNOT_RRTYPE_NS, rdata_tail); }
-	    | "CNAME"i      %{ type_num(KNOT_RRTYPE_CNAME, rdata_tail); }
-	    | "SOA"i        %{ type_num(KNOT_RRTYPE_SOA, rdata_tail); }
-	    | "PTR"i        %{ type_num(KNOT_RRTYPE_PTR, rdata_tail); }
-	    | "HINFO"i      %{ type_num(KNOT_RRTYPE_HINFO, rdata_tail); }
-	    | "MINFO"i      %{ type_num(KNOT_RRTYPE_MINFO, rdata_tail); }
-	    | "MX"i         %{ type_num(KNOT_RRTYPE_MX, rdata_tail); }
-	    | "TXT"i        %{ type_num(KNOT_RRTYPE_TXT, rdata_tail); }
-	    | "RP"i         %{ type_num(KNOT_RRTYPE_RP, rdata_tail); }
-	    | "AFSDB"i      %{ type_num(KNOT_RRTYPE_AFSDB, rdata_tail); }
-	    | "RT"i         %{ type_num(KNOT_RRTYPE_RT, rdata_tail); }
-	    | "KEY"i        %{ type_num(KNOT_RRTYPE_KEY, rdata_tail); }
-	    | "AAAA"i       %{ type_num(KNOT_RRTYPE_AAAA, rdata_tail); }
-	    | "LOC"i        %{ type_num(KNOT_RRTYPE_LOC, rdata_tail); }
-	    | "SRV"i        %{ type_num(KNOT_RRTYPE_SRV, rdata_tail); }
-	    | "NAPTR"i      %{ type_num(KNOT_RRTYPE_NAPTR, rdata_tail); }
-	    | "KX"i         %{ type_num(KNOT_RRTYPE_KX, rdata_tail); }
-	    | "CERT"i       %{ type_num(KNOT_RRTYPE_CERT, rdata_tail); }
-	    | "DNAME"i      %{ type_num(KNOT_RRTYPE_DNAME, rdata_tail); }
-	    | "APL"i        %{ type_num(KNOT_RRTYPE_APL, rdata_tail); }
-	    | "DS"i         %{ type_num(KNOT_RRTYPE_DS, rdata_tail); }
-	    | "SSHFP"i      %{ type_num(KNOT_RRTYPE_SSHFP, rdata_tail); }
-	    | "IPSECKEY"i   %{ type_num(KNOT_RRTYPE_IPSECKEY, rdata_tail); }
-	    | "RRSIG"i      %{ type_num(KNOT_RRTYPE_RRSIG, rdata_tail); }
-	    | "NSEC"i       %{ type_num(KNOT_RRTYPE_NSEC, rdata_tail); }
-	    | "DNSKEY"i     %{ type_num(KNOT_RRTYPE_DNSKEY, rdata_tail); }
-	    | "DHCID"i      %{ type_num(KNOT_RRTYPE_DHCID, rdata_tail); }
-	    | "NSEC3"i      %{ type_num(KNOT_RRTYPE_NSEC3, rdata_tail); }
-	    | "NSEC3PARAM"i %{ type_num(KNOT_RRTYPE_NSEC3PARAM, rdata_tail); }
-	    | "TLSA"i       %{ type_num(KNOT_RRTYPE_TLSA, rdata_tail); }
-	    | "SPF"i        %{ type_num(KNOT_RRTYPE_SPF, rdata_tail); }
-	    | "TYPE"i      . num16 # TYPE12345
-	    ) %_type_exit $!_type_error;
+	    ( "A"i          %{ type_num(KNOT_RRTYPE_A, &rdata_tail); }
+	    | "NS"i         %{ type_num(KNOT_RRTYPE_NS, &rdata_tail); }
+	    | "CNAME"i      %{ type_num(KNOT_RRTYPE_CNAME, &rdata_tail); }
+	    | "SOA"i        %{ type_num(KNOT_RRTYPE_SOA, &rdata_tail); }
+	    | "PTR"i        %{ type_num(KNOT_RRTYPE_PTR, &rdata_tail); }
+	    | "HINFO"i      %{ type_num(KNOT_RRTYPE_HINFO, &rdata_tail); }
+	    | "MINFO"i      %{ type_num(KNOT_RRTYPE_MINFO, &rdata_tail); }
+	    | "MX"i         %{ type_num(KNOT_RRTYPE_MX, &rdata_tail); }
+	    | "TXT"i        %{ type_num(KNOT_RRTYPE_TXT, &rdata_tail); }
+	    | "RP"i         %{ type_num(KNOT_RRTYPE_RP, &rdata_tail); }
+	    | "AFSDB"i      %{ type_num(KNOT_RRTYPE_AFSDB, &rdata_tail); }
+	    | "RT"i         %{ type_num(KNOT_RRTYPE_RT, &rdata_tail); }
+	    | "KEY"i        %{ type_num(KNOT_RRTYPE_KEY, &rdata_tail); }
+	    | "AAAA"i       %{ type_num(KNOT_RRTYPE_AAAA, &rdata_tail); }
+	    | "LOC"i        %{ type_num(KNOT_RRTYPE_LOC, &rdata_tail); }
+	    | "SRV"i        %{ type_num(KNOT_RRTYPE_SRV, &rdata_tail); }
+	    | "NAPTR"i      %{ type_num(KNOT_RRTYPE_NAPTR, &rdata_tail); }
+	    | "KX"i         %{ type_num(KNOT_RRTYPE_KX, &rdata_tail); }
+	    | "CERT"i       %{ type_num(KNOT_RRTYPE_CERT, &rdata_tail); }
+	    | "DNAME"i      %{ type_num(KNOT_RRTYPE_DNAME, &rdata_tail); }
+	    | "APL"i        %{ type_num(KNOT_RRTYPE_APL, &rdata_tail); }
+	    | "DS"i         %{ type_num(KNOT_RRTYPE_DS, &rdata_tail); }
+	    | "SSHFP"i      %{ type_num(KNOT_RRTYPE_SSHFP, &rdata_tail); }
+	    | "IPSECKEY"i   %{ type_num(KNOT_RRTYPE_IPSECKEY, &rdata_tail); }
+	    | "RRSIG"i      %{ type_num(KNOT_RRTYPE_RRSIG, &rdata_tail); }
+	    | "NSEC"i       %{ type_num(KNOT_RRTYPE_NSEC, &rdata_tail); }
+	    | "DNSKEY"i     %{ type_num(KNOT_RRTYPE_DNSKEY, &rdata_tail); }
+	    | "DHCID"i      %{ type_num(KNOT_RRTYPE_DHCID, &rdata_tail); }
+	    | "NSEC3"i      %{ type_num(KNOT_RRTYPE_NSEC3, &rdata_tail); }
+	    | "NSEC3PARAM"i %{ type_num(KNOT_RRTYPE_NSEC3PARAM, &rdata_tail); }
+	    | "TLSA"i       %{ type_num(KNOT_RRTYPE_TLSA, &rdata_tail); }
+	    | "SPF"i        %{ type_num(KNOT_RRTYPE_SPF, &rdata_tail); }
+	    | "TYPE"i      . num16 # TYPE0-TYPE65535.
+	    ) $!_type_error;
 	# END
 
 	# BEGIN - Bitmap processing
@@ -1166,7 +1181,7 @@
 		}
 	}
 
-	# TYPE0-65535.
+	# TYPE0-TYPE65535.
 	type_bitmap = number %_type_bitmap_exit;
 
 	type_bit =
@@ -1202,7 +1217,7 @@
 	    | "NSEC3PARAM"i %{ window_add_bit(KNOT_RRTYPE_NSEC3PARAM, s); }
 	    | "TLSA"i       %{ window_add_bit(KNOT_RRTYPE_TLSA, s); }
 	    | "SPF"i        %{ window_add_bit(KNOT_RRTYPE_SPF, s); }
-	    | "TYPE"i      . type_bitmap # Special types TYPE0-TYPE65535
+	    | "TYPE"i      . type_bitmap # TYPE0-TYPE65535.
 	    );
 
 	action _bitmap_init {
@@ -1248,7 +1263,7 @@
 		if (s->number64 <= 90) {
 			s->loc.d1 = (uint32_t)(s->number64);
 		} else {
-			SCANNER_WARNING(ZSCANNER_EBAD_LOC_DATA);
+			SCANNER_WARNING(ZSCANNER_EBAD_NUMBER);
 			fhold; fgoto err_line;
 		}
 	}
@@ -1256,7 +1271,7 @@
 		if (s->number64 <= 180) {
 			s->loc.d2 = (uint32_t)(s->number64);
 		} else {
-			SCANNER_WARNING(ZSCANNER_EBAD_LOC_DATA);
+			SCANNER_WARNING(ZSCANNER_EBAD_NUMBER);
 			fhold; fgoto err_line;
 		}
 	}
@@ -1264,7 +1279,7 @@
 		if (s->number64 <= 59) {
 			s->loc.m1 = (uint32_t)(s->number64);
 		} else {
-			SCANNER_WARNING(ZSCANNER_EBAD_LOC_DATA);
+			SCANNER_WARNING(ZSCANNER_EBAD_NUMBER);
 			fhold; fgoto err_line;
 		}
 	}
@@ -1272,7 +1287,7 @@
 		if (s->number64 <= 59) {
 			s->loc.m2 = (uint32_t)(s->number64);
 		} else {
-			SCANNER_WARNING(ZSCANNER_EBAD_LOC_DATA);
+			SCANNER_WARNING(ZSCANNER_EBAD_NUMBER);
 			fhold; fgoto err_line;
 		}
 	}
@@ -1280,7 +1295,7 @@
 		if (s->number64 <= 59999) {
 			s->loc.s1 = (uint32_t)(s->number64);
 		} else {
-			SCANNER_WARNING(ZSCANNER_EBAD_LOC_DATA);
+			SCANNER_WARNING(ZSCANNER_EBAD_NUMBER);
 			fhold; fgoto err_line;
 		}
 	}
@@ -1288,41 +1303,41 @@
 		if (s->number64 <= 59999) {
 			s->loc.s2 = (uint32_t)(s->number64);
 		} else {
-			SCANNER_WARNING(ZSCANNER_EBAD_LOC_DATA);
+			SCANNER_WARNING(ZSCANNER_EBAD_NUMBER);
 			fhold; fgoto err_line;
 		}
 	}
 	action _alt_exit {
 		if ((s->loc.alt_sign ==  1 && s->number64 <= 4284967295) ||
-			(s->loc.alt_sign == -1 && s->number64 <=   10000000))
+		    (s->loc.alt_sign == -1 && s->number64 <=   10000000))
 		{
 			s->loc.alt = (uint32_t)(s->number64);
 		} else {
-			SCANNER_WARNING(ZSCANNER_EBAD_LOC_DATA);
+			SCANNER_WARNING(ZSCANNER_EBAD_NUMBER);
 			fhold; fgoto err_line;
 		}
 	}
 	action _siz_exit {
-		if (s->number64 <= 9000000000) {
-			s->loc.siz = (uint32_t)(s->number64);
+		if (s->number64 <= 9000000000ULL) {
+			s->loc.siz = s->number64;
 		} else {
-			SCANNER_WARNING(ZSCANNER_EBAD_LOC_DATA);
+			SCANNER_WARNING(ZSCANNER_EBAD_NUMBER);
 			fhold; fgoto err_line;
 		}
 	}
 	action _hp_exit {
-		if (s->number64 <= 9000000000) {
-			s->loc.hp = (uint32_t)(s->number64);
+		if (s->number64 <= 9000000000ULL) {
+			s->loc.hp = s->number64;
 		} else {
-			SCANNER_WARNING(ZSCANNER_EBAD_LOC_DATA);
+			SCANNER_WARNING(ZSCANNER_EBAD_NUMBER);
 			fhold; fgoto err_line;
 		}
 	}
 	action _vp_exit {
-		if (s->number64 <= 9000000000) {
-			s->loc.vp = (uint32_t)(s->number64);
+		if (s->number64 <= 9000000000ULL) {
+			s->loc.vp = s->number64;
 		} else {
-			SCANNER_WARNING(ZSCANNER_EBAD_LOC_DATA);
+			SCANNER_WARNING(ZSCANNER_EBAD_NUMBER);
 			fhold; fgoto err_line;
 		}
 	}
@@ -1488,7 +1503,7 @@
 		$!_r_data_error %_ret . end_wchar;
 
 	r_data_ipseckey :=
-		(num8 . sep . gateway . sep . base64)
+		(num8 . sep . gateway)
 		$!_r_data_error %_ret . end_wchar;
 
 	r_data_rrsig :=
@@ -1587,7 +1602,7 @@
 	}
 	action _hex_r_data {
 		switch (s->r_type) {
-		// Next types cannot have empty rdata.
+		// Next types must not have empty rdata.
 		case KNOT_RRTYPE_A:
 		case KNOT_RRTYPE_NS:
 		case KNOT_RRTYPE_CNAME:
@@ -1633,11 +1648,12 @@
 	}
 
 	# rdata can be in text or hex format with leading "\#" string
-	r_data = ( sep  . ^('\\' | all_wchar)     $_text_r_data %_text_r_data_exit
-	         | sep  . '\\' . ^'#' ${ fhold; } $_text_r_data %_text_r_data_exit
-	         | sep  . '\\' .  '#'             $_hex_r_data   # Hex format.
-	         | sep? . end_wchar               $_text_r_data  # Empty rdata.
-	         ) >_r_data_init $!_r_data_error;
+	r_data =
+		( sep  . ^('\\' | all_wchar)     $_text_r_data %_text_r_data_exit
+		| sep  . '\\' . ^'#' ${ fhold; } $_text_r_data %_text_r_data_exit
+		| sep  . '\\' .  '#'             $_hex_r_data   # Hex format.
+		| sep? . end_wchar               $_text_r_data  # Empty rdata.
+		) >_r_data_init $!_r_data_error;
 	# END
 
 	# BEGIN - Record type processing
@@ -1683,7 +1699,7 @@
 		) $!_r_type_error;
 	# END
 
-	# BEGIN - Top level processing
+	# BEGIN - The highest level processing
 	action _record_exit {
 		if (rdata_tail - s->r_data > UINT16_MAX) {
 			SCANNER_WARNING(ZSCANNER_ERDATA_OVERFLOW);
diff --git a/src/zscanner/scanner_functions.c b/src/zscanner/scanner_functions.c
index 42fba37165ec0badf5cae14c7cedb398fd7b1573..d24b59b6fc55faec2fe502c4568a9dc3702a623f 100644
--- a/src/zscanner/scanner_functions.c
+++ b/src/zscanner/scanner_functions.c
@@ -25,16 +25,16 @@
 
 const uint8_t digit_to_num[] = {
     ['0'] = 0, ['1'] = 1, ['2'] = 2, ['3'] = 3, ['4'] = 4,
-    ['5'] = 5, ['6'] = 6, ['7'] = 7, ['8'] = 8, ['9'] = 9
+    ['5'] = 5, ['6'] = 6, ['7'] = 7, ['8'] = 8, ['9'] = 9,
 };
 
-/*   Hex transformation:
-
-         1        2
-     12345678 12345678
-in:    AAAA     BBBB
-out: AAAABBBB
-*/
+/*
+ * Hex transformation:
+ *          1        2
+ *      12345678 12345678
+ * in:    AAAA     BBBB
+ * out: AAAABBBB
+ */
 
 const uint8_t first_hex_to_num[] = {
     ['0'] = ( 0 * 16), ['6'] = ( 6 * 16), ['C'] = (12 * 16), ['b'] = (11 * 16),
@@ -42,23 +42,23 @@ const uint8_t first_hex_to_num[] = {
     ['2'] = ( 2 * 16), ['8'] = ( 8 * 16), ['E'] = (14 * 16), ['d'] = (13 * 16),
     ['3'] = ( 3 * 16), ['9'] = ( 9 * 16), ['F'] = (15 * 16), ['e'] = (14 * 16),
     ['4'] = ( 4 * 16), ['A'] = (10 * 16), ['a'] = (10 * 16), ['f'] = (15 * 16),
-    ['5'] = ( 5 * 16), ['B'] = (11 * 16)
+    ['5'] = ( 5 * 16), ['B'] = (11 * 16),
 };
 
 const uint8_t second_hex_to_num[] = {
     ['0'] =  0, ['4'] =  4, ['8'] =  8, ['C'] = 12, ['a'] = 10, ['d'] = 13,
     ['1'] =  1, ['5'] =  5, ['9'] =  9, ['D'] = 13, ['b'] = 11, ['e'] = 14,
     ['2'] =  2, ['6'] =  6, ['A'] = 10, ['E'] = 14, ['c'] = 12, ['f'] = 15,
-    ['3'] =  3, ['7'] =  7, ['B'] = 11, ['F'] = 15
+    ['3'] =  3, ['7'] =  7, ['B'] = 11, ['F'] = 15,
 };
 
-/*   Base64 transformation:
-
-         1        2        3        4
-     12345678 12345678 12345678 12345678
-in:  00AAAAAA 00BBBBBB 00CCCCCC 00DDDDDD
-out: AAAAAABB BBBBCCCC CCDDDDDD
-*/
+/*
+ * Base64 transformation:
+ *          1        2        3        4
+ *      12345678 12345678 12345678 12345678
+ * in:  00AAAAAA 00BBBBBB 00CCCCCC 00DDDDDD
+ * out: AAAAAABB BBBBCCCC CCDDDDDD
+ */
 
 // 0x3F = 00111111
 const uint8_t first_base64_to_num[] = {
@@ -93,8 +93,9 @@ const uint8_t first_base64_to_num[] = {
     ['c'] = ((28 & 0x3F) << 2), ['8'] = ((60 & 0x3F) << 2),
     ['d'] = ((29 & 0x3F) << 2), ['9'] = ((61 & 0x3F) << 2),
     ['e'] = ((30 & 0x3F) << 2), ['+'] = ((62 & 0x3F) << 2),
-    ['f'] = ((31 & 0x3F) << 2), ['/'] = ((63 & 0x3F) << 2)
+    ['f'] = ((31 & 0x3F) << 2), ['/'] = ((63 & 0x3F) << 2),
 };
+
 // 0x30 = 00110000
 const uint8_t second_left_base64_to_num[] = {
     ['A'] = (( 0 & 0x30) >> 4), ['g'] = ((32 & 0x30) >> 4),
@@ -128,8 +129,9 @@ const uint8_t second_left_base64_to_num[] = {
     ['c'] = ((28 & 0x30) >> 4), ['8'] = ((60 & 0x30) >> 4),
     ['d'] = ((29 & 0x30) >> 4), ['9'] = ((61 & 0x30) >> 4),
     ['e'] = ((30 & 0x30) >> 4), ['+'] = ((62 & 0x30) >> 4),
-    ['f'] = ((31 & 0x30) >> 4), ['/'] = ((63 & 0x30) >> 4)
+    ['f'] = ((31 & 0x30) >> 4), ['/'] = ((63 & 0x30) >> 4),
 };
+
 // 0x0F = 00001111
 const uint8_t second_right_base64_to_num[] = {
     ['A'] = (( 0 & 0x0F) << 4), ['g'] = ((32 & 0x0F) << 4),
@@ -163,8 +165,9 @@ const uint8_t second_right_base64_to_num[] = {
     ['c'] = ((28 & 0x0F) << 4), ['8'] = ((60 & 0x0F) << 4),
     ['d'] = ((29 & 0x0F) << 4), ['9'] = ((61 & 0x0F) << 4),
     ['e'] = ((30 & 0x0F) << 4), ['+'] = ((62 & 0x0F) << 4),
-    ['f'] = ((31 & 0x0F) << 4), ['/'] = ((63 & 0x0F) << 4)
+    ['f'] = ((31 & 0x0F) << 4), ['/'] = ((63 & 0x0F) << 4),
 };
+
 // 0x3C = 00111100
 const uint8_t third_left_base64_to_num[] = {
     ['A'] = (( 0 & 0x3C) >> 2), ['g'] = ((32 & 0x3C) >> 2),
@@ -198,8 +201,9 @@ const uint8_t third_left_base64_to_num[] = {
     ['c'] = ((28 & 0x3C) >> 2), ['8'] = ((60 & 0x3C) >> 2),
     ['d'] = ((29 & 0x3C) >> 2), ['9'] = ((61 & 0x3C) >> 2),
     ['e'] = ((30 & 0x3C) >> 2), ['+'] = ((62 & 0x3C) >> 2),
-    ['f'] = ((31 & 0x3C) >> 2), ['/'] = ((63 & 0x3C) >> 2)
+    ['f'] = ((31 & 0x3C) >> 2), ['/'] = ((63 & 0x3C) >> 2),
 };
+
 // 0x03 = 00000011
 const uint8_t third_right_base64_to_num[] = {
     ['A'] = (( 0 & 0x03) << 6), ['g'] = ((32 & 0x03) << 6),
@@ -233,8 +237,9 @@ const uint8_t third_right_base64_to_num[] = {
     ['c'] = ((28 & 0x03) << 6), ['8'] = ((60 & 0x03) << 6),
     ['d'] = ((29 & 0x03) << 6), ['9'] = ((61 & 0x03) << 6),
     ['e'] = ((30 & 0x03) << 6), ['+'] = ((62 & 0x03) << 6),
-    ['f'] = ((31 & 0x03) << 6), ['/'] = ((63 & 0x03) << 6)
+    ['f'] = ((31 & 0x03) << 6), ['/'] = ((63 & 0x03) << 6),
 };
+
 // 0x3F = 00111111
 const uint8_t fourth_base64_to_num[] = {
     ['A'] = (( 0 & 0x3F) << 0), ['g'] = ((32 & 0x3F) << 0),
@@ -268,16 +273,16 @@ const uint8_t fourth_base64_to_num[] = {
     ['c'] = ((28 & 0x3F) << 0), ['8'] = ((60 & 0x3F) << 0),
     ['d'] = ((29 & 0x3F) << 0), ['9'] = ((61 & 0x3F) << 0),
     ['e'] = ((30 & 0x3F) << 0), ['+'] = ((62 & 0x3F) << 0),
-    ['f'] = ((31 & 0x3F) << 0), ['/'] = ((63 & 0x3F) << 0)
+    ['f'] = ((31 & 0x3F) << 0), ['/'] = ((63 & 0x3F) << 0),
 };
 
-/*   Base32hex transformation (with lower-case):
-
-         1        2        3        4        5        6        7        8
-     12345678 12345678 12345678 12345678 12345678 12345678 12345678 12345678
-in:  000AAAAA 000BBBBB 000CCCCC 000DDDDD 000EEEEE 000FFFFF 000GGGGG 000HHHHH
-out  AAAAABBB BBCCCCCD DDDDEEEE EFFFFFGG GGGHHHHH
-*/
+/*
+ * Base32hex transformation (with lower-case):
+ *          1        2        3        4        5        6        7        8
+ *      12345678 12345678 12345678 12345678 12345678 12345678 12345678 12345678
+ * in:  000AAAAA 000BBBBB 000CCCCC 000DDDDD 000EEEEE 000FFFFF 000GGGGG 000HHHHH
+ * out  AAAAABBB BBCCCCCD DDDDEEEE EFFFFFGG GGGHHHHH
+ */
 
 // 0x1F = 00011111
 const uint8_t first_base32hex_to_num[] = {
@@ -307,8 +312,9 @@ const uint8_t first_base32hex_to_num[] = {
     ['N'] = ((23 & 0x1F) << 3), ['s'] = ((28 & 0x1F) << 3),
     ['O'] = ((24 & 0x1F) << 3), ['t'] = ((29 & 0x1F) << 3),
     ['P'] = ((25 & 0x1F) << 3), ['u'] = ((30 & 0x1F) << 3),
-    ['Q'] = ((26 & 0x1F) << 3), ['v'] = ((31 & 0x1F) << 3)
+    ['Q'] = ((26 & 0x1F) << 3), ['v'] = ((31 & 0x1F) << 3),
 };
+
 // 0x1C = 00011100
 const uint8_t second_left_base32hex_to_num[] = {
     ['0'] = (( 0 & 0x1C) >> 2), ['R'] = ((27 & 0x1C) >> 2),
@@ -337,8 +343,9 @@ const uint8_t second_left_base32hex_to_num[] = {
     ['N'] = ((23 & 0x1C) >> 2), ['s'] = ((28 & 0x1C) >> 2),
     ['O'] = ((24 & 0x1C) >> 2), ['t'] = ((29 & 0x1C) >> 2),
     ['P'] = ((25 & 0x1C) >> 2), ['u'] = ((30 & 0x1C) >> 2),
-    ['Q'] = ((26 & 0x1C) >> 2), ['v'] = ((31 & 0x1C) >> 2)
+    ['Q'] = ((26 & 0x1C) >> 2), ['v'] = ((31 & 0x1C) >> 2),
 };
+
 // 0x03 = 00000011
 const uint8_t second_right_base32hex_to_num[] = {
     ['0'] = (( 0 & 0x03) << 6), ['R'] = ((27 & 0x03) << 6),
@@ -367,8 +374,9 @@ const uint8_t second_right_base32hex_to_num[] = {
     ['N'] = ((23 & 0x03) << 6), ['s'] = ((28 & 0x03) << 6),
     ['O'] = ((24 & 0x03) << 6), ['t'] = ((29 & 0x03) << 6),
     ['P'] = ((25 & 0x03) << 6), ['u'] = ((30 & 0x03) << 6),
-    ['Q'] = ((26 & 0x03) << 6), ['v'] = ((31 & 0x03) << 6)
+    ['Q'] = ((26 & 0x03) << 6), ['v'] = ((31 & 0x03) << 6),
 };
+
 // 0x1F = 00011111
 const uint8_t third_base32hex_to_num[] = {
     ['0'] = (( 0 & 0x1F) << 1), ['R'] = ((27 & 0x1F) << 1),
@@ -397,8 +405,9 @@ const uint8_t third_base32hex_to_num[] = {
     ['N'] = ((23 & 0x1F) << 1), ['s'] = ((28 & 0x1F) << 1),
     ['O'] = ((24 & 0x1F) << 1), ['t'] = ((29 & 0x1F) << 1),
     ['P'] = ((25 & 0x1F) << 1), ['u'] = ((30 & 0x1F) << 1),
-    ['Q'] = ((26 & 0x1F) << 1), ['v'] = ((31 & 0x1F) << 1)
+    ['Q'] = ((26 & 0x1F) << 1), ['v'] = ((31 & 0x1F) << 1),
 };
+
 // 0x10 = 00010000
 const uint8_t fourth_left_base32hex_to_num[] = {
     ['0'] = (( 0 & 0x10) >> 4), ['R'] = ((27 & 0x10) >> 4),
@@ -427,8 +436,9 @@ const uint8_t fourth_left_base32hex_to_num[] = {
     ['N'] = ((23 & 0x10) >> 4), ['s'] = ((28 & 0x10) >> 4),
     ['O'] = ((24 & 0x10) >> 4), ['t'] = ((29 & 0x10) >> 4),
     ['P'] = ((25 & 0x10) >> 4), ['u'] = ((30 & 0x10) >> 4),
-    ['Q'] = ((26 & 0x10) >> 4), ['v'] = ((31 & 0x10) >> 4)
+    ['Q'] = ((26 & 0x10) >> 4), ['v'] = ((31 & 0x10) >> 4),
 };
+
 // 0x0F = 00001111
 const uint8_t fourth_right_base32hex_to_num[] = {
     ['0'] = (( 0 & 0x0F) << 4), ['R'] = ((27 & 0x0F) << 4),
@@ -457,8 +467,9 @@ const uint8_t fourth_right_base32hex_to_num[] = {
     ['N'] = ((23 & 0x0F) << 4), ['s'] = ((28 & 0x0F) << 4),
     ['O'] = ((24 & 0x0F) << 4), ['t'] = ((29 & 0x0F) << 4),
     ['P'] = ((25 & 0x0F) << 4), ['u'] = ((30 & 0x0F) << 4),
-    ['Q'] = ((26 & 0x0F) << 4), ['v'] = ((31 & 0x0F) << 4)
+    ['Q'] = ((26 & 0x0F) << 4), ['v'] = ((31 & 0x0F) << 4),
 };
+
 // 0x1E = 00011110
 const uint8_t fifth_left_base32hex_to_num[] = {
     ['0'] = (( 0 & 0x1E) >> 1), ['R'] = ((27 & 0x1E) >> 1),
@@ -487,8 +498,9 @@ const uint8_t fifth_left_base32hex_to_num[] = {
     ['N'] = ((23 & 0x1E) >> 1), ['s'] = ((28 & 0x1E) >> 1),
     ['O'] = ((24 & 0x1E) >> 1), ['t'] = ((29 & 0x1E) >> 1),
     ['P'] = ((25 & 0x1E) >> 1), ['u'] = ((30 & 0x1E) >> 1),
-    ['Q'] = ((26 & 0x1E) >> 1), ['v'] = ((31 & 0x1E) >> 1)
+    ['Q'] = ((26 & 0x1E) >> 1), ['v'] = ((31 & 0x1E) >> 1),
 };
+
 // 0x01 = 00000001
 const uint8_t fifth_right_base32hex_to_num[] = {
     ['0'] = (( 0 & 0x01) << 7), ['R'] = ((27 & 0x01) << 7),
@@ -517,8 +529,9 @@ const uint8_t fifth_right_base32hex_to_num[] = {
     ['N'] = ((23 & 0x01) << 7), ['s'] = ((28 & 0x01) << 7),
     ['O'] = ((24 & 0x01) << 7), ['t'] = ((29 & 0x01) << 7),
     ['P'] = ((25 & 0x01) << 7), ['u'] = ((30 & 0x01) << 7),
-    ['Q'] = ((26 & 0x01) << 7), ['v'] = ((31 & 0x01) << 7)
+    ['Q'] = ((26 & 0x01) << 7), ['v'] = ((31 & 0x01) << 7),
 };
+
 // 0x1F = 00011111
 const uint8_t sixth_base32hex_to_num[] = {
     ['0'] = (( 0 & 0x1F) << 2), ['R'] = ((27 & 0x1F) << 2),
@@ -547,8 +560,9 @@ const uint8_t sixth_base32hex_to_num[] = {
     ['N'] = ((23 & 0x1F) << 2), ['s'] = ((28 & 0x1F) << 2),
     ['O'] = ((24 & 0x1F) << 2), ['t'] = ((29 & 0x1F) << 2),
     ['P'] = ((25 & 0x1F) << 2), ['u'] = ((30 & 0x1F) << 2),
-    ['Q'] = ((26 & 0x1F) << 2), ['v'] = ((31 & 0x1F) << 2)
+    ['Q'] = ((26 & 0x1F) << 2), ['v'] = ((31 & 0x1F) << 2),
 };
+
 // 0x18 = 00011000
 const uint8_t seventh_left_base32hex_to_num[] = {
     ['0'] = (( 0 & 0x18) >> 3), ['R'] = ((27 & 0x18) >> 3),
@@ -577,8 +591,9 @@ const uint8_t seventh_left_base32hex_to_num[] = {
     ['N'] = ((23 & 0x18) >> 3), ['s'] = ((28 & 0x18) >> 3),
     ['O'] = ((24 & 0x18) >> 3), ['t'] = ((29 & 0x18) >> 3),
     ['P'] = ((25 & 0x18) >> 3), ['u'] = ((30 & 0x18) >> 3),
-    ['Q'] = ((26 & 0x18) >> 3), ['v'] = ((31 & 0x18) >> 3)
+    ['Q'] = ((26 & 0x18) >> 3), ['v'] = ((31 & 0x18) >> 3),
 };
+
 // 0x07 = 00000111
 const uint8_t seventh_right_base32hex_to_num[] = {
     ['0'] = (( 0 & 0x07) << 5), ['R'] = ((27 & 0x07) << 5),
@@ -607,8 +622,9 @@ const uint8_t seventh_right_base32hex_to_num[] = {
     ['N'] = ((23 & 0x07) << 5), ['s'] = ((28 & 0x07) << 5),
     ['O'] = ((24 & 0x07) << 5), ['t'] = ((29 & 0x07) << 5),
     ['P'] = ((25 & 0x07) << 5), ['u'] = ((30 & 0x07) << 5),
-    ['Q'] = ((26 & 0x07) << 5), ['v'] = ((31 & 0x07) << 5)
+    ['Q'] = ((26 & 0x07) << 5), ['v'] = ((31 & 0x07) << 5),
 };
+
 // 0x1F = 00011111
 const uint8_t eighth_base32hex_to_num[] = {
     ['0'] = (( 0 & 0x1F) << 0), ['R'] = ((27 & 0x1F) << 0),
@@ -637,20 +653,19 @@ const uint8_t eighth_base32hex_to_num[] = {
     ['N'] = ((23 & 0x1F) << 0), ['s'] = ((28 & 0x1F) << 0),
     ['O'] = ((24 & 0x1F) << 0), ['t'] = ((29 & 0x1F) << 0),
     ['P'] = ((25 & 0x1F) << 0), ['u'] = ((30 & 0x1F) << 0),
-    ['Q'] = ((26 & 0x1F) << 0), ['v'] = ((31 & 0x1F) << 0)
+    ['Q'] = ((26 & 0x1F) << 0), ['v'] = ((31 & 0x1F) << 0),
 };
 
-////////
 // Without leap day 29. 2.
 static const uint8_t days_in_months[] = {
     [ 1] = 31, [ 2] = 28, [ 3] = 31, [ 4] = 30, [ 5] = 31, [ 6] = 30,
-    [ 7] = 31, [ 8] = 31, [ 9] = 30, [10] = 31, [11] = 30, [12] = 31
+    [ 7] = 31, [ 8] = 31, [ 9] = 30, [10] = 31, [11] = 30, [12] = 31,
 };
 
 // Without leap day 29. 2.
 static const uint16_t days_across_months[] = {
     [ 1] =   0, [ 2] =  31, [ 3] =  59, [ 4] =  90, [ 5] = 120, [ 6] = 151,
-    [ 7] = 181, [ 8] = 212, [ 9] = 243, [10] = 273, [11] = 304, [12] = 334
+    [ 7] = 181, [ 8] = 212, [ 9] = 243, [10] = 273, [11] = 304, [12] = 334,
 };
 
 // 0 ~ 1970 ... 135 ~ 2105
@@ -681,11 +696,11 @@ static const uint8_t is_leap_year[] = {
     [116] = 0, [117] = 0, [118] = 1, [119] = 0, [120] = 0,
     [121] = 0, [122] = 1, [123] = 0, [124] = 0, [125] = 0,
     [126] = 1, [127] = 0, [128] = 0, [129] = 0, [130] = 0,
-    [131] = 0, [132] = 0, [133] = 0, [134] = 1, [135] = 0
+    [131] = 0, [132] = 0, [133] = 0, [134] = 1, [135] = 0,
 };
 
 // 0 ~ 1970 ... 135 ~ 2105
-const uint16_t days_across_years[] = {
+static const uint16_t days_across_years[] = {
     [  1] =   365, [  2] =   730, [  3] =  1096, [  4] =  1461, [  5] =  1826,
     [  6] =  2191, [  7] =  2557, [  8] =  2922, [  9] =  3287, [ 10] =  3652,
     [ 11] =  4018, [ 12] =  4383, [ 13] =  4748, [ 14] =  5113, [ 15] =  5479,
@@ -712,7 +727,7 @@ const uint16_t days_across_years[] = {
     [116] = 42369, [117] = 42734, [118] = 43099, [119] = 43465, [120] = 43830,
     [121] = 44195, [122] = 44560, [123] = 44926, [124] = 45291, [125] = 45656,
     [126] = 46021, [127] = 46387, [128] = 46752, [129] = 47117, [130] = 47482,
-    [131] = 47847, [132] = 48212, [133] = 48577, [134] = 48942, [135] = 49308
+    [131] = 47847, [132] = 48212, [133] = 48577, [134] = 48942, [135] = 49308,
 };
 
 int date_to_timestamp(uint8_t *buff, uint32_t *timestamp)
@@ -756,14 +771,14 @@ int date_to_timestamp(uint8_t *buff, uint32_t *timestamp)
 	return KNOT_EOK;
 }
 
-int wire_dname_to_str(const uint8_t  *data,
-		      const uint32_t data_len,
-		      char *text)
+void wire_dname_to_str(const uint8_t  *data,
+		       const uint32_t data_len,
+		       char *text)
 {
 	uint32_t i = 0, text_len = 0;
 
 	if (data == NULL || data_len == 0 || text == NULL) {
-		return -1;
+		return;
 	}
 
 	uint8_t label_len = data[0];
@@ -793,8 +808,6 @@ int wire_dname_to_str(const uint8_t  *data,
 
 	// Ending text string.
 	text[text_len] = 0;
-
-	return KNOT_EOK;
 }
 
 uint8_t loc64to8(uint64_t number)
@@ -805,10 +818,19 @@ uint8_t loc64to8(uint64_t number)
 		number /= 10;
 		exponent++;
 	}
-
-	return (((uint8_t)number % 9) << 4) + (exponent % 9);
+	// First 4 bits are mantisa, second 4 bits are exponent.
+	return ((uint8_t)number << 4) + (exponent & 15);
 }
 
+/*!
+ * \brief Returns domain name length in wire-format.
+ *
+ * \param data		Data array.
+ * \param data_len	Length of data array.
+ *
+ * \retval >0		if success.
+ * \retval 0		if error.
+ */
 static uint32_t get_dname_length(const uint8_t  *data,
 				 const uint32_t data_len)
 {
@@ -841,6 +863,15 @@ static uint32_t get_dname_length(const uint8_t  *data,
 	}
 }
 
+/*!
+ * \brief Returns length of the leading NAPTR block in wire-format.
+ *
+ * \param data		Data array.
+ * \param data_len	Length of data array.
+ *
+ * \retval >0		if success.
+ * \retval 0		if error.
+ */
 static uint32_t get_naptr_header_length(const uint8_t  *data,
 					const uint32_t data_len)
 {
@@ -866,22 +897,45 @@ static uint32_t get_naptr_header_length(const uint8_t  *data,
 	}
 }
 
-static uint32_t get_block_length(const uint8_t  *data,
-				 const uint32_t data_length,
-				 const uint32_t ofset,
-				 const int      type)
+/*!
+ * \brief Returns block length in wire-format.
+ *
+ * \param data		Data array.
+ * \param data_len	Length of data array.
+ * \param offset	Start of the block in data array.
+ * \param type		Record type.
+ *
+ * \retval >=0		if success.
+ * \retval <0		if error.
+ */
+static int32_t get_block_length(const uint8_t  *data,
+				const uint32_t data_len,
+				const uint32_t offset,
+				const int      type)
 {
+	uint32_t ret;
+
 	switch (type) {
 	case KNOT_RDATA_WF_COMPRESSED_DNAME:
 	case KNOT_RDATA_WF_UNCOMPRESSED_DNAME:
 	case KNOT_RDATA_WF_LITERAL_DNAME:
-		return get_dname_length(data + ofset,
-					data_length - ofset);
+		ret = get_dname_length(data + offset, data_len - offset);
+
+		if (ret > 0) {
+			return ret;
+		} else {
+			return -1;
+		}
 	case KNOT_RDATA_WF_NAPTR_HEADER:
-		return get_naptr_header_length(data + ofset,
-					       data_length - ofset);
+		ret = get_naptr_header_length(data + offset, data_len - offset);
+
+                if (ret > 0) {
+                        return ret;
+                } else {
+                        return -1;
+                }
 	case KNOT_RDATA_WF_REMAINDER:
-		return data_length;
+		return data_len - offset;
 	default:
 		return 0;
 	}
@@ -909,8 +963,8 @@ int find_rdata_blocks(scanner_t *s)
 					       s->r_data_length,
 					       position,
 					       *type);
-			if (ret == 0) {
-				return ZSCANNER_EBAD_HEX_RDATA;
+			if (ret < 0) {
+				return ZSCANNER_EUNKNOWN_BLOCK;
 			}
 
 			position += ret;
diff --git a/src/zscanner/scanner_functions.h b/src/zscanner/scanner_functions.h
index 03ddd3123d3d1bd8b6f39b42213730af6c8c923c..5d219d7143efa18cb1fffc39b202657291b9bc09 100644
--- a/src/zscanner/scanner_functions.h
+++ b/src/zscanner/scanner_functions.h
@@ -31,45 +31,95 @@
 
 #include "zscanner/scanner.h"
 
-
-extern const uint8_t ascii_to_lower[];
-
+/*! \brief Transforms digit char to number. */
 extern const uint8_t digit_to_num[];
 
-// Transformation arrays for Hex encoding.
+/*! \brief Transforms first hex char to the part of the total number. */
 extern const uint8_t first_hex_to_num[];
+/*! \brief Transforms second hex char to the part of the total number. */
 extern const uint8_t second_hex_to_num[];
 
-// Transformation arrays for Base64 encoding.
+/*! \brief Transforms first Base64 char. */
 extern const uint8_t first_base64_to_num[];
+/*! \brief Transforms left part of the second Base64 char. */
 extern const uint8_t second_left_base64_to_num[];
+/*! \brief Transforms left part of the second Base64 char. */
 extern const uint8_t second_right_base64_to_num[];
+/*! \brief Transforms left part of the third Base64 char. */
 extern const uint8_t third_left_base64_to_num[];
+/*! \brief Transforms left part of the third Base64 char. */
 extern const uint8_t third_right_base64_to_num[];
+/*! \brief Transforms fourth Base64 char. */
 extern const uint8_t fourth_base64_to_num[];
 
-// Transformation arrays for Base32hex encoding.
+/*! \brief Transforms first Base32hex char. */
 extern const uint8_t first_base32hex_to_num[];
+/*! \brief Transforms left part of the second Base32hex char. */
 extern const uint8_t second_left_base32hex_to_num[];
+/*! \brief Transforms right part of the second Base32hex char. */
 extern const uint8_t second_right_base32hex_to_num[];
+/*! \brief Transforms third Base32hex char. */
 extern const uint8_t third_base32hex_to_num[];
+/*! \brief Transforms left part of the fourth Base32hex char. */
 extern const uint8_t fourth_left_base32hex_to_num[];
+/*! \brief Transforms right part of the fourth Base32hex char. */
 extern const uint8_t fourth_right_base32hex_to_num[];
+/*! \brief Transforms left part of the fifth Base32hex char. */
 extern const uint8_t fifth_left_base32hex_to_num[];
+/*! \brief Transforms right part of the fifth Base32hex char. */
 extern const uint8_t fifth_right_base32hex_to_num[];
+/*! \brief Transforms sixth Base32hex char. */
 extern const uint8_t sixth_base32hex_to_num[];
+/*! \brief Transforms left part of the seventh Base32hex char. */
 extern const uint8_t seventh_left_base32hex_to_num[];
+/*! \brief Transforms right part of the seventh Base32hex char. */
 extern const uint8_t seventh_right_base32hex_to_num[];
+/*! \brief Transforms eighth Base32hex char. */
 extern const uint8_t eighth_base32hex_to_num[];
 
+/*!
+ * \brief Converts YYYYMMDDHHMMSS time string to unsigned 32-bit timestamp.
+ *
+ * \param buff		Buffer containing time string.
+ * \param timestamp	Computed timestamp.
+ *
+ * \retval KNOT_EOK	if success.
+ * \retval error_code	if error.
+ */
 int date_to_timestamp(uint8_t *buff, uint32_t *timestamp);
 
-int wire_dname_to_str(const uint8_t  *data,
-		      const uint32_t data_len,
-		      char *text);
+/*!
+ * \brief Converts wire-format dname to text dname.
+ *
+ * \param data		Buffer containg wire-format dname.
+ * \param data_len	Length of the buffer.
+ * \param text		Text output.
+ */
+void wire_dname_to_str(const uint8_t  *data,
+		       const uint32_t data_len,
+		       char *text);
 
+/*!
+ * \brief Converts unsigned integer to mantisa*10^(exponent).
+ *
+ * Given number is encoded as two 4-bit numbers. First part is mantisa [0-9],
+ * second part is decimal exponent [0-15]. Result is concatenation of these
+ * two blocks.
+ *
+ * \param number	Number to convert.
+ *
+ * \retval number	encoded number.
+ */
 uint8_t loc64to8(uint64_t number);
 
+/*!
+ * \brief Finds rdata blocks according to rdata descriptors.
+ *
+ * \param s		Zone scanner.
+ *
+ * \retval KNOT_EOK	if success.
+ * \retval error_code	if error.
+ */
 int find_rdata_blocks(scanner_t *s);
 
 #endif // _ZSCANNER__SCANNER_FUNCTIONS_H_
diff --git a/src/zscanner/test/data/test1 b/src/zscanner/test/data/test1
deleted file mode 100644
index 9c4e29679c583cdfef5a8a6fbae6282577c9e12c..0000000000000000000000000000000000000000
--- a/src/zscanner/test/data/test1
+++ /dev/null
@@ -1,70 +0,0 @@
-
-a*a
-..
-    ddd     NS
-a           A 192.168.123.1
-.           AAAA 2001:1488:ac14:1400:359d:4c74:786a:3eec
-            AAAA 2001:1488:ac14:1400:359d:4c74:1.1.1.1
-@           AAAA ::2.3.4.5
-
-324.vv      A 1.1.1.1
-a\%b.com    MX 31 u.
-@           MX 1 @
-@           MX 65535 nevim 
-
-123456789012345678901234567890123456789012345678901234567890123.test. MX 555 mx
-1234567890123456789012345678901234567890123456789012345678901234.test. MX 555 mx
-12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.1234567890123. NS ns
-12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.12345678901234. NS ns
-
-
-\@bec       MX 50 blbec.com.
-a\036b      NS u.
-mm\mm\0320mm\a  NS u
-$TTL 1d
-a           NS a
-  
-a.a         NS a
-a.a.        NS a
-$ORIGIN \090\ZZXX.Cz.
-*			NS @ ;dafadfadf
-*.a.        NS a
-a.*.a.      NS a
-    ;
-www.ahoj.cz NS a
-@ (
-
-
-    ;comment
-) NS a
-ahoj.       NS22;ddd
-$ttl 10S
-2.0.192.in-addr.arpa. NS a
-192/26  NS a
-@@
-
-
-;
-    ;
-2.3.4.5.6.7.8.9.2.0.192.in-addr.arpa.  AAAA ::
-
-123456789012345678901234567890123456789012345678901234567890123.test. MX 555 f
-12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.1234567890123. NS 44 
-
-$TTL 4294967295
-;$TTL 18446744073709551615
-$TTL 4294967295
-$ORIGIN gut.
-vv      A 1.1.1.1
-
-.           AAAA ::5 ()
-
-a TYPE1     \# 4 (aa 
-    bbcc dd
-    ) ; multiline
-b TYPE123   \# 2  0304
-c TYPE6231  \# 1		05  
-d TYPE0     \# 0
-e TYPE65535 \# 0
-e TYPE65536 \# 0
-  A \# 2  03040201
\ No newline at end of file
diff --git a/src/zscanner/test/data/test2 b/src/zscanner/test/data/test2
deleted file mode 100644
index c83194501911a5b171c7bb645a69213185b06a20..0000000000000000000000000000000000000000
--- a/src/zscanner/test/data/test2
+++ /dev/null
@@ -1,144 +0,0 @@
-$TTL 4
-$ORIGIN tttt.
-aaa         CNAME u.
-aaa.bb.        CNAME u.
-aaa         MX 768 u.
-aaa.bb.c         NS u.
-a\036b      NS u.
-a\036b      NS u.bec.grr.
-mm\mm\0320mm\a  A 192.168.123.123 a
-
-abcd.o.slon CNAME   	() abcd
-n CNAME auto 
-abcd.o.slon CNAME   	() abcd  
-abcd.o.slon CNAME   	() abcd
-
-a MX 
-a IM MXX 
-
-$TTL 456
-$ORIGIN clss.ttl.
-t01    IN    600    AAAA ::
-       IN    600    AAAA ::
-
-t03    600   IN     AAAA ::
-       600   IN     AAAA ::
-
-t05          600    AAAA ::
-             600    AAAA ::
-
-t07    IN           AAAA ::
-       IN           AAAA ::
-
-t09                 AAAA ::
-                    AAAA ::
-
-
-dskey.example.com. 86400 IN DNSKEY 256 3 5 ( AQOeiiR0GOMYkDshWoSKz9Xz
-                                             fwJr1AYtsmx3TGkJaNXVbfi/
-                                             2pHm822aJ5iI9BMzNXxeYCmZ
-                                             DRD99WYwYqUSdjMmmAphXdvx
-                                             egXd/M5+X7OrzKBaMbCVdFLU
-                                             Uh6DhweJBjEVv5f2wwjM9Xzc
-                                             nOf+EPbtG9DMBmADjFDc2w/r
-                                             ljwvFw==
-                                             ) ;  key id = 60485
-;20120611161143 20120604121020
-cz.	3600	IN	RRSIG	DNSKEY 8 1 3600 2012 2012 45772 cz. ( SEvs
-	C/pwQsNgpx88+Al4I9Pd6Uyq9yU8gSXPWfI/r0pymcZMbfT6j4zmYrPo0/63wx4G2QzfMYQ+4vguTEbEB2XZYOLT08yd0E9br9uEK2caDolqZ4FSalTquLDOyz58RcOFFl55VU7W3krSa55WolOwCkZVLbXZX2Ld0L3MMOALgw8pJ/CZCGRlNAxO6o7OrL3i+GyxhwHe3BJ/CeNAkBch2SXlqpoxbw1v+NcoD8LpOetJPiXVfHTEUs5grtmpNTvZLAJYZwxLYBRTa6COPNd74v8A80R/H5v/D3pBOD1m1ByJNhYylsTKFgzbCTyZ+HXLeVGKnKdh92KTuI12KA==
-	)
-dskey.example.com. 86400 IN DS 60485 5 1 (2BB183AF5F22588179A53B0A
-                                              98631FAD1A292118)
-
-
-000000.cz.      18000   IN  DS  18787 5 1 ( 3312B1A8370056964B61D3DE90EDF27DF1
-					    E6E2 ab)
-cz.         0   IN  NSEC3PARAM 1 0 10 1C41458D1FDF6C18
-cz.         0   IN  NSEC3PARAM 1 0 10 -
-cz.         0   IN  NSEC3PARAM 1 0 10 1C41458D1FDF6C1
-
-aa. 3600    IN  DNSKEY  257 3 8 Zg==
-aa. 3600    IN  DNSKEY  257 3 8 Zm8=
-aa. 3600    IN  DNSKEY  257 3 8 Zm9v
-aa. 3600    IN  DNSKEY  257 3 8 Zm9vYg==
-aa. 3600    IN  DNSKEY  257 3 8 Zm9vYmE=
-aa. 3600    IN  DNSKEY  257 3 8 Zm9vYmFy
-
-1cz.    3600    IN      DNSKEY  256 3 8 Zm9v
-7cz.    3600    IN      DNSKEY  256 3 8 (
-                                          a3VA bm9vYmFyZm9B
-
-                                          ZS4= ;ahoj
-                                          ) ;test
-
-1cz.    3600    IN      DNSKEY  256 3 8 Zm9v
-2cz.    3600    IN      DNSKEY  256 3 8 Zm9v ;djf
-3cz.    3600    IN      DNSKEY  256 3 8 Zm9vYmFy
-4cz.    3600    IN      DNSKEY  256 3 8 Zm9v YmFy
-5cz.    3600    IN      DNSKEY  256 3 8 Zm9vYmFyZm9v YmFy
-6cz.    3600    IN      DNSKEY  256 3 8 Zm9vYmFyZm9v YmFy b3Vy
-
-
-a.          DNSKEY  257 3 8 YW55IGNhcm5hbCBwbGVhcw== 
-a.          DNSKEY  257 3 8 ( YW55
-				IGNhcm5hbCBw
-				bGVhc3U= ;comment
-				)
-a.          DNSKEY  257 3 8 YW55IGNhcm5hbCBwbGVh c3Vy
-a.          DNSKEY  257 3 8 YW55IGNhcm5hbCBwbGVhcr=
-abcd.o.slon CNAME   	() abcd
-abcd MX 5 nevim
-& NS a
- MX 5 nevim
- MX 5 nevim
-abcd.o.slon CNAME   	() abcd
- MX 5 nevim
-
-cz.         0   IN  NSEC3PARAM 1 0 10 1C41458D1FDF6C18
-a.          DNSKEY  257 3 8 YW55IGNhcm5hbCBwbGVhcr==
-a A 192.%68.2.1
-host.example.  SSHFP 2 1 123456789abcdef67890123456789abcdef67890
-rp.host. RP    louie.trantor.umd.edu.  LAM1.people.umd.edu.
-a NS a
-00JFM7AT277MFV1UERLNS339PVVBOE8M.cz. 900 IN RRSIG NSEC3 10 2 900 20120407094741 21050207062815 16087 cz. Ph5nbbmWatZQqpYJRwqLITaJV4XoU+VJXZ4kyGVH8sGS4I37jNAgmT91 yXJ3AxsRPotKQvKVmZXv1pvAmDVyREcORcW6TPC/v0v4vLzc0r2xDH5T EoelP5D0WLW8OX1kCmkgksxlWzMQHxNPUZ638paQz23ud+uWgI4n9gBO 32w=
-00JFM7AT277MFV1UERLNS339PVVBOE8M.cz. 900 IN RRSIG NSEC3 10 2 900 2407094741 815 16087 cz. Ph5nabcd
-a. 900 IN RRSIG TYPE1 1 2 3 4 5 6 cz. Ph5nabcd
-a. 900 IN RRSIG TYPE123 1 2 3 4 5 6 cz. Ph5nabcd
-a. 900 IN RRSIG TYPE62351 1 2 3 4 5 6 cz. Ph5nabcd
-  NSEC3   1 1 12 aabbccdd (
-                          2vptu5timamqttgl4luu9kg21e0aor3s A )
-  NSEC3   1 1 12 aabbccdd ( CO====== A RRSIG )
-  NSEC3   1 1 12 aabbccdd ( CPNG==== A RRSIG )
-  NSEC3   1 1 12 aabbccdd ( CPNMU=== A RRSIG )
-  NSEC3   1 1 12 aabbccdd ( CPNMUOG= A RRSIG )
-  NSEC3   1 1 12 aabbccdd ( CPNMUOJ1 A RRSIG )
-  NSEC3   1 1 12 aabbccdd ( CPNMUOJ1E8====== A RRSIG SPF)
-a MX 5 neviim
-a A 192.68.2.1
-aa 
-x  NSEC3   1 1 12 aabbccdd  CPNMUOJ1E8====== 
-_foobar._tcp    SRV 0 1 9 old-slow-box.example.com.
-               SRV 0 3 9 new-fast-box.example.com.
-               SRV 1 0 9 sysadmins-box.example.com.
-               SRV 1 0 9 server.example.com.
-*._tcp          SRV  0 0 0 .
-*._udp          SRV  0 0 0 .
-chi.example.com.      DHCID   ( AAEBOSD+XR3Os/0LozeXVqcNc7FwCfQdWL3b/NaiUDlW2No= )
-chi6.example.com.     DHCID   ( AAIBY2/AuCccgoJbsaxcQc9TUapptP69lOjxfNuVAA2kjEA= )
-client.example.com.   DHCID   ( AAABxLmlskllE0MVjd57zHcWmEH3pCQ6VytcKD//7es/deY= )
-
-38.2.0.192.in-addr.arpa. 7200 IN     IPSECKEY ( 10 1 2
-                192.0.2.38
-                AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ== )
-38.2.0.192.in-addr.arpa. 7200 IN     IPSECKEY ( 10 0 2
-                .
-                AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ== )
-38.2.0.192.in-addr.arpa. 7200 IN     IPSECKEY ( 10 1 2
-                192.0.2.3
-                AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ== )
-38.1.0.192.in-addr.arpa. 7200 IN     IPSECKEY ( 10 3 2
-                mygateway.example.com.
-                AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ== )
-0.d.4.0.3.0.e.f.f.f.3.f.0.1.2.0 7200 IN     IPSECKEY ( 10 2 2
-                2001:0DB8:0:8002::2000:1
-                AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ== )
diff --git a/src/zscanner/test/data/test3 b/src/zscanner/test/data/test3
deleted file mode 100644
index f6da6f380ac5402e586b3b4a1b1a9a2143c1d85b..0000000000000000000000000000000000000000
--- a/src/zscanner/test/data/test3
+++ /dev/null
@@ -1,57 +0,0 @@
-1cz.	3600	IN	DNSKEY	256 3 8 Zm9v 
-7cz.	3600	IN	DNSKEY	256 3 8 (
-					  a3VA bm9vYmFyZm9B aaaa
-	
-					  ZS4= ;ahoj
-					  ) ;test
-
-
-
-
-
-
-;11cz.	3600	IN	DNSKEY	256 3 8 Zm9v
-;2cz.	3600	IN	DNSKEY	256 3 8 Zm9v ;djf
-;3cz.	3600	IN	DNSKEY	256 3 8 Zm9vYmFy
-;4cz.	3600	IN	DNSKEY	256 3 8 Zm9v YmFy
-;5cz.	3600	IN	DNSKEY	256 3 8 Zm9vYmFyZm9v YmFy
-;6cz.	3600	IN	DNSKEY	256 3 8 Zm9vYmFyZm9v YmFy b3Vy
-
-
-vqans65vboe1qaq7ggf51hj65m10hu4m NSEC3 1 0 5 9F90818BBC2D8C46 VQJKMUVK0SL27G6KHB1QE40C6QJDSPJV  A NS
-vqjkmuvk0sl27g6khb1qe40c6qjdspjv NSEC3 1 0 5 9F90818BBC2D8C46 VQRE2R86TA7AD3SVCJMN483C5E86NGAE A AAAA RRSIG
-www.zdrojak.root.cz.    600     IN      NSEC    root.cz. CNAME RRSIG NSEC
-
-alfa.example.com. 86400 IN NSEC host.example.com. (
-                                A MX RRSIG NSEC TYPE1234 )
-
-www.zdrojak.root.cz.    600     IN      NSEC    root.cz. A A 
-www.zdrojak.root.cz.    600     IN      NSEC    root.cz. TYPE1 TYPE255
-www.zdrojak.root.cz.    600     IN      NSEC    root.cz. TYPE256 TYPE2550 TYPE65535 TYPE256 TYPE2550 TYPE65535 TYPE256
-www.zdrojak.root.cz.    600     IN      NSEC    s 
-www.zdrojak.root.cz.    600     IN      NSEC    root.cz. AAA
-www.zdrojak.root.cz.    600     IN      NSEC    root.cz.%CNAME RRSIG NSEC
-
-;a TXT first
-;  TXT "first"
-;  TXT "alpha beta" second "gamma"
-;  TXT first second third
-
-b A 192.111.22.3
- AAAA ::
-www.zdrojak.root.cz.    600     IN      NSEC    root.cz. A
-
- TXT ""
- TXT aa
- TXT a a
- TXT \;
- TXT aa bb cc
- TXT "aa" 
- TXT "a ; b"
- TXT \043\ -
-
- TXT (
-"one
-two
-three")
- TXT next
\ No newline at end of file
diff --git a/src/zscanner/test/data/test4 b/src/zscanner/test/data/test4
deleted file mode 100644
index 0b1c5433a9adb3a4b4cb45f3488359a0a0438274..0000000000000000000000000000000000000000
--- a/src/zscanner/test/data/test4
+++ /dev/null
@@ -1,10 +0,0 @@
-cz.	3600	IN	SOA	a.ns.nic.cz. hostmaster.nic.cz. 1338816690 900 300 604800 3600
-cz.	3600	IN	RRSIG	SOA 8 1 3600 20120611214517 20120604122628 49563 cz. o7vy5Ai4j2W/JfFBS1/ZePMsqiNJaVGsporLiDa5urhkK1IdLh/Jn+syJ8i9TJRQM9+XlMYJ8bCjhUKFpl26zn0cIsUYVJHg4DreFqKy7j4HrUQ4eEi5GxVTYMqQk9gqxlzx5DcW6fPJo0b9YQv5l0MHpeT2yvrCzrAo92BTyy4=
-cz.	3600	IN	DNSKEY	257 3 8 AwEA AbWh 2uvj2/3zVHqOT50e2LS/jagd4pQfJ4xSOk8vSJTkLl+bnCyu8bEVhQvVAXuM2LGgYFL0o0wArfWrgXathgqG1g4xEZpkSz9FsKNoT1R4OXu6FbAuoUDe8mqG/c4k0uNpcAWY6I4yfgPOM30RH77B8hODbrfULh4FdzjwfkTRNvfXp2GLmTXBN/4twbqPx/vmkkkeQMCRsCtbT6pJzA897jhCc9ULsUDurUtNv047qsfp8b5yVHkWuSTgBkphEe3taXuuOqf5Y1LqxNmUhDYlxULyOegGA64zzPAOFWHg6lBaj3MIlBeWT9JKB4PhllWY3dbtVppbhjQY+t0a6CU= ;{id = 13415 (ksk), size = 2048b}
-cz.	3600	IN	DNSKEY	256 3 8 AwEAAbN8Ef8US4V/U0g8DW3FGjqhF2a1Sm4MgrbEVU/P7bey38vs0Y3L6aQxLMMO1ibugiEwWu8UWHr4uUTY2Xw/hZwD6xYfTLVhnz72q818KuIuoLXRsnVZu0a99WReFlmjHI+WHSBj6ALTUYXti9fiAL7lempaNAKY4kMF0t/wTNbH ;{id = 49563 (zsk), size = 1024b}
-cz.	3600	IN	RRSIG	DNSKEY 8 1 3600 20120611190007 20120604122115 13415 cz. fXBg2ITiMgVw+Up34A+tYpIK8DPtL0zVwkf5XMB2OUv1zxUXu8w2xLwQfgdHqIP2RpyVq6ez27Lj871d0QOigTK5va44NC/9Rh4m/vHSHdaMKE6bZ/fVTiTBxq+qZGdulUiDQPqzVf63BKzV2PElQ1gUa9qSdF83d0rnmbMco+iyqjJbDE+u66wMSP57nq4KdlF5Rj8nTcKfr3UgSU9Wx6ltYmgxEULtM/C71QZF9XS+NT+835LZc9giEWymVCECkLHaeWnJ3iFlhQcd8HeXyutE5jnMXsz3Vah7FB1GKMYd/hDPxU+DzSesl1Ihl/VnvUsJkCV0AtAbGc1DXJ9oGw==
-cz.	3600	IN	NSEC3PARAM	1 0 5 4901b3a81da24235 
-cz.	3600	IN	RRSIG	NSEC3PARAM 8 1 3600 20120611094827 20120604122115 49563 cz. YQxFZDAzYB0I/aUof0AKKC/IzbZI+ofsBoIJ2ym2hQ5ML+/tOtE4DiIvMYn1FJqrCakeXg3nHh7zmlUewWdgnNS35NHE38bm/96lfRVHCfDCB1bkCLdaHjLEytVN7RudNHdBmMziQmso0bCsU5tEDO8wPCIonNvllD9z9CKyY4E=
-cz.	18000	IN	NS	a.ns.nic.cz.
-cz.	18000	IN	NS	b.ns.nic.cz.
-cz.	18000	IN	NS	d.ns.nic.cz.
diff --git a/src/zscanner/test/data/test5 b/src/zscanner/test/data/test5
deleted file mode 100644
index fa2df6420322f0c66bbde0ee93bccf746d3a4b88..0000000000000000000000000000000000000000
--- a/src/zscanner/test/data/test5
+++ /dev/null
@@ -1,12 +0,0 @@
-$TTL 100
-$ORIGIN a.
-ns1 NS @
-
-$INCLUDE /w/ragel/knot/src/zscanner/test/data/test5_include1
-ns2 NS @
-
-$INCLUDE test5_include2 c.
-ns3 NS @
-
-$INCLUDE test5_include3 .
-ns4 NS @
\ No newline at end of file
diff --git a/src/zscanner/test/data/test5_include1 b/src/zscanner/test/data/test5_include1
deleted file mode 100644
index 463e714fb72af0e070cb30a98bdc6f63c6b05407..0000000000000000000000000000000000000000
--- a/src/zscanner/test/data/test5_include1
+++ /dev/null
@@ -1,3 +0,0 @@
-$TTL 200
-$ORIGIN b.
-@ A 1.1.1.1
\ No newline at end of file
diff --git a/src/zscanner/test/data/test5_include2 b/src/zscanner/test/data/test5_include2
deleted file mode 100644
index e79f56a42cfe4a812a996f9dd6ef23f3b92fcc5f..0000000000000000000000000000000000000000
--- a/src/zscanner/test/data/test5_include2
+++ /dev/null
@@ -1,2 +0,0 @@
-$TTL 300
-@ AAAA ::
diff --git a/src/zscanner/test/data/test5_include3 b/src/zscanner/test/data/test5_include3
deleted file mode 100644
index 568abd74fb58acc20c468376e9278de56e7b3284..0000000000000000000000000000000000000000
--- a/src/zscanner/test/data/test5_include3
+++ /dev/null
@@ -1,5 +0,0 @@
-$TTL 400
-@ NS @
-
-$ORIGIN include.
-@ NS @
diff --git a/src/zscanner/test/data/test6 b/src/zscanner/test/data/test6
deleted file mode 100644
index e543e225566d7240d58c7fb40e1b518e2c3a1b76..0000000000000000000000000000000000000000
--- a/src/zscanner/test/data/test6
+++ /dev/null
@@ -1,50 +0,0 @@
-cid.urn.arpa. IN NAPTR 100   10   ""    ""  "!^urn:cid:.+@([^\.]+\.)(.*)$!\\2!i"   .
-example.com.    IN NAPTR 100  50  "a"    "z3950+N2L+N2C"     ""   cidserver.example.com.
-    IN NAPTR 100  50  "a"    "rcds+N2C"          ""   cidserver.example.com.
-    IN NAPTR 100  50  "s"    "http+N2L+N2C+N2R"  ""   www.example.com.
-
-
-_443._tcp.www.example.com. IN TLSA (
-  0 0 1 d2abde240d7cd3ee6b4b28c54df034b9
-        7983a1d16e8a410e4561cb106618e971 )
-
-_443._tcp.www.example.com. IN TLSA (
-  1 1 2 92003ba34942dc74152e2f2c408d29ec
-        a5a520e7f2e06bb944f4dca346baf63c
-        1b177615d466f6c4b71c216a50292bd5
-        8c9ebdd2f74e38fe51ffd48c43326cbc )
-
-_443._tcp.www.example.com. IN TLSA (
-  3 0 0 30820307308201efa003020102020000 )
-
-
-aa. KX 456 www.nevim.cz.
-aa. AFSDB 156 www.nevim.cz.
-aa. RT 156 www.nevim.cz.
-
-cz.     3600    IN      KEY  1234 3 28 AwEA
-
-cz.     3600    IN      CERT  1234 3 28 AwEA
-
-aerope.zcu.cz.          86400   IN      HINFO   "DEC-AXP-2100" "OSF/1-V3.2C"
-ccpc1         IN     HINFO   Pentium133  Windows95
-
-bind          IN     MINFO   bind-request kjd.sample.edu.
-
-foo.example.             IN APL 1:192.168.32.0/21 !1:192.168.38.0/28
-42.168.192.IN-ADDR.ARPA. IN APL ( 1:192.168.42.0/26 1:192.168.42.64/26
-                                  1:192.168.42.128/25 )
-_axfr.sbo.example.       IN APL 1:127.0.0.1/32 1:172.16.255.0/22
-multicast.example.       IN APL 1:224.0.0.0/4  2:FF00:0:0:0:0:0:0:0/8
-multicast.example.       IN APL \# 0
-multicast.example.       IN APL 
-multicast.example.       IN APL
-;multicast.example.       IN A
-
-cambridge-net.kei.com.        LOC   42 21 54 N 71 06 18 W -24m 30m
-loiosh.kei.com.               LOC   (42 21 43.952 N 71 5 6.344 W
-                                    -24m 1m 200m)
-pipex.net.                    LOC   52 14 05 N 00 08 50 E 10m
-curtin.edu.au.                LOC   32 7 19 S 116 2 25 E 10m
-rwy04L.logan-airport.boston.  LOC   (42 21 28.764 N 71 00 51.617 W
-                                    -44m 2000m)
diff --git a/src/zscanner/test/data/test7 b/src/zscanner/test/data/test7
deleted file mode 100644
index a30efc9ad0aeefbe93f04a48e782ce2a94f3ae0f..0000000000000000000000000000000000000000
--- a/src/zscanner/test/data/test7
+++ /dev/null
@@ -1,10 +0,0 @@
-a. NS abc.
-a. NS \# 5 0361626300
-a. MX 1 abc.
-a. MX \# 7 0001 0361626300
-a. SOA \# 52 0161026E73036E696302637A000A686F73746D6173746572036E696302637A00 4FCCB8B2000003840000012C00093A8000000E10
-
- NAPTR \# 39 0064000A00001F215E75726E3A6369643A2E2B40285B5E2E5D2B2E29282E2A2924215C322169 00
- NAPTR \# 44 0064003201610D7A333935302B4E324C2B4E324300 09636964736572766572076578616D706C6503636F6D00
- NAPTR \# 39 00640032016108726364732B4E324300 09636964736572766572076578616D706C6503636F6D00
- NAPTR \# 41 00640032017310687474702B4E324C2B4E32432B4E325200 03777777076578616D706C6503636F6D00
\ No newline at end of file
diff --git a/src/zscanner/test/processing.c b/src/zscanner/test/processing.c
index 2461136a196d2b6cc09ddb1be4b1225bc91f111e..1d5ef88dd86ee7af76a8702d654c0e8ba5afd5fe 100644
--- a/src/zscanner/test/processing.c
+++ b/src/zscanner/test/processing.c
@@ -24,7 +24,6 @@
 #include "util/descriptor.h"		// knot_rrtype_to_string
 #include "zscanner/scanner.h"		// scanner_t
 
-
 #define ERROR_CODE_TO_STRING(code) [code - ZSCANNER_UNCOVERED_STATE] = #code
 const char *error_names[] = {
 	ERROR_CODE_TO_STRING(ZSCANNER_UNCOVERED_STATE),
@@ -48,6 +47,7 @@ const char *error_names[] = {
 	ERROR_CODE_TO_STRING(ZSCANNER_EBAD_IPV4),
 	ERROR_CODE_TO_STRING(ZSCANNER_EBAD_IPV6),
 	ERROR_CODE_TO_STRING(ZSCANNER_EBAD_GATEWAY),
+	ERROR_CODE_TO_STRING(ZSCANNER_EBAD_GATEWAY_KEY),
 	ERROR_CODE_TO_STRING(ZSCANNER_EBAD_APL),
 	ERROR_CODE_TO_STRING(ZSCANNER_EBAD_RDATA),
 	ERROR_CODE_TO_STRING(ZSCANNER_EBAD_HEX_RDATA),
@@ -76,6 +76,7 @@ const char *error_names[] = {
 	ERROR_CODE_TO_STRING(ZSCANNER_ECANNOT_TEXT_DATA),
 	ERROR_CODE_TO_STRING(ZSCANNER_EBAD_HEX_RDATA),
 	ERROR_CODE_TO_STRING(ZSCANNER_EBAD_LOC_DATA),
+	ERROR_CODE_TO_STRING(ZSCANNER_EUNKNOWN_BLOCK),
 };
 #define ERROR_CODE_NAME(code) error_names[code - ZSCANNER_UNCOVERED_STATE]
 
diff --git a/src/zscanner/test/processing.h b/src/zscanner/test/processing.h
index 3230dbea83cd57f88dfb1f7343d7ec335a162b52..312a893c332e41ed4b231ad35ea82f7af4c6ba88 100644
--- a/src/zscanner/test/processing.h
+++ b/src/zscanner/test/processing.h
@@ -20,7 +20,7 @@
  *
  * \brief Zone scanner test functions.
  *
- * \addtogroup zone_scanner
+ * \addtogroup zone_scanner_test
  * @{
  */
 
@@ -29,7 +29,6 @@
 
 #include "zscanner/scanner.h"
 
-
 void empty_process_record(const scanner_t *scanner);
 
 void empty_process_error(const scanner_t *scanner);
@@ -44,7 +43,6 @@ void test_process_record(const scanner_t *scanner);
 
 void dump_rdata(const scanner_t *scanner);
 
-
 #endif // _ZSCANNER__TEST_FUNCTIONS_H_
 
 /*! @} */
diff --git a/src/zscanner/test/tests.c b/src/zscanner/test/tests.c
index ef6d8c6b96ecb8071eb65071f5ec3fe9513f412a..4bc1dfcf1a7a4e4e3b2c22c110785a693b121165 100644
--- a/src/zscanner/test/tests.c
+++ b/src/zscanner/test/tests.c
@@ -22,7 +22,6 @@
 #include <stdlib.h>			// printf
 #include "../scanner_functions.h"	// date_to_timestamp
 
-
 int test__date_to_timestamp()
 {
 	time_t    ref_timestamp, max_timestamp;
diff --git a/src/zscanner/test/tests.h b/src/zscanner/test/tests.h
index 5f53803f3d8b0ec3695d5f74e0674cbce415af9f..ab5f42637462ff6ffc7ab82e9a7984229ac0e1bf 100644
--- a/src/zscanner/test/tests.h
+++ b/src/zscanner/test/tests.h
@@ -27,10 +27,8 @@
 #ifndef _ZSCANNER__TESTS_H_
 #define _ZSCANNER__TESTS_H_
 
-
 int test__date_to_timestamp();
 
-
 #endif // _ZSCANNER__TESTS_H_
 
 /*! @} */
diff --git a/src/zscanner/test/tests/29_CERT.in b/src/zscanner/test/tests/29_CERT.in
new file mode 100644
index 0000000000000000000000000000000000000000..781556a67e78579f07238acdf767ce4b2f642112
--- /dev/null
+++ b/src/zscanner/test/tests/29_CERT.in
@@ -0,0 +1,34 @@
+$ORIGIN	.
+$TTL	1
+
+; OK
+@	CERT	0	0	0	AA==		; The simplest variant
+@	CERT	65535	65535	255	AA==		; Maximal numbers
+@	CERT	0	0	0	Zm8=		; One char padding
+@	CERT	0	0	0	Zm9v		; Without padding
+@	CERT	0	0	0	Zm9vYg==	; Two base64 blocks 
+@	CERT	0	0	0	Zm9v YmE=	; Two base64 blocks with blank space between them
+@	TYPE37	\# 6 000000000000			; TYPE + Hexadecimal rdata
+@	TYPE37	0	0	0	AA==		; TYPE
+@	cert	0	0	0	AA==		; Type in lower-case
+
+; KO
+@	CERT
+@	CERT						; Empty rdata
+@	CERT	\# 0					; Hex empty rdata
+@	CERT	\#					; Missing hex length
+@	CERT	65536	0	0	AA==		; Type overflow
+@	CERT	0	65536	0	AA==		; Key tag overflow
+@	CERT	0	0	256	AA==		; Algorithm overflow
+@	CERT	0	0	0	A		; Continuous block length must be multiple of 4
+@	CERT	0	0	0	AB		; Continuous block length must be multiple of 4
+@	CERT	0	0	0	ABC		; Continuous block length must be multiple of 4
+@	CERT	0	0	0	AA ==		; Continuous block length must be multiple of 4
+@	CERT	0	0	0	A===		; Bad padding
+@	CERT	0	0	0	=		; Bad padding
+@	CERT	0	0	0	==		; Bad padding
+@	CERT	0	0	0	===		; Bad padding
+@	CERT	0	0	0	====		; Bad padding
+@	CERT	0	0	0			; Missing item
+@	CERT	\# 6 00000000000000			; Too long rdata
+@	CERT	\# 7 000000000000			; Bad rdata length
diff --git a/src/zscanner/test/tests/29_CERT.out b/src/zscanner/test/tests/29_CERT.out
new file mode 100644
index 0000000000000000000000000000000000000000..c0042f34e5948f78e7efc1cb87ef908ad3176070
--- /dev/null
+++ b/src/zscanner/test/tests/29_CERT.out
@@ -0,0 +1,92 @@
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0025
+RDATA=000000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0025
+RDATA=FFFFFFFFFF00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0025
+RDATA=0000000000666F
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0025
+RDATA=0000000000666F6F
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0025
+RDATA=0000000000666F6F62
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0025
+RDATA=0000000000666F6F6261
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0025
+RDATA=000000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0025
+RDATA=000000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0025
+RDATA=000000000000
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_ENUMBER16_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER16_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
diff --git a/src/zscanner/test/tests/30_KEY.in b/src/zscanner/test/tests/30_KEY.in
new file mode 100644
index 0000000000000000000000000000000000000000..8d57bf5f49a654c26620bd0212640cf5a14c8202
--- /dev/null
+++ b/src/zscanner/test/tests/30_KEY.in
@@ -0,0 +1,34 @@
+$ORIGIN	.
+$TTL	1
+
+; OK
+@	KEY	0	0	0	AA==		; The simplest variant
+@	KEY	65535	255	255	AA==		; Maximal numbers
+@	KEY	0	0	0	Zm8=		; One char padding
+@	KEY	0	0	0	Zm9v		; Without padding
+@	KEY	0	0	0	Zm9vYg==	; Two base64 blocks 
+@	KEY	0	0	0	Zm9v YmE=	; Two base64 blocks with blank space between them
+@	TYPE25	\# 5 0000000000				; TYPE + Hexadecimal rdata
+@	TYPE25	0	0	0	AA==		; TYPE
+@	key	0	0	0	AA==		; Type in lower-case
+
+; KO
+@	KEY
+@	KEY						; Empty rdata
+@	KEY	\# 0					; Hex empty rdata
+@	KEY	\#					; Missing hex length
+@	KEY	65536	0	0	AA==		; Type overflow
+@	KEY	0	256	0	AA==		; Key tag overflow
+@	KEY	0	0	256	AA==		; Algorithm overflow
+@	KEY	0	0	0	A		; Continuous block length must be multiple of 4
+@	KEY	0	0	0	AB		; Continuous block length must be multiple of 4
+@	KEY	0	0	0	ABC		; Continuous block length must be multiple of 4
+@	KEY	0	0	0	AA ==		; Continuous block length must be multiple of 4
+@	KEY	0	0	0	A===		; Bad padding
+@	KEY	0	0	0	=		; Bad padding
+@	KEY	0	0	0	==		; Bad padding
+@	KEY	0	0	0	===		; Bad padding
+@	KEY	0	0	0	====		; Bad padding
+@	KEY	0	0	0			; Missing item
+@	KEY	\# 5 000000000000			; Too long rdata
+@	KEY	\# 6 0000000000				; Bad rdata length
diff --git a/src/zscanner/test/tests/30_KEY.out b/src/zscanner/test/tests/30_KEY.out
new file mode 100644
index 0000000000000000000000000000000000000000..aa721d25b14d00219c56deaaacbbbc5c44b8d162
--- /dev/null
+++ b/src/zscanner/test/tests/30_KEY.out
@@ -0,0 +1,92 @@
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0019
+RDATA=0000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0019
+RDATA=FFFFFFFF00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0019
+RDATA=00000000666F
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0019
+RDATA=00000000666F6F
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0019
+RDATA=00000000666F6F62
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0019
+RDATA=00000000666F6F6261
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0019
+RDATA=0000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0019
+RDATA=0000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0019
+RDATA=0000000000
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_ENUMBER16_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
diff --git a/src/zscanner/test/tests/31_DNSKEY.in b/src/zscanner/test/tests/31_DNSKEY.in
new file mode 100644
index 0000000000000000000000000000000000000000..665d9c8bf3c2714bec0ae63107898a844fb5c4af
--- /dev/null
+++ b/src/zscanner/test/tests/31_DNSKEY.in
@@ -0,0 +1,34 @@
+$ORIGIN	.
+$TTL	1
+
+; OK
+@	DNSKEY	0	0	0	AA==		; The simplest variant
+@	DNSKEY	65535	255	255	AA==		; Maximal numbers
+@	DNSKEY	0	0	0	Zm8=		; One char padding
+@	DNSKEY	0	0	0	Zm9v		; Without padding
+@	DNSKEY	0	0	0	Zm9vYg==	; Two base64 blocks 
+@	DNSKEY	0	0	0	Zm9v YmE=	; Two base64 blocks with blank space between them
+@	TYPE48	\# 5 0000000000				; TYPE + Hexadecimal rdata
+@	TYPE48	0	0	0	AA==		; TYPE
+@	dnskey	0	0	0	AA==		; Type in lower-case
+
+; KO
+@	DNSKEY
+@	DNSKEY						; Empty rdata
+@	DNSKEY	\# 0					; Hex empty rdata
+@	DNSKEY	\#					; Missing hex length
+@	DNSKEY	65536	0	0	AA==		; Type overflow
+@	DNSKEY	0	256	0	AA==		; Key tag overflow
+@	DNSKEY	0	0	256	AA==		; Algorithm overflow
+@	DNSKEY	0	0	0	A		; Continuous block length must be multiple of 4
+@	DNSKEY	0	0	0	AB		; Continuous block length must be multiple of 4
+@	DNSKEY	0	0	0	ABC		; Continuous block length must be multiple of 4
+@	DNSKEY	0	0	0	AA ==		; Continuous block length must be multiple of 4
+@	DNSKEY	0	0	0	A===		; Bad padding
+@	DNSKEY	0	0	0	=		; Bad padding
+@	DNSKEY	0	0	0	==		; Bad padding
+@	DNSKEY	0	0	0	===		; Bad padding
+@	DNSKEY	0	0	0	====		; Bad padding
+@	DNSKEY	0	0	0			; Missing item
+@	DNSKEY	\# 5 000000000000			; Too long rdata
+@	DNSKEY	\# 6 0000000000				; Bad rdata length
diff --git a/src/zscanner/test/tests/31_DNSKEY.out b/src/zscanner/test/tests/31_DNSKEY.out
new file mode 100644
index 0000000000000000000000000000000000000000..99167d7d7176cd5f216a0dfa6734bb406c0396a0
--- /dev/null
+++ b/src/zscanner/test/tests/31_DNSKEY.out
@@ -0,0 +1,92 @@
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0030
+RDATA=0000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0030
+RDATA=FFFFFFFF00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0030
+RDATA=00000000666F
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0030
+RDATA=00000000666F6F
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0030
+RDATA=00000000666F6F62
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0030
+RDATA=00000000666F6F6261
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0030
+RDATA=0000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0030
+RDATA=0000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0030
+RDATA=0000000000
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_ENUMBER16_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
diff --git a/src/zscanner/test/tests/32_APL.in b/src/zscanner/test/tests/32_APL.in
new file mode 100644
index 0000000000000000000000000000000000000000..ee93bcb754f89b2dfeadf3b4bd0fe2746a449bb8
--- /dev/null
+++ b/src/zscanner/test/tests/32_APL.in
@@ -0,0 +1,30 @@
+$ORIGIN	.
+$TTL	1
+
+; OK
+@	APL				; The simplest variant - blank list
+@	APL	1:0.0.0.0/0		; Minimal ipv4 prefix length
+@	APL	1:255.255.255.255/32	; Maximal ipv4 prefix length
+@	APL	1:255.255.255.255/30	; Prefix length isn't multiple of 8
+@	APL	2:0::0/0		; Minimal ipv6 prefix length
+@	APL	2:0::0/128		; Maximal ipv6 prefix length
+@	APL	2:FFFF:FFFF:FFFF::/2	; Trailing zeroes test
+@	APL	!1:0.0.0.0/0		; Negation flag
+@	APL	1:0.0.0.0/0 1:255.255.255.255/32	; More APLs
+@	TYPE42	\# 4 00010000		; TYPE + Hexadecimal rdata
+@	TYPE42	1:0.0.0.0/0		; TYPE
+@	APL	\# 0			; Zero length rdata
+@	apl	1:0.0.0.0/0		; Type in lower-case
+
+; KO
+@	APL	0:0.0.0.0/32		; Bad address family
+@	APL	x:0.0.0.0/32		; Bad address family 
+@	APL	!x:0.0.0.0/32		; Bad address family 
+@	APL	1:0.0.0.0/33		; Prefix length is too long
+@	APL	2:0::0/129		; Prefix length is too long
+@	APL	2::/0			; Bad ipv6 address
+@	APL	2:0::0/x		; Bad prefix length
+@	APL	1:0.0.0.0/		; Missing prefix length
+@	APL	\#			; Missing hex length
+@	APL	\# 4 0001000000		; Too long rdata
+@	APL	\# 5 00000000		; Bad rdata length
diff --git a/src/zscanner/test/tests/32_APL.out b/src/zscanner/test/tests/32_APL.out
new file mode 100644
index 0000000000000000000000000000000000000000..1471082e5351d6ee90eed03c5672ea4c91ef4d7c
--- /dev/null
+++ b/src/zscanner/test/tests/32_APL.out
@@ -0,0 +1,100 @@
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002A
+RDATA=
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002A
+RDATA=00010000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002A
+RDATA=00012004FFFFFFFF
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002A
+RDATA=00011E04FFFFFFFC
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002A
+RDATA=00020000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002A
+RDATA=00028000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002A
+RDATA=00020201C0
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002A
+RDATA=00010080
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002A
+RDATA=0001000000012004FFFFFFFF
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002A
+RDATA=00010000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002A
+RDATA=00010000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002A
+RDATA=
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002A
+RDATA=00010000
+------
+WARNG=ZSCANNER_EBAD_APL
+------
+WARNG=ZSCANNER_EBAD_APL
+------
+WARNG=ZSCANNER_EBAD_APL
+------
+WARNG=ZSCANNER_EBAD_APL
+------
+WARNG=ZSCANNER_EBAD_APL
+------
+WARNG=ZSCANNER_EBAD_IPV6
+------
+WARNG=ZSCANNER_EBAD_APL
+------
+WARNG=ZSCANNER_EBAD_APL
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
diff --git a/src/zscanner/test/tests/33_DS.in b/src/zscanner/test/tests/33_DS.in
new file mode 100644
index 0000000000000000000000000000000000000000..db6c0ded925099d65acc3cbd8492f876a8f58ecf
--- /dev/null
+++ b/src/zscanner/test/tests/33_DS.in
@@ -0,0 +1,25 @@
+$ORIGIN	.
+$TTL	1
+
+; OK
+@	DS	0	0	0	00		; The simplest variant
+@	DS	65535	255	255	00		; Maximal numbers
+@	DS	0	0	0	01 02 0304	; Hex block with blank spaces between them
+@	TYPE43	\# 5 0000000000				; TYPE + Hexadecimal rdata
+@	TYPE43	0	0	0	00		; TYPE
+@	ds	0	0	0	00		; Type in lower-case
+
+; KO
+@	DS
+@	DS						; Empty rdata
+@	DS	\# 0					; Hex empty rdata
+@	DS	\#					; Missing hex length
+@	DS	65536	0	0	00		; Key tag overflow
+@	DS	0	256	0	00		; Algorithm overflow
+@	DS	0	0	256	00		; Digest type overflow
+@	DS	0	0	0	0		; Continuous block length must be multiple of 2
+@	DS	0	0	0	00 0		; Continuous block length must be multiple of 2
+@	DS	0	0	0	XX		; Bad hex character
+@	DS	0	0	0			; Missing item
+@	DS	\# 5 000000000000			; Too long rdata
+@	DS	\# 6 0000000000				; Bad rdata length
diff --git a/src/zscanner/test/tests/33_DS.out b/src/zscanner/test/tests/33_DS.out
new file mode 100644
index 0000000000000000000000000000000000000000..2b57fb55697f320154291e9846a7845df1eb5032
--- /dev/null
+++ b/src/zscanner/test/tests/33_DS.out
@@ -0,0 +1,62 @@
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002B
+RDATA=0000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002B
+RDATA=FFFFFFFF00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002B
+RDATA=0000000001020304
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002B
+RDATA=0000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002B
+RDATA=0000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002B
+RDATA=0000000000
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_ENUMBER16_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
diff --git a/src/zscanner/test/tests/34_SSHFP.in b/src/zscanner/test/tests/34_SSHFP.in
new file mode 100644
index 0000000000000000000000000000000000000000..b8b502d988ba41da69b29f0a31d1f2316a3229e5
--- /dev/null
+++ b/src/zscanner/test/tests/34_SSHFP.in
@@ -0,0 +1,24 @@
+$ORIGIN	.
+$TTL	1
+
+; OK
+@	SSHFP	0	0	00		; The simplest variant
+@	SSHFP	255	255	00		; Maximal numbers
+@	SSHFP	0	0	01 02 0304	; Hex block with blank spaces between them
+@	TYPE44	\# 3 000000			; TYPE + Hexadecimal rdata
+@	TYPE44	0	0	00		; TYPE
+@	sshfp	0	0	00		; Type in lower-case
+
+; KO
+@	SSHFP
+@	SSHFP					; Empty rdata
+@	SSHFP	\# 0				; Hex empty rdata
+@	SSHFP	\#				; Missing hex length
+@	SSHFP	256	0	00		; Algorithm overflow
+@	SSHFP	0	256	00		; Fp type overflow
+@	SSHFP	0	0	0		; Continuous block length must be multiple of 2
+@	SSHFP	0	0	00 0		; Continuous block length must be multiple of 2
+@	SSHFP	0	0	XX		; Bad hex character
+@	SSHFP	0	0			; Missing item
+@	SSHFP	\# 3 00000000			; Too long rdata
+@	SSHFP	\# 4 000000			; Bad rdata length
diff --git a/src/zscanner/test/tests/34_SSHFP.out b/src/zscanner/test/tests/34_SSHFP.out
new file mode 100644
index 0000000000000000000000000000000000000000..787074b91f0b5bc89b985957380727bd214857bc
--- /dev/null
+++ b/src/zscanner/test/tests/34_SSHFP.out
@@ -0,0 +1,60 @@
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002C
+RDATA=000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002C
+RDATA=FFFF00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002C
+RDATA=000001020304
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002C
+RDATA=000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002C
+RDATA=000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002C
+RDATA=000000
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
diff --git a/src/zscanner/test/tests/35_IPSECKEY.in b/src/zscanner/test/tests/35_IPSECKEY.in
new file mode 100644
index 0000000000000000000000000000000000000000..c0e06f8b3e4c01f4bf15956f4275658ecd6d823a
--- /dev/null
+++ b/src/zscanner/test/tests/35_IPSECKEY.in
@@ -0,0 +1,32 @@
+$ORIGIN	.
+$TTL	1
+
+; OK
+@	IPSECKEY	0	0	0	.			; The simplest variant - no gw, no key
+@	IPSECKEY	255	3	255	.	AA==		; Maximal numbers
+@	IPSECKEY	0	1	0	0.0.0.0			; IPv4 address
+@	IPSECKEY	0	2	0	::			; IPv6 address
+@	IPSECKEY	0	3	0	\0320\ \\\"\.\@\*.tld.	; Special chars in domain name
+@	IPSECKEY	0	0	1	.	Zm8=            ; One char padding
+@	IPSECKEY	0	0	1	.	Zm9v            ; Without padding
+@	IPSECKEY	0	0	1	.	Zm9vYg==        ; Two base64 blocks
+@	IPSECKEY	0	0	1	.	Zm9v YmE=       ; Two base64 blocks with blank space between them
+@	TYPE45	\# 3 000000						; TYPE + Hexadecimal rdata
+@	TYPE45		0	0	1	.	AA==		; TYPE
+@	ipseckey	0	0	1	.	AA==		; Type in lower-case
+
+; KO
+@	IPSECKEY
+@	IPSECKEY							; Empty rdata
+@	IPSECKEY	\# 0						; Hex empty rdata
+@	IPSECKEY	\#						; Missing hex length
+@	IPSECKEY	256	0	0	.			; Precedence overflow
+@	IPSECKEY	0	4	0	.			; Unknown gateway
+@	IPSECKEY	0	0	256	.	AA==		; Algorithm overflow
+@	IPSECKEY	0	0	0	.	AA==		; If alg is 0 then key shouldn't be given
+@	IPSECKEY	0	0	0	a%			; Bad domain name char
+@	IPSECKEY	0	0	1	.	A		; Continuous block length must be multiple of 4
+@	IPSECKEY	0	0	1	.	=		; Bad padding
+@	IPSECKEY	0	0					; Missing item
+@	IPSECKEY	\# 3 00000000					; Too long rdata
+@	IPSECKEY	\# 4 000000					; Bad rdata length
diff --git a/src/zscanner/test/tests/35_IPSECKEY.out b/src/zscanner/test/tests/35_IPSECKEY.out
new file mode 100644
index 0000000000000000000000000000000000000000..6865bc72c8b9fe0e47df7cd2248f0a0a2b84a898
--- /dev/null
+++ b/src/zscanner/test/tests/35_IPSECKEY.out
@@ -0,0 +1,100 @@
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002D
+RDATA=000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002D
+RDATA=FF03FF0000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002D
+RDATA=00010000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002D
+RDATA=00020000000000000000000000000000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002D
+RDATA=000300082030205C222E402A03746C6400
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002D
+RDATA=000001666F
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002D
+RDATA=000001666F6F
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002D
+RDATA=000001666F6F62
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002D
+RDATA=000001666F6F6261
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002D
+RDATA=000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002D
+RDATA=00000100
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002D
+RDATA=00000100
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_EBAD_GATEWAY
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_EBAD_GATEWAY_KEY
+------
+WARNG=ZSCANNER_EBAD_GATEWAY
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_GATEWAY_KEY
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
diff --git a/src/zscanner/test/tests/36_RRSIG.in b/src/zscanner/test/tests/36_RRSIG.in
new file mode 100644
index 0000000000000000000000000000000000000000..cd0ae66e8b95abe73b929bd7278c3a25eb2a948b
--- /dev/null
+++ b/src/zscanner/test/tests/36_RRSIG.in
@@ -0,0 +1,47 @@
+$ORIGIN	.
+$TTL	1
+
+; OK
+@	RRSIG	TYPE0	0	0	0	0	0	0	.	AA==	; The simplest variant
+@	RRSIG	A	2	3	4	5	6	7	\008.	CQ==	; Human visual test - block numbering
+@	RRSIG	TYPE65535	255	255	4294967295	4294967295	4294967295	65535	.	AA==	; Maximal numbers
+@	RRSIG	A	0	0	0	19700101000000	0	0	.	AA==	; Minimal date format	
+@	RRSIG	A	0	0	0	0	21051231235959	0	.	AA==	; Maximal date format (zscanner limit)
+@	RRSIG	TYPE0	0	0	0	0	0	0	\0320\ \\\"\.\@\*.tld.	AA==	; Special chars in domain name
+@	RRSIG	A	0	0	0	0	0	0	.	Zm8=		; One char padding
+@	RRSIG	A	0	0	0	0	0	0	.	Zm9v		; Without padding
+@	RRSIG	A	0	0	0	0	0	0	.	Zm9vYg==	; Two base64 blocks 
+@	RRSIG	A	0	0	0	0	0	0	.	Zm9v YmE=	; Two base64 blocks with blank space between them
+@	TYPE46	\# 20 000100000000000000000000000000000000 00 00			; TYPE + Hexadecimal rdata
+@	TYPE46	A       0       0       0       0       0       0       .       AA==	; TYPE
+@	rrsig	A       0       0       0       0       0       0       .       AA==	; Type in lower-case
+
+; KO
+@	RRSIG
+@	RRSIG										; Empty rdata
+@	RRSIG	\# 0									; Hex empty rdata
+@	RRSIG	\#									; Missing hex length
+@	RRSIG	X	0	0	0	0	0	0	.	AA==	; Unknown type
+@	RRSIG	TYPE65536	0	0	0	0	0	0	.	AA==	; Type overflow
+@	RRSIG	A	256	0	0	0	0	0		.	AA==	; Algorithm overflow
+@	RRSIG	A	0	256	0	0	0	0		.	AA==	; Labels overflow
+@	RRSIG	A	0	0	4294967296	0	0	0	.	AA==	; TTL overflow
+@	RRSIG	A	0	0	0	9294967296	0	0	.	AA==	; Sig. exp. overflow
+@	RRSIG	A	0	0	0	0	4294967296	0	.	AA==	; Sig. inc. overflow
+@	RRSIG	A	0	0	0	0	0	65536		.	AA==	; Key tag overflow
+@	RRSIG	A	0	0	0	0	21060101000000	0	.	AA==	; Date overflow
+@	RRSIG	A	0	0	0	0	2106010100000x	0	.	AA==	; Bad timestamp char
+@	RRSIG	A	0	0	0	0	210601010000000	0	.	AA==	; Bad timestamp length
+@	RRSIG	A	0	0	0	0	0	0	a%	AA==	; Bad domain char
+@	RRSIG	A	0	0	0	0	0	0	.	A	; Continuous block length must be multiple of 4	
+@	RRSIG	A	0	0	0	0	0	0	.	AB	; Continuous block length must be multiple of 4
+@	RRSIG	A	0	0	0	0	0	0	.	ABC	; Continuous block length must be multiple of 4
+@	RRSIG	A	0	0	0	0	0	0	.	AA ==	; Continuous block length must be multiple of 4
+@	RRSIG	A	0	0	0	0	0	0	.	A===	; Bad padding	
+@	RRSIG	A	0	0	0	0	0	0	.	=	; Bad padding
+@	RRSIG	A	0	0	0	0	0	0	.	==	; Bad padding
+@	RRSIG	A	0	0	0	0	0	0	.	===	; Bad padding
+@	RRSIG	A	0	0	0	0	0	0	.	====	; Bad padding
+@	RRSIG	A	0	0	0	0	0	0	.		; Missing item
+@	RRSIG	\# 20 000100000000000000000000000000000000 00 0000			; Too long rdata
+@	RRSIG	\# 21 000100000000000000000000000000000000 00 00			; Bad rdata length
diff --git a/src/zscanner/test/tests/36_RRSIG.out b/src/zscanner/test/tests/36_RRSIG.out
new file mode 100644
index 0000000000000000000000000000000000000000..7d1af4e822f8fdaddbda983733576fb8e964ecdf
--- /dev/null
+++ b/src/zscanner/test/tests/36_RRSIG.out
@@ -0,0 +1,134 @@
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002E
+RDATA=000000000000000000000000000000000000 00 00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002E
+RDATA=000102030000000400000005000000060007 010800 09
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002E
+RDATA=FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 00 00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002E
+RDATA=000100000000000000000000000000000000 00 00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002E
+RDATA=000100000000000000000000FFCEDD7F0000 00 00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002E
+RDATA=000000000000000000000000000000000000 082030205C222E402A03746C6400 00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002E
+RDATA=000100000000000000000000000000000000 00 666F
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002E
+RDATA=000100000000000000000000000000000000 00 666F6F
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002E
+RDATA=000100000000000000000000000000000000 00 666F6F62
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002E
+RDATA=000100000000000000000000000000000000 00 666F6F6261
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002E
+RDATA=000100000000000000000000000000000000 00 00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002E
+RDATA=000100000000000000000000000000000000 00 00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002E
+RDATA=000100000000000000000000000000000000 00 00
+------
+WARNG=ZSCANNER_EUNSUPPORTED_TYPE
+------
+WARNG=ZSCANNER_EUNSUPPORTED_TYPE
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EUNSUPPORTED_TYPE
+------
+WARNG=ZSCANNER_ENUMBER16_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER32_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER32_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER32_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER16_OVERFLOW
+------
+WARNG=ZSCANNER_EBAD_DATE
+------
+WARNG=ZSCANNER_EBAD_TIMESTAMP_CHAR
+------
+WARNG=ZSCANNER_EBAD_TIMESTAMP_LENGTH
+------
+WARNG=ZSCANNER_EBAD_DNAME_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
diff --git a/src/zscanner/test/tests/37_NSEC.in b/src/zscanner/test/tests/37_NSEC.in
new file mode 100644
index 0000000000000000000000000000000000000000..e424816d62b632ba0da3889adfb7d4219a88df57
--- /dev/null
+++ b/src/zscanner/test/tests/37_NSEC.in
@@ -0,0 +1,23 @@
+$ORIGIN	.
+$TTL	1
+
+; OK
+@	NSEC	.					; The simplest variant - without bitmap
+@	NSEC	\0320\ \\\"\.\@\*.tld.			; Special chars in domain name
+@	NSEC	.	TYPE0				; Minimal type number
+@	NSEC	.	TYPE65535			; Maximal type number
+@	NSEC	.	TYPE0 A NS			; First bitmap window
+@	NSEC	.	TYPE0 TYPE256 TYPE512 TYPE32768	; First, second, third and 128. bitmap window
+@	TYPE47	\# 1 00					; TYPE + Hexadecimal rdata
+@	TYPE47	.					; TYPE
+@	nsec	.					; Type in lower-case
+
+; KO
+@	NSEC
+@	NSEC						; Empty rdata
+@	NSEC	\# 0					; Hex empty rdata
+@	NSEC	\#					; Missing hex length
+@	NSEC	.	TYPE65536			; Type number overflow
+@	NSEC	.	X				; Unknown type
+@	NSEC	\# 1 0000				; Too long rdata
+@	NSEC	\# 2 00					; Bad rdata length
diff --git a/src/zscanner/test/tests/37_NSEC.out b/src/zscanner/test/tests/37_NSEC.out
new file mode 100644
index 0000000000000000000000000000000000000000..b6e57a4b5e1125fd61216cd3f064219cb17585c9
--- /dev/null
+++ b/src/zscanner/test/tests/37_NSEC.out
@@ -0,0 +1,70 @@
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002F
+RDATA=00 
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002F
+RDATA=082030205C222E402A03746C6400 
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002F
+RDATA=00 000180
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002F
+RDATA=00 FF200000000000000000000000000000000000000000000000000000000000000001
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002F
+RDATA=00 0001E0
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002F
+RDATA=00 000180010180020180800180
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002F
+RDATA=00 
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002F
+RDATA=00 
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=002F
+RDATA=00 
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_ENUMBER16_OVERFLOW
+------
+WARNG=ZSCANNER_EBAD_BITMAP
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
diff --git a/src/zscanner/test/tests/38_DHCID.in b/src/zscanner/test/tests/38_DHCID.in
new file mode 100644
index 0000000000000000000000000000000000000000..9a1033d7c74f1424e72fe588de3037ab29aa6683
--- /dev/null
+++ b/src/zscanner/test/tests/38_DHCID.in
@@ -0,0 +1,29 @@
+$ORIGIN	.
+$TTL	1
+
+; OK
+@	DHCID	AA==		; The simplest variant
+@	DHCID	Zm8=		; One char padding
+@	DHCID	Zm9v		; Without padding
+@	DHCID	Zm9vYg==	; Two base64 blocks 
+@	DHCID	Zm9v YmE=	; Two base64 blocks with blank space between them
+@	TYPE49	\# 1 00		; TYPE + Hexadecimal rdata
+@	TYPE49	AA==		; TYPE
+@	dhcid	AA==		; Type in lower-case
+
+; KO
+@	DHCID
+@	DHCID			; Empty rdata
+@	DHCID	\# 0		; Hex empty rdata
+@	DHCID	\#		; Missing hex length
+@	DHCID	A		; Continuous block length must be multiple of 4
+@	DHCID	AB		; Continuous block length must be multiple of 4
+@	DHCID	ABC		; Continuous block length must be multiple of 4
+@	DHCID	AA ==		; Continuous block length must be multiple of 4
+@	DHCID	A===		; Bad padding
+@	DHCID	=		; Bad padding
+@	DHCID	==		; Bad padding
+@	DHCID	===		; Bad padding
+@	DHCID	====		; Bad padding
+@	DHCID	\# 1 0000	; Too long rdata
+@	DHCID	\# 2 00		; Bad rdata length
diff --git a/src/zscanner/test/tests/38_DHCID.out b/src/zscanner/test/tests/38_DHCID.out
new file mode 100644
index 0000000000000000000000000000000000000000..41774e3ee37da9d4a9af1379877d5c96da438d73
--- /dev/null
+++ b/src/zscanner/test/tests/38_DHCID.out
@@ -0,0 +1,78 @@
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0031
+RDATA=00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0031
+RDATA=666F
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0031
+RDATA=666F6F
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0031
+RDATA=666F6F62
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0031
+RDATA=666F6F6261
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0031
+RDATA=00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0031
+RDATA=00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0031
+RDATA=00
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE64_CHAR
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
diff --git a/src/zscanner/test/tests/39_NSEC3.in b/src/zscanner/test/tests/39_NSEC3.in
new file mode 100644
index 0000000000000000000000000000000000000000..ba8bdcb25e2bddae3f20d51e394e9f916f9458b2
--- /dev/null
+++ b/src/zscanner/test/tests/39_NSEC3.in
@@ -0,0 +1,49 @@
+$ORIGIN	.
+$TTL	1
+
+; OK
+@	NSEC3	0	0	0	-	00======		; The simplest variant - without bitmap
+@	NSEC3	255	255	65535	-	00======		; Maximal numbers
+@	NSEC3	0	0	0	00FF	00======		; Hex string
+@	NSEC3	0	0	0	-	00======		; Eight char padding
+@	NSEC3	0	0	0	-	CPNG====		; Four char padding
+@	NSEC3	0	0	0	-	CPNMU===		; Three char padding
+@	NSEC3	0	0	0	-	CPNMUOG=		; One char padding
+@	NSEC3	0	0	0	-	CPNMUOJ1		; Without padding
+@	NSEC3	0	0	0	-	CPNMUOJ1E8======	; Two base32hex blocks
+@	NSEC3	0	0	0	-	00======	TYPE0		; Minimal type number
+@	NSEC3	0	0	0	-	00======	TYPE65535	; Maximal type number
+@	NSEC3	0	0	0	-	00======	TYPE0 A NS	; First bitmap window
+@	NSEC3	0	0	0	-	00======	TYPE0 TYPE256 TYPE512 TYPE32768	; First, second, third and 128. bitmap window
+@	TYPE50	\# 7 00000000000100					; TYPE + Hexadecimal rdata
+@	TYPE50	0	0	0	-       00======		; TYPE
+@	nsec3	0	0	0	-       00======		; Type in lower-case
+
+; KO
+@	NSEC3
+@	NSEC3								; Empty rdata
+@	NSEC3	\# 0							; Hex empty rdata
+@	NSEC3	\#							; Missing hex length
+@	NSEC3	256	0	0	-	00======		; Algorithm overflow
+@	NSEC3	0	256	0	-	00======		; Flags overflow
+@	NSEC3	0	0	65536	-	00======		; Iterations overflow
+@	NSEC3	0	0	0	0	00======		; Hex block must be multiple of 2
+@	NSEC3	0	0	0	0X	00======		; Bad hex char
+@	NSEC3	0	0	0	00 FF	00======		; Hex string with blank space inside
+@	NSEC3	0	0	0	-	1			; Continuous block length must be multiple of 8
+@	NSEC3	0	0	0	-	12			; Continuous block length must be multiple of 8
+@	NSEC3	0	0	0	-	123			; Continuous block length must be multiple of 8
+@	NSEC3	0	0	0	-	1234			; Continuous block length must be multiple of 8
+@	NSEC3	0	0	0	-	12345			; Continuous block length must be multiple of 8
+@	NSEC3	0	0	0	-	123456			; Continuous block length must be multiple of 8
+@	NSEC3	0	0	0	-	1234567			; Continuous block length must be multiple of 8
+@	NSEC3	0	0	0	-	123456 78		; Continuous block length must be multiple of 8
+@	NSEC3	0	0	0	-	========		; Bad padding
+@	NSEC3	0	0	0	-	1=======		; Bad padding
+@	NSEC3	0	0	0	-	123=====		; Bad padding
+@	NSEC3	0	0	0	-	123456==		; Bad padding
+@	NSEC3	0	0	0	-	CPNMUOJ1  E8======	; Two base32hex blocks with blank space between them
+@	NSEC3	0	0	0	-	00======	TYPE65536	; Type number overflow
+@	NSEC3	0	0	0	-	00======	X		; Unknown type
+@	NSEC3	\# 7 0000000000010000					; Too long rdata
+@	NSEC3	\# 8 00000000000100					; Bad rdata length
diff --git a/src/zscanner/test/tests/39_NSEC3.out b/src/zscanner/test/tests/39_NSEC3.out
new file mode 100644
index 0000000000000000000000000000000000000000..ef533f58778075183c5f153337fff37d1a7ee55f
--- /dev/null
+++ b/src/zscanner/test/tests/39_NSEC3.out
@@ -0,0 +1,150 @@
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0032
+RDATA=00000000000100
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0032
+RDATA=FFFFFFFF000100
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0032
+RDATA=000000000200FF0100
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0032
+RDATA=00000000000100
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0032
+RDATA=000000000002666F
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0032
+RDATA=000000000003666F6F
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0032
+RDATA=000000000004666F6F62
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0032
+RDATA=000000000005666F6F6261
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0032
+RDATA=000000000006666F6F626172
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0032
+RDATA=00000000000100000180
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0032
+RDATA=00000000000100FF200000000000000000000000000000000000000000000000000000000000000001
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0032
+RDATA=000000000001000001E0
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0032
+RDATA=00000000000100000180010180020180800180
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0032
+RDATA=00000000000100
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0032
+RDATA=00000000000100
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0032
+RDATA=00000000000100
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER16_OVERFLOW
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE32HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE32HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE32HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE32HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE32HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE32HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE32HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE32HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE32HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE32HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE32HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE32HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_BASE32HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_BITMAP
+------
+WARNG=ZSCANNER_ENUMBER16_OVERFLOW
+------
+WARNG=ZSCANNER_EBAD_BITMAP
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
diff --git a/src/zscanner/test/tests/40_NSEC3PARAM.in b/src/zscanner/test/tests/40_NSEC3PARAM.in
new file mode 100644
index 0000000000000000000000000000000000000000..b397591e514ab9fd002c201da3c52902fe5bb309
--- /dev/null
+++ b/src/zscanner/test/tests/40_NSEC3PARAM.in
@@ -0,0 +1,26 @@
+$ORIGIN	.
+$TTL	1
+
+; OK
+@	NSEC3PARAM	0	0	0	-		; The simplest variant
+@	NSEC3PARAM	255	255	65535	-		; Maximal numbers
+@	NSEC3PARAM	0	0	0	0102FF		; Hex string
+@	TYPE51	\# 5 0000000000					; TYPE + Hexadecimal rdata
+@	TYPE51		0       0       0       -		; TYPE
+@	nsec3param	0       0       0       -		; Type in lower-case
+
+; KO
+@	NSEC3PARAM
+@	NSEC3PARAM						; Empty rdata
+@	NSEC3PARAM	\# 0					; Hex empty rdata
+@	NSEC3PARAM	\#					; Missing hex length
+@	NSEC3PARAM	256	0	0	00		; Algorithm overflow
+@	NSEC3PARAM	0	256	0	00		; Flags overflow
+@	NSEC3PARAM	0	0	65536	00		; Iterations overflow
+@	NSEC3PARAM	0	0	0	0		; Hex block length must be multiple of 2
+@	NSEC3PARAM	0	0	0	0x		; Bad hex char
+@	NSEC3PARAM	0	0	0	00 00		; Hex block must not contain blank spaces
+@	NSEC3PARAM	0	0	0	00 x		; Unexpected item
+@	NSEC3PARAM	0	0	0			; Missing item
+@	NSEC3PARAM	\# 5 000000000000			; Too long rdata
+@	NSEC3PARAM	\# 6 0000000000				; Bad rdata length
diff --git a/src/zscanner/test/tests/40_NSEC3PARAM.out b/src/zscanner/test/tests/40_NSEC3PARAM.out
new file mode 100644
index 0000000000000000000000000000000000000000..85f9f74f76816115404d169d00d37add1bbf52cf
--- /dev/null
+++ b/src/zscanner/test/tests/40_NSEC3PARAM.out
@@ -0,0 +1,64 @@
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0033
+RDATA=0000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0033
+RDATA=FFFFFFFF00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0033
+RDATA=00000000030102FF
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0033
+RDATA=0000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0033
+RDATA=0000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0033
+RDATA=0000000000
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER16_OVERFLOW
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_REST
+------
+WARNG=ZSCANNER_EBAD_REST
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
diff --git a/src/zscanner/test/tests/41_TLSA.in b/src/zscanner/test/tests/41_TLSA.in
new file mode 100644
index 0000000000000000000000000000000000000000..d28f426ee73b64eab1acb240c92fc301c4be1c92
--- /dev/null
+++ b/src/zscanner/test/tests/41_TLSA.in
@@ -0,0 +1,24 @@
+$ORIGIN	.
+$TTL	1
+
+; OK
+@	TLSA	0	0	0	00		; The simplest variant
+@	TLSA	255	255	255	00		; Maximal numbers
+@	TLSA	0	0	0	0102 00 FF	; Hex string with blank spaces inside
+@	TYPE52	\# 4 00000000				; TYPE + Hexadecimal rdata
+@	TYPE52	0       0       0       00		; TYPE
+@	tlsa	0       0       0       00		; Type in lower-case
+
+; KO
+@	TLSA
+@	TLSA						; Empty rdata
+@	TLSA	\# 0					; Hex empty rdata
+@	TLSA	\#					; Missing hex length
+@	TLSA	256	0	0	00		; Algorithm overflow
+@	TLSA	0	256	0	00		; Flags overflow
+@	TLSA	0	0	256	00		; Iterations overflow
+@	TLSA	0	0	0	0		; Hex block length must be multiple of 2
+@	TLSA	0	0	0	0x		; Bad hex char
+@	TLSA	0	0	0			; Missing item
+@	TLSA	\# 4 0000000000				; Too long rdata
+@	TLSA	\# 5 00000000				; Bad rdata length
diff --git a/src/zscanner/test/tests/41_TLSA.out b/src/zscanner/test/tests/41_TLSA.out
new file mode 100644
index 0000000000000000000000000000000000000000..ebe5eaa31653c9daf549eac62b95501fec9facb5
--- /dev/null
+++ b/src/zscanner/test/tests/41_TLSA.out
@@ -0,0 +1,60 @@
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0034
+RDATA=00000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0034
+RDATA=FFFFFF00
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0034
+RDATA=000000010200FF
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0034
+RDATA=00000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0034
+RDATA=00000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=0034
+RDATA=00000000
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_ENUMBER8_OVERFLOW
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
diff --git a/src/zscanner/test/tests/42_LOC.in b/src/zscanner/test/tests/42_LOC.in
new file mode 100644
index 0000000000000000000000000000000000000000..7aae50f7dc3d23d08c79f15b6e5093bef05e53a0
--- /dev/null
+++ b/src/zscanner/test/tests/42_LOC.in
@@ -0,0 +1,67 @@
+$ORIGIN	.
+$TTL	1
+
+; OK
+@	LOC	1     N 1     E	0			; The simplest case
+@	LOC	0 1   N 1     E 0			; Combination of parameters 
+@	LOC	0 0 1 N 1     E 0			; Combination of parameters
+@	LOC	1     N 0 1   E 0			; Combination of parameters
+@	LOC	1     N 0 0 1 E 0			; Combination of parameters
+@	LOC	1     N 0 0 1 E 0m			; Combination of parameters
+@	LOC	1     N 1     E 0 1			; Combination of parameters
+@	LOC	1     N 1     E 0 1m			; Combination of parameters
+@	LOC	1     N 1     E 0 0 1			; Combination of parameters
+@	LOC	1     N 1     E 0 0 1m			; Combination of parameters
+@	LOC	1     N 1     E 0 0 0 1			; Combination of parameters
+@	LOC	1     N 1     E 0 0 0 1m		; Combination of parameters
+@	LOC	0 0 0 N 0 0 0 E	-100000.00 0 0 0	; Minimal values
+@	LOC	90 59 59.999 S 180 59 59.999 W 42849672.95m 90000000.00m 90000000.00m 90000000.00m	; Maximal values
+@	LOC	0     S 0 0 0.001 W 0			; Float dd.ddd test
+@	LOC	0     S 0 0 0.01  W 0			; Float dd.ddd test
+@	LOC	0     S 0 0 0.1   W 0			; Float dd.ddd test
+@	LOC	0     S 0 0 1.0   W 0			; Float dd.ddd test
+@	LOC	0     S 0 0 10    W 0			; Float dd.ddd test
+@	LOC	0     S 0     W 0 0.01			; Number to [mantisa,exponent] test
+@	LOC	0     S 0     W 0 0.10			; Number to [mantisa,exponent] test 
+@	LOC	0     S 0     W 0 1.0			; Number to [mantisa,exponent] test
+@	LOC	0     S 0     W 0 10			; Number to [mantisa,exponent] test
+@	LOC	0     S 0     W 0 100			; Number to [mantisa,exponent] test
+@	LOC	0     S 0     W 0 1000			; Number to [mantisa,exponent] test
+@	LOC	0     S 0     W 0 10000			; Number to [mantisa,exponent] test
+@	LOC	0     S 0     W 0 100000		; Number to [mantisa,exponent] test
+@	LOC	0     S 0     W 0 1000000		; Number to [mantisa,exponent] test
+@	LOC	0     S 0     W 0 10000000		; Number to [mantisa,exponent] test
+@	LOC	\# 16 00 00 00 00 00000000 00000000 00000000	; Hexadecimal rdata
+@	TYPE29	\# 16 00 00 00 00 00000000 00000000 00000000	; TYPE + Hexadecimal rdata
+@	TYPE29	0     N 0     E 0			; TYPE
+@	loc	0     N 0     E 0			; Type in lower-case
+
+; KO
+@	LOC
+@	LOC						; Empty rdata
+@	LOC	\# 0					; Hex empty rdata
+@	LOC	\#					; Missing hex length
+@	LOC	91 0 0 N 0 0 0 E 0 0 0 0		; Degree overflow
+@	LOC	0 60 0 N 0 0 0 E 0 0 0 0		; Minute overflow
+@	LOC	0 0 60 0 N 0 0 0 E 0 0 0 0		; Second overflow
+@	LOC	0 0 0 N 181 0 0 E 0 0 0 0		; Degree overflow
+@	LOC	0 0 0 N 0 60 0 E 0 0 0 0		; Minute overflow
+@	LOC	0 0 0 N 0 0 60 E 0 0 0 0		; Second overflow
+@	LOC	0 0 0 N 0 0 0 E 42849672.96 0 0 0	; Altitude overflow
+@	LOC	0 0 0 N 0 0 0 E 42849673 0 0 0		; Altitude overflow
+@	LOC	0 0 0 N 0 0 0 E -100000.01 0 0 0	; Altitude underflow
+@	LOC	0 0 0 N 0 0 0 E -100001 0 0 0		; Altitude underflow
+@	LOC	0 0 0 N 0 0 0 E 0 90000000.01 0 0	; Size overflow
+@	LOC	0 0 0 N 0 0 0 E 0 90000001 0 0		; Size overflow
+@	LOC	0 0 0 N 0 0 0 E 0 0 90000000.01 0	; HP overflow
+@	LOC	0 0 0 N 0 0 0 E 0 0 90000001 0		; HP overflow
+@	LOC	0 0 0 N 0 0 0 E 0 0 0 90000000.01	; VP overflow
+@	LOC	0 0 0 N 0 0 0 E 0 0 0 90000001		; VP overflow
+@	LOC	1       1     E	0			; Missing N or S
+@	LOC	1     x 1     E	0			; Bad letter
+@	LOC	1     N 1      	0			; Missing E or W
+@	LOC	1     N 1     x	0			; Bad letter
+@	LOC	1     N 1     E				; Missing altitude
+@	LOC	0 0 0 N 0 0 0 E 0 0 0 0 x		; Unexpected item
+@	LOC	\# 16 00 00 00 00 00000000 00000000 00000000 00	; Too long rdata
+@	LOC	\# 17 00 00 00 00 00000000 00000000 00000000	; Bad rdata length
diff --git a/src/zscanner/test/tests/42_LOC.out b/src/zscanner/test/tests/42_LOC.out
new file mode 100644
index 0000000000000000000000000000000000000000..ab939eb2083b31bbec2680b80d9992024935a135
--- /dev/null
+++ b/src/zscanner/test/tests/42_LOC.out
@@ -0,0 +1,254 @@
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=001216138036EE808036EE8000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=001216138000EA608036EE8000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00121613800003E88036EE8000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=001216138036EE808000EA6000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=001216138036EE80800003E800989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=001216138036EE80800003E800989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=001216138036EE808036EE8000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=001216138036EE808036EE8000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=000012138036EE808036EE8000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=000012138036EE808036EE8000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=000000128036EE808036EE8000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=000000128036EE808036EE8000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00000000800000008000000000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=009999996C79388159295F81FFFFFFFF
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00121613800000007FFFFFFF00989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00121613800000007FFFFFF600989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00121613800000007FFFFF9C00989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00121613800000007FFFFC1800989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00121613800000007FFFD8F000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00101613800000008000000000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00111613800000008000000000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00121613800000008000000000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00131613800000008000000000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00141613800000008000000000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00151613800000008000000000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00161613800000008000000000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00171613800000008000000000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00181613800000008000000000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00191613800000008000000000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00000000000000000000000000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00000000000000000000000000000000
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00121613800000008000000000989680
+------
+OWNER=00
+CLASS=0001
+RRTTL=00000001
+RTYPE=001D
+RDATA=00121613800000008000000000989680
+------
+WARNG=ZSCANNER_EBAD_LOC_DATA
+------
+WARNG=ZSCANNER_EBAD_LOC_DATA
+------
+WARNG=ZSCANNER_EBAD_HEX_CHAR
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_NUMBER
+------
+WARNG=ZSCANNER_EBAD_LOC_DATA
+------
+WARNG=ZSCANNER_EBAD_LOC_DATA
+------
+WARNG=ZSCANNER_EBAD_LOC_DATA
+------
+WARNG=ZSCANNER_EBAD_LOC_DATA
+------
+WARNG=ZSCANNER_EBAD_LOC_DATA
+------
+WARNG=ZSCANNER_EBAD_LOC_DATA
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
+WARNG=ZSCANNER_EBAD_RDATA_LENGTH
+------
diff --git a/src/zscanner/test/zscanner_test.c b/src/zscanner/test/zscanner_test.c
index 10bf278a8475e34d4abae541b09f3516786f6ead..0853784c0ebd6d80dffad1a174b7a2ae206ad416 100644
--- a/src/zscanner/test/zscanner_test.c
+++ b/src/zscanner/test/zscanner_test.c
@@ -26,8 +26,7 @@
 
 #define DEFAULT_MODE	1
 
-
-/*! \brief Print help. */
+/*! \brief Prints help. */
 void help(int argc, char **argv)
 {
 	printf("\nZone scanner testing tool.\n"