fillin net_connection.state

This commit is contained in:
Doug MacEachern 2005-03-11 17:11:30 +00:00
parent d0c0043afe
commit 3c0527670c
1 changed files with 12 additions and 14 deletions

View File

@ -1993,7 +1993,6 @@ static int net_conn_get_tcp(sigar_t *sigar,
for (i = 0; i < tcp->dwNumEntries; i++) { for (i = 0; i < tcp->dwNumEntries; i++) {
sigar_net_connection_t conn; sigar_net_connection_t conn;
int tcp_state;
DWORD state = tcp->table[i].dwState; DWORD state = tcp->table[i].dwState;
if (flags & SIGAR_NETCONN_SERVER) { if (flags & SIGAR_NETCONN_SERVER) {
@ -2022,45 +2021,44 @@ static int net_conn_get_tcp(sigar_t *sigar,
switch (state) { switch (state) {
case MIB_TCP_STATE_CLOSED: case MIB_TCP_STATE_CLOSED:
tcp_state = SIGAR_TCP_CLOSE; conn.state = SIGAR_TCP_CLOSE;
break; break;
case MIB_TCP_STATE_LISTEN: case MIB_TCP_STATE_LISTEN:
tcp_state = SIGAR_TCP_LISTEN; conn.state = SIGAR_TCP_LISTEN;
break; break;
case MIB_TCP_STATE_SYN_SENT: case MIB_TCP_STATE_SYN_SENT:
tcp_state = SIGAR_TCP_SYN_SENT; conn.state = SIGAR_TCP_SYN_SENT;
break; break;
case MIB_TCP_STATE_SYN_RCVD: case MIB_TCP_STATE_SYN_RCVD:
tcp_state = SIGAR_TCP_SYN_RECV; conn.state = SIGAR_TCP_SYN_RECV;
break; break;
case MIB_TCP_STATE_ESTAB: case MIB_TCP_STATE_ESTAB:
tcp_state = SIGAR_TCP_ESTABLISHED; conn.state = SIGAR_TCP_ESTABLISHED;
break; break;
case MIB_TCP_STATE_FIN_WAIT1: case MIB_TCP_STATE_FIN_WAIT1:
tcp_state = SIGAR_TCP_FIN_WAIT1; conn.state = SIGAR_TCP_FIN_WAIT1;
break; break;
case MIB_TCP_STATE_FIN_WAIT2: case MIB_TCP_STATE_FIN_WAIT2:
tcp_state = SIGAR_TCP_FIN_WAIT2; conn.state = SIGAR_TCP_FIN_WAIT2;
break; break;
case MIB_TCP_STATE_CLOSE_WAIT: case MIB_TCP_STATE_CLOSE_WAIT:
tcp_state = SIGAR_TCP_CLOSE_WAIT; conn.state = SIGAR_TCP_CLOSE_WAIT;
break; break;
case MIB_TCP_STATE_CLOSING: case MIB_TCP_STATE_CLOSING:
tcp_state = SIGAR_TCP_CLOSING; conn.state = SIGAR_TCP_CLOSING;
break; break;
case MIB_TCP_STATE_LAST_ACK: case MIB_TCP_STATE_LAST_ACK:
tcp_state = SIGAR_TCP_LAST_ACK; conn.state = SIGAR_TCP_LAST_ACK;
break; break;
case MIB_TCP_STATE_TIME_WAIT: case MIB_TCP_STATE_TIME_WAIT:
tcp_state = SIGAR_TCP_TIME_WAIT; conn.state = SIGAR_TCP_TIME_WAIT;
break; break;
case MIB_TCP_STATE_DELETE_TCB: case MIB_TCP_STATE_DELETE_TCB:
default: default:
tcp_state = SIGAR_TCP_ESTABLISHED; /*XXX*/ conn.state = SIGAR_TCP_UNKNOWN;
break; break;
} }
/* XXX conn.state = tcp_state */
SIGAR_NET_CONNLIST_GROW(connlist); SIGAR_NET_CONNLIST_GROW(connlist);
memcpy(&connlist->data[connlist->number++], memcpy(&connlist->data[connlist->number++],
&conn, sizeof(conn)); &conn, sizeof(conn));