1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * Copyright (c) 1997-1998 by Sun Microsystems, Inc. 3*7c478bd9Sstevel@tonic-gate * All rights reserved. 4*7c478bd9Sstevel@tonic-gate */ 5*7c478bd9Sstevel@tonic-gate 6*7c478bd9Sstevel@tonic-gate /* 7*7c478bd9Sstevel@tonic-gate * Copyright (c) 1982, 1986 Regents of the University of California. 8*7c478bd9Sstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement 9*7c478bd9Sstevel@tonic-gate * specifies the terms and conditions for redistribution. 10*7c478bd9Sstevel@tonic-gate */ 11*7c478bd9Sstevel@tonic-gate 12*7c478bd9Sstevel@tonic-gate /* 13*7c478bd9Sstevel@tonic-gate * Kernel variables for tcp. 14*7c478bd9Sstevel@tonic-gate */ 15*7c478bd9Sstevel@tonic-gate 16*7c478bd9Sstevel@tonic-gate #ifndef _NETINET_TCP_VAR_H 17*7c478bd9Sstevel@tonic-gate #define _NETINET_TCP_VAR_H 18*7c478bd9Sstevel@tonic-gate 19*7c478bd9Sstevel@tonic-gate /* tcp_var.h 1.11 88/08/19 SMI; from UCB 7.3 6/30/87 */ 20*7c478bd9Sstevel@tonic-gate 21*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 22*7c478bd9Sstevel@tonic-gate extern "C" { 23*7c478bd9Sstevel@tonic-gate #endif 24*7c478bd9Sstevel@tonic-gate 25*7c478bd9Sstevel@tonic-gate /* 26*7c478bd9Sstevel@tonic-gate * Tcp control block, one per tcp; fields: 27*7c478bd9Sstevel@tonic-gate */ 28*7c478bd9Sstevel@tonic-gate struct tcpcb { 29*7c478bd9Sstevel@tonic-gate struct tcpiphdr *seg_next; /* sequencing queue */ 30*7c478bd9Sstevel@tonic-gate struct tcpiphdr *seg_prev; 31*7c478bd9Sstevel@tonic-gate short t_state; /* state of this connection */ 32*7c478bd9Sstevel@tonic-gate short t_timer[TCPT_NTIMERS]; /* tcp timers */ 33*7c478bd9Sstevel@tonic-gate short t_rxtshift; /* log(2) of rexmt exp. backoff */ 34*7c478bd9Sstevel@tonic-gate short t_rxtcur; /* current retransmit value */ 35*7c478bd9Sstevel@tonic-gate short t_dupacks; /* consecutive dup acks recd */ 36*7c478bd9Sstevel@tonic-gate ushort_t t_maxseg; /* maximum segment size */ 37*7c478bd9Sstevel@tonic-gate char t_force; /* 1 if forcing out a byte */ 38*7c478bd9Sstevel@tonic-gate uchar_t t_flags; 39*7c478bd9Sstevel@tonic-gate #define TF_ACKNOW 0x01 /* ack peer immediately */ 40*7c478bd9Sstevel@tonic-gate #define TF_DELACK 0x02 /* ack, but try to delay it */ 41*7c478bd9Sstevel@tonic-gate #define TF_NODELAY 0x04 /* don't delay packets to coalesce */ 42*7c478bd9Sstevel@tonic-gate #define TF_NOOPT 0x08 /* don't use tcp options */ 43*7c478bd9Sstevel@tonic-gate #define TF_SENTFIN 0x10 /* have sent FIN */ 44*7c478bd9Sstevel@tonic-gate struct tcpiphdr *t_template; /* skeletal packet for transmit */ 45*7c478bd9Sstevel@tonic-gate struct inpcb *t_inpcb; /* back pointer to internet pcb */ 46*7c478bd9Sstevel@tonic-gate /* 47*7c478bd9Sstevel@tonic-gate * The following fields are used as in the protocol specification. 48*7c478bd9Sstevel@tonic-gate * See RFC783, Dec. 1981, page 21. 49*7c478bd9Sstevel@tonic-gate */ 50*7c478bd9Sstevel@tonic-gate /* send sequence variables */ 51*7c478bd9Sstevel@tonic-gate tcp_seq snd_una; /* send unacknowledged */ 52*7c478bd9Sstevel@tonic-gate tcp_seq snd_nxt; /* send next */ 53*7c478bd9Sstevel@tonic-gate tcp_seq snd_up; /* send urgent pointer */ 54*7c478bd9Sstevel@tonic-gate tcp_seq snd_wl1; /* window update seg seq number */ 55*7c478bd9Sstevel@tonic-gate tcp_seq snd_wl2; /* window update seg ack number */ 56*7c478bd9Sstevel@tonic-gate tcp_seq iss; /* initial send sequence number */ 57*7c478bd9Sstevel@tonic-gate ushort_t snd_wnd; /* send window */ 58*7c478bd9Sstevel@tonic-gate /* receive sequence variables */ 59*7c478bd9Sstevel@tonic-gate ushort_t rcv_wnd; /* receive window */ 60*7c478bd9Sstevel@tonic-gate tcp_seq rcv_nxt; /* receive next */ 61*7c478bd9Sstevel@tonic-gate tcp_seq rcv_up; /* receive urgent pointer */ 62*7c478bd9Sstevel@tonic-gate tcp_seq irs; /* initial receive sequence number */ 63*7c478bd9Sstevel@tonic-gate /* 64*7c478bd9Sstevel@tonic-gate * Additional variables for this implementation. 65*7c478bd9Sstevel@tonic-gate */ 66*7c478bd9Sstevel@tonic-gate /* receive variables */ 67*7c478bd9Sstevel@tonic-gate tcp_seq rcv_adv; /* advertised window */ 68*7c478bd9Sstevel@tonic-gate /* retransmit variables */ 69*7c478bd9Sstevel@tonic-gate tcp_seq snd_max; /* highest sequence number sent */ 70*7c478bd9Sstevel@tonic-gate /* used to recognize retransmits */ 71*7c478bd9Sstevel@tonic-gate 72*7c478bd9Sstevel@tonic-gate /* congestion control (for slow start, source quench, retransmit after loss) */ 73*7c478bd9Sstevel@tonic-gate ushort_t snd_cwnd; /* congestion-controlled window */ 74*7c478bd9Sstevel@tonic-gate ushort_t snd_ssthresh; /* snd_cwnd size threshhold for */ 75*7c478bd9Sstevel@tonic-gate /* for slow start exponential to */ 76*7c478bd9Sstevel@tonic-gate /* 77*7c478bd9Sstevel@tonic-gate * transmit timing stuff. 78*7c478bd9Sstevel@tonic-gate * srtt and rttvar are stored as fixed point; for convenience in smoothing, 79*7c478bd9Sstevel@tonic-gate * srtt has 3 bits to the right of the binary point, rttvar has 2. 80*7c478bd9Sstevel@tonic-gate * "Variance" is actually smoothed difference. 81*7c478bd9Sstevel@tonic-gate */ 82*7c478bd9Sstevel@tonic-gate short t_idle; /* inactivity time */ 83*7c478bd9Sstevel@tonic-gate short t_rtt; /* round trip time */ 84*7c478bd9Sstevel@tonic-gate tcp_seq t_rtseq; /* sequence number being timed */ 85*7c478bd9Sstevel@tonic-gate short t_srtt; /* smoothed round-trip time */ 86*7c478bd9Sstevel@tonic-gate short t_rttvar; /* variance in round-trip time */ 87*7c478bd9Sstevel@tonic-gate ushort_t max_rcvd; /* most peer has sent into window */ 88*7c478bd9Sstevel@tonic-gate ushort_t max_sndwnd; /* largest window peer has offered */ 89*7c478bd9Sstevel@tonic-gate /* out-of-band data */ 90*7c478bd9Sstevel@tonic-gate char t_oobflags; /* have some */ 91*7c478bd9Sstevel@tonic-gate char t_iobc; /* input character */ 92*7c478bd9Sstevel@tonic-gate #define TCPOOB_HAVEDATA 0x01 93*7c478bd9Sstevel@tonic-gate #define TCPOOB_HADDATA 0x02 94*7c478bd9Sstevel@tonic-gate }; 95*7c478bd9Sstevel@tonic-gate 96*7c478bd9Sstevel@tonic-gate #define intotcpcb(ip) ((struct tcpcb *)(ip)->inp_ppcb) 97*7c478bd9Sstevel@tonic-gate #define sototcpcb(so) (intotcpcb(sotoinpcb(so))) 98*7c478bd9Sstevel@tonic-gate 99*7c478bd9Sstevel@tonic-gate /* 100*7c478bd9Sstevel@tonic-gate * TCP statistics. 101*7c478bd9Sstevel@tonic-gate * Many of these should be kept per connection, 102*7c478bd9Sstevel@tonic-gate * but that's inconvenient at the moment. 103*7c478bd9Sstevel@tonic-gate */ 104*7c478bd9Sstevel@tonic-gate struct tcpstat { 105*7c478bd9Sstevel@tonic-gate uint_t tcps_connattempt; /* connections initiated */ 106*7c478bd9Sstevel@tonic-gate uint_t tcps_accepts; /* connections accepted */ 107*7c478bd9Sstevel@tonic-gate uint_t tcps_connects; /* connections established */ 108*7c478bd9Sstevel@tonic-gate uint_t tcps_drops; /* connections dropped */ 109*7c478bd9Sstevel@tonic-gate uint_t tcps_conndrops; /* embryonic connections dropped */ 110*7c478bd9Sstevel@tonic-gate uint_t tcps_closed; /* conn. closed (includes drops) */ 111*7c478bd9Sstevel@tonic-gate uint_t tcps_segstimed; /* segs where we tried to get rtt */ 112*7c478bd9Sstevel@tonic-gate uint_t tcps_rttupdated; /* times we succeeded */ 113*7c478bd9Sstevel@tonic-gate uint_t tcps_delack; /* delayed acks sent */ 114*7c478bd9Sstevel@tonic-gate uint_t tcps_timeoutdrop; /* conn. dropped in rxmt timeout */ 115*7c478bd9Sstevel@tonic-gate uint_t tcps_rexmttimeo; /* retransmit timeouts */ 116*7c478bd9Sstevel@tonic-gate uint_t tcps_persisttimeo; /* persist timeouts */ 117*7c478bd9Sstevel@tonic-gate uint_t tcps_keeptimeo; /* keepalive timeouts */ 118*7c478bd9Sstevel@tonic-gate uint_t tcps_keepprobe; /* keepalive probes sent */ 119*7c478bd9Sstevel@tonic-gate uint_t tcps_keepdrops; /* connections dropped in keepalive */ 120*7c478bd9Sstevel@tonic-gate 121*7c478bd9Sstevel@tonic-gate uint_t tcps_sndtotal; /* total packets sent */ 122*7c478bd9Sstevel@tonic-gate uint_t tcps_sndpack; /* data packets sent */ 123*7c478bd9Sstevel@tonic-gate uint_t tcps_sndbyte; /* data bytes sent */ 124*7c478bd9Sstevel@tonic-gate uint_t tcps_sndrexmitpack; /* data packets retransmitted */ 125*7c478bd9Sstevel@tonic-gate uint_t tcps_sndrexmitbyte; /* data bytes retransmitted */ 126*7c478bd9Sstevel@tonic-gate uint_t tcps_sndacks; /* ack-only packets sent */ 127*7c478bd9Sstevel@tonic-gate uint_t tcps_sndprobe; /* window probes sent */ 128*7c478bd9Sstevel@tonic-gate uint_t tcps_sndurg; /* packets sent with URG only */ 129*7c478bd9Sstevel@tonic-gate uint_t tcps_sndwinup; /* window update-only packets sent */ 130*7c478bd9Sstevel@tonic-gate uint_t tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */ 131*7c478bd9Sstevel@tonic-gate 132*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvtotal; /* total packets received */ 133*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvpack; /* packets received in sequence */ 134*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvbyte; /* bytes received in sequence */ 135*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvbadsum; /* packets received with ccksum errs */ 136*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvbadoff; /* packets received with bad offset */ 137*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvshort; /* packets received too short */ 138*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvduppack; /* duplicate-only packets received */ 139*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvdupbyte; /* duplicate-only bytes received */ 140*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvpartduppack; /* packets with some duplicate data */ 141*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */ 142*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvoopack; /* out-of-order packets received */ 143*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvoobyte; /* out-of-order bytes received */ 144*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvpackafterwin; /* packets with data after window */ 145*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvbyteafterwin; /* bytes rcvd after window */ 146*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvafterclose; /* packets rcvd after "close" */ 147*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvwinprobe; /* rcvd window probe packets */ 148*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvdupack; /* rcvd duplicate acks */ 149*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvacktoomuch; /* rcvd acks for unsent data */ 150*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvackpack; /* rcvd ack packets */ 151*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvackbyte; /* bytes acked by rcvd acks */ 152*7c478bd9Sstevel@tonic-gate uint_t tcps_rcvwinupd; /* rcvd window update packets */ 153*7c478bd9Sstevel@tonic-gate }; 154*7c478bd9Sstevel@tonic-gate 155*7c478bd9Sstevel@tonic-gate #define TCP_COMPAT_42 156*7c478bd9Sstevel@tonic-gate 157*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 158*7c478bd9Sstevel@tonic-gate } 159*7c478bd9Sstevel@tonic-gate #endif 160*7c478bd9Sstevel@tonic-gate 161*7c478bd9Sstevel@tonic-gate #endif /* _NETINET_TCP_VAR_H */ 162