xref: /original-bsd/sys/netinet/tcp_var.h (revision 957a0273)
1 /*	tcp_var.h	4.16	82/01/18	*/
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_DONTKEEP	0x04			/* don't use keep-alives */
24 #define	TF_NOOPT	0x08			/* don't use tcp options */
25 #ifdef TCPTRUEOOB
26 #define	TF_DOOOB	0x10			/* do use out of band data */
27 #endif
28 	struct	tcpiphdr *t_template;	/* skeletal packet for transmit */
29 	struct	inpcb *t_inpcb;		/* back pointer to internet pcb */
30 /*
31  * The following fields are used as in the protocol specification.
32  * See RFC783, Dec. 1981, page 21.
33  */
34 /* send sequence variables */
35 	tcp_seq	snd_una;		/* send unacknowledged */
36 	tcp_seq	snd_nxt;		/* send next */
37 	tcp_seq	snd_up;			/* send urgent pointer */
38 	tcp_seq	snd_wl1;		/* window update seg seq number */
39 	tcp_seq	snd_wl2;		/* window update seg ack number */
40 	tcp_seq	iss;			/* initial send sequence number */
41 	u_short	snd_wnd;		/* send window */
42 /* receive sequence variables */
43 	short	rcv_wnd;		/* receive window */
44 	tcp_seq	rcv_nxt;		/* receive next */
45 	tcp_seq	rcv_up;			/* receive urgent pointer */
46 	tcp_seq	irs;			/* initial receive sequence number */
47 /*
48  * Additional variables for this implementation.
49  */
50 /* receive variables */
51 	tcp_seq	rcv_adv;		/* advertised window */
52 /* retransmit variables */
53 	tcp_seq	snd_max;		/* highest sequence number sent
54 					   used to recognize retransmits */
55 /* transmit timing stuff */
56 	short	t_idle;			/* inactivity time */
57 	short	t_rtt;			/* round trip time */
58 	tcp_seq	t_rtseq;		/* sequence number being timed */
59 	float	t_srtt;			/* smoothed round-trip time */
60 /* out-of-band data */
61 	char	t_oobflags;		/* have some */
62 	char	t_iobc;			/* input character */
63 #define	TCPOOB_HAVEDATA	0x01
64 
65 #ifdef TCPTRUEOOB
66 #define	TCPOOB_OWEACK	0x02
67 #define	TCPOOB_NEEDACK	0x04
68 	u_char	t_iobseq;		/* input receive sequence number */
69 	tcp_seq	t_oobmark;		/* output mark position */
70 	char	t_oobc;			/* output character */
71 	u_char	t_oobseq;		/* output transmit sequence number */
72 #endif
73 };
74 
75 #define	intotcpcb(ip)	((struct tcpcb *)(ip)->inp_ppcb)
76 #define	sototcpcb(so)	(intotcpcb(sotoinpcb(so)))
77 
78 struct	tcpstat {
79 	int	tcps_badsum;
80 	int	tcps_badoff;
81 	int	tcps_hdrops;
82 	int	tcps_badsegs;
83 	int	tcps_unack;
84 };
85 
86 #ifdef KERNEL
87 struct	inpcb tcb;		/* head of queue of active tcpcb's */
88 struct	tcpstat tcpstat;	/* tcp statistics */
89 struct	tcpiphdr *tcp_template();
90 #endif
91