xref: /csrg-svn/sys/netinet/tcp_var.h (revision 5246)
1 /*	tcp_var.h	4.13	81/12/12	*/
2 
3 /*
4  * Kernel variables for tcp.
5  */
6 
7 /*
8  * Tcp control block, one per tcp; fields:
9  */
10 struct tcpcb {
11 	struct	tcpiphdr *seg_next;	/* sequencing queue */
12 	struct	tcpiphdr *seg_prev;
13 	short	t_state;		/* state of this connection */
14 	short	t_timer[TCPT_NTIMERS];	/* tcp timers */
15 	short	t_rxtshift;		/* log(2) of rexmt exp. backoff */
16 	struct	mbuf *t_tcpopt;		/* tcp options */
17 	struct	mbuf *t_ipopt;		/* ip options */
18 	short	t_maxseg;		/* maximum segment size */
19 	char	t_force;		/* 1 if forcing out a byte */
20 	u_char	t_flags;
21 #define	TF_ACKNOW	0x01			/* ack peer immediately */
22 #define	TF_DELACK	0x02			/* ack, but try to delay it */
23 #define	TF_PUSH		0x04			/* push mode */
24 #define	TF_URG		0x08			/* urgent mode */
25 #define	TF_DONTKEEP	0x10			/* don't use keep-alives */
26 	struct	tcpiphdr *t_template;	/* skeletal packet for transmit */
27 	struct	inpcb *t_inpcb;		/* back pointer to internet pcb */
28 /*
29  * The following fields are used as in the protocol specification.
30  * See RFC783, Dec. 1981, page 21.
31  */
32 /* send sequence variables */
33 	tcp_seq	snd_una;		/* send unacknowledged */
34 	tcp_seq	snd_nxt;		/* send next */
35 	tcp_seq	snd_up;			/* send urgent pointer */
36 	tcp_seq	snd_wl1;		/* window update seg seq number */
37 	tcp_seq	snd_wl2;		/* window update seg ack number */
38 	tcp_seq	iss;			/* initial send sequence number */
39 	u_short	snd_wnd;		/* send window */
40 /* receive sequence variables */
41 	short	rcv_wnd;		/* receive window */
42 	tcp_seq	rcv_nxt;		/* receive next */
43 	tcp_seq	rcv_up;			/* receive urgent pointer */
44 	tcp_seq	irs;			/* initial receive sequence number */
45 /*
46  * Additional variables for this implementation.
47  */
48 /* receive variables */
49 	tcp_seq	rcv_adv;		/* advertised window */
50 /* retransmit variables */
51 	tcp_seq	snd_max;		/* highest sequence number sent
52 					   used to recognize retransmits */
53 /* transmit timing stuff */
54 	short	t_idle;			/* inactivity time */
55 	short	t_rtt;			/* round trip time */
56 	tcp_seq	t_rtseq;		/* sequence number being timed */
57 	float	t_srtt;			/* smoothed round-trip time */
58 };
59 
60 #define	intotcpcb(ip)	((struct tcpcb *)(ip)->inp_ppcb)
61 #define	sototcpcb(so)	(intotcpcb(sotoinpcb(so)))
62 
63 struct	tcpstat {
64 	int	tcps_badsum;
65 	int	tcps_badoff;
66 	int	tcps_hdrops;
67 	int	tcps_badsegs;
68 	int	tcps_unack;
69 };
70 
71 #ifdef KERNEL
72 struct	inpcb tcb;		/* head of queue of active tcpcb's */
73 struct	tcpstat tcpstat;	/* tcp statistics */
74 struct	tcpiphdr *tcp_template();
75 #endif
76