xref: /csrg-svn/sys/netinet/tcp_seq.h (revision 5124)
1*5124Swnj /*	tcp_seq.h	4.1	81/11/29	*/
2*5124Swnj 
3*5124Swnj /*
4*5124Swnj  * TCP sequence numbers are 32 bit integers operated
5*5124Swnj  * on with modular arithmetic.  These macros can be
6*5124Swnj  * used to compare such integers.
7*5124Swnj  */
8*5124Swnj #define	SEQ_LT(a,b)	((int)((a)-(b)) < 0)
9*5124Swnj #define	SEQ_LEQ(a,b)	((int)((a)-(b)) <= 0)
10*5124Swnj #define	SEQ_GT(a,b)	((int)((a)-(b)) > 0)
11*5124Swnj #define	SEQ_GEQ(a,b)	((int)((a)-(b)) >= 0)
12*5124Swnj 
13*5124Swnj /*
14*5124Swnj  * Macros to initialize tcp sequence numbers for
15*5124Swnj  * send and receive from initial send and receive
16*5124Swnj  * sequence numbers.
17*5124Swnj  */
18*5124Swnj #define	tcp_rcvseqinit(tp) \
19*5124Swnj 	(tp)->rcv_nxt = (tp)->irs + 1
20*5124Swnj 
21*5124Swnj #define	tcp_sendseqinit(tp) \
22*5124Swnj 	(tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \
23*5124Swnj 	    (tp)->iss
24*5124Swnj 
25*5124Swnj #define	TCP_ISSINCR	128		/* increment for tcp_iss each second */
26*5124Swnj 
27*5124Swnj #ifdef KERNEL
28*5124Swnj tcp_seq	tcp_iss;		/* tcp initial send seq # */
29*5124Swnj #endif
30