summaryrefslogtreecommitdiff
path: root/src/common/print.h
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-11-02 22:44:12 +0100
committerOndřej Surý <ondrej@sury.org>2011-11-02 22:44:12 +0100
commitc8d5977bb546dae9ed59d81556639c49badd8121 (patch)
tree4c86750db26c1c3502b60f2cd78ca9611cfa01d6 /src/common/print.h
downloadknot-upstream/0.8.0_pre1.tar.gz
Imported Upstream version 0.8.0~pre1upstream/0.8.0_pre1
Diffstat (limited to 'src/common/print.h')
-rw-r--r--src/common/print.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/common/print.h b/src/common/print.h
new file mode 100644
index 0000000..482f55e
--- /dev/null
+++ b/src/common/print.h
@@ -0,0 +1,72 @@
+/* Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+/*!
+ * \file print.h
+ *
+ * \author Marek Vavrusa <marek.vavrusa@nic.cz>
+ *
+ * \brief Custom printing functions.
+ *
+ * Downloaded hex_print, bit_print from http://www.digitalpeer.com/id/print
+ * Updated with generic printf handler.
+ *
+ * \addtogroup common_lib
+ * @{
+ */
+
+#ifndef _KNOTD_COMMON_PRINT_H_
+#define _KNOTD_COMMON_PRINT_H_
+
+typedef int (*printf_t)(const char *fmt, ...);
+
+/*!
+ * \brief Prints the given data as hexadecimal characters.
+ *
+ * \param data Data to print.
+ * \param length Size of the \a data array.
+ */
+void hex_print(const char *data, int length);
+
+/*!
+ * \brief Prints the given data as hexadecimal characters using the given
+ * handler.
+ *
+ * \param data Data to print.
+ * \param length Size of the \a data array.
+ * \param print_handler Handler for printing.
+ */
+void hex_printf(const char *data, int length, printf_t print_handler);
+
+/*!
+ * \brief Prints the given data as a bitmap.
+ *
+ * \param data Data to print.
+ * \param length Size of the \a data array.
+ */
+void bit_print(const char *data, int length);
+
+/*!
+ * \brief Prints the given data as a bitmap using the given handler.
+ *
+ * \param data Data to print.
+ * \param length Size of the \a data array.
+ * \param print_handler Handler for printing.
+ */
+void bit_printf(const char *data, int length, printf_t print_handler);
+
+#endif /* _KNOTD_COMMON_PRINT_H_ */
+
+/*! @} */