1 | /* $Id: debug.h 28800 2010-04-27 08:22:32Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * NAT - debug helpers (declarations/defines).
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2010 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | /*
|
---|
19 | * This code is based on:
|
---|
20 | *
|
---|
21 | * Copyright (c) 1995 Danny Gasparovski.
|
---|
22 | *
|
---|
23 | * Please read the file COPYRIGHT for the
|
---|
24 | * terms and conditions of the copyright.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #define PRN_STDERR 1
|
---|
28 | #define PRN_SPRINTF 2
|
---|
29 |
|
---|
30 | /* Unused anyway, using VBox Log facility. */
|
---|
31 | #define dfd NULL
|
---|
32 |
|
---|
33 | #define DBG_CALL 0x1
|
---|
34 | #define DBG_MISC 0x2
|
---|
35 | #define DBG_ERROR 0x4
|
---|
36 | #define DEBUG_DEFAULT DBG_CALL|DBG_MISC|DBG_ERROR
|
---|
37 |
|
---|
38 | #include <VBox/log.h>
|
---|
39 | /* we've excluded stdio.h */
|
---|
40 | # define FILE void
|
---|
41 |
|
---|
42 | #ifdef LOG_ENABLED
|
---|
43 | #define DEBUG_CALL(x) LogFlow(("%s:\n", x))
|
---|
44 | #define DEBUG_ARG(x, y) do { LogFlow((x, y)); LogFlow(("\n")); } while (0)
|
---|
45 | #define DEBUG_ARGS(x) __debug_flow x
|
---|
46 | #define DEBUG_MISC(x) __debug_log2 x
|
---|
47 | #define DEBUG_ERROR(x) __debug_log x
|
---|
48 |
|
---|
49 | DECLINLINE(void) __debug_flow(FILE *pIgnore, const char *pszFormat, ...)
|
---|
50 | {
|
---|
51 | va_list args;
|
---|
52 | va_start(args, pszFormat);
|
---|
53 | LogFlow(("%Nv\n", pszFormat, &args));
|
---|
54 | va_end(args);
|
---|
55 | }
|
---|
56 |
|
---|
57 | DECLINLINE(void) __debug_log2(FILE *pIgnore, const char *pszFormat, ...)
|
---|
58 | {
|
---|
59 | va_list args;
|
---|
60 | va_start(args, pszFormat);
|
---|
61 | Log2(("%Nv\n", pszFormat, &args));
|
---|
62 | va_end(args);
|
---|
63 | }
|
---|
64 |
|
---|
65 | DECLINLINE(void) __debug_log(FILE *pIgnore, const char *pszFormat, ...)
|
---|
66 | {
|
---|
67 | va_list args;
|
---|
68 | va_start(args, pszFormat);
|
---|
69 | Log(("%Nv\n", pszFormat, &args));
|
---|
70 | va_end(args);
|
---|
71 | }
|
---|
72 |
|
---|
73 | #else /* !LOG_ENABLED */
|
---|
74 |
|
---|
75 | #define DEBUG_CALL(x) do {} while (0)
|
---|
76 | #define DEBUG_ARG(x, y) do {} while (0)
|
---|
77 | #define DEBUG_ARGS(x) do {} while (0)
|
---|
78 | #define DEBUG_MISC(x) do {} while (0)
|
---|
79 | #define DEBUG_ERROR(x) do {} while (0)
|
---|
80 |
|
---|
81 | #endif /* !LOG_ENABLED */
|
---|
82 |
|
---|
83 | int debug_init (void);
|
---|
84 | void ipstats (PNATState);
|
---|
85 | void tcpstats (PNATState);
|
---|
86 | void udpstats (PNATState);
|
---|
87 | void icmpstats (PNATState);
|
---|
88 | void mbufstats (PNATState);
|
---|
89 | void sockstats (PNATState);
|
---|
90 |
|
---|