module: added support for multiple USERSPACE receivers
[p2p-kernel-protocol.git] / module / p2pkp_debug.h
diff --git a/module/p2pkp_debug.h b/module/p2pkp_debug.h
new file mode 100644 (file)
index 0000000..2b8e944
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef _P2PKP_DEBUG_H_
+#define _P2PKP_DEBUG_H_
+
+//#include "linux/kernel.h"
+
+#ifndef P2PKP_DEBUG
+ /* uncomment to turn debugging off */
+ #define P2PKP_DEBUG   yes
+#endif
+
+#ifdef P2PKP_DEBUG
+#define DEBUG(format, args...)                                 \
+       do {                                    \
+               printk(KERN_DEBUG "[%s:%d] " format "\n", __func__, __LINE__, ## args); \
+       } while (0)
+#else
+#define LOG(s)                                 \
+       do {} while (0)
+#endif
+
+/* p2pkp error func */
+#define ERROR(format, args...) \
+       do {                                    \
+               printk(KERN_ERR "[%s:%d] " format "\n", __func__, __LINE__, ## args); \
+       } while (0)
+
+#define print_sock_address(addr)               \
+       do {                                    \
+               printk(LOG_DEBUG "connection established to "   \
+                               NIPQUAD_FMT ":%d\n",            \
+                               NIPQUAD(addr.sin_addr.s_addr),  \
+                               ntohs(addr.sin_port));          \
+       } while (0)
+
+
+#endif /* _P2PKP_DEBUG_H_ */
+