doxygen: group/module definitions (part 2)
[oweals/gnunet.git] / src / include / gnunet_constants.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2009 Christian Grothoff (and other contributing authors)
4
5      GNUnet is free software; you can redistribute it and/or modify
6      it under the terms of the GNU General Public License as published
7      by the Free Software Foundation; either version 3, or (at your
8      option) any later version.
9
10      GNUnet is distributed in the hope that it will be useful, but
11      WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13      General Public License for more details.
14
15      You should have received a copy of the GNU General Public License
16      along with GNUnet; see the file COPYING.  If not, write to the
17      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18      Boston, MA 02110-1301, USA.
19 */
20
21 /**
22  * @author Christian Grothoff
23  *
24  * @file
25  * Global constants for performance tuning
26  *
27  * @defgroup constants  Constant definitions
28  * Global constants for performance tuning
29  * @{
30  */
31
32 #ifndef GNUNET_CONSTANTS_H
33 #define GNUNET_CONSTANTS_H
34
35 #ifdef __cplusplus
36 extern "C"
37 {
38 #if 0                           /* keep Emacsens' auto-indent happy */
39 }
40 #endif
41 #endif
42
43 /**
44  * Last resort choice for configuration file name.
45  */
46 #define GNUNET_DEFAULT_USER_CONFIG_FILE "~/.config/gnunet.conf"
47
48 /**
49  * Bandwidth (in/out) to assume initially (before either peer has
50  * communicated any particular preference).  Should be rather low; set
51  * so that at least one maximum-size message can be send roughly once
52  * per minute.
53  */
54 #define GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT GNUNET_BANDWIDTH_value_init (1024)
55
56 /**
57  * After how long do we consider a connection to a peer dead
58  * if we don't receive messages from the peer?
59  */
60 #define GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
61
62 /**
63  * How long do we delay reading more from a peer after a quota violation?
64  */
65 #define GNUNET_CONSTANTS_QUOTA_VIOLATION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2)
66
67 /**
68  * After how long do we consider a service unresponsive
69  * even if we assume that the service commonly does not
70  * respond instantly (DNS, Database, etc.).
71  */
72 #define GNUNET_CONSTANTS_SERVICE_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 10)
73
74 /**
75  * How long do we delay messages to get larger packet sizes (CORKing)?
76  */
77 #define GNUNET_CONSTANTS_MAX_CORK_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
78
79 /**
80  * After what amount of latency for a message do we print a warning?
81  */
82 #define GNUNET_CONSTANTS_LATENCY_WARN GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3)
83
84 /**
85  * Until which load do we consider the peer overly idle
86  * (which means that we would like to use more resources).<p>
87  *
88  * Note that we use 70 to leave some room for applications
89  * to consume resources "idly" (i.e. up to 85%) and then
90  * still have some room for "paid for" resource consumption.
91  */
92 #define GNUNET_CONSTANTS_IDLE_LOAD_THRESHOLD 70
93
94 /**
95  * For how long do we allow unused bandwidth
96  * from the past to carry over into the future? (in seconds)
97  */
98 #define GNUNET_CONSTANTS_MAX_BANDWIDTH_CARRY_S 5
99
100
101 /**
102  * After how long do we expire an address in a HELLO that we just
103  * validated?  This value is also used for our own addresses when we
104  * create a HELLO.
105  */
106 #define GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 12)
107
108
109 /**
110  * How long do we cache records at most in the DHT?
111  */
112 #define GNUNET_CONSTANTS_DHT_MAX_EXPIRATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 24)
113
114
115 /**
116  * Size of the `struct EncryptedMessage` of the core (which
117  * is the per-message overhead of the core).
118  */
119 #define GNUNET_CONSTANTS_CORE_SIZE_ENCRYPTED_MESSAGE (24 + sizeof (struct GNUNET_HashCode))
120
121 /**
122  * What is the maximum size for encrypted messages?  Note that this
123  * number imposes a clear limit on the maximum size of any message.
124  * Set to a value close to 64k but not so close that transports will
125  * have trouble with their headers.
126  *
127  * Could theoretically be 64k minus (#GNUNET_CONSTANTS_CORE_SIZE_ENCRYPTED_MESSAGE +
128  * #GNUNET_CONSTANTS_TRANSPORT_SIZE_OUTBOUND_MESSAGE), but we're going
129  * to be more conservative for now.
130  */
131 #define GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE (63 * 1024)
132
133 /**
134  * Size of the CADET message overhead:
135  * + sizeof (struct GNUNET_CADET_Encrypted)
136  * + sizeof (struct GNUNET_CADET_Data)
137  * + sizeof (struct GNUNET_CADET_ACK))
138  *
139  * Checked for correcteness in gnunet-service-cadet_tunnel.c: GCT_init().
140  */
141 #define GNUNET_CONSTANTS_CADET_P2P_OVERHEAD 132
142
143 /**
144  * Maximum message size that can be sent on CADET.
145  */
146 #define GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE \
147 (GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE - GNUNET_CONSTANTS_CADET_P2P_OVERHEAD)
148
149 /**
150  * Largest block that can be stored in the DHT.
151  */
152 #define GNUNET_CONSTANTS_MAX_BLOCK_SIZE (62 * 1024)
153
154
155 /**
156  * K-value that must be used for the bloom filters in 'GET'
157  * queries.
158  */
159 #define GNUNET_CONSTANTS_BLOOMFILTER_K 16
160
161
162
163
164 #if 0                           /* keep Emacsens' auto-indent happy */
165 {
166 #endif
167 #ifdef __cplusplus
168 }
169 #endif
170
171 #endif
172
173 /** @} */  /* end of group */