aboutsummaryrefslogtreecommitdiff
path: root/src/debug.h
blob: 0f9f3eff3fb168efcc16c512f3300feaeefacae4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* SPDX-License-Identifier: BSD-3-Clause */
/*
 * Copyright (c) 1995 Danny Gasparovski.
 */

#ifndef DEBUG_H_
#define DEBUG_H_

#define DBG_CALL (1 << 0)
#define DBG_MISC (1 << 1)
#define DBG_ERROR (1 << 2)
#define DBG_TFTP (1 << 3)
#define DBG_VERBOSE_CALL (1 << 4)

extern int slirp_debug;

#define DEBUG_CALL(fmt, ...)                      \
    do {                                          \
        if (G_UNLIKELY(slirp_debug & DBG_CALL)) { \
            g_debug(fmt "...", ##__VA_ARGS__);    \
        }                                         \
    } while (0)

#define DEBUG_VERBOSE_CALL(fmt, ...)                      \
    do {                                                  \
        if (G_UNLIKELY(slirp_debug & DBG_VERBOSE_CALL)) { \
            g_debug(fmt "...", ##__VA_ARGS__);            \
        }                                                 \
    } while (0)

#define DEBUG_ARG(fmt, ...)                       \
    do {                                          \
        if (G_UNLIKELY(slirp_debug & DBG_CALL)) { \
            g_debug(" " fmt, ##__VA_ARGS__);      \
        }                                         \
    } while (0)

#define DEBUG_MISC(fmt, ...)                      \
    do {                                          \
        if (G_UNLIKELY(slirp_debug & DBG_MISC)) { \
            g_debug(fmt, ##__VA_ARGS__);          \
        }                                         \
    } while (0)

#define DEBUG_ERROR(fmt, ...)                      \
    do {                                           \
        if (G_UNLIKELY(slirp_debug & DBG_ERROR)) { \
            g_debug(fmt, ##__VA_ARGS__);           \
        }                                          \
    } while (0)

#define DEBUG_TFTP(fmt, ...)                      \
    do {                                          \
        if (G_UNLIKELY(slirp_debug & DBG_TFTP)) { \
            g_debug(fmt, ##__VA_ARGS__);          \
        }                                         \
    } while (0)

#endif /* DEBUG_H_ */