1*5550Swnj /* tcp_var.h 4.16 82/01/18 */ 24808Swnj 34808Swnj /* 44808Swnj * Kernel variables for tcp. 54808Swnj */ 64808Swnj 74808Swnj /* 85166Swnj * Tcp control block, one per tcp; fields: 94808Swnj */ 104881Swnj struct tcpcb { 115076Swnj struct tcpiphdr *seg_next; /* sequencing queue */ 125076Swnj struct tcpiphdr *seg_prev; 135246Sroot short t_state; /* state of this connection */ 145092Swnj short t_timer[TCPT_NTIMERS]; /* tcp timers */ 155166Swnj short t_rxtshift; /* log(2) of rexmt exp. backoff */ 165092Swnj struct mbuf *t_tcpopt; /* tcp options */ 175092Swnj struct mbuf *t_ipopt; /* ip options */ 185092Swnj short t_maxseg; /* maximum segment size */ 195246Sroot char t_force; /* 1 if forcing out a byte */ 205067Swnj u_char t_flags; 215092Swnj #define TF_ACKNOW 0x01 /* ack peer immediately */ 225092Swnj #define TF_DELACK 0x02 /* ack, but try to delay it */ 235443Swnj #define TF_DONTKEEP 0x04 /* don't use keep-alives */ 245443Swnj #define TF_NOOPT 0x08 /* don't use tcp options */ 255443Swnj #ifdef TCPTRUEOOB 265443Swnj #define TF_DOOOB 0x10 /* do use out of band data */ 275443Swnj #endif 284881Swnj struct tcpiphdr *t_template; /* skeletal packet for transmit */ 295067Swnj struct inpcb *t_inpcb; /* back pointer to internet pcb */ 304808Swnj /* 315067Swnj * The following fields are used as in the protocol specification. 325067Swnj * See RFC783, Dec. 1981, page 21. 334808Swnj */ 345067Swnj /* send sequence variables */ 355067Swnj tcp_seq snd_una; /* send unacknowledged */ 365067Swnj tcp_seq snd_nxt; /* send next */ 375067Swnj tcp_seq snd_up; /* send urgent pointer */ 385067Swnj tcp_seq snd_wl1; /* window update seg seq number */ 395067Swnj tcp_seq snd_wl2; /* window update seg ack number */ 405067Swnj tcp_seq iss; /* initial send sequence number */ 415246Sroot u_short snd_wnd; /* send window */ 425067Swnj /* receive sequence variables */ 435246Sroot short rcv_wnd; /* receive window */ 445067Swnj tcp_seq rcv_nxt; /* receive next */ 455067Swnj tcp_seq rcv_up; /* receive urgent pointer */ 465067Swnj tcp_seq irs; /* initial receive sequence number */ 475067Swnj /* 485067Swnj * Additional variables for this implementation. 495067Swnj */ 505076Swnj /* receive variables */ 515076Swnj tcp_seq rcv_adv; /* advertised window */ 525067Swnj /* retransmit variables */ 535092Swnj tcp_seq snd_max; /* highest sequence number sent 545076Swnj used to recognize retransmits */ 555166Swnj /* transmit timing stuff */ 565166Swnj short t_idle; /* inactivity time */ 575166Swnj short t_rtt; /* round trip time */ 585166Swnj tcp_seq t_rtseq; /* sequence number being timed */ 595166Swnj float t_srtt; /* smoothed round-trip time */ 605443Swnj /* out-of-band data */ 615443Swnj char t_oobflags; /* have some */ 62*5550Swnj char t_iobc; /* input character */ 635443Swnj #define TCPOOB_HAVEDATA 0x01 645443Swnj 655443Swnj #ifdef TCPTRUEOOB 665443Swnj #define TCPOOB_OWEACK 0x02 675443Swnj #define TCPOOB_NEEDACK 0x04 685443Swnj u_char t_iobseq; /* input receive sequence number */ 69*5550Swnj tcp_seq t_oobmark; /* output mark position */ 705443Swnj char t_oobc; /* output character */ 715443Swnj u_char t_oobseq; /* output transmit sequence number */ 725443Swnj #endif 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(); 904808Swnj #endif 91