doc: abstract + architecture
[p2p-kernel-protocol.git] / module / p2pkp_debug.h
1 #ifndef _P2PKP_DEBUG_H_
2 #define _P2PKP_DEBUG_H_
3
4 //#include "linux/kernel.h"
5
6 #ifndef P2PKP_DEBUG
7  /* uncomment to turn debugging off */
8  //#define P2PKP_DEBUG  yes
9 #endif
10
11 #ifdef P2PKP_DEBUG
12 #define DEBUG(format, args...)                                  \
13         do {                                    \
14                 printk(KERN_DEBUG "[%s:%d] " format "\n", __func__, __LINE__, ## args); \
15         } while (0)
16 #else
17 #define DEBUG(format, args...)                                  \
18         do {} while (0)
19 #endif
20
21 /* p2pkp error func */
22 #define ERROR(format, args...) \
23         do {                                    \
24                 printk(KERN_ERR "[%s:%d] " format "\n", __func__, __LINE__, ## args); \
25         } while (0)
26
27 #define print_sock_address(addr)                \
28         do {                                    \
29                 printk(LOG_DEBUG "connection established to "   \
30                                 NIPQUAD_FMT ":%d\n",            \
31                                 NIPQUAD(addr.sin_addr.s_addr),  \
32                                 ntohs(addr.sin_port));          \
33         } while (0)
34
35
36 #endif /* _P2PKP_DEBUG_H_ */
37