|
|
1.1 root 1: /* URP window-size negotiation.
2: *
3: * The 16 bits of the window-size argument are defined as:
4: *
5: * -----------------------------------------------------------------
6: * |valid| spare | originator | destination | traffic |
7: * | | | window size | window size | |
8: * -----------------------------------------------------------------
9: * 1 3 4 4 4
10: *
11: * The "valid" bit equals 1 to indicate that the window size values
12: * are specified. Zero means they should be ignored and that default
13: * values must be used instead. Old controllers that do not have
14: * window size negotiation happen to set this bit to zero, fortunately.
15: *
16: * The actual window size is computed from the 4-bit window size
17: * parameter (n) as 2**(n+4). Thus, window sizes range from 16 to
18: * 512K bytes.
19: *
20: * The originator of a call sets his "originator window size" to be
21: * less than or equal to the size of his receive buffer, and he
22: * requests through the "destination window size" the size of the
23: * buffer that he would like to use for transmission. As the call
24: * is being set up, trunk processes and the destination line process
25: * may lower either or both window sizes. The resulting window sizes
26: * are returned to the originator in the call ANSWER message.
27: */
28:
29: #ifndef MIN
30: #define MIN(x,y) (x < y ? x : y)
31: #endif
32: /* Format originator, destination, and traffic values */
33: #define WINDOW(o,d,t) ((o<<8) | (d<<4) | t | 0100000)
34:
35: #define W_VALID(x) (x & 0100000)
36:
37: #define W_ORIG(x) ((x>>8) & 017)
38:
39: #define W_DEST(x) ((x>>4) & 017)
40:
41: #define W_TRAF(x) (x & 017)
42:
43: #define W_DESTMAX(x,y) (WINDOW(W_ORIG(x),MIN(W_DEST(x),y),W_TRAF(x)))
44:
45: #define W_LIMIT(x,y) (WINDOW(MIN(W_ORIG(x),y),MIN(W_DEST(x),y),W_TRAF(x)))
46:
47: #define W_VALUE(x) (1<<(x+4))
48:
49:
50: #define WS_16 0
51: #define WS_32 1
52: #define WS_64 2
53: #define WS_128 3
54: #define WS_256 4
55: #define WS_512 5
56: #define WS_1K 6
57: #define WS_2K 7
58: #define WS_4K 8
59: #define WS_8K 9
60: #define WS_16K 10
61: #define WS_32K 11
62: #define WS_64K 12
63: #define WS_128K 13
64: #define WS_256K 14
65: #define WS_512K 15
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.