os/ossrv/genericopenlibs/cstdlib/LINCINET/TCP_SEQ.H
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/* TCP_SEQ.H
sl@0
     2
 * Portions Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
 * All rights reserved.
sl@0
     4
 */
sl@0
     5
sl@0
     6
/*
sl@0
     7
 * Copyright (c) 1982, 1986 Regents of the University of California.
sl@0
     8
 * All rights reserved.  The Berkeley software License Agreement
sl@0
     9
 * specifies the terms and conditions for redistribution.
sl@0
    10
 */
sl@0
    11
sl@0
    12
/** @file
sl@0
    13
@publishedAll
sl@0
    14
@released
sl@0
    15
*/
sl@0
    16
sl@0
    17
#ifndef	_NETINET_TCP_SEQ_H
sl@0
    18
#define	_NETINET_TCP_SEQ_H
sl@0
    19
sl@0
    20
#ifdef	__cplusplus
sl@0
    21
extern "C" {
sl@0
    22
#endif
sl@0
    23
sl@0
    24
/**
sl@0
    25
TCP sequence numbers are 32 bit integers operated
sl@0
    26
on with modular arithmetic.  These macros can be
sl@0
    27
used to compare such integers.
sl@0
    28
*/
sl@0
    29
#define	SEQ_LT(a, b)	((int)((a)-(b)) < 0)
sl@0
    30
#define	SEQ_LEQ(a, b)	((int)((a)-(b)) <= 0)
sl@0
    31
#define	SEQ_GT(a, b)	((int)((a)-(b)) > 0)
sl@0
    32
#define	SEQ_GEQ(a, b)	((int)((a)-(b)) >= 0)
sl@0
    33
sl@0
    34
/**
sl@0
    35
Macros to initialize tcp sequence numbers for
sl@0
    36
send and receive from initial send and receive
sl@0
    37
sequence numbers.
sl@0
    38
*/
sl@0
    39
#define	tcp_rcvseqinit(tp) \
sl@0
    40
	(tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1
sl@0
    41
sl@0
    42
#define	tcp_sendseqinit(tp) \
sl@0
    43
	(tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \
sl@0
    44
	    (tp)->iss
sl@0
    45
sl@0
    46
#define	TCP_ISSINCR	(125*1024)	/* increment for tcp_iss each second */
sl@0
    47
sl@0
    48
#ifdef	__cplusplus
sl@0
    49
}
sl@0
    50
#endif
sl@0
    51
sl@0
    52
#endif	/* _NETINET_TCP_SEQ_H */