xref: /csrg-svn/sys/netinet/tcp_var.h (revision 5092)
1*5092Swnj /*	tcp_var.h	4.9	81/11/26	*/
24808Swnj 
34808Swnj /*
44808Swnj  * Kernel variables for tcp.
54808Swnj  */
64808Swnj 
74808Swnj /*
84808Swnj  * Tcp control block.
94808Swnj  */
104881Swnj struct tcpcb {
115076Swnj 	struct	tcpiphdr *seg_next;	/* sequencing queue */
125076Swnj 	struct	tcpiphdr *seg_prev;
135076Swnj 	int	t_state;		/* state of this connection */
14*5092Swnj 	int	t_seqcnt;		/* count of chars in seq queue */
15*5092Swnj 	short	t_timer[TCPT_NTIMERS];	/* tcp timers */
16*5092Swnj 	struct	mbuf *t_tcpopt;		/* tcp options */
17*5092Swnj 	struct	mbuf *t_ipopt;		/* ip options */
18*5092Swnj 	short	t_maxseg;		/* maximum segment size */
195067Swnj 	u_char	t_flags;
20*5092Swnj #define	TF_ACKNOW	0x01			/* ack peer immediately */
21*5092Swnj #define	TF_DELACK	0x02			/* ack, but try to delay it */
22*5092Swnj #define	TF_PUSH		0x04			/* push mode */
23*5092Swnj #define	TF_URG		0x08			/* urgent mode */
24*5092Swnj #define	TF_KEEP		0x10			/* use keep-alives */
254881Swnj 	struct	tcpiphdr *t_template;	/* skeletal packet for transmit */
265067Swnj 	struct	inpcb *t_inpcb;		/* back pointer to internet pcb */
274808Swnj /*
285067Swnj  * The following fields are used as in the protocol specification.
295067Swnj  * See RFC783, Dec. 1981, page 21.
304808Swnj  */
315067Swnj /* send sequence variables */
325067Swnj 	tcp_seq	snd_una;		/* send unacknowledged */
335067Swnj 	tcp_seq	snd_nxt;		/* send next */
345067Swnj 	u_short	snd_wnd;		/* send window */
355067Swnj 	tcp_seq	snd_up;			/* send urgent pointer */
365067Swnj 	tcp_seq	snd_wl1;		/* window update seg seq number */
375067Swnj 	tcp_seq	snd_wl2;		/* window update seg ack number */
385067Swnj 	tcp_seq	iss;			/* initial send sequence number */
395067Swnj /* receive sequence variables */
405067Swnj 	tcp_seq	rcv_nxt;		/* receive next */
415067Swnj 	u_short	rcv_wnd;		/* receive window */
425067Swnj 	tcp_seq	rcv_up;			/* receive urgent pointer */
435067Swnj 	tcp_seq	irs;			/* initial receive sequence number */
445067Swnj /*
455067Swnj  * Additional variables for this implementation.
465067Swnj  */
475076Swnj /* receive variables */
485076Swnj 	tcp_seq	rcv_adv;		/* advertised window */
495067Swnj /* retransmit variables */
50*5092Swnj 	tcp_seq	snd_max;		/* highest sequence number sent
515076Swnj 					   used to recognize retransmits */
52*5092Swnj 	tcp_seq	rxt_seq;
53*5092Swnj 	short	rxt_time;
54*5092Swnj 	short	rxt_cnt;
555067Swnj };
564808Swnj 
57*5092Swnj #define	tcp_finisacked(tp)	0		/* XXX */
58*5092Swnj 
594881Swnj #define	intotcpcb(ip)	((struct tcpcb *)(ip)->inp_ppcb)
604881Swnj #define	sototcpcb(so)	(intotcpcb(sotoinpcb(so)))
614881Swnj 
62*5092Swnj #define	TCP_ISSINCR	128		/* increment for iss each second */
634808Swnj 
644926Swnj struct	tcpstat {
654926Swnj 	int	tcps_badsum;
664926Swnj 	int	tcps_badoff;
674926Swnj 	int	tcps_hdrops;
684926Swnj 	int	tcps_badsegs;
694926Swnj 	int	tcps_unack;
704926Swnj };
714926Swnj 
724808Swnj #ifdef KERNEL
735067Swnj struct	inpcb tcb;		/* head of queue of active tcpcb's */
745067Swnj struct	tcpstat tcpstat;	/* tcp statistics */
754881Swnj struct	tcpiphdr *tcp_template();
764808Swnj #endif
77