Changeset 19802 in vbox
- Timestamp:
- May 19, 2009 6:16:26 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/debug.c
r16448 r19802 246 246 uint32_t ip; 247 247 struct sockaddr addr; 248 struct sockaddr_in *in_addr; 248 249 socklen_t socklen = sizeof(struct sockaddr); 249 250 int status = 0; … … 251 252 AssertReturn(strcmp(pszType, "natsock") == 0, 0); 252 253 if (so == NULL) 253 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "socket is null"); 254 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 255 "socket is null"); 254 256 if (so->so_state == SS_NOFDREF || so->s == -1) 255 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "socket(%d) SS_NODREF",so->s); 257 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 258 "socket(%d) SS_NODREF",so->s); 256 259 status = getsockname(so->s, &addr, &socklen); 257 260 258 261 if(status != 0 || addr.sa_family != AF_INET) 259 262 { 260 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "socket(%d) is invalid(probably closed)",so->s); 261 } 262 263 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 264 "socket(%d) is invalid(probably closed)",so->s); 265 } 266 267 in_addr = (struct sockaddr_in *)&addr; 263 268 ip = ntohl(so->so_faddr.s_addr); 264 269 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "socket %4d:(proto:%u) " 265 "state=%04x ip=" IP4_ADDR_PRINTF_FORMAT ":%d name=" IP4_ADDR_PRINTF_FORMAT ":%d", 266 so->s, so->so_type, so->so_state, IP4_ADDR_PRINTF_DECOMP(ip), ntohs(so->so_fport), 267 IP4_ADDR_PRINTF_DECOMP(ntohl(((struct sockaddr_in *)&addr)->sin_addr.s_addr)), 268 ntohs(((struct sockaddr_in *)&addr)->sin_port)); 270 "state=%04x ip=" IP4_ADDR_PRINTF_FORMAT ":%d " 271 "name=" IP4_ADDR_PRINTF_FORMAT ":%d", 272 so->s, so->so_type, so->so_state, IP4_ADDR_PRINTF_DECOMP(ip), 273 ntohs(so->so_fport), 274 IP4_ADDR_PRINTF_DECOMP(ntohl(in_addr->sin_addr.s_addr)), 275 ntohs(in_addr->sin_port)); 269 276 } 270 277 … … 282 289 AssertReturn(strcmp(pszType, "natwinnetevents") == 0, 0); 283 290 284 cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "events=%02x (", pNetworkEvents->lNetworkEvents); 291 cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "events=%02x (", 292 pNetworkEvents->lNetworkEvents); 285 293 # define DO_BIT(bit) \ 286 if (pNetworkEvents->lNetworkEvents & FD_ ## bit) \ 287 { \ 288 cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%s" #bit "(%d)", \ 289 fDelim ? "," : "", pNetworkEvents->iErrorCode[FD_ ## bit ## _BIT]); \ 290 fDelim = true; \ 294 if (pNetworkEvents->lNetworkEvents & FD_ ## bit) \ 295 { \ 296 cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, \ 297 "%s" #bit "(%d)", fDelim ? "," : "", \ 298 pNetworkEvents->iErrorCode[FD_ ## bit ## _BIT]); \ 299 fDelim = true; \ 291 300 } 292 301 DO_BIT(READ); … … 325 334 { 326 335 /* 327 * XXX Move this to IPRT using RTNETADDRIPV4. Use the specifier %RNAipv4. 336 * XXX(r - frank): Move this to IPRT using RTNETADDRIPV4. 337 * Use the specifier %RNAipv4. 328 338 */ 329 339 rc = RTStrFormatTypeRegister("IP4", print_ipv4_address, NULL); … … 331 341 rc = RTStrFormatTypeRegister("natsock", print_socket, NULL); 332 342 AssertRC(rc); 333 rc = RTStrFormatTypeRegister("natwinnetevents", print_networkevents, NULL); 343 rc = RTStrFormatTypeRegister("natwinnetevents", 344 print_networkevents, NULL); 334 345 AssertRC(rc); 335 346 g_fFormatRegistered = 1;
Note:
See TracChangeset
for help on using the changeset viewer.