OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [tcpip/] [v2_0/] [include/] [netinet/] [tcp_var.h] - Blame information for rev 27

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      include/netinet_tcp_var.h
4
//
5
//      
6
//
7
//==========================================================================
8
//####BSDCOPYRIGHTBEGIN####
9
//
10
// -------------------------------------------
11
//
12
// Portions of this software may have been derived from OpenBSD or other sources,
13
// and are covered by the appropriate copyright disclaimers included herein.
14
//
15
// -------------------------------------------
16
//
17
//####BSDCOPYRIGHTEND####
18
//==========================================================================
19
//#####DESCRIPTIONBEGIN####
20
//
21
// Author(s):    gthomas
22
// Contributors: gthomas
23
// Date:         2000-01-10
24
// Purpose:      
25
// Description:  
26
//              
27
//
28
//####DESCRIPTIONEND####
29
//
30
//==========================================================================
31
 
32
 
33
/*      $OpenBSD: tcp_var.h,v 1.25 1999/12/08 06:50:20 itojun Exp $     */
34
/*      $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $    */
35
 
36
/*
37
 * Copyright (c) 1982, 1986, 1993, 1994
38
 *      The Regents of the University of California.  All rights reserved.
39
 *
40
 * Redistribution and use in source and binary forms, with or without
41
 * modification, are permitted provided that the following conditions
42
 * are met:
43
 * 1. Redistributions of source code must retain the above copyright
44
 *    notice, this list of conditions and the following disclaimer.
45
 * 2. Redistributions in binary form must reproduce the above copyright
46
 *    notice, this list of conditions and the following disclaimer in the
47
 *    documentation and/or other materials provided with the distribution.
48
 * 3. All advertising materials mentioning features or use of this software
49
 *    must display the following acknowledgement:
50
 *      This product includes software developed by the University of
51
 *      California, Berkeley and its contributors.
52
 * 4. Neither the name of the University nor the names of its contributors
53
 *    may be used to endorse or promote products derived from this software
54
 *    without specific prior written permission.
55
 *
56
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
57
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
58
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
59
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
60
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
61
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
62
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
63
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
64
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
65
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
66
 * SUCH DAMAGE.
67
 *
68
 *      @(#)tcp_var.h   8.3 (Berkeley) 4/10/94
69
 */
70
 
71
#ifndef _NETINET_TCP_VAR_H_
72
#define _NETINET_TCP_VAR_H_
73
 
74
struct sackblk {
75
        tcp_seq start;          /* start seq no. of sack block */
76
        tcp_seq end;            /* end seq no. */
77
};
78
 
79
struct sackhole {
80
        tcp_seq start;          /* start seq no. of hole */
81
        tcp_seq end;            /* end seq no. */
82
        int     dups;           /* number of dup(s)acks for this hole */
83
        tcp_seq rxmit;          /* next seq. no in hole to be retransmitted */
84
        struct sackhole *next;  /* next in list */
85
};
86
 
87
/*
88
 * Kernel variables for tcp.
89
 */
90
 
91
/*
92
 * Tcp control block, one per tcp; fields:
93
 */
94
struct tcpcb {
95
        struct ipqehead segq;           /* sequencing queue */
96
        short   t_state;                /* state of this connection */
97
        short   t_timer[TCPT_NTIMERS];  /* tcp timers */
98
        short   t_rxtshift;             /* log(2) of rexmt exp. backoff */
99
        short   t_rxtcur;               /* current retransmit value */
100
        short   t_dupacks;              /* consecutive dup acks recd */
101
        u_short t_maxseg;               /* maximum segment size */
102
        char    t_force;                /* 1 if forcing out a byte */
103
        u_short t_flags;
104
#define TF_ACKNOW       0x0001          /* ack peer immediately */
105
#define TF_DELACK       0x0002          /* ack, but try to delay it */
106
#define TF_NODELAY      0x0004          /* don't delay packets to coalesce */
107
#define TF_NOOPT        0x0008          /* don't use tcp options */
108
#define TF_SENTFIN      0x0010          /* have sent FIN */
109
#define TF_REQ_SCALE    0x0020          /* have/will request window scaling */
110
#define TF_RCVD_SCALE   0x0040          /* other side has requested scaling */
111
#define TF_REQ_TSTMP    0x0080          /* have/will request timestamps */
112
#define TF_RCVD_TSTMP   0x0100          /* a timestamp was received in SYN */
113
#define TF_SACK_PERMIT  0x0200          /* other side said I could SACK */
114
#define TF_SIGNATURE    0x0400          /* require TCP MD5 signature */
115
 
116
        struct  mbuf *t_template;       /* skeletal packet for transmit */
117
        struct  inpcb *t_inpcb;         /* back pointer to internet pcb */
118
/*
119
 * The following fields are used as in the protocol specification.
120
 * See RFC783, Dec. 1981, page 21.
121
 */
122
/* send sequence variables */
123
        tcp_seq snd_una;                /* send unacknowledged */
124
        tcp_seq snd_nxt;                /* send next */
125
        tcp_seq snd_up;                 /* send urgent pointer */
126
        tcp_seq snd_wl1;                /* window update seg seq number */
127
        tcp_seq snd_wl2;                /* window update seg ack number */
128
        tcp_seq iss;                    /* initial send sequence number */
129
        u_long  snd_wnd;                /* send window */
130
#ifdef TCP_SACK
131
        int     sack_disable;           /* disable SACK for this connection */
132
        int     snd_numholes;           /* number of holes seen by sender */
133
        struct sackhole *snd_holes;     /* linked list of holes (sorted) */
134
#if defined(TCP_SACK) && defined(TCP_FACK)
135
        tcp_seq snd_fack;               /* for FACK congestion control */
136
        u_long  snd_awnd;               /* snd_nxt - snd_fack + */
137
                                        /* retransmitted data */
138
        int retran_data;                /* amount of outstanding retx. data  */
139
#endif /* TCP_FACK */
140
#endif /* TCP_SACK */
141
#if defined(TCP_SACK) || defined(TCP_NEWRENO)
142
        tcp_seq snd_last;               /* for use in fast recovery */
143
#endif
144
/* receive sequence variables */
145
        u_long  rcv_wnd;                /* receive window */
146
        tcp_seq rcv_nxt;                /* receive next */
147
        tcp_seq rcv_up;                 /* receive urgent pointer */
148
        tcp_seq irs;                    /* initial receive sequence number */
149
#ifdef TCP_SACK
150
        tcp_seq rcv_laststart;          /* start of last segment recd. */
151
        tcp_seq rcv_lastend;            /* end of ... */
152
        tcp_seq rcv_lastsack;           /* last seq number(+1) sack'd by rcv'r*/
153
        int     rcv_numsacks;           /* # distinct sack blks present */
154
        struct sackblk sackblks[MAX_SACK_BLKS]; /* seq nos. of sack blocks */
155
#endif
156
 
157
/*
158
 * Additional variables for this implementation.
159
 */
160
/* receive variables */
161
        tcp_seq rcv_adv;                /* advertised window */
162
/* retransmit variables */
163
        tcp_seq snd_max;                /* highest sequence number sent;
164
                                         * used to recognize retransmits
165
                                         */
166
/* congestion control (for slow start, source quench, retransmit after loss) */
167
        u_long  snd_cwnd;               /* congestion-controlled window */
168
        u_long  snd_ssthresh;           /* snd_cwnd size threshhold for
169
                                         * for slow start exponential to
170
                                         * linear switch
171
                                         */
172
        u_int   t_maxopd;               /* mss plus options */
173
 
174
/*
175
 * transmit timing stuff.  See below for scale of srtt and rttvar.
176
 * "Variance" is actually smoothed difference.
177
 */
178
        short   t_idle;                 /* inactivity time */
179
        short   t_rtt;                  /* round trip time */
180
        tcp_seq t_rtseq;                /* sequence number being timed */
181
        short   t_srtt;                 /* smoothed round-trip time */
182
        short   t_rttvar;               /* variance in round-trip time */
183
        u_short t_rttmin;               /* minimum rtt allowed */
184
        u_long  max_sndwnd;             /* largest window peer has offered */
185
 
186
/* out-of-band data */
187
        char    t_oobflags;             /* have some */
188
        char    t_iobc;                 /* input character */
189
#define TCPOOB_HAVEDATA 0x01
190
#define TCPOOB_HADDATA  0x02
191
        short   t_softerror;            /* possible error not yet reported */
192
 
193
/* RFC 1323 variables */
194
        u_char  snd_scale;              /* window scaling for send window */
195
        u_char  rcv_scale;              /* window scaling for recv window */
196
        u_char  request_r_scale;        /* pending window scaling */
197
        u_char  requested_s_scale;
198
        u_int32_t ts_recent;            /* timestamp echo data */
199
        u_int32_t ts_recent_age;                /* when last updated */
200
        tcp_seq last_ack_sent;
201
 
202
/* TUBA stuff */
203
        caddr_t t_tuba_pcb;             /* next level down pcb for TCP over z */
204
 
205
        int pf;
206
};
207
 
208
#define intotcpcb(ip)   ((struct tcpcb *)(ip)->inp_ppcb)
209
#define sototcpcb(so)   (intotcpcb(sotoinpcb(so)))
210
 
211
/*
212
 * The smoothed round-trip time and estimated variance
213
 * are stored as fixed point numbers scaled by the values below.
214
 * For convenience, these scales are also used in smoothing the average
215
 * (smoothed = (1/scale)sample + ((scale-1)/scale)smoothed).
216
 * With these scales, srtt has 3 bits to the right of the binary point,
217
 * and thus an "ALPHA" of 0.875.  rttvar has 2 bits to the right of the
218
 * binary point, and is smoothed with an ALPHA of 0.75.
219
 */
220
#define TCP_RTT_SCALE           8       /* multiplier for srtt; 3 bits frac. */
221
#define TCP_RTT_SHIFT           3       /* shift for srtt; 3 bits frac. */
222
#define TCP_RTTVAR_SCALE        4       /* multiplier for rttvar; 2 bits */
223
#define TCP_RTTVAR_SHIFT        2       /* multiplier for rttvar; 2 bits */
224
 
225
/*
226
 * The initial retransmission should happen at rtt + 4 * rttvar.
227
 * Because of the way we do the smoothing, srtt and rttvar
228
 * will each average +1/2 tick of bias.  When we compute
229
 * the retransmit timer, we want 1/2 tick of rounding and
230
 * 1 extra tick because of +-1/2 tick uncertainty in the
231
 * firing of the timer.  The bias will give us exactly the
232
 * 1.5 tick we need.  But, because the bias is
233
 * statistical, we have to test that we don't drop below
234
 * the minimum feasible timer (which is 2 ticks).
235
 * This macro assumes that the value of TCP_RTTVAR_SCALE
236
 * is the same as the multiplier for rttvar.
237
 */
238
#define TCP_REXMTVAL(tp) \
239
        ((((tp)->t_srtt >> TCP_RTT_SHIFT) + (tp)->t_rttvar) >> 2)
240
 
241
/*
242
 * TCP statistics.
243
 * Many of these should be kept per connection,
244
 * but that's inconvenient at the moment.
245
 */
246
struct  tcpstat {
247
        u_int32_t tcps_connattempt;     /* connections initiated */
248
        u_int32_t tcps_accepts;         /* connections accepted */
249
        u_int32_t tcps_connects;        /* connections established */
250
        u_int32_t tcps_drops;           /* connections dropped */
251
        u_int32_t tcps_conndrops;       /* embryonic connections dropped */
252
        u_int32_t tcps_closed;          /* conn. closed (includes drops) */
253
        u_int32_t tcps_segstimed;       /* segs where we tried to get rtt */
254
        u_int32_t tcps_rttupdated;      /* times we succeeded */
255
        u_int32_t tcps_delack;          /* delayed acks sent */
256
        u_int32_t tcps_timeoutdrop;     /* conn. dropped in rxmt timeout */
257
        u_int32_t tcps_rexmttimeo;      /* retransmit timeouts */
258
        u_int32_t tcps_persisttimeo;    /* persist timeouts */
259
        u_int32_t tcps_persistdrop;     /* connections dropped in persist */
260
        u_int32_t tcps_keeptimeo;       /* keepalive timeouts */
261
        u_int32_t tcps_keepprobe;       /* keepalive probes sent */
262
        u_int32_t tcps_keepdrops;       /* connections dropped in keepalive */
263
 
264
        u_int32_t tcps_sndtotal;                /* total packets sent */
265
        u_int32_t tcps_sndpack;         /* data packets sent */
266
        u_int64_t tcps_sndbyte;         /* data bytes sent */
267
        u_int32_t tcps_sndrexmitpack;   /* data packets retransmitted */
268
        u_int64_t tcps_sndrexmitbyte;   /* data bytes retransmitted */
269
        u_int64_t tcps_sndrexmitfast;   /* Fast retransmits */
270
        u_int32_t tcps_sndacks;         /* ack-only packets sent */
271
        u_int32_t tcps_sndprobe;        /* window probes sent */
272
        u_int32_t tcps_sndurg;          /* packets sent with URG only */
273
        u_int32_t tcps_sndwinup;        /* window update-only packets sent */
274
        u_int32_t tcps_sndctrl;         /* control (SYN|FIN|RST) packets sent */
275
 
276
        u_int32_t tcps_rcvtotal;        /* total packets received */
277
        u_int32_t tcps_rcvpack;         /* packets received in sequence */
278
        u_int64_t tcps_rcvbyte;         /* bytes received in sequence */
279
        u_int32_t tcps_rcvbadsum;       /* packets received with ccksum errs */
280
        u_int32_t tcps_rcvbadoff;       /* packets received with bad offset */
281
        u_int32_t tcps_rcvmemdrop;      /* packets dropped for lack of memory */
282
        u_int32_t tcps_rcvnosec;        /* packets dropped for lack of ipsec */
283
        u_int32_t tcps_rcvshort;        /* packets received too short */
284
        u_int32_t tcps_rcvduppack;      /* duplicate-only packets received */
285
        u_int64_t tcps_rcvdupbyte;      /* duplicate-only bytes received */
286
        u_int32_t tcps_rcvpartduppack;  /* packets with some duplicate data */
287
        u_int64_t tcps_rcvpartdupbyte;  /* dup. bytes in part-dup. packets */
288
        u_int32_t tcps_rcvoopack;       /* out-of-order packets received */
289
        u_int64_t tcps_rcvoobyte;       /* out-of-order bytes received */
290
        u_int32_t tcps_rcvpackafterwin; /* packets with data after window */
291
        u_int64_t tcps_rcvbyteafterwin; /* bytes rcvd after window */
292
        u_int32_t tcps_rcvafterclose;   /* packets rcvd after "close" */
293
        u_int32_t tcps_rcvwinprobe;     /* rcvd window probe packets */
294
        u_int32_t tcps_rcvdupack;       /* rcvd duplicate acks */
295
        u_int32_t tcps_rcvacktoomuch;   /* rcvd acks for unsent data */
296
        u_int32_t tcps_rcvackpack;      /* rcvd ack packets */
297
        u_int64_t tcps_rcvackbyte;      /* bytes acked by rcvd acks */
298
        u_int32_t tcps_rcvwinupd;       /* rcvd window update packets */
299
        u_int32_t tcps_pawsdrop;        /* segments dropped due to PAWS */
300
        u_int32_t tcps_predack;         /* times hdr predict ok for acks */
301
        u_int32_t tcps_preddat;         /* times hdr predict ok for data pkts */
302
 
303
        u_int32_t tcps_pcbhashmiss;     /* input packets missing pcb hash */
304
        u_int32_t tcps_noport;          /* no socket on port */
305
        u_int32_t tcps_badsyn;          /* SYN packet with src==dst rcv'ed */
306
 
307
        u_int32_t tcps_rcvbadsig;       /* rcvd bad/missing TCP signatures */
308
        u_int64_t tcps_rcvgoodsig;      /* rcvd good TCP signatures */
309
};
310
 
