xref: /titanic_44/usr/src/uts/common/netinet/tcp_seq.h (revision b509e89b2befbaa42939abad9da1d7f5a8c6aaae)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
11 /* tcp_seq.h 1.7 88/08/19 SMI; from UCB 7.1 6/5/85	*/
12 
13 #ifdef	__cplusplus
14 extern "C" {
15 #endif
16 
17 /*
18  * TCP sequence numbers are 32 bit integers operated
19  * on with modular arithmetic.  These macros can be
20  * used to compare such integers.
21  */
22 #define	SEQ_LT(a, b)	((int32_t)((a)-(b)) < 0)
23 #define	SEQ_LEQ(a, b)	((int32_t)((a)-(b)) <= 0)
24 #define	SEQ_GT(a, b)	((int32_t)((a)-(b)) > 0)
25 #define	SEQ_GEQ(a, b)	((int32_t)((a)-(b)) >= 0)
26 
27 /*
28  * Macros to initialize tcp sequence numbers for
29  * send and receive from initial send and receive
30  * sequence numbers.
31  */
32 #define	tcp_rcvseqinit(tp) \
33 	(tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1
34 
35 #define	tcp_sendseqinit(tp) \
36 	(tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \
37 	    (tp)->iss
38 
39 #define	TCP_ISSINCR	(125*1024)	/* increment for tcp_iss each second */
40 
41 #ifdef	__cplusplus
42 }
43 #endif
44 
45 #endif	/* _NETINET_TCP_SEQ_H */
46