use sigar_inet_ntoa
This commit is contained in:
parent
bd8c153973
commit
f019d2594b
|
@ -806,15 +806,6 @@ int sigar_net_interface_stat_get(sigar_t *sigar, const char *name,
|
||||||
return SIGAR_OK;
|
return SIGAR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ip_format(char *buffer, int buflen, ip_addr ip)
|
|
||||||
{
|
|
||||||
sprintf(buffer, "%d.%d.%d.%d",
|
|
||||||
((ip >> 24) & 0xFF),
|
|
||||||
((ip >> 16) & 0xFF),
|
|
||||||
((ip >> 8) & 0xFF),
|
|
||||||
((ip) & 0xFF));
|
|
||||||
}
|
|
||||||
|
|
||||||
#define IS_TCP_SERVER(state, flags) \
|
#define IS_TCP_SERVER(state, flags) \
|
||||||
((flags & SIGAR_NETCONN_SERVER) && (state == TCLISTEN))
|
((flags & SIGAR_NETCONN_SERVER) && (state == TCLISTEN))
|
||||||
|
|
||||||
|
@ -916,13 +907,11 @@ static int net_conn_get_tcp(sigar_t *sigar,
|
||||||
conn.remote_port = entry->RemPort;
|
conn.remote_port = entry->RemPort;
|
||||||
conn.type = SIGAR_NETCONN_TCP;
|
conn.type = SIGAR_NETCONN_TCP;
|
||||||
|
|
||||||
ip_format(conn.local_address,
|
sigar_inet_ntoa(sigar, entry->LocalAddress,
|
||||||
sizeof(conn.local_address),
|
conn.local_address);
|
||||||
entry->LocalAddress);
|
|
||||||
|
|
||||||
ip_format(conn.remote_address,
|
sigar_inet_ntoa(sigar, entry->RemAddress,
|
||||||
sizeof(conn.remote_address),
|
conn.remote_address);
|
||||||
entry->RemAddress);
|
|
||||||
|
|
||||||
conn.send_queue = conn.receive_queue = SIGAR_FIELD_NOTIMPL;
|
conn.send_queue = conn.receive_queue = SIGAR_FIELD_NOTIMPL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue