comparison packages/net/tcpip/current/include/netinet/tcp_seq.h @ 97:ced4577552cd ecos-sw-2000-06-06

Merge from eCos master repository on 2000-06-06-08:44:00-BST
author jlarmour
date Tue, 06 Jun 2000 08:39:36 +0000
parents
children e0c0827131d1
comparison
equal deleted inserted replaced
96:b15c60e34c84 97:ced4577552cd
1 //==========================================================================
2 //
3 // include/netinet_tcp_seq.h
4 //
5 //
6 //
7 //==========================================================================
8 //####COPYRIGHTBEGIN####
9 //
10 // -------------------------------------------
11 // The contents of this file are subject to the Red Hat eCos Public License
12 // Version 1.1 (the "License"); you may not use this file except in
13 // compliance with the License. You may obtain a copy of the License at
14 // http://www.redhat.com/
15 //
16 // Software distributed under the License is distributed on an "AS IS"
17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
18 // License for the specific language governing rights and limitations under
19 // the License.
20 //
21 // The Original Code is eCos - Embedded Configurable Operating System,
22 // released September 30, 1998.
23 //
24 // The Initial Developer of the Original Code is Red Hat.
25 // Portions created by Red Hat are
26 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
27 // All Rights Reserved.
28 // -------------------------------------------
29 //
30 //####COPYRIGHTEND####
31 //####BSDCOPYRIGHTBEGIN####
32 //
33 // -------------------------------------------
34 //
35 // Portions of this software may have been derived from OpenBSD or other sources,
36 // and are covered by the appropriate copyright disclaimers included herein.
37 //
38 // -------------------------------------------
39 //
40 //####BSDCOPYRIGHTEND####
41 //==========================================================================
42 //#####DESCRIPTIONBEGIN####
43 //
44 // Author(s): gthomas
45 // Contributors: gthomas
46 // Date: 2000-01-10
47 // Purpose:
48 // Description:
49 //
50 //
51 //####DESCRIPTIONEND####
52 //
53 //==========================================================================
54
55
56 /* $OpenBSD: tcp_seq.h,v 1.2 1997/02/24 14:06:46 niklas Exp $ */
57 /* $NetBSD: tcp_seq.h,v 1.6 1995/03/26 20:32:35 jtc Exp $ */
58
59 /*
60 * Copyright (c) 1982, 1986, 1993
61 * The Regents of the University of California. All rights reserved.
62 *
63 * Redistribution and use in source and binary forms, with or without
64 * modification, are permitted provided that the following conditions
65 * are met:
66 * 1. Redistributions of source code must retain the above copyright
67 * notice, this list of conditions and the following disclaimer.
68 * 2. Redistributions in binary form must reproduce the above copyright
69 * notice, this list of conditions and the following disclaimer in the
70 * documentation and/or other materials provided with the distribution.
71 * 3. All advertising materials mentioning features or use of this software
72 * must display the following acknowledgement:
73 * This product includes software developed by the University of
74 * California, Berkeley and its contributors.
75 * 4. Neither the name of the University nor the names of its contributors
76 * may be used to endorse or promote products derived from this software
77 * without specific prior written permission.
78 *
79 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
80 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
81 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
82 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
83 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
84 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
85 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
86 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
87 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
88 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
89 * SUCH DAMAGE.
90 *
91 * @(#)tcp_seq.h 8.1 (Berkeley) 6/10/93
92 */
93
94 #ifndef _NETINET_TCP_SEQ_H_
95 #define _NETINET_TCP_SEQ_H_
96
97 /*
98 * TCP sequence numbers are 32 bit integers operated
99 * on with modular arithmetic. These macros can be
100 * used to compare such integers.
101 */
102 #define SEQ_LT(a,b) ((int)((a)-(b)) < 0)
103 #define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0)
104 #define SEQ_GT(a,b) ((int)((a)-(b)) > 0)
105 #define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0)
106
107 /*
108 * Macros to initialize tcp sequence numbers for
109 * send and receive from initial send and receive
110 * sequence numbers.
111 */
112 #define tcp_rcvseqinit(tp) \
113 (tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1
114
115 #define tcp_sendseqinit(tp) \
116 (tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \
117 (tp)->iss
118
119 #define TCP_ISSINCR (125*1024) /* increment for tcp_iss each second */
120
121 #ifdef _KERNEL
122 tcp_seq tcp_iss; /* tcp initial send seq # */
123 #endif
124
125 #endif // _NETINET_TCP_SEQ_H_