xref: /csrg-svn/sys/netinet/tcp_var.h (revision 5443)
1*5443Swnj /*	tcp_var.h	4.15	82/01/17	*/
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 */
23*5443Swnj #define	TF_DONTKEEP	0x04			/* don't use keep-alives */
24*5443Swnj #define	TF_NOOPT	0x08			/* don't use tcp options */
25*5443Swnj #ifdef TCPTRUEOOB
26*5443Swnj #define	TF_DOOOB	0x10			/* do use out of band data */
27*5443Swnj #endif
284881Swnj 	struct	tcpiphdr *t_template;	/* skeletal packet for transmit */
295067Swnj 	struct	inpcb *t_inpcb;		/* back pointer to internet pcb */
304808Swnj /*
315067Swnj  * The following fields are used as in the protocol specification.
325067Swnj  * See RFC783, Dec. 1981, page 21.
334808Swnj  */
345067Swnj /* send sequence variables */
355067Swnj 	tcp_seq	snd_una;		/* send unacknowledged */
365067Swnj 	tcp_seq	snd_nxt;		/* send next */
375067Swnj 	tcp_seq	snd_up;			/* send urgent pointer */
385067Swnj 	tcp_seq	snd_wl1;		/* window update seg seq number */
395067Swnj 	tcp_seq	snd_wl2;		/* window update seg ack number */
405067Swnj 	tcp_seq	iss;			/* initial send sequence number */
415246Sroot 	u_short	snd_wnd;		/* send window */
425067Swnj /* receive sequence variables */
435246Sroot 	short	rcv_wnd;		/* receive window */
445067Swnj 	tcp_seq	rcv_nxt;		/* receive next */
455067Swnj 	tcp_seq	rcv_up;			/* receive urgent pointer */
465067Swnj 	tcp_seq	irs;			/* initial receive sequence number */
475067Swnj /*
485067Swnj  * Additional variables for this implementation.
495067Swnj  */
505076Swnj /* receive variables */
515076Swnj 	tcp_seq	rcv_adv;		/* advertised window */
525067Swnj /* retransmit variables */
535092Swnj 	tcp_seq	snd_max;		/* highest sequence number sent
545076Swnj 					   used to recognize retransmits */
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 */
60*5443Swnj /* out-of-band data */
61*5443Swnj 	char	t_oobflags;		/* have some */
62*5443Swnj #define	TCPOOB_HAVEDATA	0x01
63*5443Swnj 
64*5443Swnj #ifdef TCPTRUEOOB
65*5443Swnj #define	TCPOOB_OWEACK	0x02
66*5443Swnj #define	TCPOOB_NEEDACK	0x04
67*5443Swnj 	char	t_iobc;			/* input character */
68*5443Swnj 	u_char	t_iobseq;		/* input receive sequence number */
69*5443Swnj 	char	t_oobc;			/* output character */
70*5443Swnj 	u_char	t_oobseq;		/* output transmit sequence number */
71*5443Swnj #endif
725067Swnj };
734808Swnj 
744881Swnj #define	intotcpcb(ip)	((struct tcpcb *)(ip)->inp_ppcb)
754881Swnj #define	sototcpcb(so)	(intotcpcb(sotoinpcb(so)))
764881Swnj 
774926Swnj struct	tcpstat {
784926Swnj 	int	tcps_badsum;
794926Swnj 	int	tcps_badoff;
804926Swnj 	int	tcps_hdrops;
814926Swnj 	int	tcps_badsegs;
824926Swnj 	int	tcps_unack;
834926Swnj };
844926Swnj 
854808Swnj #ifdef KERNEL
865067Swnj struct	inpcb tcb;		/* head of queue of active tcpcb's */
875067Swnj struct	tcpstat tcpstat;	/* tcp statistics */
884881Swnj struct	tcpiphdr *tcp_template();
894808Swnj #endif
90