rx: add and export a public keepalive toggle
[openafs.git] / src / rx / rx_globals.c
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /* RX:  Globals for internal use, basically */
11
12 /* This controls the size of an fd_set; it must be defined early before
13  * the system headers define that type and the macros that operate on it.
14  * Its value should be as large as the maximum file descriptor limit we
15  * are likely to run into on any platform.  Right now, that is 65536
16  * which is the default hard fd limit on Solaris 9 */
17 #if !defined(_WIN32) && !defined(KERNEL)
18 #define FD_SETSIZE 65536
19 #endif
20
21 #include <afsconfig.h>
22 #include <afs/param.h>
23
24 /* Enable data initialization when the header file is included */
25 #define GLOBALSINIT(stuff) = stuff
26 #if defined(AFS_NT40_ENV) && defined(AFS_PTHREAD_ENV)
27 #define EXT __declspec(dllexport)
28 #define EXT2 __declspec(dllexport)
29 #else
30 #define EXT
31 #define EXT2
32 #endif
33
34 #ifdef KERNEL
35 # ifndef UKERNEL
36 #  include "h/types.h"
37 # else /* !UKERNEL */
38 #  include      "afs/sysincludes.h"
39 # endif /* UKERNEL */
40 #else /* KERNEL */
41 # include <roken.h>
42 #endif /* KERNEL */
43
44 #include "rx.h"
45 #include "rx_clock.h"
46 #include "rx_packet.h"
47 #include "rx_globals.h"
48
49 void rx_SetMaxReceiveWindow(int packets)
50 {
51     if (packets > rx_maxWindow)
52         packets = rx_maxWindow;
53
54     rx_maxReceiveWindow = packets;
55 }
56
57 int rx_GetMaxReceiveWindow(void)
58 {
59     return rx_maxReceiveWindow;
60 }
61
62 void rx_SetMaxSendWindow(int packets)
63 {
64     if (packets > rx_maxWindow)
65         packets = rx_maxWindow;
66
67     rx_maxSendWindow = packets;
68 }
69
70 int rx_GetMaxSendWindow(void)
71 {
72     return rx_maxSendWindow;
73 }
74
75 void rx_SetMinPeerTimeout(int timeo)
76 {
77     if (timeo >= 1 && timeo < 1000)
78         rx_minPeerTimeout = timeo;
79 }
80
81 int rx_GetMinPeerTimeout(void)
82 {
83     return rx_minPeerTimeout;
84 }
85
86 #ifdef AFS_NT40_ENV
87
88 void rx_SetRxDeadTime(int seconds)
89 {
90     rx_connDeadTime = seconds;
91 }
92
93 int rx_GetMinUdpBufSize(void)
94 {
95     return 64*1024;
96 }
97
98 void rx_SetUdpBufSize(int x)
99 {
100     if (x > rx_GetMinUdpBufSize())
101         rx_UdpBufSize = x;
102 }
103
104 #endif /* AFS_NT40_ENV */