williamr@2
|
1 |
/* TCP_SEQ.H
|
williamr@2
|
2 |
*
|
williamr@2
|
3 |
* Portions copyright (c) 1997-1999 Symbian Ltd. All rights reserved.
|
williamr@2
|
4 |
*/
|
williamr@2
|
5 |
|
williamr@2
|
6 |
/*
|
williamr@2
|
7 |
* Copyright (c) 1982, 1986 Regents of the University of California.
|
williamr@2
|
8 |
* All rights reserved. The Berkeley software License Agreement
|
williamr@2
|
9 |
* specifies the terms and conditions for redistribution.
|
williamr@2
|
10 |
*/
|
williamr@2
|
11 |
|
williamr@2
|
12 |
/** @file
|
williamr@2
|
13 |
@publishedAll
|
williamr@2
|
14 |
@released
|
williamr@2
|
15 |
*/
|
williamr@2
|
16 |
|
williamr@2
|
17 |
#ifndef _NETINET_TCP_SEQ_H
|
williamr@2
|
18 |
#define _NETINET_TCP_SEQ_H
|
williamr@2
|
19 |
|
williamr@2
|
20 |
#ifdef __cplusplus
|
williamr@2
|
21 |
extern "C" {
|
williamr@2
|
22 |
#endif
|
williamr@2
|
23 |
|
williamr@2
|
24 |
/**
|
williamr@2
|
25 |
TCP sequence numbers are 32 bit integers operated
|
williamr@2
|
26 |
on with modular arithmetic. These macros can be
|
williamr@2
|
27 |
used to compare such integers.
|
williamr@2
|
28 |
*/
|
williamr@2
|
29 |
#define SEQ_LT(a, b) ((int)((a)-(b)) < 0)
|
williamr@2
|
30 |
#define SEQ_LEQ(a, b) ((int)((a)-(b)) <= 0)
|
williamr@2
|
31 |
#define SEQ_GT(a, b) ((int)((a)-(b)) > 0)
|
williamr@2
|
32 |
#define SEQ_GEQ(a, b) ((int)((a)-(b)) >= 0)
|
williamr@2
|
33 |
|
williamr@2
|
34 |
/**
|
williamr@2
|
35 |
Macros to initialize tcp sequence numbers for
|
williamr@2
|
36 |
send and receive from initial send and receive
|
williamr@2
|
37 |
sequence numbers.
|
williamr@2
|
38 |
*/
|
williamr@2
|
39 |
#define tcp_rcvseqinit(tp) \
|
williamr@2
|
40 |
(tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1
|
williamr@2
|
41 |
|
williamr@2
|
42 |
#define tcp_sendseqinit(tp) \
|
williamr@2
|
43 |
(tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \
|
williamr@2
|
44 |
(tp)->iss
|
williamr@2
|
45 |
|
williamr@2
|
46 |
#define TCP_ISSINCR (125*1024) /* increment for tcp_iss each second */
|
williamr@2
|
47 |
|
williamr@2
|
48 |
#ifdef __cplusplus
|
williamr@2
|
49 |
}
|
williamr@2
|
50 |
#endif
|
williamr@2
|
51 |
|
williamr@2
|
52 |
#endif /* _NETINET_TCP_SEQ_H */
|