summaryrefslogtreecommitdiff
path: root/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'debug.h')
-rw-r--r--debug.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/debug.h b/debug.h
new file mode 100644
index 0000000..ed62da1
--- /dev/null
+++ b/debug.h
@@ -0,0 +1,27 @@
+/* Copyright 2011 NORDUnet A/S. All rights reserved.
+ See LICENSE for licensing information. */
+
+#define hd(p, l) { int i; \
+ for (i = 1; i <= l; i++) { \
+ printf ("%02x ", p[i-1]); \
+ if (i % 8 == 0) printf (" "); \
+ if (i % 16 == 0) printf ("\n"); } \
+ printf ("\n"); }
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+struct rs_packet;
+void rs_dump_packet (const struct rs_packet *pkt);
+int _rs_debug (const char *fmt, ...);
+
+#if defined (DEBUG)
+#define rs_debug(x) _rs_debug x
+#else
+#define rs_debug(x) do {;} while (0)
+#endif
+
+#if defined (__cplusplus)
+}
+#endif