1 | /* SPDX-License-Identifier: BSD-3-Clause */ |
2 | /* |
3 | * Copyright (c) 1995 Danny Gasparovski. |
4 | */ |
5 | |
6 | #ifndef DEBUG_H_ |
7 | #define DEBUG_H_ |
8 | |
9 | #define DBG_CALL (1 << 0) |
10 | #define DBG_MISC (1 << 1) |
11 | #define DBG_ERROR (1 << 2) |
12 | #define DBG_TFTP (1 << 3) |
13 | |
14 | extern int slirp_debug; |
15 | |
16 | #define DEBUG_CALL(fmt, ...) \ |
17 | do { \ |
18 | if (G_UNLIKELY(slirp_debug & DBG_CALL)) { \ |
19 | g_debug(fmt "...", ##__VA_ARGS__); \ |
20 | } \ |
21 | } while (0) |
22 | |
23 | #define DEBUG_ARG(fmt, ...) \ |
24 | do { \ |
25 | if (G_UNLIKELY(slirp_debug & DBG_CALL)) { \ |
26 | g_debug(" " fmt, ##__VA_ARGS__); \ |
27 | } \ |
28 | } while (0) |
29 | |
30 | #define DEBUG_MISC(fmt, ...) \ |
31 | do { \ |
32 | if (G_UNLIKELY(slirp_debug & DBG_MISC)) { \ |
33 | g_debug(fmt, ##__VA_ARGS__); \ |
34 | } \ |
35 | } while (0) |
36 | |
37 | #define DEBUG_ERROR(fmt, ...) \ |
38 | do { \ |
39 | if (G_UNLIKELY(slirp_debug & DBG_ERROR)) { \ |
40 | g_debug(fmt, ##__VA_ARGS__); \ |
41 | } \ |
42 | } while (0) |
43 | |
44 | #define DEBUG_TFTP(fmt, ...) \ |
45 | do { \ |
46 | if (G_UNLIKELY(slirp_debug & DBG_TFTP)) { \ |
47 | g_debug(fmt, ##__VA_ARGS__); \ |
48 | } \ |
49 | } while (0) |
50 | |
51 | #endif /* DEBUG_H_ */ |
52 | |