1 | /* $Id: debug.h 56992 2015-07-18 23:01:44Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * NAT - debug helpers (declarations/defines).
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2015 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 | #ifndef _DEBUG_H_
|
---|
28 | #define _DEBUG_H_
|
---|
29 |
|
---|
30 | #include <VBox/log.h>
|
---|
31 | /* we've excluded stdio.h */
|
---|
32 | #define FILE void
|
---|
33 |
|
---|
34 | int debug_init (PNATState);
|
---|
35 | void ipstats (PNATState);
|
---|
36 | void tcpstats (PNATState);
|
---|
37 | void udpstats (PNATState);
|
---|
38 | void icmpstats (PNATState);
|
---|
39 | void mbufstats (PNATState);
|
---|
40 | void sockstats (PNATState);
|
---|
41 |
|
---|
42 | #ifdef LOG_ENABLED
|
---|
43 | # define TCP_STATE_SWITCH_TO(tp, new_tcp_state) \
|
---|
44 | do { \
|
---|
45 | Log2(("%R[tcpcb793] switch to %R[tcpstate] -> %R[tcpstate]\n", (tp), (tp->t_state) ,(new_tcp_state))); \
|
---|
46 | if ((tp)->t_socket) \
|
---|
47 | Log2(("%R[tcpcb793] %R[natsock]\n", (tp), (tp)->t_socket)); \
|
---|
48 | (tp)->t_state = (new_tcp_state); \
|
---|
49 | } while (0)
|
---|
50 | #else
|
---|
51 | # define TCP_STATE_SWITCH_TO(tp, new_tcp_state) (tp)->t_state = (new_tcp_state)
|
---|
52 | #endif
|
---|
53 |
|
---|
54 | /* TCP CB state validity macro definitions
|
---|
55 | * we need to be sure that TCP is in right state.
|
---|
56 | * TCP_ACCEPTABLE_STATEX(tp, (X-states here))
|
---|
57 | */
|
---|
58 | #ifdef DEBUG_vvl
|
---|
59 | # define TCP_ACCEPTABLE_STATE1(tp, tcp_state1) Assert((tp)->t_state == (tcp_state))
|
---|
60 | # define TCP_ACCEPTABLE_STATE2(tp, tcp_state1, tcp_state2) \
|
---|
61 | Assert( (tp)->t_state == (tcp_state1) \
|
---|
62 | || (tp)->t_state == (tcp_state2) ); \
|
---|
63 | #else
|
---|
64 | # define TCP_ACCEPTABLE_STATE1(tp, tcp_state1) do { } while(0)
|
---|
65 | # define TCP_ACCEPTABLE_STATE2(tp, tcp_state1, tcp_state2) do { } while(0)
|
---|
66 | #endif
|
---|
67 | #endif
|
---|