tcpstat.c,v

来自「TCP-IP红宝书源代码」· C,V 代码 · 共 82 行

C,V
82
字号
head	1.2;
access;
symbols;
locks
	dls:1.2; strict;
comment	@ * @;


1.2
date	97.09.21.19.30.11;	author dls;	state Dist;
branches;
next	1.1;

1.1
date	94.01.14.04.11.50;	author dls;	state v2e1;
branches;
next	;


desc
@@


1.2
log
@pre-3e code
@
text
@/* tcpstat.c - tcpstat */

#include <conf.h>
#include <kernel.h>
#include <network.h>

/*------------------------------------------------------------------------
 *  tcpstat - return status information for a TCP pseudo device
 *------------------------------------------------------------------------
 */
int tcpstat(ptcb, tcps)
struct	tcb	*ptcb;
struct tcpstat	*tcps;
{
	tcps->ts_type = ptcb->tcb_type;
	switch (ptcb->tcb_type) {
	case TCPT_SERVER:
		/* should increase to entire TCP MIB */
		tcps->ts_connects = TcpActiveOpens;
		tcps->ts_aborts = TcpEstabResets;
		tcps->ts_retrans = TcpRetransSegs;
		break;
	case TCPT_CONNECTION:
		tcps->ts_laddr = ptcb->tcb_lip;
		tcps->ts_lport = ptcb->tcb_lport;
		tcps->ts_faddr = ptcb->tcb_rip;
		tcps->ts_fport = ptcb->tcb_rport;
		tcps->ts_rwin = ptcb->tcb_rbsize - ptcb->tcb_rbcount; 
		tcps->ts_swin = ptcb->tcb_swindow;
		tcps->ts_state = ptcb->tcb_state;
		tcps->ts_unacked = ptcb->tcb_suna;
		tcps->ts_prec = 0;
		break;
	case TCPT_MASTER:
		break;
	}
	return OK;
}
@


1.1
log
@Initial revision
@
text
@d24 1
a24 1
		blkcopy(tcps->ts_laddr, ptcb->tcb_lip, IP_ALEN);
d26 1
a26 1
		blkcopy(tcps->ts_faddr, ptcb->tcb_rip, IP_ALEN);
@

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?