os/ossrv/genericopenlibs/cstdlib/LINCINET/TCP_SEQ.H
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/cstdlib/LINCINET/TCP_SEQ.H	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,52 @@
     1.4 +/* TCP_SEQ.H
     1.5 + * Portions Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
     1.6 + * All rights reserved.
     1.7 + */
     1.8 +
     1.9 +/*
    1.10 + * Copyright (c) 1982, 1986 Regents of the University of California.
    1.11 + * All rights reserved.  The Berkeley software License Agreement
    1.12 + * specifies the terms and conditions for redistribution.
    1.13 + */
    1.14 +
    1.15 +/** @file
    1.16 +@publishedAll
    1.17 +@released
    1.18 +*/
    1.19 +
    1.20 +#ifndef	_NETINET_TCP_SEQ_H
    1.21 +#define	_NETINET_TCP_SEQ_H
    1.22 +
    1.23 +#ifdef	__cplusplus
    1.24 +extern "C" {
    1.25 +#endif
    1.26 +
    1.27 +/**
    1.28 +TCP sequence numbers are 32 bit integers operated
    1.29 +on with modular arithmetic.  These macros can be
    1.30 +used to compare such integers.
    1.31 +*/
    1.32 +#define	SEQ_LT(a, b)	((int)((a)-(b)) < 0)
    1.33 +#define	SEQ_LEQ(a, b)	((int)((a)-(b)) <= 0)
    1.34 +#define	SEQ_GT(a, b)	((int)((a)-(b)) > 0)
    1.35 +#define	SEQ_GEQ(a, b)	((int)((a)-(b)) >= 0)
    1.36 +
    1.37 +/**
    1.38 +Macros to initialize tcp sequence numbers for
    1.39 +send and receive from initial send and receive
    1.40 +sequence numbers.
    1.41 +*/
    1.42 +#define	tcp_rcvseqinit(tp) \
    1.43 +	(tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1
    1.44 +
    1.45 +#define	tcp_sendseqinit(tp) \
    1.46 +	(tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \
    1.47 +	    (tp)->iss
    1.48 +
    1.49 +#define	TCP_ISSINCR	(125*1024)	/* increment for tcp_iss each second */
    1.50 +
    1.51 +#ifdef	__cplusplus
    1.52 +}
    1.53 +#endif
    1.54 +
    1.55 +#endif	/* _NETINET_TCP_SEQ_H */