The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netinet/tcp_seq.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 2003, 2004 Jeffrey M. Hsu.  All rights reserved.
    3  * Copyright (c) 2003, 2004 The DragonFly Project.  All rights reserved.
    4  *
    5  * This code is derived from software contributed to The DragonFly Project
    6  * by Jeffrey M. Hsu.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  * 3. Neither the name of The DragonFly Project nor the names of its
   17  *    contributors may be used to endorse or promote products derived
   18  *    from this software without specific, prior written permission.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
   24  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   25  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
   26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
   28  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   29  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   30  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   31  * SUCH DAMAGE.
   32  */
   33 
   34 /*
   35  * Copyright (c) 1982, 1986, 1993, 1995
   36  *      The Regents of the University of California.  All rights reserved.
   37  *
   38  * Redistribution and use in source and binary forms, with or without
   39  * modification, are permitted provided that the following conditions
   40  * are met:
   41  * 1. Redistributions of source code must retain the above copyright
   42  *    notice, this list of conditions and the following disclaimer.
   43  * 2. Redistributions in binary form must reproduce the above copyright
   44  *    notice, this list of conditions and the following disclaimer in the
   45  *    documentation and/or other materials provided with the distribution.
   46  * 3. All advertising materials mentioning features or use of this software
   47  *    must display the following acknowledgement:
   48  *      This product includes software developed by the University of
   49  *      California, Berkeley and its contributors.
   50  * 4. Neither the name of the University nor the names of its contributors
   51  *    may be used to endorse or promote products derived from this software
   52  *    without specific prior written permission.
   53  *
   54  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   55  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   56  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   57  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   58  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   59  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   60  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   61  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   62  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   63  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   64  * SUCH DAMAGE.
   65  *
   66  *      @(#)tcp_seq.h   8.3 (Berkeley) 6/21/95
   67  * $FreeBSD: src/sys/netinet/tcp_seq.h,v 1.11.2.7 2003/02/03 02:33:10 hsu Exp $
   68  * $DragonFly: src/sys/netinet/tcp_seq.h,v 1.10 2007/03/04 18:51:59 swildner Exp $
   69  */
   70 
   71 #ifndef _NETINET_TCP_SEQ_H_
   72 #define _NETINET_TCP_SEQ_H_
   73 
   74 #ifndef _NETINET_TCP_H_
   75 #include <netinet/tcp.h>
   76 #endif
   77 
   78 /*
   79  * TCP sequence numbers are 32 bit integers operated
   80  * on with modular arithmetic.  These macros can be
   81  * used to compare such integers.
   82  */
   83 #define SEQ_LT(a,b)     ((int)((a)-(b)) < 0)
   84 #define SEQ_LEQ(a,b)    ((int)((a)-(b)) <= 0)
   85 #define SEQ_GT(a,b)     ((int)((a)-(b)) > 0)
   86 #define SEQ_GEQ(a,b)    ((int)((a)-(b)) >= 0)
   87 
   88 static __inline tcp_seq
   89 seq_max(tcp_seq a, tcp_seq b)
   90 {
   91         return (SEQ_GT(a, b) ? a : b);
   92 }
   93 
   94 static __inline tcp_seq
   95 seq_min(tcp_seq a, tcp_seq b)
   96 {
   97         return (SEQ_LT(a, b) ? a : b);
   98 }
   99 
  100 /* for modulo comparisons of timestamps */
  101 #define TSTMP_LT(a,b)   ((int)((a)-(b)) < 0)
  102 #define TSTMP_GT(a,b)   ((int)((a)-(b)) > 0)
  103 #define TSTMP_GEQ(a,b)  ((int)((a)-(b)) >= 0)
  104 
  105 /*
  106  * Macros to initialize tcp sequence numbers for
  107  * send and receive from initial send and receive
  108  * sequence numbers.
  109  */
  110 #define tcp_rcvseqinit(tp) \
  111         (tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1
  112 
  113 #define tcp_sendseqinit(tp) \
  114         (tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \
  115             (tp)->snd_recover = (tp)->iss
  116 
  117 #define TCP_PAWS_IDLE   (24 * 24 * 60 * 60 * hz)
  118                                         /* timestamp wrap-around time */
  119 
  120 #endif /* _NETINET_TCP_SEQ_H_ */

Cache object: ae46308f43066709423c5d690ae4f8a8


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.