xref: /original-bsd/sys/netinet/tcp_seq.h (revision 6471873a)
1 /*
2  * Copyright (c) 1982, 1986, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)tcp_seq.h	8.1 (Berkeley) 06/10/93
8  */
9 
10 /*
11  * TCP sequence numbers are 32 bit integers operated
12  * on with modular arithmetic.  These macros can be
13  * used to compare such integers.
14  */
15 #define	SEQ_LT(a,b)	((int)((a)-(b)) < 0)
16 #define	SEQ_LEQ(a,b)	((int)((a)-(b)) <= 0)
17 #define	SEQ_GT(a,b)	((int)((a)-(b)) > 0)
18 #define	SEQ_GEQ(a,b)	((int)((a)-(b)) >= 0)
19 
20 /*
21  * Macros to initialize tcp sequence numbers for
22  * send and receive from initial send and receive
23  * sequence numbers.
24  */
25 #define	tcp_rcvseqinit(tp) \
26 	(tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1
27 
28 #define	tcp_sendseqinit(tp) \
29 	(tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \
30 	    (tp)->iss
31 
32 #define	TCP_ISSINCR	(125*1024)	/* increment for tcp_iss each second */
33 
34 #ifdef KERNEL
35 tcp_seq	tcp_iss;		/* tcp initial send seq # */
36 #endif
37