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