Watt-32 tcp/ip  2.2 dev-rel.10
pcdbug.h
Go to the documentation of this file.
1 
3 #ifndef _w32_PCDBUG_H
4 #define _w32_PCDBUG_H
5 
6 #include "strings.h" /* _printf */
7 
8 typedef void (*DebugProc) (const void *sock, const in_Header *ip,
9  const char *file, unsigned line);
10 
11 #define debug_xmit W32_NAMESPACE (debug_xmit)
12 #define debug_recv W32_NAMESPACE (debug_recv)
13 #define debug_on W32_NAMESPACE (debug_on)
14 
15 W32_DATA DebugProc debug_xmit, debug_recv;
16 W32_DATA int debug_on;
17 
18 extern const char *tcpStateName (UINT state);
19 
20 extern BOOL dbg_mode_all, dbg_print_stat, dbg_dns_details;
21 
22 extern void dbug_open (void);
23 extern BOOL dbug_file (void);
24 extern int dbug_write (const char *);
25 extern int dbug_putc (int c);
26 extern void dbug_flush (void);
27 
28 extern int MS_CDECL dbug_printf (const char *fmt, ...) ATTR_PRINTF (1, 2);
29 
30 #if defined(USE_PPPOE)
31  extern const char *pppoe_get_code (WORD code);
32 #endif
33 
34 /*
35  * Send Rx/Tx packet to debug-file.
36  * 'nw_pkt' must point to network layer packet.
37  */
38 #if defined(USE_DEBUG)
39  #define DEBUG_RX(sock, nw_pkt) \
40  do { \
41  if (debug_recv) \
42  (*debug_recv) (sock, (const in_Header*)nw_pkt, \
43  __FILE__, __LINE__); \
44  } while (0)
45 
46  #define DEBUG_TX(sock, nw_pkt) \
47  do { \
48  if (debug_xmit) \
49  (*debug_xmit) (sock, (const in_Header*)nw_pkt, \
50  __FILE__, __LINE__); \
51  } while (0)
52 
53  /* Generic trace to wattcp.dbg file
54  */
55  #define TCP_TRACE_MSG(args) \
56  do { \
57  if (dbug_file()) \
58  dbug_printf args; \
59  } while (0)
60 
61  /* Trace to console
62  */
63  #define TCP_CONSOLE_MSG(lvl, args) \
64  do { \
65  if (debug_on >= lvl) { \
66  (*_printf) args; \
67  fflush (stdout); \
68  } \
69  } while (0)
70 #else
71  #define DEBUG_RX(sock, ip) ((void)0)
72  #define DEBUG_TX(sock, ip) ((void)0)
73  #define TCP_TRACE_MSG(args) ((void)0)
74  #define TCP_CONSOLE_MSG(args, lvl) ((void)0)
75 #endif
76 
77 #define TRACE_MSG TCP_TRACE_MSG
78 #define CONSOLE_MSG TCP_CONSOLE_MSG
79 
80 #endif
81 
Definition: ip.h:67
Definition: zinftree.h:24
BOOL dbg_mode_all
These are public so they can be set by application if running without a config-file.
Definition: pcdbug.c:190