311
/*
312
 * Names for TCP sysctl objects.
313
 */
314
 
315
#define TCPCTL_RFC1323          1 /* enable/disable RFC1323 timestamps/scaling */
316
#define TCPCTL_KEEPINITTIME     2 /* TCPT_KEEP value */
317
#define TCPCTL_KEEPIDLE         3 /* allow tcp_keepidle to be changed */
318
#define TCPCTL_KEEPINTVL        4 /* allow tcp_keepintvl to be changed */
319
#define TCPCTL_SLOWHZ           5 /* return kernel idea of PR_SLOWHZ */ 
320
#define TCPCTL_BADDYNAMIC       6 /* return bad dynamic port bitmap */ 
321
#define TCPCTL_RECVSPACE        7 /* receive buffer space */
322
#define TCPCTL_SENDSPACE        8 /* send buffer space */
323
#define TCPCTL_IDENT            9 /* get connection owner */
324
#define TCPCTL_SACK            10 /* selective acknowledgement, rfc 2018 */
325
#define TCPCTL_MSSDFLT         11 /* Default maximum segment size */
326
#define TCPCTL_MAXID           12
327
 
328
#define TCPCTL_NAMES { \
329
        { 0, 0 }, \
330
        { "rfc1323",    CTLTYPE_INT }, \
331
        { "keepinittime",       CTLTYPE_INT }, \
332
        { "keepidle",   CTLTYPE_INT }, \
333
        { "keepintvl",  CTLTYPE_INT }, \
334
        { "slowhz",     CTLTYPE_INT }, \
335
        { "baddynamic", CTLTYPE_STRUCT }, \
336
        { "recvspace",  CTLTYPE_INT }, \
337
        { "sendspace",  CTLTYPE_INT }, \
338
        { "ident", CTLTYPE_STRUCT }, \
339
        { "sack",       CTLTYPE_INT }, \
340
        { "mssdflt",    CTLTYPE_INT }, \
341
}
342
 
343
struct tcp_ident_mapping {
344
        struct sockaddr faddr, laddr;
345
        int euid, ruid;
346
};
347
 
