Commit | Line | Data |
---|---|---|
8ae0e4b4 | 1 | /* |
0880b18e | 2 | * Copyright (c) 1982, 1986 Regents of the University of California. |
2b6b6284 | 3 | * All rights reserved. |
8ae0e4b4 | 4 | * |
2b6b6284 KB |
5 | * Redistribution and use in source and binary forms are permitted |
6 | * provided that this notice is preserved and that due credit is given | |
7 | * to the University of California at Berkeley. The name of the University | |
8 | * may not be used to endorse or promote products derived from this | |
9 | * software without specific prior written permission. This software | |
10 | * is provided ``as is'' without express or implied warranty. | |
11 | * | |
12 | * @(#)tcp_seq.h 7.2 (Berkeley) %G% | |
8ae0e4b4 | 13 | */ |
5c3c035b BJ |
14 | |
15 | /* | |
16 | * TCP sequence numbers are 32 bit integers operated | |
17 | * on with modular arithmetic. These macros can be | |
18 | * used to compare such integers. | |
19 | */ | |
20 | #define SEQ_LT(a,b) ((int)((a)-(b)) < 0) | |
21 | #define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0) | |
22 | #define SEQ_GT(a,b) ((int)((a)-(b)) > 0) | |
23 | #define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0) | |
24 | ||
25 | /* | |
26 | * Macros to initialize tcp sequence numbers for | |
27 | * send and receive from initial send and receive | |
28 | * sequence numbers. | |
29 | */ | |
30 | #define tcp_rcvseqinit(tp) \ | |
678bbab1 | 31 | (tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1 |
5c3c035b BJ |
32 | |
33 | #define tcp_sendseqinit(tp) \ | |
34 | (tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \ | |
35 | (tp)->iss | |
36 | ||
875dfa99 | 37 | #define TCP_ISSINCR (125*1024) /* increment for tcp_iss each second */ |
5c3c035b BJ |
38 | |
39 | #ifdef KERNEL | |
40 | tcp_seq tcp_iss; /* tcp initial send seq # */ | |
41 | #endif |