VirtualBox

Ignore:
Timestamp:
Dec 10, 2008 1:02:10 PM (16 years ago)
Author:
vboxsync
Message:

slirp: added some disabled debug code

Location:
trunk/src/VBox/Devices/Network/slirp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/debug.c

    r15238 r15244  
    249249}
    250250
     251static DECLCALLBACK(size_t)
     252print_networkevents(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
     253                    const char *pszType, void const *pvValue,
     254                    int cchWidth, int cchPrecision, unsigned fFlags,
     255                    void *pvUser)
     256{
     257    WSANETWORKEVENTS *pNetworkEvents = (WSANETWORKEVENTS*)pvValue;
     258    size_t cb;
     259    bool fDelim = false;
     260
     261    AssertReturn(strcmp(pszType, "natwinnetevents") == 0, 0);
     262
     263    cb  = RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "events=%02x (", pNetworkEvents->lNetworkEvents);
     264#define DO_BIT(bit) \
     265    if (pNetworkEvents->lNetworkEvents & FD_ ## bit) \
     266    { \
     267        cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%s" #bit "(%d)", \
     268                          fDelim ? "," : "", pNetworkEvents->iErrorCode[FD_ ## bit ## _BIT]); \
     269        fDelim = true; \
     270    }
     271    DO_BIT(READ);
     272    DO_BIT(WRITE);
     273    DO_BIT(OOB);
     274    DO_BIT(ACCEPT);
     275    DO_BIT(CONNECT);
     276    DO_BIT(CLOSE);
     277    DO_BIT(QOS);
     278#undef DO_BIT
     279    cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, ")");
     280    return cb;
     281}
     282
     283#if 0
     284/*
     285 * Debugging
     286 */
     287int errno_func(const char *file, int line)
     288{
     289    int err = WSAGetLastError();
     290    LogRel(("errno=%d (%s:%d)\n", err, file, line));
     291    return err;
     292}
     293#endif
     294
    251295int
    252296debug_init()
     
    265309        rc = RTStrFormatTypeRegister("natsock", print_socket, NULL);
    266310        AssertRC(rc);
     311        rc = RTStrFormatTypeRegister("natwinnetevents", print_networkevents, NULL);
     312        AssertRC(rc);
    267313        g_fFormatRegistered = 1;
    268314    }
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r15243 r15244  
    724724
    725725            POLL_TCP_EVENTS(rc, error, so, &NetworkEvents);
     726#if 0
     727# if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
     728            LogRel(("  %R[natsock] %R[natwinnetevents]\n", so, &NetworkEvents));
     729# else
     730            LogRel(("  %R[natsock] %s %s %s\n", so, FD_ISSET(so->s, readfds)?"READ":"",
     731                     FD_ISSET(so->s, writefds)?"WRITE":"", FD_ISSET(so->s, xfds)?"OOB":""));
     732# endif
     733#endif
    726734
    727735            /*
  • trunk/src/VBox/Devices/Network/slirp/slirp.h

    r15059 r15244  
    350350#ifdef RT_OS_WINDOWS
    351351# undef errno
    352 # define errno (WSAGetLastError())
    353 #endif
    354 
    355 #endif
     352# if 0 /* debugging */
     353int errno_func(const char *file, int line);
     354#  define errno (errno_func(__FILE__, __LINE__))
     355# else
     356#  define errno (WSAGetLastError())
     357# endif
     358#endif
     359
     360#endif
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette