fillin udp connection info

This commit is contained in:
Doug MacEachern 2005-03-12 02:38:34 +00:00
parent 7bb832181c
commit 3cde52b59f
1 changed files with 18 additions and 0 deletions

View File

@ -1894,6 +1894,24 @@ static int udp_connection_list_get(sigar_t *sigar,
char *end = (char *)entry + len;
while ((char *)entry < end) {
int state = entry->udpEntryInfo.ue_state;
/* XXX dunno if this state check is right */
if (((flags & SIGAR_NETCONN_SERVER) && (state == MIB2_UDP_idle)) ||
((flags & SIGAR_NETCONN_CLIENT) && (state != MIB2_UDP_idle)))
{
sigar_net_connection_t *conn;
SIGAR_NET_CONNLIST_GROW(connlist);
conn = &connlist->data[connlist->number++];
ip_format(conn->local_address, entry->udpLocalAddress);
SIGAR_SSTRCPY(conn->remote_address, "0.0.0.0");
conn->local_port = entry->udpLocalPort;
conn->remote_port = 0;
conn->type = SIGAR_NETCONN_UDP;
}
entry++;
}