1 /*
2  * Copyright (c) 1982, 1986 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  */
6 
7 #ifndef	_NETINET_TCP_SEQ_H
8 #define	_NETINET_TCP_SEQ_H
9 
10 /* tcp_seq.h 1.7 88/08/19 SMI; from UCB 7.1 6/5/85	*/
11 
12 #ifdef	__cplusplus
13 extern "C" {
14 #endif
15 
16 /*
17  * TCP sequence numbers are 32 bit integers operated
18  * on with modular arithmetic.  These macros can be
19  * used to compare such integers.
20  */
21 #define	SEQ_LT(a, b)	((int32_t)((a)-(b)) < 0)
22 #define	SEQ_LEQ(a, b)	((int32_t)((a)-(b)) <= 0)
23 #define	SEQ_GT(a, b)	((int32_t)((a)-(b)) > 0)
24 #define	SEQ_GEQ(a, b)	((int32_t)((a)-(b)) >= 0)
25 
26 /*
27  * Macros to initialize tcp sequence numbers for
28  * send and receive from initial send and receive
29  * sequence numbers.
30  */
31 #define	tcp_rcvseqinit(tp) \
32 	(tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1
33 
34 #define	tcp_sendseqinit(tp) \
35 	(tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \
36 	    (tp)->iss
37 
38 #define	TCP_ISSINCR	(125*1024)	/* increment for tcp_iss each second */
39 
40 #ifdef	__cplusplus
41 }
42 #endif
43 
44 #endif	/* _NETINET_TCP_SEQ_H */
45