debug.c revision 0f252ad257bdf002284cb2a1359814cd9fa3f2a9
/*
* Copyright (c) 1995 Danny Gasparovski.
* Portions copyright (c) 2000 Kelly Price.
*
* Please read the file COPYRIGHT for the
* terms and conditions of the copyright.
*/
#include <slirp.h>
#ifdef DEBUG
void dump_packet(void *, int);
#endif
#define IP4_ADDR_PRINTF_DECOMP(ip) ((ip) >> 24), ((ip) >> 16) & 0xff, ((ip) >> 8) & 0xff, (ip) & 0xff
#define IP4_ADDR_PRINTF_FORMAT "%u.%u.%u.%u"
/*
* Dump a packet in the same format as tcpdump -x
*/
#ifdef DEBUG
void
dump_packet(void *dat, int n)
{
}
#endif
#ifdef LOG_ENABLED
static void
{
}
void
{
lprint(" \n");
lprint("IP stats:\n");
lprint(" %6d total packets received (%d were unaligned)\n",
}
void
{
lprint(" \n");
lprint("TCP stats:\n");
lprint(" %6d data packets (%d bytes)\n",
lprint(" %6d data packets retransmitted (%d bytes)\n",
lprint(" %6d ack-only packets (%d delayed)\n",
lprint(" %6d acks (for %d bytes)\n",
lprint(" %6d packets received in sequence (%d bytes)\n",
lprint(" %6d completely duplicate packets (%d bytes)\n",
lprint(" %6d packets with some duplicate data (%d bytes duped)\n",
lprint(" %6d out-of-order packets (%d bytes)\n",
lprint(" %6d packets of data after window (%d bytes)\n",
lprint(" %6d discarded for bad header offset fields\n",
lprint(" %6d connections closed (including %d drop)\n",
lprint(" %6d segments we tried to get rtt (%d succeeded)\n",
lprint(" %6d connections dropped by rxmt timeout\n",
/* lprint(" Packets received too short: %d\n", tcpstat.tcps_rcvshort); */
/* lprint(" Segments dropped due to PAWS: %d\n", tcpstat.tcps_pawsdrop); */
}
void
{
lprint(" \n");
lprint("UDP stats:\n");
}
void
{
lprint(" \n");
lprint("ICMP stats:\n");
}
void
{
struct mbuf *m;
int i;
lprint(" \n");
lprint("Mbuf stats:\n");
i = 0;
i++;
lprint(" %6d mbufs on free list\n", i);
i = 0;
i++;
lprint(" %6d mbufs on used list\n", i);
}
void
{
char buff[256];
int n;
lprint(" \n");
"Proto[state] Sock Local Address, Port Remote Address, Port RecvQ SendQ\n");
/* { */
while (n < 17)
buff[n++] = ' ';
buff[17] = 0;
lprint("%s %3d %15s %5d ",
lprint("%15s %5d %5d %5d\n",
}
/* { */
while (n < 17)
buff[n++] = ' ';
buff[17] = 0;
lprint("%s %3d %15s %5d ",
lprint("%15s %5d %5d %5d\n",
}
}
#endif
static DECLCALLBACK(size_t)
void *pvUser)
{
}
static DECLCALLBACK(size_t)
void *pvUser)
{
int status = 0;
}
static DECLCALLBACK(size_t)
void *pvUser)
{
#ifdef RT_OS_WINDOWS
bool fDelim = false;
cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "events=%02x (", pNetworkEvents->lNetworkEvents);
{ \
fDelim = true; \
}
#endif
return cb;
}
#if 0
/*
* Debugging
*/
{
int err = WSAGetLastError();
return err;
}
#endif
int
{
int rc = VINF_SUCCESS;
static int g_fFormatRegistered;
if (!g_fFormatRegistered)
{
/*
* XXX Move this to IPRT using RTNETADDRIPV4. Use the specifier %RNAipv4.
*/
g_fFormatRegistered = 1;
}
return rc;
}