1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 3*0Sstevel@tonic-gate * Use is subject to license terms. 4*0Sstevel@tonic-gate */ 5*0Sstevel@tonic-gate 6*0Sstevel@tonic-gate /* 7*0Sstevel@tonic-gate * Copyright (c) 1982, 1986 Regents of the University of California. 8*0Sstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement 9*0Sstevel@tonic-gate * specifies the terms and conditions for redistribution. 10*0Sstevel@tonic-gate */ 11*0Sstevel@tonic-gate 12*0Sstevel@tonic-gate #ifndef _TCP_INET_H 13*0Sstevel@tonic-gate #define _TCP_INET_H 14*0Sstevel@tonic-gate 15*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 16*0Sstevel@tonic-gate 17*0Sstevel@tonic-gate #ifdef __cplusplus 18*0Sstevel@tonic-gate extern "C" { 19*0Sstevel@tonic-gate #endif 20*0Sstevel@tonic-gate 21*0Sstevel@tonic-gate #include "tcp_sack.h" 22*0Sstevel@tonic-gate 23*0Sstevel@tonic-gate /* TCP states */ 24*0Sstevel@tonic-gate #define TCPS_ALL_ACKED -7 /* Internal state for retransmissions */ 25*0Sstevel@tonic-gate #define TCPS_CLOSED -6 26*0Sstevel@tonic-gate #define TCPS_IDLE -5 /* idle (opened, but not bound) */ 27*0Sstevel@tonic-gate #define TCPS_BOUND -4 /* bound, ready to connect or accept */ 28*0Sstevel@tonic-gate #define TCPS_LISTEN -3 /* listening for connection */ 29*0Sstevel@tonic-gate #define TCPS_SYN_SENT -2 /* active, have sent syn */ 30*0Sstevel@tonic-gate #define TCPS_SYN_RCVD -1 /* have received syn (and sent ours) */ 31*0Sstevel@tonic-gate /* states < TCPS_ESTABLISHED are those where connections not established */ 32*0Sstevel@tonic-gate #define TCPS_ESTABLISHED 0 /* established */ 33*0Sstevel@tonic-gate #define TCPS_CLOSE_WAIT 1 /* rcvd fin, waiting for close */ 34*0Sstevel@tonic-gate /* states > TCPS_CLOSE_WAIT are those where user has closed */ 35*0Sstevel@tonic-gate #define TCPS_FIN_WAIT_1 2 /* have closed and sent fin */ 36*0Sstevel@tonic-gate #define TCPS_CLOSING 3 /* closed, xchd FIN, await FIN ACK */ 37*0Sstevel@tonic-gate #define TCPS_LAST_ACK 4 /* had fin and close; await FIN ACK */ 38*0Sstevel@tonic-gate /* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */ 39*0Sstevel@tonic-gate #define TCPS_FIN_WAIT_2 5 /* have closed, fin is acked */ 40*0Sstevel@tonic-gate #define TCPS_TIME_WAIT 6 /* in 2*msl quiet wait after close */ 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate /* 43*0Sstevel@tonic-gate * Internal flags used in conjunction with the packet header flags. 44*0Sstevel@tonic-gate * Used in tcp_rput_data to keep track of what needs to be done. 45*0Sstevel@tonic-gate */ 46*0Sstevel@tonic-gate #define TH_LIMIT_XMIT 0x0400 /* Limited xmit is needed */ 47*0Sstevel@tonic-gate #define TH_XMIT_NEEDED 0x0800 /* Window opened - send queued data */ 48*0Sstevel@tonic-gate #define TH_REXMIT_NEEDED 0x1000 /* Time expired for unacked data */ 49*0Sstevel@tonic-gate #define TH_ACK_NEEDED 0x2000 /* Send an ack now. */ 50*0Sstevel@tonic-gate #define TH_NEED_SACK_REXMIT 0x4000 /* Use SACK info to retransmission */ 51*0Sstevel@tonic-gate #define TH_TIMER_NEEDED 0x8000 /* Start the delayed ack/push bit timer */ 52*0Sstevel@tonic-gate 53*0Sstevel@tonic-gate /* 54*0Sstevel@tonic-gate * Special Magic number used by TCP to issue a callback to recvfrom() in the 55*0Sstevel@tonic-gate * form of a dummy inetgram. 56*0Sstevel@tonic-gate */ 57*0Sstevel@tonic-gate #define TCP_CALLB_MAGIC_ID 0xFFFF 58*0Sstevel@tonic-gate 59*0Sstevel@tonic-gate /* 60*0Sstevel@tonic-gate * TCP sequence numbers are 32 bit integers operated 61*0Sstevel@tonic-gate * on with modular arithmetic. These macros can be 62*0Sstevel@tonic-gate * used to compare such integers. 63*0Sstevel@tonic-gate */ 64*0Sstevel@tonic-gate #define SEQ_LT(a, b) ((int32_t)((a)-(b)) < 0) 65*0Sstevel@tonic-gate #define SEQ_LEQ(a, b) ((int32_t)((a)-(b)) <= 0) 66*0Sstevel@tonic-gate #define SEQ_GT(a, b) ((int32_t)((a)-(b)) > 0) 67*0Sstevel@tonic-gate #define SEQ_GEQ(a, b) ((int32_t)((a)-(b)) >= 0) 68*0Sstevel@tonic-gate 69*0Sstevel@tonic-gate /* TCP Protocol header */ 70*0Sstevel@tonic-gate typedef struct tcphdr_s { 71*0Sstevel@tonic-gate uint8_t th_lport[2]; /* Source port */ 72*0Sstevel@tonic-gate uint8_t th_fport[2]; /* Destination port */ 73*0Sstevel@tonic-gate uint8_t th_seq[4]; /* Sequence number */ 74*0Sstevel@tonic-gate uint8_t th_ack[4]; /* Acknowledgement number */ 75*0Sstevel@tonic-gate uint8_t th_offset_and_rsrvd[1]; /* Offset to the packet data */ 76*0Sstevel@tonic-gate uint8_t th_flags[1]; 77*0Sstevel@tonic-gate uint8_t th_win[2]; /* Allocation number */ 78*0Sstevel@tonic-gate uint8_t th_sum[2]; /* TCP checksum */ 79*0Sstevel@tonic-gate uint8_t th_urp[2]; /* Urgent pointer */ 80*0Sstevel@tonic-gate } tcph_t; 81*0Sstevel@tonic-gate 82*0Sstevel@tonic-gate #define TCP_HDR_LENGTH(tcph) (((tcph)->th_offset_and_rsrvd[0] >>2) &(0xF << 2)) 83*0Sstevel@tonic-gate #define TCP_MAX_COMBINED_HEADER_LENGTH (60 + 60) /* Maxed out ip + tcp */ 84*0Sstevel@tonic-gate #define TCP_MAX_IP_OPTIONS_LENGTH (60 - IP_SIMPLE_HDR_LENGTH) 85*0Sstevel@tonic-gate #define TCP_MAX_HDR_LENGTH 60 86*0Sstevel@tonic-gate #define TCP_MAX_TCP_OPTIONS_LENGTH (60 - sizeof (tcph_t)) 87*0Sstevel@tonic-gate #define TCP_MIN_HEADER_LENGTH 20 88*0Sstevel@tonic-gate #define TCP_MAXWIN 65535 89*0Sstevel@tonic-gate #define TCP_PORT_LEN sizeof (in_port_t) 90*0Sstevel@tonic-gate #define TCP_MAX_WINSHIFT 14 91*0Sstevel@tonic-gate #define TCP_MAX_LARGEWIN (TCP_MAXWIN << TCP_MAX_WINSHIFT) 92*0Sstevel@tonic-gate 93*0Sstevel@tonic-gate #define TCPIP_HDR_LENGTH(mp, n) \ 94*0Sstevel@tonic-gate (n) = IPH_HDR_LENGTH((mp)->b_rptr), \ 95*0Sstevel@tonic-gate (n) += TCP_HDR_LENGTH((tcph_t *)&(mp)->b_rptr[(n)]) 96*0Sstevel@tonic-gate 97*0Sstevel@tonic-gate /* TCP Protocol header (used if the header is known to be 32-bit aligned) */ 98*0Sstevel@tonic-gate typedef struct tcphdra_s { 99*0Sstevel@tonic-gate in_port_t tha_lport; /* Source port */ 100*0Sstevel@tonic-gate in_port_t tha_fport; /* Destination port */ 101*0Sstevel@tonic-gate uint32_t tha_seq; /* Sequence number */ 102*0Sstevel@tonic-gate uint32_t tha_ack; /* Acknowledgement number */ 103*0Sstevel@tonic-gate uint8_t tha_offset_and_reserved; /* Offset to the packet data */ 104*0Sstevel@tonic-gate uint8_t tha_flags; 105*0Sstevel@tonic-gate uint16_t tha_win; /* Allocation number */ 106*0Sstevel@tonic-gate uint16_t tha_sum; /* TCP checksum */ 107*0Sstevel@tonic-gate uint16_t tha_urp; /* Urgent pointer */ 108*0Sstevel@tonic-gate } tcpha_t; 109*0Sstevel@tonic-gate 110*0Sstevel@tonic-gate typedef struct tcp_s { 111*0Sstevel@tonic-gate struct tcp_s *tcp_time_wait_next; /* Next TCP in TIME_WAIT list */ 112*0Sstevel@tonic-gate struct tcp_s *tcp_time_wait_prev; /* Prev TCP in TIME_WAIT list */ 113*0Sstevel@tonic-gate uint32_t tcp_max_swnd; /* Maximum swnd we have seen */ 114*0Sstevel@tonic-gate uint32_t tcp_suna; /* Sender unacknowledged */ 115*0Sstevel@tonic-gate uint32_t tcp_csuna; /* Clear (no rexmits in window) suna */ 116*0Sstevel@tonic-gate uint32_t tcp_snxt; /* Senders next seq num */ 117*0Sstevel@tonic-gate uint32_t tcp_swnd; /* Senders window (relative to suna) */ 118*0Sstevel@tonic-gate uint32_t tcp_mss; /* Max segment size */ 119*0Sstevel@tonic-gate uint32_t tcp_iss; /* Initial send seq num */ 120*0Sstevel@tonic-gate uint32_t tcp_rnxt; /* Seq we expect to recv next */ 121*0Sstevel@tonic-gate uint32_t tcp_rwnd; /* Current receive window */ 122*0Sstevel@tonic-gate uint32_t tcp_rwnd_max; /* Max receive window */ 123*0Sstevel@tonic-gate 124*0Sstevel@tonic-gate uint32_t tcp_irs; /* Initial recv seq num */ 125*0Sstevel@tonic-gate uint32_t tcp_fss; /* Final/fin send seq num */ 126*0Sstevel@tonic-gate 127*0Sstevel@tonic-gate uint32_t tcp_swl1; /* These help us avoid using stale */ 128*0Sstevel@tonic-gate uint32_t tcp_swl2; /* packets to update state */ 129*0Sstevel@tonic-gate 130*0Sstevel@tonic-gate uint32_t tcp_cwnd; /* Congestion window */ 131*0Sstevel@tonic-gate int32_t tcp_cwnd_cnt; /* cwnd cnt in congestion avoidance */ 132*0Sstevel@tonic-gate uint32_t tcp_cwnd_ssthresh; /* Congestion window */ 133*0Sstevel@tonic-gate uint32_t tcp_cwnd_max; 134*0Sstevel@tonic-gate 135*0Sstevel@tonic-gate int32_t tcp_snd_burst; /* Send burst factor */ 136*0Sstevel@tonic-gate 137*0Sstevel@tonic-gate int32_t tcp_state; 138*0Sstevel@tonic-gate int32_t tcp_rcv_ws; /* My window scale power */ 139*0Sstevel@tonic-gate int32_t tcp_snd_ws; /* Sender's window scale power */ 140*0Sstevel@tonic-gate uint32_t tcp_ts_recent; /* Timestamp of earliest unacked */ 141*0Sstevel@tonic-gate /* data segment */ 142*0Sstevel@tonic-gate 143*0Sstevel@tonic-gate uint32_t tcp_if_mtu; /* Outgoing interface MTU. */ 144*0Sstevel@tonic-gate 145*0Sstevel@tonic-gate uint32_t tcp_rtt_sa; /* Round trip smoothed average */ 146*0Sstevel@tonic-gate uint32_t tcp_rtt_sd; /* Round trip smoothed deviation */ 147*0Sstevel@tonic-gate uint32_t tcp_rtt_update; /* Round trip update(s) */ 148*0Sstevel@tonic-gate uint32_t tcp_ms_we_have_waited; /* Total retrans time */ 149*0Sstevel@tonic-gate uint32_t tcp_rto; /* Round trip timeout */ 150*0Sstevel@tonic-gate uint32_t tcp_rto_timeout; /* RTT timeout time */ 151*0Sstevel@tonic-gate uint32_t tcp_time_wait_expire; 152*0Sstevel@tonic-gate /* time in hz when t/w expires */ 153*0Sstevel@tonic-gate uint32_t tcp_last_rcv_lbolt; 154*0Sstevel@tonic-gate /* lbolt on last packet, used for PAWS */ 155*0Sstevel@tonic-gate int tcp_lingertime; /* Close linger time (in seconds) */ 156*0Sstevel@tonic-gate 157*0Sstevel@tonic-gate uint32_t tcp_first_timer_threshold; /* When to prod IP */ 158*0Sstevel@tonic-gate uint32_t tcp_second_timer_threshold; /* When to give up completely */ 159*0Sstevel@tonic-gate uint32_t tcp_first_ctimer_threshold; /* 1st threshold when connecting */ 160*0Sstevel@tonic-gate uint32_t tcp_second_ctimer_threshold; /* 2nd ... while connecting */ 161*0Sstevel@tonic-gate 162*0Sstevel@tonic-gate uint32_t tcp_rexmit_nxt; /* Next rexmit seq num */ 163*0Sstevel@tonic-gate uint32_t tcp_rexmit_max; /* Max retran seq num */ 164*0Sstevel@tonic-gate 165*0Sstevel@tonic-gate uint32_t tcp_naglim; /* Tunable nagle limit */ 166*0Sstevel@tonic-gate uint32_t tcp_valid_bits; 167*0Sstevel@tonic-gate #define TCP_ISS_VALID 0x1 /* Is the tcp_iss seq num active? */ 168*0Sstevel@tonic-gate #define TCP_FSS_VALID 0x2 /* Is the tcp_fss seq num active? */ 169*0Sstevel@tonic-gate #define TCP_URG_VALID 0x4 /* Is the tcp_urg seq num active? */ 170*0Sstevel@tonic-gate #define TCP_OFO_FIN_VALID 0x8 /* Has TCP received an out of order FIN? */ 171*0Sstevel@tonic-gate 172*0Sstevel@tonic-gate int32_t tcp_xmit_hiwater; /* Send buffer high water mark. */ 173*0Sstevel@tonic-gate int32_t tcp_xmit_lowater; /* Send buffer low water mark. */ 174*0Sstevel@tonic-gate 175*0Sstevel@tonic-gate uchar_t tcp_timer_backoff; /* Backoff shift count. */ 176*0Sstevel@tonic-gate uint32_t tcp_last_recv_time; /* Last time we receive a segment. */ 177*0Sstevel@tonic-gate 178*0Sstevel@tonic-gate /* Fields arranged in approximate access order along main paths */ 179*0Sstevel@tonic-gate mblk_t *tcp_xmit_head; /* Head of rexmit list */ 180*0Sstevel@tonic-gate mblk_t *tcp_xmit_last; /* last valid data seen by tcp_wput */ 181*0Sstevel@tonic-gate uint32_t tcp_unsent; /* # of bytes in hand that are unsent */ 182*0Sstevel@tonic-gate mblk_t *tcp_xmit_tail; /* Last rexmit data sent */ 183*0Sstevel@tonic-gate uint32_t tcp_xmit_tail_unsent; /* # of unsent bytes in xmit_tail */ 184*0Sstevel@tonic-gate mblk_t *tcp_rcv_list; /* Queued until push or exceed */ 185*0Sstevel@tonic-gate mblk_t *tcp_rcv_last_tail; /* tcp_rcv_push_wait. */ 186*0Sstevel@tonic-gate uint32_t tcp_rcv_cnt; /* tcp_rcv_list is b_next chain. */ 187*0Sstevel@tonic-gate 188*0Sstevel@tonic-gate uint32_t tcp_rack; /* Seq # we have acked */ 189*0Sstevel@tonic-gate uint32_t tcp_rack_cnt; /* # of bytes we have deferred ack */ 190*0Sstevel@tonic-gate 191*0Sstevel@tonic-gate mblk_t *tcp_reass_head; /* Out of order reassembly list head */ 192*0Sstevel@tonic-gate mblk_t *tcp_reass_tail; /* Out of order reassembly list tail */ 193*0Sstevel@tonic-gate 194*0Sstevel@tonic-gate tcp_sack_info_t *tcp_sack_info; 195*0Sstevel@tonic-gate 196*0Sstevel@tonic-gate #define tcp_pipe tcp_sack_info->tcp_pipe 197*0Sstevel@tonic-gate #define tcp_fack tcp_sack_info->tcp_fack 198*0Sstevel@tonic-gate #define tcp_sack_snxt tcp_sack_info->tcp_sack_snxt 199*0Sstevel@tonic-gate #define tcp_max_sack_blk tcp_sack_info->tcp_max_sack_blk 200*0Sstevel@tonic-gate #define tcp_num_sack_blk tcp_sack_info->tcp_num_sack_blk 201*0Sstevel@tonic-gate #define tcp_sack_list tcp_sack_info->tcp_sack_list 202*0Sstevel@tonic-gate #define tcp_num_notsack_blk tcp_sack_info->tcp_num_notsack_blk 203*0Sstevel@tonic-gate #define tcp_cnt_notsack_list tcp_sack_info->tcp_cnt_notsack_list 204*0Sstevel@tonic-gate #define tcp_notsack_list tcp_sack_info->tcp_notsack_list 205*0Sstevel@tonic-gate 206*0Sstevel@tonic-gate int tcp_conn_req_cnt_q0; /* # of conn reqs in SYN_RCVD */ 207*0Sstevel@tonic-gate int tcp_conn_req_cnt_q; /* # of conn reqs in ESTABLISHED */ 208*0Sstevel@tonic-gate int tcp_conn_req_max; /* # of ESTABLISHED conn reqs allowed */ 209*0Sstevel@tonic-gate 210*0Sstevel@tonic-gate int tcp_iphc_len; /* actual allocated buffer size */ 211*0Sstevel@tonic-gate int32_t tcp_hdr_len; /* Byte len of combined TCP/IP hdr */ 212*0Sstevel@tonic-gate struct ip *tcp_ipha; /* IPv4 header in the buffer */ 213*0Sstevel@tonic-gate int tcp_ip_hdr_len; /* Byte len of our current IPvx hdr */ 214*0Sstevel@tonic-gate tcph_t *tcp_tcph; /* tcp header within combined hdr */ 215*0Sstevel@tonic-gate int32_t tcp_tcp_hdr_len; /* tcp header len within combined */ 216*0Sstevel@tonic-gate 217*0Sstevel@tonic-gate uint16_t tcp_last_sent_len; /* Record length for nagle */ 218*0Sstevel@tonic-gate uint16_t tcp_dupack_cnt; /* # of consequtive duplicate acks */ 219*0Sstevel@tonic-gate 220*0Sstevel@tonic-gate /* 221*0Sstevel@tonic-gate * Address family that app wishes returned addrsses to be in. 222*0Sstevel@tonic-gate * Currently taken from address family used in T_BIND_REQ, but 223*0Sstevel@tonic-gate * should really come from family used in original socket() call. 224*0Sstevel@tonic-gate * Value can be AF_INET or AF_INET6. 225*0Sstevel@tonic-gate */ 226*0Sstevel@tonic-gate uint_t tcp_family; 227*0Sstevel@tonic-gate 228*0Sstevel@tonic-gate uint32_t tcp_ofo_fin_seq; /* Recv out of order FIN seq num */ 229*0Sstevel@tonic-gate uint32_t tcp_cwr_snd_max; 230*0Sstevel@tonic-gate 231*0Sstevel@tonic-gate uint32_t 232*0Sstevel@tonic-gate tcp_fin_acked : 1, /* Has our FIN been acked? */ 233*0Sstevel@tonic-gate tcp_fin_rcvd : 1, /* Have we seen a FIN? */ 234*0Sstevel@tonic-gate tcp_fin_sent : 1, /* Have we sent our FIN yet? */ 235*0Sstevel@tonic-gate tcp_useloopback : 1, /* SO_USELOOPBACK "socket" option. */ 236*0Sstevel@tonic-gate 237*0Sstevel@tonic-gate tcp_conn_def_q0: 1, /* move from q0 to q deferred */ 238*0Sstevel@tonic-gate tcp_zero_win_probe: 1, /* Zero win probing is in progress */ 239*0Sstevel@tonic-gate tcp_set_timer : 1, 240*0Sstevel@tonic-gate tcp_active_open: 1, /* This is a active open */ 241*0Sstevel@tonic-gate 242*0Sstevel@tonic-gate tcp_timer_running: 1, /* Retransmission timer running */ 243*0Sstevel@tonic-gate tcp_rexmit : 1, /* TCP is retransmitting */ 244*0Sstevel@tonic-gate tcp_snd_sack_ok : 1, /* Can use SACK for this connection */ 245*0Sstevel@tonic-gate tcp_ecn_ok : 1, /* Can use ECN for this connection */ 246*0Sstevel@tonic-gate 247*0Sstevel@tonic-gate tcp_ecn_echo_on : 1, /* Need to do ECN echo */ 248*0Sstevel@tonic-gate tcp_ecn_cwr_sent : 1, /* ECN_CWR has been sent */ 249*0Sstevel@tonic-gate tcp_cwr : 1, /* Cwnd has reduced recently */ 250*0Sstevel@tonic-gate tcp_snd_ts_ok : 1, 251*0Sstevel@tonic-gate 252*0Sstevel@tonic-gate tcp_snd_ws_ok : 1, 253*0Sstevel@tonic-gate tcp_linger : 1, 254*0Sstevel@tonic-gate tcp_dontdrop : 1, 255*0Sstevel@tonic-gate tcp_junk_fill_thru_bit_31 : 13; 256*0Sstevel@tonic-gate 257*0Sstevel@tonic-gate char *tcp_iphc; /* Buffer holding tcp/ip hdr template */ 258*0Sstevel@tonic-gate 259*0Sstevel@tonic-gate in_addr_t tcp_remote; /* true remote address - needed for */ 260*0Sstevel@tonic-gate /* source routing. */ 261*0Sstevel@tonic-gate in_addr_t tcp_bound_source; /* IP address in bind_req */ 262*0Sstevel@tonic-gate /* 263*0Sstevel@tonic-gate * These fields contain the same information as tcp_tcph->th_*port. 264*0Sstevel@tonic-gate * However, the lookup functions can not use the header fields 265*0Sstevel@tonic-gate * since during IP option manipulation the tcp_tcph pointer 266*0Sstevel@tonic-gate * changes. 267*0Sstevel@tonic-gate */ 268*0Sstevel@tonic-gate union { 269*0Sstevel@tonic-gate struct { 270*0Sstevel@tonic-gate in_port_t tcpu_fport; /* Remote port */ 271*0Sstevel@tonic-gate in_port_t tcpu_lport; /* Local port */ 272*0Sstevel@tonic-gate } tcpu_ports1; 273*0Sstevel@tonic-gate uint32_t tcpu_ports2; /* Rem port, */ 274*0Sstevel@tonic-gate /* local port */ 275*0Sstevel@tonic-gate /* Used for TCP_MATCH performance */ 276*0Sstevel@tonic-gate } tcp_tcpu; 277*0Sstevel@tonic-gate #define tcp_fport tcp_tcpu.tcpu_ports1.tcpu_fport 278*0Sstevel@tonic-gate #define tcp_lport tcp_tcpu.tcpu_ports1.tcpu_lport 279*0Sstevel@tonic-gate #define tcp_ports tcp_tcpu.tcpu_ports2 280*0Sstevel@tonic-gate /* 281*0Sstevel@tonic-gate * IP format that packets transmitted from this struct should use. 282*0Sstevel@tonic-gate * Value can be IPV4_VERSION or IPV6_VERSION. Determines whether 283*0Sstevel@tonic-gate * IP+TCP header template above stores an IPv4 or IPv6 header. 284*0Sstevel@tonic-gate */ 285*0Sstevel@tonic-gate ushort_t tcp_ipversion; 286*0Sstevel@tonic-gate int tcp_client_errno; 287*0Sstevel@tonic-gate struct tcp_s *tcp_eager_next_q; /* next eager in ESTABLISHED state */ 288*0Sstevel@tonic-gate struct tcp_s *tcp_eager_last_q; /* last eager in ESTABLISHED state */ 289*0Sstevel@tonic-gate struct tcp_s *tcp_eager_next_q0; /* next eager in SYN_RCVD state */ 290*0Sstevel@tonic-gate struct tcp_s *tcp_eager_prev_q0; /* prev eager in SYN_RCVD state */ 291*0Sstevel@tonic-gate struct tcp_s *tcp_listener; /* Our listener */ 292*0Sstevel@tonic-gate } tcp_t; 293*0Sstevel@tonic-gate 294*0Sstevel@tonic-gate /* External TCP functions. */ 295*0Sstevel@tonic-gate extern void tcp_socket_init(struct inetboot_socket *); 296*0Sstevel@tonic-gate extern int tcp_connect(int); 297*0Sstevel@tonic-gate extern int tcp_listen(int, int); 298*0Sstevel@tonic-gate extern int tcp_bind(int); 299*0Sstevel@tonic-gate extern int tcp_send(int, tcp_t *, const void *, int); 300*0Sstevel@tonic-gate extern int tcp_opt_set(tcp_t *, int, int, const void *, socklen_t); 301*0Sstevel@tonic-gate extern int tcp_accept(int, struct sockaddr *, socklen_t *); 302*0Sstevel@tonic-gate extern int tcp_shutdown(int); 303*0Sstevel@tonic-gate 304*0Sstevel@tonic-gate /* Exported for recvfrom */ 305*0Sstevel@tonic-gate extern void tcp_rcv_drain_sock(int); 306*0Sstevel@tonic-gate 307*0Sstevel@tonic-gate /* Exported for stand/lib/sock/sock_test.c */ 308*0Sstevel@tonic-gate extern void tcp_time_wait_report(void); 309*0Sstevel@tonic-gate 310*0Sstevel@tonic-gate #ifdef __cplusplus 311*0Sstevel@tonic-gate } 312*0Sstevel@tonic-gate #endif 313*0Sstevel@tonic-gate 314*0Sstevel@tonic-gate #endif /* _TCP_INET_H */ 315