xref: /csrg-svn/sys/netinet/tcp_var.h (revision 17359)
1*17359Skarels /*	tcp_var.h	6.2	84/11/14	*/
24808Swnj 
34808Swnj /*
44808Swnj  * Kernel variables for tcp.
54808Swnj  */
64808Swnj 
74808Swnj /*
85166Swnj  * Tcp control block, one per tcp; fields:
94808Swnj  */
104881Swnj struct tcpcb {
115076Swnj 	struct	tcpiphdr *seg_next;	/* sequencing queue */
125076Swnj 	struct	tcpiphdr *seg_prev;
135246Sroot 	short	t_state;		/* state of this connection */
145092Swnj 	short	t_timer[TCPT_NTIMERS];	/* tcp timers */
155166Swnj 	short	t_rxtshift;		/* log(2) of rexmt exp. backoff */
165092Swnj 	struct	mbuf *t_tcpopt;		/* tcp options */
175092Swnj 	struct	mbuf *t_ipopt;		/* ip options */
185092Swnj 	short	t_maxseg;		/* maximum segment size */
195246Sroot 	char	t_force;		/* 1 if forcing out a byte */
205067Swnj 	u_char	t_flags;
215092Swnj #define	TF_ACKNOW	0x01			/* ack peer immediately */
225092Swnj #define	TF_DELACK	0x02			/* ack, but try to delay it */
235443Swnj #define	TF_DONTKEEP	0x04			/* don't use keep-alives */
245443Swnj #define	TF_NOOPT	0x08			/* don't use tcp options */
254881Swnj 	struct	tcpiphdr *t_template;	/* skeletal packet for transmit */
265067Swnj 	struct	inpcb *t_inpcb;		/* back pointer to internet pcb */
274808Swnj /*
285067Swnj  * The following fields are used as in the protocol specification.
295067Swnj  * See RFC783, Dec. 1981, page 21.
304808Swnj  */
315067Swnj /* send sequence variables */
325067Swnj 	tcp_seq	snd_una;		/* send unacknowledged */
335067Swnj 	tcp_seq	snd_nxt;		/* send next */
345067Swnj 	tcp_seq	snd_up;			/* send urgent pointer */
355067Swnj 	tcp_seq	snd_wl1;		/* window update seg seq number */
365067Swnj 	tcp_seq	snd_wl2;		/* window update seg ack number */
375067Swnj 	tcp_seq	iss;			/* initial send sequence number */
385246Sroot 	u_short	snd_wnd;		/* send window */
395067Swnj /* receive sequence variables */
405246Sroot 	short	rcv_wnd;		/* receive window */
415067Swnj 	tcp_seq	rcv_nxt;		/* receive next */
425067Swnj 	tcp_seq	rcv_up;			/* receive urgent pointer */
435067Swnj 	tcp_seq	irs;			/* initial receive sequence number */
445067Swnj /*
455067Swnj  * Additional variables for this implementation.
465067Swnj  */
475076Swnj /* receive variables */
485076Swnj 	tcp_seq	rcv_adv;		/* advertised window */
495067Swnj /* retransmit variables */
505092Swnj 	tcp_seq	snd_max;		/* highest sequence number sent
51*17359Skarels 					 * used to recognize retransmits
52*17359Skarels 					 */
53*17359Skarels /* congestion control (for source quench) */
54*17359Skarels 	u_short	snd_cwnd;		/* congestion-controlled window */
555166Swnj /* transmit timing stuff */
565166Swnj 	short	t_idle;			/* inactivity time */
575166Swnj 	short	t_rtt;			/* round trip time */
585166Swnj 	tcp_seq	t_rtseq;		/* sequence number being timed */
595166Swnj 	float	t_srtt;			/* smoothed round-trip time */
605443Swnj /* out-of-band data */
615443Swnj 	char	t_oobflags;		/* have some */
625550Swnj 	char	t_iobc;			/* input character */
635443Swnj #define	TCPOOB_HAVEDATA	0x01
645067Swnj };
654808Swnj 
664881Swnj #define	intotcpcb(ip)	((struct tcpcb *)(ip)->inp_ppcb)
674881Swnj #define	sototcpcb(so)	(intotcpcb(sotoinpcb(so)))
684881Swnj 
694926Swnj struct	tcpstat {
704926Swnj 	int	tcps_badsum;
714926Swnj 	int	tcps_badoff;
724926Swnj 	int	tcps_hdrops;
734926Swnj 	int	tcps_badsegs;
744926Swnj 	int	tcps_unack;
754926Swnj };
764926Swnj 
774808Swnj #ifdef KERNEL
785067Swnj struct	inpcb tcb;		/* head of queue of active tcpcb's */
795067Swnj struct	tcpstat tcpstat;	/* tcp statistics */
804881Swnj struct	tcpiphdr *tcp_template();
8110398Ssam struct	tcpcb *tcp_close(), *tcp_drop();
8210398Ssam struct	tcpcb *tcp_timers(), *tcp_disconnect(), *tcp_usrclosed();
834808Swnj #endif
84