348
#ifdef _KERNEL
349
struct  inpcbtable tcbtable;    /* head of queue of active tcpcb's */
350
struct  tcpstat tcpstat;        /* tcp statistics */
351
u_int32_t tcp_now;              /* for RFC 1323 timestamps */
352
extern  int tcp_do_rfc1323;     /* enabled/disabled? */
353
extern  int tcp_mssdflt;        /* default maximum segment size */
354
#ifdef TCP_SACK
355
extern  int tcp_do_sack;        /* SACK enabled/disabled */
356
#endif
357
 
358
int      tcp_attach __P((struct socket *));
359
void     tcp_canceltimers __P((struct tcpcb *));
360
struct tcpcb *
361
         tcp_close __P((struct tcpcb *));
362
#if defined(INET6) && !defined(TCP6)
363
void     tcp6_ctlinput __P((int, struct sockaddr *, void *));
364
#endif
365
void     *tcp_ctlinput __P((int, struct sockaddr *, void *));
366
int      tcp_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
367
struct tcpcb *
368
         tcp_disconnect __P((struct tcpcb *));
369
struct tcpcb *
370
         tcp_drop __P((struct tcpcb *, int));
371
void     tcp_dooptions __P((struct tcpcb *, u_char *, int, struct tcphdr *,
372
                int *, u_int32_t *, u_int32_t *));
373
void     tcp_drain __P((void));
374
void     tcp_fasttimo __P((void));
375
void     tcp_init __P((void));
376
#if defined(INET6) && !defined(TCP6)
377
int      tcp6_input __P((struct mbuf **, int *, int));
378
#endif
379
void     tcp_input __P((struct mbuf *, ...));
380
int      tcp_mss __P((struct tcpcb *, u_int));
381
struct tcpcb *
382
         tcp_newtcpcb __P((struct inpcb *));
383
void     tcp_notify __P((struct inpcb *, int));
384
int      tcp_output __P((struct tcpcb *));
385
void     tcp_pulloutofband __P((struct socket *, u_int, struct mbuf *, int));
386
void     tcp_quench __P((struct inpcb *, int));
387
int      tcp_reass __P((struct tcpcb *, struct tcphdr *, struct mbuf *, int *));
388
void     tcp_respond __P((struct tcpcb *, caddr_t, struct mbuf *, tcp_seq,
389
                tcp_seq, int));
390
void     tcp_setpersist __P((struct tcpcb *));
391
void     tcp_slowtimo __P((void));
392
struct mbuf *
393
         tcp_template __P((struct tcpcb *));
394
struct tcpcb *
395
         tcp_timers __P((struct tcpcb *, int));
396
void     tcp_trace __P((int, int, struct tcpcb *, caddr_t, int, int));
397
struct tcpcb *
398
         tcp_usrclosed __P((struct tcpcb *));
399
int      tcp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
400
#if defined(INET6) && !defined(TCP6)
401
int      tcp6_usrreq __P((struct socket *,
402
            int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *));
403
#endif
404
int      tcp_usrreq __P((struct socket *,
405
            int, struct mbuf *, struct mbuf *, struct mbuf *));
406
void     tcp_xmit_timer __P((struct tcpcb *, int));
407
void     tcpdropoldhalfopen __P((struct tcpcb *, u_int16_t));
408
#ifdef TCP_SACK
409
int      tcp_sack_option __P((struct tcpcb *,struct tcphdr *,u_char *,int));
410
void     tcp_update_sack_list __P((struct tcpcb *tp));
411
void     tcp_del_sackholes __P((struct tcpcb *, struct tcphdr *));
412
void     tcp_clean_sackreport __P((struct tcpcb *tp));
413
void     tcp_sack_adjust __P((struct tcpcb *tp));
414
struct sackhole *
415
         tcp_sack_output __P((struct tcpcb *tp));
416
int      tcp_sack_partialack __P((struct tcpcb *, struct tcphdr *));
417
#ifdef DEBUG
418
void     tcp_print_holes __P((struct tcpcb *tp));
419
#endif
420
#endif /* TCP_SACK */
421
#if defined(TCP_NEWRENO) || defined(TCP_SACK)
422
int      tcp_newreno __P((struct tcpcb *, struct tcphdr *));
423
u_long   tcp_seq_subtract  __P((u_long, u_long ));
424
#endif /* TCP_NEWRENO || TCP_SACK */
425
#ifdef TCP_SIGNATURE
426
int     tcp_signature_apply __P((caddr_t, caddr_t, unsigned int));
427
#endif /* TCP_SIGNATURE */
428
 
429
#endif /* _KERNEL */
430
 
431
#endif // _NETINET_TCP_VAR_H_

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.