xref: /csrg-svn/sys/netinet/tcp_seq.h (revision 25204)
1 /*
2  * Copyright (c) 1982 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  *	@(#)tcp_seq.h	6.4 (Berkeley) 10/15/85
7  */
8 
9 /*
10  * TCP sequence numbers are 32 bit integers operated
11  * on with modular arithmetic.  These macros can be
12  * used to compare such integers.
13  */
14 #define	SEQ_LT(a,b)	((int)((a)-(b)) < 0)
15 #define	SEQ_LEQ(a,b)	((int)((a)-(b)) <= 0)
16 #define	SEQ_GT(a,b)	((int)((a)-(b)) > 0)
17 #define	SEQ_GEQ(a,b)	((int)((a)-(b)) >= 0)
18 
19 /*
20  * Macros to initialize tcp sequence numbers for
21  * send and receive from initial send and receive
22  * sequence numbers.
23  */
24 #define	tcp_rcvseqinit(tp) \
25 	(tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1
26 
27 #define	tcp_sendseqinit(tp) \
28 	(tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \
29 	    (tp)->iss
30 
31 #define	TCP_ISSINCR	(125*1024)	/* increment for tcp_iss each second */
32 
33 #ifdef KERNEL
34 tcp_seq	tcp_iss;		/* tcp initial send seq # */
35 #endif
36