xref: /csrg-svn/sys/netinet/tcp_var.h (revision 5246)
1*5246Sroot /*	tcp_var.h	4.13	81/12/12	*/
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;
13*5246Sroot 	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 */
19*5246Sroot 	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 */
235092Swnj #define	TF_PUSH		0x04			/* push mode */
245092Swnj #define	TF_URG		0x08			/* urgent mode */
255166Swnj #define	TF_DONTKEEP	0x10			/* don't use keep-alives */
264881Swnj 	struct	tcpiphdr *t_template;	/* skeletal packet for transmit */
275067Swnj 	struct	inpcb *t_inpcb;		/* back pointer to internet pcb */
284808Swnj /*
295067Swnj  * The following fields are used as in the protocol specification.
305067Swnj  * See RFC783, Dec. 1981, page 21.
314808Swnj  */
325067Swnj /* send sequence variables */
335067Swnj 	tcp_seq	snd_una;		/* send unacknowledged */
345067Swnj 	tcp_seq	snd_nxt;		/* send next */
355067Swnj 	tcp_seq	snd_up;			/* send urgent pointer */
365067Swnj 	tcp_seq	snd_wl1;		/* window update seg seq number */
375067Swnj 	tcp_seq	snd_wl2;		/* window update seg ack number */
385067Swnj 	tcp_seq	iss;			/* initial send sequence number */
39*5246Sroot 	u_short	snd_wnd;		/* send window */
405067Swnj /* receive sequence variables */
41*5246Sroot 	short	rcv_wnd;		/* receive window */
425067Swnj 	tcp_seq	rcv_nxt;		/* receive next */
435067Swnj 	tcp_seq	rcv_up;			/* receive urgent pointer */
445067Swnj 	tcp_seq	irs;			/* initial receive sequence number */
455067Swnj /*
465067Swnj  * Additional variables for this implementation.
475067Swnj  */
485076Swnj /* receive variables */
495076Swnj 	tcp_seq	rcv_adv;		/* advertised window */
505067Swnj /* retransmit variables */
515092Swnj 	tcp_seq	snd_max;		/* highest sequence number sent
525076Swnj 					   used to recognize retransmits */
535166Swnj /* transmit timing stuff */
545166Swnj 	short	t_idle;			/* inactivity time */
555166Swnj 	short	t_rtt;			/* round trip time */
565166Swnj 	tcp_seq	t_rtseq;		/* sequence number being timed */
575166Swnj 	float	t_srtt;			/* smoothed round-trip time */
585067Swnj };
594808Swnj 
604881Swnj #define	intotcpcb(ip)	((struct tcpcb *)(ip)->inp_ppcb)
614881Swnj #define	sototcpcb(so)	(intotcpcb(sotoinpcb(so)))
624881Swnj 
634926Swnj struct	tcpstat {
644926Swnj 	int	tcps_badsum;
654926Swnj 	int	tcps_badoff;
664926Swnj 	int	tcps_hdrops;
674926Swnj 	int	tcps_badsegs;
684926Swnj 	int	tcps_unack;
694926Swnj };
704926Swnj 
714808Swnj #ifdef KERNEL
725067Swnj struct	inpcb tcb;		/* head of queue of active tcpcb's */
735067Swnj struct	tcpstat tcpstat;	/* tcp statistics */
744881Swnj struct	tcpiphdr *tcp_template();
754808Swnj #endif
76