247
247
AssertReturn(strcmp(pszType, "ether") == 0, 0);
248
248
if (ether != NULL)
249
return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
249
return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
250
250
"[ether %hhx:%hhx:%hhx:%hhx:%hhx:%hhx]",
251
ether[0], ether[1], ether[2],
251
ether[0], ether[1], ether[2],
252
252
ether[3], ether[4], ether[5]);
254
254
return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "[ether null]");
270
270
AssertReturn(strcmp(pszType, "natsock") == 0, 0);
272
return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
272
return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
273
273
"socket is null");
274
if (so->so_state == SS_NOFDREF || so->s == -1)
275
return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
274
if (so->so_state == SS_NOFDREF || so->s == -1)
275
return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
276
276
"socket(%d) SS_NODREF",so->s);
277
277
status = getsockname(so->s, &addr, &socklen);
279
if(status != 0 || addr.sa_family != AF_INET)
279
if (status != 0 || addr.sa_family != AF_INET)
281
return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
281
return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
282
282
"socket(%d) is invalid(probably closed)",so->s);
287
287
return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "socket %4d:(proto:%u) "
288
288
"state=%04x ip=" IP4_ADDR_PRINTF_FORMAT ":%d "
289
289
"name=" IP4_ADDR_PRINTF_FORMAT ":%d",
290
so->s, so->so_type, so->so_state, IP4_ADDR_PRINTF_DECOMP(ip),
290
so->s, so->so_type, so->so_state, IP4_ADDR_PRINTF_DECOMP(ip),
292
292
IP4_ADDR_PRINTF_DECOMP(ntohl(in_addr->sin_addr.s_addr)),
293
293
ntohs(in_addr->sin_port));
307
307
AssertReturn(strcmp(pszType, "natwinnetevents") == 0, 0);
309
cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "events=%02x (",
309
cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "events=%02x (",
310
310
pNetworkEvents->lNetworkEvents);
311
311
# define DO_BIT(bit) \
312
312
if (pNetworkEvents->lNetworkEvents & FD_ ## bit) \
351
351
if (!g_fFormatRegistered)
354
* XXX(r - frank): Move this to IPRT using RTNETADDRIPV4.
354
* XXX(r - frank): Move this to IPRT using RTNETADDRIPV4.
355
355
* Use the specifier %RNAipv4.
357
357
rc = RTStrFormatTypeRegister("IP4", print_ipv4_address, NULL);
361
361
rc = RTStrFormatTypeRegister("natsock", print_socket, NULL);
363
rc = RTStrFormatTypeRegister("natwinnetevents",
363
rc = RTStrFormatTypeRegister("natwinnetevents",
364
364
print_networkevents, NULL);
366
366
g_fFormatRegistered = 1;