Chameleon

Chameleon Svn Source Tree

Root/tags/2.0/i386/include/netinet/tcp_var.h

Source at commit 1808 created 12 years 4 months ago.
By blackosx, Revise layout of package installer 'Welcome' file so it looks cleaner. Change the copyright notice to begin from 2009 as seen in the Chameleon 2.0 r431 installer. Should this date be set earlier?
1/*
2 * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * Copyright (c) 1982, 1986, 1993, 1994, 1995
30 *The Regents of the University of California. All rights reserved.
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
34 * are met:
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
40 * 3. All advertising materials mentioning features or use of this software
41 * must display the following acknowledgement:
42 *This product includes software developed by the University of
43 *California, Berkeley and its contributors.
44 * 4. Neither the name of the University nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 *
60 *@(#)tcp_var.h8.4 (Berkeley) 5/24/95
61 * $FreeBSD: src/sys/netinet/tcp_var.h,v 1.56.2.8 2001/08/22 00:59:13 silby Exp $
62 */
63
64#ifndef _NETINET_TCP_VAR_H_
65#define _NETINET_TCP_VAR_H_
66#include <sys/appleapiopts.h>
67#include <sys/queue.h>
68#include <netinet/in_pcb.h>
69#include <netinet/tcp_timer.h>
70
71#if defined(__LP64__)
72#define _TCPCB_PTR(x)u_int32_t
73#define _TCPCB_LIST_HEAD(name, type)\
74struct name {\
75u_int32_tlh_first;\
76};
77#else
78#define _TCPCB_PTR(x)x
79#define _TCPCB_LIST_HEAD(name, type)LIST_HEAD(name, type)
80#endif
81
82#define TCP_RETRANSHZ 10/* tcp retrans timer (100ms) per hz */
83
84struct tseg_qent;
85_TCPCB_LIST_HEAD(tsegqe_head, tseg_qent);
86
87struct tcpcb {
88structtsegqe_head t_segq;
89intt_dupacks;/* consecutive dup acks recd */
90u_int32_t unused;/* unused now: was t_template */
91
92intt_timer[TCPT_NTIMERS];/* tcp timers */
93
94_TCPCB_PTR(struct inpcb *) t_inpcb;/* back pointer to internet pcb */
95intt_state;/* state of this connection */
96u_intt_flags;
97#defineTF_ACKNOW0x00001/* ack peer immediately */
98#defineTF_DELACK0x00002/* ack, but try to delay it */
99#defineTF_NODELAY0x00004/* don't delay packets to coalesce */
100#defineTF_NOOPT0x00008/* don't use tcp options */
101#defineTF_SENTFIN0x00010/* have sent FIN */
102#defineTF_REQ_SCALE0x00020/* have/will request window scaling */
103#defineTF_RCVD_SCALE0x00040/* other side has requested scaling */
104#defineTF_REQ_TSTMP0x00080/* have/will request timestamps */
105#defineTF_RCVD_TSTMP0x00100/* a timestamp was received in SYN */
106#defineTF_SACK_PERMIT0x00200/* other side said I could SACK */
107#defineTF_NEEDSYN0x00400/* send SYN (implicit state) */
108#defineTF_NEEDFIN0x00800/* send FIN (implicit state) */
109#defineTF_NOPUSH0x01000/* don't push */
110#defineTF_REQ_CC0x02000/* have/will request CC */
111#defineTF_RCVD_CC0x04000/* a CC was received in SYN */
112#defineTF_SENDCCNEW0x08000/* send CCnew instead of CC in SYN */
113#defineTF_MORETOCOME0x10000/* More data to be appended to sock */
114#defineTF_LQ_OVERFLOW0x20000/* listen queue overflow */
115#defineTF_RXWIN0SENT0x40000/* sent a receiver win 0 in response */
116#defineTF_SLOWLINK0x80000/* route is a on a modem speed link */
117
118intt_force;/* 1 if forcing out a byte */
119
120tcp_seqsnd_una;/* send unacknowledged */
121tcp_seqsnd_max;/* highest sequence number sent;
122 * used to recognize retransmits
123 */
124tcp_seqsnd_nxt;/* send next */
125tcp_seqsnd_up;/* send urgent pointer */
126
127tcp_seqsnd_wl1;/* window update seg seq number */
128tcp_seqsnd_wl2;/* window update seg ack number */
129tcp_seqiss;/* initial send sequence number */
130tcp_seqirs;/* initial receive sequence number */
131
132tcp_seqrcv_nxt;/* receive next */
133tcp_seqrcv_adv;/* advertised window */
134u_int32_t rcv_wnd;/* receive window */
135tcp_seqrcv_up;/* receive urgent pointer */
136
137u_int32_t snd_wnd;/* send window */
138u_int32_t snd_cwnd;/* congestion-controlled window */
139u_int32_t snd_ssthresh;/* snd_cwnd size threshold for
140 * for slow start exponential to
141 * linear switch
142 */
143u_intt_maxopd;/* mss plus options */
144
145u_int32_t t_rcvtime;/* inactivity time */
146u_int32_t t_starttime;/* time connection was established */
147intt_rtttime;/* round trip time */
148tcp_seqt_rtseq;/* sequence number being timed */
149
150intt_rxtcur;/* current retransmit value (ticks) */
151u_intt_maxseg;/* maximum segment size */
152intt_srtt;/* smoothed round-trip time */
153intt_rttvar;/* variance in round-trip time */
154
155intt_rxtshift;/* log(2) of rexmt exp. backoff */
156u_intt_rttmin;/* minimum rtt allowed */
157u_int32_t t_rttupdated;/* number of times rtt sampled */
158u_int32_t max_sndwnd;/* largest window peer has offered */
159
160intt_softerror;/* possible error not yet reported */
161/* out-of-band data */
162chart_oobflags;/* have some */
163chart_iobc;/* input character */
164#defineTCPOOB_HAVEDATA0x01
165#defineTCPOOB_HADDATA0x02
166/* RFC 1323 variables */
167u_charsnd_scale;/* window scaling for send window */
168u_charrcv_scale;/* window scaling for recv window */
169u_charrequest_r_scale;/* pending window scaling */
170u_charrequested_s_scale;
171u_int32_t ts_recent;/* timestamp echo data */
172
173u_int32_t ts_recent_age;/* when last updated */
174tcp_seqlast_ack_sent;
175/* RFC 1644 variables */
176tcp_cccc_send;/* send connection count */
177tcp_cccc_recv;/* receive connection count */
178tcp_seqsnd_recover;/* for use in fast recovery */
179/* experimental */
180u_int32_t snd_cwnd_prev;/* cwnd prior to retransmit */
181u_int32_t snd_ssthresh_prev;/* ssthresh prior to retransmit */
182u_int32_t t_badrxtwin;/* window for retransmit recovery */
183};
184
185
186/*
187 * TCP statistics.
188 * Many of these should be kept per connection,
189 * but that's inconvenient at the moment.
190 */
191structtcpstat {
192u_int32_ttcps_connattempt;/* connections initiated */
193u_int32_ttcps_accepts;/* connections accepted */
194u_int32_ttcps_connects;/* connections established */
195u_int32_ttcps_drops;/* connections dropped */
196u_int32_ttcps_conndrops;/* embryonic connections dropped */
197u_int32_ttcps_closed;/* conn. closed (includes drops) */
198u_int32_ttcps_segstimed;/* segs where we tried to get rtt */
199u_int32_ttcps_rttupdated;/* times we succeeded */
200u_int32_ttcps_delack;/* delayed acks sent */
201u_int32_ttcps_timeoutdrop;/* conn. dropped in rxmt timeout */
202u_int32_ttcps_rexmttimeo;/* retransmit timeouts */
203u_int32_ttcps_persisttimeo;/* persist timeouts */
204u_int32_ttcps_keeptimeo;/* keepalive timeouts */
205u_int32_ttcps_keepprobe;/* keepalive probes sent */
206u_int32_ttcps_keepdrops;/* connections dropped in keepalive */
207
208u_int32_ttcps_sndtotal;/* total packets sent */
209u_int32_ttcps_sndpack;/* data packets sent */
210u_int32_ttcps_sndbyte;/* data bytes sent */
211u_int32_ttcps_sndrexmitpack;/* data packets retransmitted */
212u_int32_ttcps_sndrexmitbyte;/* data bytes retransmitted */
213u_int32_ttcps_sndacks;/* ack-only packets sent */
214u_int32_ttcps_sndprobe;/* window probes sent */
215u_int32_ttcps_sndurg;/* packets sent with URG only */
216u_int32_ttcps_sndwinup;/* window update-only packets sent */
217u_int32_ttcps_sndctrl;/* control (SYN|FIN|RST) packets sent */
218
219u_int32_ttcps_rcvtotal;/* total packets received */
220u_int32_ttcps_rcvpack;/* packets received in sequence */
221u_int32_ttcps_rcvbyte;/* bytes received in sequence */
222u_int32_ttcps_rcvbadsum;/* packets received with ccksum errs */
223u_int32_ttcps_rcvbadoff;/* packets received with bad offset */
224u_int32_ttcps_rcvmemdrop;/* packets dropped for lack of memory */
225u_int32_ttcps_rcvshort;/* packets received too short */
226u_int32_ttcps_rcvduppack;/* duplicate-only packets received */
227u_int32_ttcps_rcvdupbyte;/* duplicate-only bytes received */
228u_int32_ttcps_rcvpartduppack;/* packets with some duplicate data */
229u_int32_ttcps_rcvpartdupbyte;/* dup. bytes in part-dup. packets */
230u_int32_ttcps_rcvoopack;/* out-of-order packets received */
231u_int32_ttcps_rcvoobyte;/* out-of-order bytes received */
232u_int32_ttcps_rcvpackafterwin;/* packets with data after window */
233u_int32_ttcps_rcvbyteafterwin;/* bytes rcvd after window */
234u_int32_ttcps_rcvafterclose;/* packets rcvd after "close" */
235u_int32_ttcps_rcvwinprobe;/* rcvd window probe packets */
236u_int32_ttcps_rcvdupack;/* rcvd duplicate acks */
237u_int32_ttcps_rcvacktoomuch;/* rcvd acks for unsent data */
238u_int32_ttcps_rcvackpack;/* rcvd ack packets */
239u_int32_ttcps_rcvackbyte;/* bytes acked by rcvd acks */
240u_int32_ttcps_rcvwinupd;/* rcvd window update packets */
241u_int32_ttcps_pawsdrop;/* segments dropped due to PAWS */
242u_int32_ttcps_predack;/* times hdr predict ok for acks */
243u_int32_ttcps_preddat;/* times hdr predict ok for data pkts */
244u_int32_ttcps_pcbcachemiss;
245u_int32_ttcps_cachedrtt;/* times cached RTT in route updated */
246u_int32_ttcps_cachedrttvar;/* times cached rttvar updated */
247u_int32_ttcps_cachedssthresh;/* times cached ssthresh updated */
248u_int32_ttcps_usedrtt;/* times RTT initialized from route */
249u_int32_ttcps_usedrttvar;/* times RTTVAR initialized from rt */
250u_int32_ttcps_usedssthresh;/* times ssthresh initialized from rt*/
251u_int32_ttcps_persistdrop;/* timeout in persist state */
252u_int32_ttcps_badsyn;/* bogus SYN, e.g. premature ACK */
253u_int32_ttcps_mturesent;/* resends due to MTU discovery */
254u_int32_ttcps_listendrop;/* listen queue overflows */
255
256/* new stats from FreeBSD 5.4 sync up */
257u_int32_ttcps_minmssdrops;/* average minmss too low drops */
258u_int32_ttcps_sndrexmitbad;/* unnecessary packet retransmissions */
259u_int32_ttcps_badrst;/* ignored RSTs in the window */
260
261u_int32_ttcps_sc_added;/* entry added to syncache */
262u_int32_ttcps_sc_retransmitted;/* syncache entry was retransmitted */
263u_int32_ttcps_sc_dupsyn;/* duplicate SYN packet */
264u_int32_ttcps_sc_dropped;/* could not reply to packet */
265u_int32_ttcps_sc_completed;/* successful extraction of entry */
266u_int32_ttcps_sc_bucketoverflow;/* syncache per-bucket limit hit */
267u_int32_ttcps_sc_cacheoverflow;/* syncache cache limit hit */
268u_int32_ttcps_sc_reset;/* RST removed entry from syncache */
269u_int32_ttcps_sc_stale;/* timed out or listen socket gone */
270u_int32_ttcps_sc_aborted;/* syncache entry aborted */
271u_int32_ttcps_sc_badack;/* removed due to bad ACK */
272u_int32_ttcps_sc_unreach;/* ICMP unreachable received */
273u_int32_ttcps_sc_zonefail;/* zalloc() failed */
274u_int32_ttcps_sc_sendcookie;/* SYN cookie sent */
275u_int32_ttcps_sc_recvcookie;/* SYN cookie received */
276
277u_int32_ttcps_hc_added;/* entry added to hostcache */
278u_int32_ttcps_hc_bucketoverflow;/* hostcache per bucket limit hit */
279
280/* SACK related stats */
281u_int32_ttcps_sack_recovery_episode; /* SACK recovery episodes */
282u_int32_t tcps_sack_rexmits; /* SACK rexmit segments */
283u_int32_t tcps_sack_rexmit_bytes; /* SACK rexmit bytes */
284u_int32_t tcps_sack_rcv_blocks; /* SACK blocks (options) received */
285u_int32_t tcps_sack_send_blocks; /* SACK blocks (options) sent */
286u_int32_t tcps_sack_sboverflow; /* SACK sendblock overflow */
287
288#if TRAFFIC_MGT
289u_int32_ttcps_bg_rcvtotal;/* total background packets received */
290#endif /* TRAFFIC_MGT */
291};
292
293#pragma pack(4)
294
295/*
296 * TCB structure exported to user-land via sysctl(3).
297 * Evil hack: declare only if in_pcb.h and sys/socketvar.h have been
298 * included. Not all of our clients do.
299 */
300
301struct xtcpcb {
302 u_int32_t xt_len;
303 struct inpcb xt_inp;
304 struct tcpcb xt_tp;
305 struct xsocket xt_socket;
306 u_quad_t xt_alignment_hack;
307};
308
309#if !CONFIG_EMBEDDED
310
311struct xtcpcb64 {
312 u_int32_t xt_len;
313 struct xinpcb64xt_inpcb;
314
315 u_int64_t t_segq;
316 int t_dupacks; /* consecutive dup acks recd */
317
318 int t_timer[TCPT_NTIMERS]; /* tcp timers */
319
320 int t_state; /* state of this connection */
321 u_int t_flags;
322
323 int t_force; /* 1 if forcing out a byte */
324
325 tcp_seq snd_una; /* send unacknowledged */
326 tcp_seq snd_max; /* highest sequence number sent;
327 * used to recognize retransmits
328 */
329 tcp_seq snd_nxt; /* send next */
330 tcp_seq snd_up; /* send urgent pointer */
331
332 tcp_seq snd_wl1; /* window update seg seq number */
333 tcp_seq snd_wl2; /* window update seg ack number */
334 tcp_seq iss; /* initial send sequence number */
335 tcp_seq irs; /* initial receive sequence number */
336
337 tcp_seq rcv_nxt; /* receive next */
338 tcp_seq rcv_adv; /* advertised window */
339 u_int32_t rcv_wnd; /* receive window */
340 tcp_seq rcv_up; /* receive urgent pointer */
341
342 u_int32_t snd_wnd; /* send window */
343 u_int32_t snd_cwnd; /* congestion-controlled window */
344 u_int32_t snd_ssthresh; /* snd_cwnd size threshold for
345 * for slow start exponential to
346 * linear switch
347 */
348 u_int t_maxopd; /* mss plus options */
349
350 u_int32_t t_rcvtime; /* inactivity time */
351 u_int32_t t_starttime; /* time connection was established */
352 int t_rtttime; /* round trip time */
353 tcp_seq t_rtseq; /* sequence number being timed */
354
355 int t_rxtcur; /* current retransmit value (ticks) */
356 u_int t_maxseg; /* maximum segment size */
357 int t_srtt; /* smoothed round-trip time */
358 int t_rttvar; /* variance in round-trip time */
359
360 int t_rxtshift; /* log(2) of rexmt exp. backoff */
361 u_int t_rttmin; /* minimum rtt allowed */
362 u_int32_t t_rttupdated; /* number of times rtt sampled */
363 u_int32_t max_sndwnd; /* largest window peer has offered */
364
365 int t_softerror; /* possible error not yet reported */
366/* out-of-band data */
367 char t_oobflags; /* have some */
368 char t_iobc; /* input character */
369/* RFC 1323 variables */
370 u_char snd_scale; /* window scaling for send window */
371 u_char rcv_scale; /* window scaling for recv window */
372 u_char request_r_scale; /* pending window scaling */
373 u_char requested_s_scale;
374 u_int32_t ts_recent; /* timestamp echo data */
375
376 u_int32_t ts_recent_age; /* when last updated */
377 tcp_seq last_ack_sent;
378/* RFC 1644 variables */
379 tcp_cc cc_send; /* send connection count */
380 tcp_cc cc_recv; /* receive connection count */
381 tcp_seq snd_recover; /* for use in fast recovery */
382/* experimental */
383 u_int32_t snd_cwnd_prev; /* cwnd prior to retransmit */
384 u_int32_t snd_ssthresh_prev; /* ssthresh prior to retransmit */
385 u_int32_t t_badrxtwin; /* window for retransmit recovery */
386
387 u_quad_txt_alignment_hack;
388};
389
390#endif /* !CONFIG_EMBEDDED */
391
392#pragma pack()
393
394/*
395 * Names for TCP sysctl objects
396 */
397#defineTCPCTL_DO_RFC13231/* use RFC-1323 extensions */
398#defineTCPCTL_DO_RFC16442/* use RFC-1644 extensions */
399#defineTCPCTL_MSSDFLT3/* MSS default */
400#define TCPCTL_STATS4/* statistics (read-only) */
401#defineTCPCTL_RTTDFLT5/* default RTT estimate */
402#defineTCPCTL_KEEPIDLE6/* keepalive idle timer */
403#defineTCPCTL_KEEPINTVL7/* interval to send keepalives */
404#defineTCPCTL_SENDSPACE8/* send buffer space */
405#defineTCPCTL_RECVSPACE9/* receive buffer space */
406#defineTCPCTL_KEEPINIT10/* timeout for establishing syn */
407#defineTCPCTL_PCBLIST11/* list of all outstanding PCBs */
408#defineTCPCTL_DELACKTIME12/* time before sending delayed ACK */
409#defineTCPCTL_V6MSSDFLT13/* MSS default for IPv6 */
410#defineTCPCTL_MAXID14
411
412
413#endif /* _NETINET_TCP_VAR_H_ */
414

Archive Download this file

Revision: 1808