VirtualBox

source: vbox/trunk/src/VBox/Devices/Network/slirp/debug.h@ 530

Last change on this file since 530 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
File size: 2.5 KB
Line 
1/*
2 * Copyright (c) 1995 Danny Gasparovski.
3 *
4 * Please read the file COPYRIGHT for the
5 * terms and conditions of the copyright.
6 */
7
8#define PRN_STDERR 1
9#define PRN_SPRINTF 2
10
11extern FILE *dfd;
12extern FILE *lfd;
13extern int dostats;
14extern int slirp_debug;
15
16#define DBG_CALL 0x1
17#define DBG_MISC 0x2
18#define DBG_ERROR 0x4
19#define DEBUG_DEFAULT DBG_CALL|DBG_MISC|DBG_ERROR
20
21#ifndef VBOX
22#ifdef DEBUG
23#define DEBUG_CALL(x) if (slirp_debug & DBG_CALL) { fprintf(dfd, "%s...\n", x); fflush(dfd); }
24#define DEBUG_ARG(x, y) if (slirp_debug & DBG_CALL) { fputc(' ', dfd); fprintf(dfd, x, y); fputc('\n', dfd); fflush(dfd); }
25#define DEBUG_ARGS(x) if (slirp_debug & DBG_CALL) { fprintf x ; fflush(dfd); }
26#define DEBUG_MISC(x) if (slirp_debug & DBG_MISC) { fprintf x ; fflush(dfd); }
27#define DEBUG_ERROR(x) if (slirp_debug & DBG_ERROR) {fprintf x ; fflush(dfd); }
28
29
30#else
31
32#define DEBUG_CALL(x)
33#define DEBUG_ARG(x, y)
34#define DEBUG_ARGS(x)
35#define DEBUG_MISC(x)
36#define DEBUG_ERROR(x)
37
38#endif
39#else /* VBOX */
40
41#include <VBox/log.h>
42
43#ifdef LOG_ENABLED
44#define DEBUG_CALL(x) LogFlow(("%s:\n", x))
45#define DEBUG_ARG(x, y) do { LogFlow((x, y)); LogFlow(("\n")); } while (0)
46#define DEBUG_ARGS(x) __debug_flow x
47#define DEBUG_MISC(x) __debug_log2 x
48#define DEBUG_ERROR(x) __debug_log x
49
50DECLINLINE(void) __debug_flow(FILE *pIgnore, const char *pszFormat, ...)
51{
52 va_list args;
53 va_start(args, pszFormat);
54 LogFlow(("%Nv\n", pszFormat, &args));
55 va_end(args);
56}
57
58DECLINLINE(void) __debug_log2(FILE *pIgnore, const char *pszFormat, ...)
59{
60 va_list args;
61 va_start(args, pszFormat);
62 Log2(("%Nv\n", pszFormat, &args));
63 va_end(args);
64}
65
66DECLINLINE(void) __debug_log(FILE *pIgnore, const char *pszFormat, ...)
67{
68 va_list args;
69 va_start(args, pszFormat);
70 Log(("%Nv\n", pszFormat, &args));
71 va_end(args);
72}
73
74#else /* !LOG_ENABLED */
75
76#define DEBUG_CALL(x) do {} while (0)
77#define DEBUG_ARG(x, y) do {} while (0)
78#define DEBUG_ARGS(x) do {} while (0)
79#define DEBUG_MISC(x) do {} while (0)
80#define DEBUG_ERROR(x) do {} while (0)
81
82#endif /* !LOG_ENABLED */
83
84#endif /* VBOX */
85
86void debug_init _P((char *, int));
87/*void ttystats _P((struct ttys *)); */
88void allttystats _P((void));
89void ipstats _P((void));
90#ifndef VBOX
91void vjstats _P((void));
92#endif /* VBOX */
93void tcpstats _P((void));
94void udpstats _P((void));
95void icmpstats _P((void));
96void mbufstats _P((void));
97void sockstats _P((void));
98#ifndef VBOX
99void slirp_exit _P((int));
100#endif /* VBOX */
101
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette