xref: /csrg-svn/sys/netinet/tcp_var.h (revision 25894)
123197Smckusick /*
223197Smckusick  * Copyright (c) 1982 Regents of the University of California.
323197Smckusick  * All rights reserved.  The Berkeley software License Agreement
423197Smckusick  * specifies the terms and conditions for redistribution.
523197Smckusick  *
6*25894Skarels  *	@(#)tcp_var.h	6.6 (Berkeley) 01/13/86
723197Smckusick  */
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 	short	t_maxseg;		/* maximum segment size */
245246Sroot 	char	t_force;		/* 1 if forcing out a byte */
255067Swnj 	u_char	t_flags;
26*25894Skarels #define	TF_ACKNOW	0x01		/* ack peer immediately */
27*25894Skarels #define	TF_DELACK	0x02		/* ack, but try to delay it */
28*25894Skarels #define	TF_NODELAY	0x04		/* don't delay packets to coalesce */
29*25894Skarels #define	TF_NOOPT	0x08		/* don't use tcp options */
304881Swnj 	struct	tcpiphdr *t_template;	/* skeletal packet for transmit */
315067Swnj 	struct	inpcb *t_inpcb;		/* back pointer to internet pcb */
324808Swnj /*
335067Swnj  * The following fields are used as in the protocol specification.
345067Swnj  * See RFC783, Dec. 1981, page 21.
354808Swnj  */
365067Swnj /* send sequence variables */
375067Swnj 	tcp_seq	snd_una;		/* send unacknowledged */
385067Swnj 	tcp_seq	snd_nxt;		/* send next */
395067Swnj 	tcp_seq	snd_up;			/* send urgent pointer */
405067Swnj 	tcp_seq	snd_wl1;		/* window update seg seq number */
415067Swnj 	tcp_seq	snd_wl2;		/* window update seg ack number */
425067Swnj 	tcp_seq	iss;			/* initial send sequence number */
435246Sroot 	u_short	snd_wnd;		/* send window */
445067Swnj /* receive sequence variables */
45*25894Skarels 	u_short	rcv_wnd;		/* receive window */
465067Swnj 	tcp_seq	rcv_nxt;		/* receive next */
475067Swnj 	tcp_seq	rcv_up;			/* receive urgent pointer */
485067Swnj 	tcp_seq	irs;			/* initial receive sequence number */
495067Swnj /*
505067Swnj  * Additional variables for this implementation.
515067Swnj  */
525076Swnj /* receive variables */
535076Swnj 	tcp_seq	rcv_adv;		/* advertised window */
545067Swnj /* retransmit variables */
555092Swnj 	tcp_seq	snd_max;		/* highest sequence number sent
5617359Skarels 					 * used to recognize retransmits
5717359Skarels 					 */
5817359Skarels /* congestion control (for source quench) */
5917359Skarels 	u_short	snd_cwnd;		/* congestion-controlled window */
605166Swnj /* transmit timing stuff */
615166Swnj 	short	t_idle;			/* inactivity time */
625166Swnj 	short	t_rtt;			/* round trip time */
6324822Skarels 	u_short max_rcvd;		/* most peer has sent into window */
645166Swnj 	tcp_seq	t_rtseq;		/* sequence number being timed */
655166Swnj 	float	t_srtt;			/* smoothed round-trip time */
6625262Skarels 	u_short	max_sndwnd;		/* largest window peer has offered */
675443Swnj /* out-of-band data */
685443Swnj 	char	t_oobflags;		/* have some */
695550Swnj 	char	t_iobc;			/* input character */
705443Swnj #define	TCPOOB_HAVEDATA	0x01
7124822Skarels #define	TCPOOB_HADDATA	0x02
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();
8910398Ssam struct	tcpcb *tcp_close(), *tcp_drop();
9010398Ssam struct	tcpcb *tcp_timers(), *tcp_disconnect(), *tcp_usrclosed();
914808Swnj #endif
92