1 /* 2 * Copyright (c) 1982 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 * 6 * @(#)tcp_var.h 6.3 (Berkeley) 06/08/85 7 */ 8 9 /* 10 * Kernel variables for tcp. 11 */ 12 13 /* 14 * Tcp control block, one per tcp; fields: 15 */ 16 struct tcpcb { 17 struct tcpiphdr *seg_next; /* sequencing queue */ 18 struct tcpiphdr *seg_prev; 19 short t_state; /* state of this connection */ 20 short t_timer[TCPT_NTIMERS]; /* tcp timers */ 21 short t_rxtshift; /* log(2) of rexmt exp. backoff */ 22 struct mbuf *t_tcpopt; /* tcp options */ 23 struct mbuf *t_ipopt; /* ip options */ 24 short t_maxseg; /* maximum segment size */ 25 char t_force; /* 1 if forcing out a byte */ 26 u_char t_flags; 27 #define TF_ACKNOW 0x01 /* ack peer immediately */ 28 #define TF_DELACK 0x02 /* ack, but try to delay it */ 29 #define TF_DONTKEEP 0x04 /* don't use keep-alives */ 30 #define TF_NOOPT 0x08 /* don't use tcp options */ 31 struct tcpiphdr *t_template; /* skeletal packet for transmit */ 32 struct inpcb *t_inpcb; /* back pointer to internet pcb */ 33 /* 34 * The following fields are used as in the protocol specification. 35 * See RFC783, Dec. 1981, page 21. 36 */ 37 /* send sequence variables */ 38 tcp_seq snd_una; /* send unacknowledged */ 39 tcp_seq snd_nxt; /* send next */ 40 tcp_seq snd_up; /* send urgent pointer */ 41 tcp_seq snd_wl1; /* window update seg seq number */ 42 tcp_seq snd_wl2; /* window update seg ack number */ 43 tcp_seq iss; /* initial send sequence number */ 44 u_short snd_wnd; /* send window */ 45 /* receive sequence variables */ 46 short rcv_wnd; /* receive window */ 47 tcp_seq rcv_nxt; /* receive next */ 48 tcp_seq rcv_up; /* receive urgent pointer */ 49 tcp_seq irs; /* initial receive sequence number */ 50 /* 51 * Additional variables for this implementation. 52 */ 53 /* receive variables */ 54 tcp_seq rcv_adv; /* advertised window */ 55 /* retransmit variables */ 56 tcp_seq snd_max; /* highest sequence number sent 57 * used to recognize retransmits 58 */ 59 /* congestion control (for source quench) */ 60 u_short snd_cwnd; /* congestion-controlled window */ 61 /* transmit timing stuff */ 62 short t_idle; /* inactivity time */ 63 short t_rtt; /* round trip time */ 64 tcp_seq t_rtseq; /* sequence number being timed */ 65 float t_srtt; /* smoothed round-trip time */ 66 /* out-of-band data */ 67 char t_oobflags; /* have some */ 68 char t_iobc; /* input character */ 69 #define TCPOOB_HAVEDATA 0x01 70 }; 71 72 #define intotcpcb(ip) ((struct tcpcb *)(ip)->inp_ppcb) 73 #define sototcpcb(so) (intotcpcb(sotoinpcb(so))) 74 75 struct tcpstat { 76 int tcps_badsum; 77 int tcps_badoff; 78 int tcps_hdrops; 79 int tcps_badsegs; 80 int tcps_unack; 81 }; 82 83 #ifdef KERNEL 84 struct inpcb tcb; /* head of queue of active tcpcb's */ 85 struct tcpstat tcpstat; /* tcp statistics */ 86 struct tcpiphdr *tcp_template(); 87 struct tcpcb *tcp_close(), *tcp_drop(); 88 struct tcpcb *tcp_timers(), *tcp_disconnect(), *tcp_usrclosed(); 89 #endif 90