- Timestamp:
- May 10, 2012 7:11:01 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/debug.c
r39430 r41228 74 74 DEBUGSTRSOCKETSTATE_HELPER(SS_FACCEPTCONN), 75 75 DEBUGSTRSOCKETSTATE_HELPER(SS_FACCEPTONCE), 76 }; 77 78 static DEBUGSTRSOCKETSTATE g_aTcpFlags[] = 79 { 80 DEBUGSTRSOCKETSTATE_HELPER(TH_FIN), 81 DEBUGSTRSOCKETSTATE_HELPER(TH_SYN), 82 DEBUGSTRSOCKETSTATE_HELPER(TH_RST), 83 DEBUGSTRSOCKETSTATE_HELPER(TH_PUSH), 84 DEBUGSTRSOCKETSTATE_HELPER(TH_ACK), 85 DEBUGSTRSOCKETSTATE_HELPER(TH_URG), 76 86 }; 77 87 … … 296 306 { 297 307 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 298 "socket(%d) is invalid( probably closed)", so->s);308 "socket(%d) is invalid(%s)", so->s, strerror(errno)); 299 309 } 300 310 … … 302 312 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "socket %d:(proto:%u) exp. in %d " 303 313 "state=%R[natsockstate] " 314 "fUnderPolling:%RTbool " 315 "fShouldBeRemoved:%RTbool " 304 316 "f_(addr:port)=%RTnaipv4:%d " 305 317 "l_(addr:port)=%RTnaipv4:%d " … … 308 320 so->so_expire ? so->so_expire - curtime : 0, 309 321 so->so_state, 322 so->fUnderPolling, 323 so->fShouldBeRemoved, 310 324 so->so_faddr.s_addr, 311 325 RT_N2H_U16(so->so_fport), … … 420 434 cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%s", pszTcpStateName); 421 435 return cb; 436 } 437 438 /* 439 * Prints TCP flags 440 */ 441 static DECLCALLBACK(size_t) 442 printTcpFlags(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, 443 const char *pszType, void const *pvValue, 444 int cchWidth, int cchPrecision, unsigned fFlags, 445 void *pvUser) 446 { 447 size_t cbPrint = 0; 448 uint32_t u32TcpFlags = (uint32_t)(uintptr_t)pvValue; 449 bool fSingleValue = true; 450 int idxTcpFlags = 0; 451 NOREF(cchWidth); 452 NOREF(cchPrecision); 453 NOREF(fFlags); 454 NOREF(pvUser); 455 AssertReturn(RTStrCmp(pszType, "tcpflags") == 0, 0); 456 cbPrint += RTStrFormat(pfnOutput, 457 pvArgOutput, 458 NULL, 459 0, 460 "tcpflags: %RX8 [", (uint8_t)u32TcpFlags); 461 for (idxTcpFlags = 0; idxTcpFlags < RT_ELEMENTS(g_aTcpFlags); ++idxTcpFlags) 462 { 463 if (u32TcpFlags & g_aTcpFlags[idxTcpFlags].u32SocketState) 464 { 465 cbPrint += RTStrFormat(pfnOutput, 466 pvArgOutput, 467 NULL, 468 0, 469 fSingleValue ? "%s(%RX8)" : "|%s(%RX8)", 470 g_aTcpFlags[idxTcpFlags].pcszSocketStateName, 471 (uint8_t)g_aTcpFlags[idxTcpFlags].u32SocketState); 472 fSingleValue = false; 473 } 474 } 475 cbPrint += RTStrFormat(pfnOutput, 476 pvArgOutput, 477 NULL, 478 0, 479 "]"); 480 return cbPrint; 422 481 } 423 482 … … 568 627 rc = RTStrFormatTypeRegister("tcpseg793", printTcpSegmentRfc793, NULL); AssertRC(rc); 569 628 rc = RTStrFormatTypeRegister("tcpstate", printTcpState, NULL); AssertRC(rc); 629 rc = RTStrFormatTypeRegister("tcpflags", printTcpFlags, NULL); AssertRC(rc); 570 630 rc = RTStrFormatTypeRegister("sbuf", printSbuf, NULL); AssertRC(rc); 571 631 rc = RTStrFormatTypeRegister("mzone", printMbufZone, NULL); AssertRC(rc);
Note:
See TracChangeset
for help on using the changeset viewer.