VirtualBox

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

最後變更 在這個檔案從1048是 1033,由 vboxsync 提交於 18 年 前

Big change to make slirp fully instantiatable (replace all global
variables with local ones, passing a reference to the state/config
structure to all places which are interested). You can now have as many
cards in the guest configured for NAT networking as you want.

  • 屬性 svn:eol-style 設為 native
檔案大小: 2.8 KB
 
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
11#ifdef VBOX
12/* Unused anyway, using VBox Log facility. */
13#define dfd NULL
14#else /* !VBOX */
15extern FILE *dfd;
16extern FILE *lfd;
17#endif /* !VBOX */
18extern int dostats;
19extern int slirp_debug;
20
21#define DBG_CALL 0x1
22#define DBG_MISC 0x2
23#define DBG_ERROR 0x4
24#define DEBUG_DEFAULT DBG_CALL|DBG_MISC|DBG_ERROR
25
26#ifndef VBOX
27#ifdef DEBUG
28#define DEBUG_CALL(x) if (slirp_debug & DBG_CALL) { fprintf(dfd, "%s...\n", x); fflush(dfd); }
29#define DEBUG_ARG(x, y) if (slirp_debug & DBG_CALL) { fputc(' ', dfd); fprintf(dfd, x, y); fputc('\n', dfd); fflush(dfd); }
30#define DEBUG_ARGS(x) if (slirp_debug & DBG_CALL) { fprintf x ; fflush(dfd); }
31#define DEBUG_MISC(x) if (slirp_debug & DBG_MISC) { fprintf x ; fflush(dfd); }
32#define DEBUG_ERROR(x) if (slirp_debug & DBG_ERROR) {fprintf x ; fflush(dfd); }
33
34
35#else
36
37#define DEBUG_CALL(x)
38#define DEBUG_ARG(x, y)
39#define DEBUG_ARGS(x)
40#define DEBUG_MISC(x)
41#define DEBUG_ERROR(x)
42
43#endif
44#else /* VBOX */
45
46#include <VBox/log.h>
47
48#ifdef LOG_ENABLED
49#define DEBUG_CALL(x) LogFlow(("%s:\n", x))
50#define DEBUG_ARG(x, y) do { LogFlow((x, y)); LogFlow(("\n")); } while (0)
51#define DEBUG_ARGS(x) __debug_flow x
52#define DEBUG_MISC(x) __debug_log2 x
53#define DEBUG_ERROR(x) __debug_log x
54
55DECLINLINE(void) __debug_flow(FILE *pIgnore, const char *pszFormat, ...)
56{
57 va_list args;
58 va_start(args, pszFormat);
59 LogFlow(("%Nv\n", pszFormat, &args));
60 va_end(args);
61}
62
63DECLINLINE(void) __debug_log2(FILE *pIgnore, const char *pszFormat, ...)
64{
65 va_list args;
66 va_start(args, pszFormat);
67 Log2(("%Nv\n", pszFormat, &args));
68 va_end(args);
69}
70
71DECLINLINE(void) __debug_log(FILE *pIgnore, const char *pszFormat, ...)
72{
73 va_list args;
74 va_start(args, pszFormat);
75 Log(("%Nv\n", pszFormat, &args));
76 va_end(args);
77}
78
79#else /* !LOG_ENABLED */
80
81#define DEBUG_CALL(x) do {} while (0)
82#define DEBUG_ARG(x, y) do {} while (0)
83#define DEBUG_ARGS(x) do {} while (0)
84#define DEBUG_MISC(x) do {} while (0)
85#define DEBUG_ERROR(x) do {} while (0)
86
87#endif /* !LOG_ENABLED */
88
89#endif /* VBOX */
90
91void debug_init _P((char *, int));
92/*void ttystats _P((struct ttys *)); */
93void allttystats _P((void));
94#ifdef VBOX
95void ipstats _P((PNATState));
96void tcpstats _P((PNATState));
97void udpstats _P((PNATState));
98void icmpstats _P((PNATState));
99void mbufstats _P((PNATState));
100void sockstats _P((PNATState));
101#else /* !VBOX */
102void ipstats _P((void));
103void vjstats _P((void));
104void tcpstats _P((void));
105void udpstats _P((void));
106void icmpstats _P((void));
107void mbufstats _P((void));
108void sockstats _P((void));
109#endif /* VBOX */
110#ifndef VBOX
111void slirp_exit _P((int));
112#endif /* VBOX */
113
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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