VirtualBox

source: vbox/trunk/src/VBox/Devices/Network/slirp/debug.c@ 39347

Last change on this file since 39347 was 39286, checked in by vboxsync, 13 years ago

NAT: socket status print.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 19.4 KB
Line 
1/* $Id: debug.c 39286 2011-11-14 06:45:27Z vboxsync $ */
2/** @file
3 * NAT - debug helpers.
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/*
20 * This code is based on:
21 *
22 * Copyright (c) 1995 Danny Gasparovski.
23 * Portions copyright (c) 2000 Kelly Price.
24 *
25 * Please read the file COPYRIGHT for the
26 * terms and conditions of the copyright.
27 */
28
29#include <slirp.h>
30#include <iprt/string.h>
31#include <iprt/stream.h>
32#include <iprt/critsect.h>
33#include "zone.h"
34
35#ifdef DEBUG
36void dump_packet(void *, int);
37#endif
38
39#ifndef STRINGIFY
40# define STRINGIFY(x) #x
41#endif
42
43static char *g_apszTcpStates[TCP_NSTATES] =
44{
45 STRINGIFY(TCPS_CLOSED),
46 STRINGIFY(TCPS_LISTEN),
47 STRINGIFY(TCPS_SYN_SENT),
48 STRINGIFY(TCPS_SYN_RECEIVED),
49 STRINGIFY(TCPS_ESTABLISHED),
50 STRINGIFY(TCPS_CLOSE_WAIT),
51 STRINGIFY(TCPS_FIN_WAIT_1),
52 STRINGIFY(TCPS_CLOSING),
53 STRINGIFY(TCPS_LAST_ACK),
54 STRINGIFY(TCPS_FIN_WAIT_2),
55 STRINGIFY(TCPS_TIME_WAIT)
56};
57
58typedef struct DEBUGSTRSOCKETSTATE
59{
60 uint32_t u32SocketState;
61 const char *pcszSocketStateName;
62} DEBUGSTRSOCKETSTATE;
63
64#define DEBUGSTRSOCKETSTATE_HELPER(x) {(x), #x}
65
66static DEBUGSTRSOCKETSTATE g_apszSocketStates[8] =
67{
68 DEBUGSTRSOCKETSTATE_HELPER(SS_NOFDREF),
69 DEBUGSTRSOCKETSTATE_HELPER(SS_ISFCONNECTING),
70 DEBUGSTRSOCKETSTATE_HELPER(SS_ISFCONNECTED),
71 DEBUGSTRSOCKETSTATE_HELPER(SS_FCANTRCVMORE),
72 DEBUGSTRSOCKETSTATE_HELPER(SS_FCANTSENDMORE),
73 DEBUGSTRSOCKETSTATE_HELPER(SS_FWDRAIN),
74 DEBUGSTRSOCKETSTATE_HELPER(SS_FACCEPTCONN),
75 DEBUGSTRSOCKETSTATE_HELPER(SS_FACCEPTONCE),
76};
77
78/*
79 * Dump a packet in the same format as tcpdump -x
80 */
81#ifdef DEBUG
82void
83dump_packet(void *dat, int n)
84{
85 Log(("nat: PACKET DUMPED:\n%.*Rhxd\n", n, dat));
86}
87#endif
88
89#ifdef LOG_ENABLED
90static void
91lprint(const char *pszFormat, ...)
92{
93 va_list args;
94 va_start(args, pszFormat);
95 RTLogPrintfV(pszFormat, args);
96 va_end(args);
97}
98
99void
100ipstats(PNATState pData)
101{
102 lprint("\n");
103
104 lprint("IP stats:\n");
105 lprint(" %6d total packets received (%d were unaligned)\n",
106 ipstat.ips_total, ipstat.ips_unaligned);
107 lprint(" %6d with incorrect version\n", ipstat.ips_badvers);
108 lprint(" %6d with bad header checksum\n", ipstat.ips_badsum);
109 lprint(" %6d with length too short (len < sizeof(iphdr))\n", ipstat.ips_tooshort);
110 lprint(" %6d with length too small (len < ip->len)\n", ipstat.ips_toosmall);
111 lprint(" %6d with bad header length\n", ipstat.ips_badhlen);
112 lprint(" %6d with bad packet length\n", ipstat.ips_badlen);
113 lprint(" %6d fragments received\n", ipstat.ips_fragments);
114 lprint(" %6d fragments dropped\n", ipstat.ips_fragdropped);
115 lprint(" %6d fragments timed out\n", ipstat.ips_fragtimeout);
116 lprint(" %6d packets reassembled ok\n", ipstat.ips_reassembled);
117 lprint(" %6d outgoing packets fragmented\n", ipstat.ips_fragmented);
118 lprint(" %6d total outgoing fragments\n", ipstat.ips_ofragments);
119 lprint(" %6d with bad protocol field\n", ipstat.ips_noproto);
120 lprint(" %6d total packets delivered\n", ipstat.ips_delivered);
121}
122
123void
124tcpstats(PNATState pData)
125{
126 lprint("\n");
127
128 lprint("TCP stats:\n");
129
130 lprint(" %6d packets sent\n", tcpstat.tcps_sndtotal);
131 lprint(" %6d data packets (%d bytes)\n",
132 tcpstat.tcps_sndpack, tcpstat.tcps_sndbyte);
133 lprint(" %6d data packets retransmitted (%d bytes)\n",
134 tcpstat.tcps_sndrexmitpack, tcpstat.tcps_sndrexmitbyte);
135 lprint(" %6d ack-only packets (%d delayed)\n",
136 tcpstat.tcps_sndacks, tcpstat.tcps_delack);
137 lprint(" %6d URG only packets\n", tcpstat.tcps_sndurg);
138 lprint(" %6d window probe packets\n", tcpstat.tcps_sndprobe);
139 lprint(" %6d window update packets\n", tcpstat.tcps_sndwinup);
140 lprint(" %6d control (SYN/FIN/RST) packets\n", tcpstat.tcps_sndctrl);
141 lprint(" %6d times tcp_output did nothing\n", tcpstat.tcps_didnuttin);
142
143 lprint(" %6d packets received\n", tcpstat.tcps_rcvtotal);
144 lprint(" %6d acks (for %d bytes)\n",
145 tcpstat.tcps_rcvackpack, tcpstat.tcps_rcvackbyte);
146 lprint(" %6d duplicate acks\n", tcpstat.tcps_rcvdupack);
147 lprint(" %6d acks for unsent data\n", tcpstat.tcps_rcvacktoomuch);
148 lprint(" %6d packets received in sequence (%d bytes)\n",
149 tcpstat.tcps_rcvpack, tcpstat.tcps_rcvbyte);
150 lprint(" %6d completely duplicate packets (%d bytes)\n",
151 tcpstat.tcps_rcvduppack, tcpstat.tcps_rcvdupbyte);
152
153 lprint(" %6d packets with some duplicate data (%d bytes duped)\n",
154 tcpstat.tcps_rcvpartduppack, tcpstat.tcps_rcvpartdupbyte);
155 lprint(" %6d out-of-order packets (%d bytes)\n",
156 tcpstat.tcps_rcvoopack, tcpstat.tcps_rcvoobyte);
157 lprint(" %6d packets of data after window (%d bytes)\n",
158 tcpstat.tcps_rcvpackafterwin, tcpstat.tcps_rcvbyteafterwin);
159 lprint(" %6d window probes\n", tcpstat.tcps_rcvwinprobe);
160 lprint(" %6d window update packets\n", tcpstat.tcps_rcvwinupd);
161 lprint(" %6d packets received after close\n", tcpstat.tcps_rcvafterclose);
162 lprint(" %6d discarded for bad checksums\n", tcpstat.tcps_rcvbadsum);
163 lprint(" %6d discarded for bad header offset fields\n",
164 tcpstat.tcps_rcvbadoff);
165
166 lprint(" %6d connection requests\n", tcpstat.tcps_connattempt);
167 lprint(" %6d connection accepts\n", tcpstat.tcps_accepts);
168 lprint(" %6d connections established (including accepts)\n", tcpstat.tcps_connects);
169 lprint(" %6d connections closed (including %d drop)\n",
170 tcpstat.tcps_closed, tcpstat.tcps_drops);
171 lprint(" %6d embryonic connections dropped\n", tcpstat.tcps_conndrops);
172 lprint(" %6d segments we tried to get rtt (%d succeeded)\n",
173 tcpstat.tcps_segstimed, tcpstat.tcps_rttupdated);
174 lprint(" %6d retransmit timeouts\n", tcpstat.tcps_rexmttimeo);
175 lprint(" %6d connections dropped by rxmt timeout\n",
176 tcpstat.tcps_timeoutdrop);
177 lprint(" %6d persist timeouts\n", tcpstat.tcps_persisttimeo);
178 lprint(" %6d keepalive timeouts\n", tcpstat.tcps_keeptimeo);
179 lprint(" %6d keepalive probes sent\n", tcpstat.tcps_keepprobe);
180 lprint(" %6d connections dropped by keepalive\n", tcpstat.tcps_keepdrops);
181 lprint(" %6d correct ACK header predictions\n", tcpstat.tcps_predack);
182 lprint(" %6d correct data packet header predictions\n", tcpstat.tcps_preddat);
183 lprint(" %6d TCP cache misses\n", tcpstat.tcps_socachemiss);
184
185/* lprint(" Packets received too short: %d\n", tcpstat.tcps_rcvshort); */
186/* lprint(" Segments dropped due to PAWS: %d\n", tcpstat.tcps_pawsdrop); */
187
188}
189
190void
191udpstats(PNATState pData)
192{
193 lprint("\n");
194
195 lprint("UDP stats:\n");
196 lprint(" %6d datagrams received\n", udpstat.udps_ipackets);
197 lprint(" %6d with packets shorter than header\n", udpstat.udps_hdrops);
198 lprint(" %6d with bad checksums\n", udpstat.udps_badsum);
199 lprint(" %6d with data length larger than packet\n", udpstat.udps_badlen);
200 lprint(" %6d UDP socket cache misses\n", udpstat.udpps_pcbcachemiss);
201 lprint(" %6d datagrams sent\n", udpstat.udps_opackets);
202}
203
204void
205icmpstats(PNATState pData)
206{
207 lprint("\n");
208 lprint("ICMP stats:\n");
209 lprint(" %6d ICMP packets received\n", icmpstat.icps_received);
210 lprint(" %6d were too short\n", icmpstat.icps_tooshort);
211 lprint(" %6d with bad checksums\n", icmpstat.icps_checksum);
212 lprint(" %6d with type not supported\n", icmpstat.icps_notsupp);
213 lprint(" %6d with bad type feilds\n", icmpstat.icps_badtype);
214 lprint(" %6d ICMP packets sent in reply\n", icmpstat.icps_reflect);
215}
216
217void
218mbufstats(PNATState pData)
219{
220 /*
221 * (vvl) this static code can't work with mbuf zone anymore
222 * @todo: make statistic correct
223 */
224 NOREF(pData);
225}
226
227void
228sockstats(PNATState pData)
229{
230 char buff[256];
231 size_t n;
232 struct socket *so, *so_next;
233
234 lprint("\n");
235
236 lprint(
237 "Proto[state] Sock Local Address, Port Remote Address, Port RecvQ SendQ\n");
238
239 QSOCKET_FOREACH(so, so_next, tcp)
240 /* { */
241 n = RTStrPrintf(buff, sizeof(buff), "tcp[%s]", so->so_tcpcb?tcpstates[so->so_tcpcb->t_state]:"NONE");
242 while (n < 17)
243 buff[n++] = ' ';
244 buff[17] = 0;
245 lprint("%s %3d %15s %5d ",
246 buff, so->s, inet_ntoa(so->so_laddr), RT_N2H_U16(so->so_lport));
247 lprint("%15s %5d %5d %5d\n",
248 inet_ntoa(so->so_faddr), RT_N2H_U16(so->so_fport),
249 SBUF_LEN(&so->so_rcv), SBUF_LEN(&so->so_snd));
250 LOOP_LABEL(tcp, so, so_next);
251 }
252
253 QSOCKET_FOREACH(so, so_next, udp)
254 /* { */
255 n = RTStrPrintf(buff, sizeof(buff), "udp[%d sec]", (so->so_expire - curtime) / 1000);
256 while (n < 17)
257 buff[n++] = ' ';
258 buff[17] = 0;
259 lprint("%s %3d %15s %5d ",
260 buff, so->s, inet_ntoa(so->so_laddr), RT_N2H_U16(so->so_lport));
261 lprint("%15s %5d %5d %5d\n",
262 inet_ntoa(so->so_faddr), RT_N2H_U16(so->so_fport),
263 SBUF_LEN(&so->so_rcv), SBUF_LEN(&so->so_snd));
264 LOOP_LABEL(udp, so, so_next);
265 }
266}
267#endif
268
269static DECLCALLBACK(size_t)
270printSocket(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
271 const char *pszType, void const *pvValue,
272 int cchWidth, int cchPrecision, unsigned fFlags,
273 void *pvUser)
274{
275 struct socket *so = (struct socket*)pvValue;
276 struct sockaddr addr;
277 struct sockaddr_in *in_addr;
278 socklen_t socklen = sizeof(struct sockaddr);
279 int status = 0;
280 NOREF(cchWidth);
281 NOREF(cchPrecision);
282 NOREF(fFlags);
283 NOREF(pvUser);
284
285 AssertReturn(strcmp(pszType, "natsock") == 0, 0);
286 if (so == NULL)
287 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
288 "socket is null");
289 if (so->s == -1)
290 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
291 "socket(%d)", so->s);
292
293 status = getsockname(so->s, &addr, &socklen);
294 if(status != 0 || addr.sa_family != AF_INET)
295 {
296 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
297 "socket(%d) is invalid(probably closed)", so->s);
298 }
299
300 in_addr = (struct sockaddr_in *)&addr;
301 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "socket %d:(proto:%u) "
302 "state=%R[natsockstate] "
303 "f_(addr:port)=%RTnaipv4:%d "
304 "l_(addr:port)=%RTnaipv4:%d "
305 "name=%RTnaipv4:%d",
306 so->s, so->so_type, so->so_state,
307 so->so_faddr.s_addr,
308 RT_N2H_U16(so->so_fport),
309 so->so_laddr.s_addr,
310 RT_N2H_U16(so->so_lport),
311 in_addr->sin_addr.s_addr,
312 RT_N2H_U16(in_addr->sin_port));
313}
314
315static DECLCALLBACK(size_t)
316printNATSocketState(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
317 const char *pszType, void const *pvValue,
318 int cchWidth, int cchPrecision, unsigned fFlags,
319 void *pvUser)
320{
321 uint32_t u32SocketState = (uint32_t)(uintptr_t)pvValue;
322 int idxNATState = 0;
323 NOREF(cchWidth);
324 NOREF(cchPrecision);
325 NOREF(fFlags);
326 NOREF(pvUser);
327 AssertReturn(strcmp(pszType, "natsockstate") == 0, 0);
328
329 for (idxNATState = 0; idxNATState < RT_ELEMENTS(g_apszSocketStates); ++idxNATState)
330 {
331 if (u32SocketState == g_apszSocketStates[idxNATState].u32SocketState)
332 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, g_apszSocketStates[idxNATState].pcszSocketStateName);
333 }
334 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "[unknown state %RX32]", u32SocketState);
335}
336
337/**
338 * Print callback dumping TCP Control Block in terms of RFC 793.
339 */
340static DECLCALLBACK(size_t)
341printTcpcbRfc793(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
342 const char *pszType, void const *pvValue,
343 int cchWidth, int cchPrecision, unsigned fFlags,
344 void *pvUser)
345{
346 size_t cb = 0;
347 const struct tcpcb *tp = (const struct tcpcb *)pvValue;
348 NOREF(cchWidth);
349 NOREF(cchPrecision);
350 NOREF(fFlags);
351 NOREF(pvUser);
352 AssertReturn(RTStrCmp(pszType, "tcpcb793") == 0, 0);
353 if (tp)
354 {
355 cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "TCB793[ state:%R[tcpstate] SND(UNA: %x, NXT: %x, UP: %x, WND: %x, WL1:%x, WL2:%x, ISS:%x), ",
356 tp->t_state, tp->snd_una, tp->snd_nxt, tp->snd_up, tp->snd_wnd, tp->snd_wl1, tp->snd_wl2, tp->iss);
357 cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "RCV(WND: %x, NXT: %x, UP: %x, IRS:%x)]", tp->rcv_wnd, tp->rcv_nxt, tp->rcv_up, tp->irs);
358 }
359 else
360 {
361 cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "TCB793[ NULL ]");
362 }
363 return cb;
364}
365/*
366 * Prints TCP segment in terms of RFC 793.
367 */
368static DECLCALLBACK(size_t)
369printTcpSegmentRfc793(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
370 const char *pszType, void const *pvValue,
371 int cchWidth, int cchPrecision, unsigned fFlags,
372 void *pvUser)
373{
374 size_t cb = 0;
375 const struct tcpiphdr *ti = (const struct tcpiphdr *)pvValue;
376 NOREF(cchWidth);
377 NOREF(cchPrecision);
378 NOREF(fFlags);
379 NOREF(pvUser);
380 AssertReturn(RTStrCmp(pszType, "tcpseg793") == 0 && ti, 0);
381 cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "SEG[ACK: %x, SEQ: %x, LEN: %x, WND: %x, UP: %x]",
382 ti->ti_ack, ti->ti_seq, ti->ti_len, ti->ti_win, ti->ti_urp);
383 return cb;
384}
385
386/*
387 * Prints TCP state
388 */
389static DECLCALLBACK(size_t)
390printTcpState(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
391 const char *pszType, void const *pvValue,
392 int cchWidth, int cchPrecision, unsigned fFlags,
393 void *pvUser)
394{
395 size_t cb = 0;
396 const int idxTcpState = (int)(uintptr_t)pvValue;
397 char *pszTcpStateName = (idxTcpState >= 0 && idxTcpState < TCP_NSTATES) ? g_apszTcpStates[idxTcpState] : "TCPS_INVALIDE_STATE";
398 NOREF(cchWidth);
399 NOREF(cchPrecision);
400 NOREF(fFlags);
401 NOREF(pvUser);
402 AssertReturn(RTStrCmp(pszType, "tcpstate") == 0, 0);
403 cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%s", pszTcpStateName);
404 return cb;
405}
406
407/*
408 * Prints sbuf state
409 */
410static DECLCALLBACK(size_t)
411printSbuf(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
412 const char *pszType, void const *pvValue,
413 int cchWidth, int cchPrecision, unsigned fFlags,
414 void *pvUser)
415{
416 size_t cb = 0;
417 const struct sbuf *sb = (struct sbuf *)pvValue;
418 NOREF(cchWidth);
419 NOREF(cchPrecision);
420 NOREF(fFlags);
421 NOREF(pvUser);
422 AssertReturn(RTStrCmp(pszType, "sbuf") == 0, 0);
423 cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "[sbuf:%p cc:%d, datalen:%d, wprt:%p, rptr:%p data:%p]",
424 sb, sb->sb_cc, sb->sb_datalen, sb->sb_wptr, sb->sb_rptr, sb->sb_data);
425 return cb;
426}
427
428/*
429 * Prints zone state
430 */
431static DECLCALLBACK(size_t)
432printMbufZone(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
433 const char *pszType, void const *pvValue,
434 int cchWidth, int cchPrecision, unsigned fFlags,
435 void *pvUser)
436{
437 size_t cb = 0;
438 const uma_zone_t zone = (const uma_zone_t)pvValue;
439 NOREF(cchWidth);
440 NOREF(cchPrecision);
441 NOREF(fFlags);
442 NOREF(pvUser);
443 AssertReturn(RTStrCmp(pszType, "mzone") == 0, 0);
444 if (!zone)
445 cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "[zone:NULL]");
446 else
447 cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "[zone:%p name:%s, master_zone:%R[mzone]]",
448 zone, zone->name, zone->master_zone);
449 return cb;
450}
451
452/*
453 * Prints zone's item state
454 */
455static DECLCALLBACK(size_t)
456printMbufZoneItem(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
457 const char *pszType, void const *pvValue,
458 int cchWidth, int cchPrecision, unsigned fFlags,
459 void *pvUser)
460{
461 size_t cb = 0;
462 const struct item *it = (const struct item *)pvValue;
463 NOREF(cchWidth);
464 NOREF(cchPrecision);
465 NOREF(fFlags);
466 NOREF(pvUser);
467 AssertReturn(RTStrCmp(pszType, "mzoneitem") == 0, 0);
468 if (!it)
469 cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "[item:NULL]");
470 else
471 cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "[iptem:%p ref_count:%d, zone:%R[mzone]]",
472 it, it->ref_count, it->zone);
473 return cb;
474}
475
476static DECLCALLBACK(size_t)
477print_networkevents(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
478 const char *pszType, void const *pvValue,
479 int cchWidth, int cchPrecision, unsigned fFlags,
480 void *pvUser)
481{
482 size_t cb = 0;
483#ifdef RT_OS_WINDOWS
484 WSANETWORKEVENTS *pNetworkEvents = (WSANETWORKEVENTS*)pvValue;
485 bool fDelim = false;
486#endif
487
488 NOREF(cchWidth);
489 NOREF(cchPrecision);
490 NOREF(fFlags);
491 NOREF(pvUser);
492
493#ifdef RT_OS_WINDOWS
494 AssertReturn(strcmp(pszType, "natwinnetevents") == 0, 0);
495
496 cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "events=%02x (",
497 pNetworkEvents->lNetworkEvents);
498# define DO_BIT(bit) \
499 if (pNetworkEvents->lNetworkEvents & FD_ ## bit) \
500 { \
501 cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, \
502 "%s" #bit "(%d)", fDelim ? "," : "", \
503 pNetworkEvents->iErrorCode[FD_ ## bit ## _BIT]); \
504 fDelim = true; \
505 }
506 DO_BIT(READ);
507 DO_BIT(WRITE);
508 DO_BIT(OOB);
509 DO_BIT(ACCEPT);
510 DO_BIT(CONNECT);
511 DO_BIT(CLOSE);
512 DO_BIT(QOS);
513# undef DO_BIT
514 cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, ")");
515#else
516 NOREF(pfnOutput);
517 NOREF(pvArgOutput);
518 NOREF(pszType);
519 NOREF(pvValue);
520#endif
521 return cb;
522}
523
524#if 0
525/*
526 * Debugging
527 */
528int errno_func(const char *file, int line)
529{
530 int err = WSAGetLastError();
531 LogRel(("errno=%d (%s:%d)\n", err, file, line));
532 return err;
533}
534#endif
535
536int
537debug_init()
538{
539 int rc = VINF_SUCCESS;
540
541 static int g_fFormatRegistered;
542
543 if (!g_fFormatRegistered)
544 {
545
546 rc = RTStrFormatTypeRegister("natsock", printSocket, NULL); AssertRC(rc);
547 rc = RTStrFormatTypeRegister("natsockstate", printNATSocketState, NULL); AssertRC(rc);
548 rc = RTStrFormatTypeRegister("natwinnetevents",
549 print_networkevents, NULL); AssertRC(rc);
550 rc = RTStrFormatTypeRegister("tcpcb793", printTcpcbRfc793, NULL); AssertRC(rc);
551 rc = RTStrFormatTypeRegister("tcpseg793", printTcpSegmentRfc793, NULL); AssertRC(rc);
552 rc = RTStrFormatTypeRegister("tcpstate", printTcpState, NULL); AssertRC(rc);
553 rc = RTStrFormatTypeRegister("sbuf", printSbuf, NULL); AssertRC(rc);
554 rc = RTStrFormatTypeRegister("mzone", printMbufZone, NULL); AssertRC(rc);
555 rc = RTStrFormatTypeRegister("mzoneitem", printMbufZoneItem, NULL); AssertRC(rc);
556 g_fFormatRegistered = 1;
557 }
558
559 return rc;
560}
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