tcprmss.c,v

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

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


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

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


desc
@@


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

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

/*------------------------------------------------------------------------
 *  tcprmss - set receive MSS option
 *------------------------------------------------------------------------
 */
int tcprmss(ptcb, pip)
struct	tcb	*ptcb;
struct	ip	*pip;
{
	struct	tcp	*ptcp = (struct tcp *)pip->ip_data;
	int		mss, hlen, olen, i;

	hlen = TCP_HLEN(ptcp);
	olen = 2 + sizeof(short);
	pip->ip_data[hlen] = TPO_MSS;		/* option kind		*/
	pip->ip_data[hlen+1] = olen;		/* option length	*/
	mss = ptcb->tcb_rmss;
	for (i=olen-1; i>1; i--) {
		pip->ip_data[hlen+i] = mss & LOWBYTE;
		mss >>= 8;
	}
	hlen += olen + 3;	/* +3 for proper rounding below */
	/* header length is high 4 bits of tcp_offset, in longs	*/
	ptcp->tcp_offset = ((hlen<<2) & 0xf0) | ptcp->tcp_offset & 0xf;
}
@


1.1
log
@Initial revision
@
text
@d22 1
a22 1
	mss = hs2net((short)ptcb->tcb_smss);
@

⌨️ 快捷键说明

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