xref: /csrg-svn/sys/netinet/tcp_var.h (revision 29156)
123197Smckusick /*
2*29156Smckusick  * Copyright (c) 1982, 1986 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*29156Smckusick  *	@(#)tcp_var.h	7.1 (Berkeley) 06/05/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 */
2327068Skarels 	u_short	t_maxseg;		/* maximum segment size */
245246Sroot 	char	t_force;		/* 1 if forcing out a byte */
255067Swnj 	u_char	t_flags;
2625894Skarels #define	TF_ACKNOW	0x01		/* ack peer immediately */
2725894Skarels #define	TF_DELACK	0x02		/* ack, but try to delay it */
2825894Skarels #define	TF_NODELAY	0x04		/* don't delay packets to coalesce */
2925894Skarels #define	TF_NOOPT	0x08		/* don't use tcp options */
3027068Skarels #define	TF_SENTFIN	0x10		/* have sent FIN */
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 */
4625894Skarels 	u_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 */
6424822Skarels 	u_short max_rcvd;		/* most peer has sent into window */
655166Swnj 	tcp_seq	t_rtseq;		/* sequence number being timed */
665166Swnj 	float	t_srtt;			/* smoothed round-trip time */
6725262Skarels 	u_short	max_sndwnd;		/* largest window peer has offered */
685443Swnj /* out-of-band data */
695443Swnj 	char	t_oobflags;		/* have some */
705550Swnj 	char	t_iobc;			/* input character */
715443Swnj #define	TCPOOB_HAVEDATA	0x01
7224822Skarels #define	TCPOOB_HADDATA	0x02
735067Swnj };
744808Swnj 
754881Swnj #define	intotcpcb(ip)	((struct tcpcb *)(ip)->inp_ppcb)
764881Swnj #define	sototcpcb(so)	(intotcpcb(sotoinpcb(so)))
774881Swnj 
784926Swnj struct	tcpstat {
794926Swnj 	int	tcps_badsum;
804926Swnj 	int	tcps_badoff;
814926Swnj 	int	tcps_hdrops;
824926Swnj 	int	tcps_badsegs;
834926Swnj 	int	tcps_unack;
844926Swnj };
854926Swnj 
864808Swnj #ifdef KERNEL
875067Swnj struct	inpcb tcb;		/* head of queue of active tcpcb's */
885067Swnj struct	tcpstat tcpstat;	/* tcp statistics */
894881Swnj struct	tcpiphdr *tcp_template();
9010398Ssam struct	tcpcb *tcp_close(), *tcp_drop();
9110398Ssam struct	tcpcb *tcp_timers(), *tcp_disconnect(), *tcp_usrclosed();
924808Swnj #endif
93