VirtualBox

Changeset 15238 in vbox


Ignore:
Timestamp:
Dec 10, 2008 10:37:57 AM (16 years ago)
Author:
vboxsync
Message:

slirp: added %R[natsock] format specifier

File:
1 edited

Legend:

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

    r15117 r15238  
    233233}
    234234
     235static DECLCALLBACK(size_t)
     236print_socket(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
     237             const char *pszType, void const *pvValue,
     238             int cchWidth, int cchPrecision, unsigned fFlags,
     239             void *pvUser)
     240{
     241    struct socket *so = (struct socket*)pvValue;
     242    uint32_t ip;
     243
     244    AssertReturn(strcmp(pszType, "natsock") == 0, 0);
     245
     246    ip = ntohl(so->so_faddr.s_addr);
     247    return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "socket %4d: state=%04x ip=%u.%u.%u.%u",
     248           so->s, so->so_state, (ip >> 24), (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff);
     249}
     250
    235251int
    236252debug_init()
     
    247263        rc = RTStrFormatTypeRegister("IP4", print_ipv4_address, NULL);
    248264        AssertRC(rc);
     265        rc = RTStrFormatTypeRegister("natsock", print_socket, NULL);
     266        AssertRC(rc);
    249267        g_fFormatRegistered = 1;
    250268    }
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