xref: /csrg-svn/sys/netinet/tcp_var.h (revision 23197)
1*23197Smckusick /*
2*23197Smckusick  * Copyright (c) 1982 Regents of the University of California.
3*23197Smckusick  * All rights reserved.  The Berkeley software License Agreement
4*23197Smckusick  * specifies the terms and conditions for redistribution.
5*23197Smckusick  *
6*23197Smckusick  *	@(#)tcp_var.h	6.3 (Berkeley) 06/08/85
7*23197Smckusick  */
84808Swnj 
94808Swnj /*
104808Swnj  * Kernel variables for tcp.
114808Swnj  */
124808Swnj 
134808Swnj /*
145166Swnj  * Tcp control block, one per tcp; fields:
154808Swnj  */
164881Swnj struct tcpcb {
175076Swnj 	struct	tcpiphdr *seg_next;	/* sequencing queue */
185076Swnj 	struct	tcpiphdr *seg_prev;
195246Sroot 	short	t_state;		/* state of this connection */
205092Swnj 	short	t_timer[TCPT_NTIMERS];	/* tcp timers */
215166Swnj 	short	t_rxtshift;		/* log(2) of rexmt exp. backoff */
225092Swnj 	struct	mbuf *t_tcpopt;		/* tcp options */
235092Swnj 	struct	mbuf *t_ipopt;		/* ip options */
245092Swnj 	short	t_maxseg;		/* maximum segment size */
255246Sroot 	char	t_force;		/* 1 if forcing out a byte */
265067Swnj 	u_char	t_flags;
275092Swnj #define	TF_ACKNOW	0x01			/* ack peer immediately */
285092Swnj #define	TF_DELACK	0x02			/* ack, but try to delay it */
295443Swnj #define	TF_DONTKEEP	0x04			/* don't use keep-alives */
305443Swnj #define	TF_NOOPT	0x08			/* don't use tcp options */
314881Swnj 	struct	tcpiphdr *t_template;	/* skeletal packet for transmit */
325067Swnj 	struct	inpcb *t_inpcb;		/* back pointer to internet pcb */
334808Swnj /*
345067Swnj  * The following fields are used as in the protocol specification.
355067Swnj  * See RFC783, Dec. 1981, page 21.
364808Swnj  */
375067Swnj /* send sequence variables */
385067Swnj 	tcp_seq	snd_una;		/* send unacknowledged */
395067Swnj 	tcp_seq	snd_nxt;		/* send next */
405067Swnj 	tcp_seq	snd_up;			/* send urgent pointer */
415067Swnj 	tcp_seq	snd_wl1;		/* window update seg seq number */
425067Swnj 	tcp_seq	snd_wl2;		/* window update seg ack number */
435067Swnj 	tcp_seq	iss;			/* initial send sequence number */
445246Sroot 	u_short	snd_wnd;		/* send window */
455067Swnj /* receive sequence variables */
465246Sroot 	short	rcv_wnd;		/* receive window */
475067Swnj 	tcp_seq	rcv_nxt;		/* receive next */
485067Swnj 	tcp_seq	rcv_up;			/* receive urgent pointer */
495067Swnj 	tcp_seq	irs;			/* initial receive sequence number */
505067Swnj /*
515067Swnj  * Additional variables for this implementation.
525067Swnj  */
535076Swnj /* receive variables */
545076Swnj 	tcp_seq	rcv_adv;		/* advertised window */
555067Swnj /* retransmit variables */
565092Swnj 	tcp_seq	snd_max;		/* highest sequence number sent
5717359Skarels 					 * used to recognize retransmits
5817359Skarels 					 */
5917359Skarels /* congestion control (for source quench) */
6017359Skarels 	u_short	snd_cwnd;		/* congestion-controlled window */
615166Swnj /* transmit timing stuff */
625166Swnj 	short	t_idle;			/* inactivity time */
635166Swnj 	short	t_rtt;			/* round trip time */
645166Swnj 	tcp_seq	t_rtseq;		/* sequence number being timed */
655166Swnj 	float	t_srtt;			/* smoothed round-trip time */
665443Swnj /* out-of-band data */
675443Swnj 	char	t_oobflags;		/* have some */
685550Swnj 	char	t_iobc;			/* input character */
695443Swnj #define	TCPOOB_HAVEDATA	0x01
705067Swnj };
714808Swnj 
724881Swnj #define	intotcpcb(ip)	((struct tcpcb *)(ip)->inp_ppcb)
734881Swnj #define	sototcpcb(so)	(intotcpcb(sotoinpcb(so)))
744881Swnj 
754926Swnj struct	tcpstat {
764926Swnj 	int	tcps_badsum;
774926Swnj 	int	tcps_badoff;
784926Swnj 	int	tcps_hdrops;
794926Swnj 	int	tcps_badsegs;
804926Swnj 	int	tcps_unack;
814926Swnj };
824926Swnj 
834808Swnj #ifdef KERNEL
845067Swnj struct	inpcb tcb;		/* head of queue of active tcpcb's */
855067Swnj struct	tcpstat tcpstat;	/* tcp statistics */
864881Swnj struct	tcpiphdr *tcp_template();
8710398Ssam struct	tcpcb *tcp_close(), *tcp_drop();
8810398Ssam struct	tcpcb *tcp_timers(), *tcp_disconnect(), *tcp_usrclosed();
894808Swnj #endif
90