763baa367e9128d4ea164a5a8e026c6e38cb9fe3
[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
25 /* Enable data initialization when the header file is included */
26 #define GLOBALSINIT(stuff) = stuff
27 #if defined(AFS_NT40_ENV) && defined(AFS_PTHREAD_ENV)
28 #define EXT __declspec(dllexport)
29 #define EXT2 __declspec(dllexport)
30 #else
31 #define EXT
32 #define EXT2
33 #endif
34
35 #ifdef KERNEL
36 #ifndef UKERNEL
37 #include "h/types.h"
38 #else /* !UKERNEL */
39 #include        "afs/sysincludes.h"
40 #endif /* UKERNEL */
41 #endif /* KERNEL */
42
43 #include "rx_globals.h"
44
45 void rx_SetMaxReceiveWindow(int packets)
46 {
47     if (packets > rx_maxWindow)
48         packets = rx_maxWindow;
49
50     rx_maxReceiveWindow = packets;
51 }
52
53 int rx_GetMaxReceiveWindow(void)
54 {
55     return rx_maxReceiveWindow;
56 }
57
58 void rx_SetMaxSendWindow(int packets)
59 {
60     if (packets > rx_maxWindow)
61         packets = rx_maxWindow;
62
63     rx_maxSendWindow = packets;
64 }
65
66 int rx_GetMaxSendWindow(void)
67 {
68     return rx_maxSendWindow;
69 }
70
71 void rx_SetMinPeerTimeout(int timeo)
72 {
73     if (timeo >= 1 && timeo < 1000)
74         rx_minPeerTimeout = timeo;
75 }
76
77 int rx_GetMinPeerTimeout(void)
78 {
79     return rx_minPeerTimeout;
80 }
81
82 #ifdef AFS_NT40_ENV
83
84 void rx_SetRxDeadTime(int seconds)
85 {
86     rx_connDeadTime = seconds;
87 }
88
89 int rx_GetMinUdpBufSize(void)
90 {
91     return 64*1024;
92 }
93
94 void rx_SetUdpBufSize(int x)
95 {
96     if (x > rx_GetMinUdpBufSize())
97         rx_UdpBufSize = x;
98 }
99
100 #endif /* AFS_NT40_ENV */