Alexandre Lision | 8af73cb | 2013-12-10 14:11:20 -0500 | [diff] [blame] | 1 | /* $Id$ */ |
| 2 | /* |
| 3 | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) |
| 4 | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ |
| 20 | #ifndef __PJLIB_UTIL_CONFIG_H__ |
| 21 | #define __PJLIB_UTIL_CONFIG_H__ |
| 22 | |
| 23 | |
| 24 | /** |
| 25 | * @file config.h |
| 26 | * @brief Compile time settings |
| 27 | */ |
| 28 | |
| 29 | /** |
| 30 | * @defgroup PJLIB_UTIL_CONFIG Configuration |
| 31 | * @ingroup PJLIB_UTIL_BASE |
| 32 | * @{ |
| 33 | */ |
| 34 | |
| 35 | |
| 36 | /* ************************************************************************** |
| 37 | * DNS CONFIGURATION |
| 38 | */ |
| 39 | |
| 40 | /** |
| 41 | * Maximum number of IP addresses in DNS A response. |
| 42 | */ |
| 43 | #ifndef PJ_DNS_MAX_IP_IN_A_REC |
| 44 | # define PJ_DNS_MAX_IP_IN_A_REC 8 |
| 45 | #endif |
| 46 | |
| 47 | |
| 48 | /** |
| 49 | * Maximum server address entries per one SRV record |
| 50 | */ |
| 51 | #ifndef PJ_DNS_SRV_MAX_ADDR |
| 52 | # define PJ_DNS_SRV_MAX_ADDR 8 |
| 53 | #endif |
| 54 | |
| 55 | |
| 56 | /** |
| 57 | * This constant specifies the maximum names to keep in the temporary name |
| 58 | * table when performing name compression scheme when duplicating DNS packet |
| 59 | * (the #pj_dns_packet_dup() function). |
| 60 | * |
| 61 | * Generally name compression is desired, since it saves some memory (see |
| 62 | * PJ_DNS_RESOLVER_RES_BUF_SIZE setting). However it comes at the expense of |
| 63 | * a little processing overhead to perform name scanning and also a little |
| 64 | * bit more stack usage (8 bytes per entry on 32bit platform). |
| 65 | * |
| 66 | * Default: 16 |
| 67 | */ |
| 68 | #ifndef PJ_DNS_MAX_NAMES_IN_NAMETABLE |
| 69 | # define PJ_DNS_MAX_NAMES_IN_NAMETABLE 16 |
| 70 | #endif |
| 71 | |
| 72 | |
| 73 | /* ************************************************************************** |
| 74 | * RESOLVER CONFIGURATION |
| 75 | */ |
| 76 | |
| 77 | |
| 78 | /** |
| 79 | * Maximum numbers of DNS nameservers that can be configured in resolver. |
| 80 | */ |
| 81 | #ifndef PJ_DNS_RESOLVER_MAX_NS |
| 82 | # define PJ_DNS_RESOLVER_MAX_NS 16 |
| 83 | #endif |
| 84 | |
| 85 | |
| 86 | /** |
| 87 | * Default retransmission delay, in miliseconds. The combination of |
| 88 | * retransmission delay and count determines the query timeout. |
| 89 | * |
| 90 | * Default: 2000 (2 seconds, according to RFC 1035) |
| 91 | */ |
| 92 | #ifndef PJ_DNS_RESOLVER_QUERY_RETRANSMIT_DELAY |
| 93 | # define PJ_DNS_RESOLVER_QUERY_RETRANSMIT_DELAY 2000 |
| 94 | #endif |
| 95 | |
| 96 | |
| 97 | /** |
| 98 | * Maximum number of transmissions before timeout is declared for |
| 99 | * the query. |
| 100 | * |
| 101 | * Default: 5 |
| 102 | */ |
| 103 | #ifndef PJ_DNS_RESOLVER_QUERY_RETRANSMIT_COUNT |
| 104 | # define PJ_DNS_RESOLVER_QUERY_RETRANSMIT_COUNT 5 |
| 105 | #endif |
| 106 | |
| 107 | |
| 108 | /** |
| 109 | * Maximum life-time of DNS response in the resolver response cache, |
| 110 | * in seconds. If the value is zero, then DNS response caching will be |
| 111 | * disabled. |
| 112 | * |
| 113 | * Default is 300 seconds (5 minutes). |
| 114 | * |
| 115 | * @see PJ_DNS_RESOLVER_INVALID_TTL |
| 116 | */ |
| 117 | #ifndef PJ_DNS_RESOLVER_MAX_TTL |
| 118 | # define PJ_DNS_RESOLVER_MAX_TTL (5*60) |
| 119 | #endif |
| 120 | |
| 121 | /** |
| 122 | * The life-time of invalid DNS response in the resolver response cache. |
| 123 | * An invalid DNS response is a response which RCODE is non-zero and |
| 124 | * response without any answer section. These responses can be put in |
| 125 | * the cache too to minimize message round-trip. |
| 126 | * |
| 127 | * Default: 60 (one minute). |
| 128 | * |
| 129 | * @see PJ_DNS_RESOLVER_MAX_TTL |
| 130 | */ |
| 131 | #ifndef PJ_DNS_RESOLVER_INVALID_TTL |
| 132 | # define PJ_DNS_RESOLVER_INVALID_TTL 60 |
| 133 | #endif |
| 134 | |
| 135 | /** |
| 136 | * The interval on which nameservers which are known to be good to be |
| 137 | * probed again to determine whether they are still good. Note that |
| 138 | * this applies to both active nameserver (the one currently being used) |
| 139 | * and idle nameservers (good nameservers that are not currently selected). |
| 140 | * The probing to query the "goodness" of nameservers involves sending |
| 141 | * the same query to multiple servers, so it's probably not a good idea |
| 142 | * to send this probing too often. |
| 143 | * |
| 144 | * Default: 600 (ten minutes) |
| 145 | * |
| 146 | * @see PJ_DNS_RESOLVER_BAD_NS_TTL |
| 147 | */ |
| 148 | #ifndef PJ_DNS_RESOLVER_GOOD_NS_TTL |
| 149 | # define PJ_DNS_RESOLVER_GOOD_NS_TTL (10*60) |
| 150 | #endif |
| 151 | |
| 152 | /** |
| 153 | * The interval on which nameservers which known to be bad to be probed |
| 154 | * again to determine whether it is still bad. |
| 155 | * |
| 156 | * Default: 60 (one minute) |
| 157 | * |
| 158 | * @see PJ_DNS_RESOLVER_GOOD_NS_TTL |
| 159 | */ |
| 160 | #ifndef PJ_DNS_RESOLVER_BAD_NS_TTL |
| 161 | # define PJ_DNS_RESOLVER_BAD_NS_TTL (1*60) |
| 162 | #endif |
| 163 | |
| 164 | |
| 165 | /** |
| 166 | * Maximum size of UDP packet. RFC 1035 states that maximum size of |
| 167 | * DNS packet carried over UDP is 512 bytes. |
| 168 | * |
| 169 | * Default: 512 byes |
| 170 | */ |
| 171 | #ifndef PJ_DNS_RESOLVER_MAX_UDP_SIZE |
| 172 | # define PJ_DNS_RESOLVER_MAX_UDP_SIZE 512 |
| 173 | #endif |
| 174 | |
| 175 | |
| 176 | /** |
| 177 | * Size of memory pool allocated for each individual DNS response cache. |
| 178 | * This value here should be more or less the same as maximum UDP packet |
| 179 | * size (PJ_DNS_RESOLVER_MAX_UDP_SIZE), since the DNS replicator function |
| 180 | * (#pj_dns_packet_dup()) is also capable of performing name compressions. |
| 181 | * |
| 182 | * Default: 512 |
| 183 | */ |
| 184 | #ifndef PJ_DNS_RESOLVER_RES_BUF_SIZE |
| 185 | # define PJ_DNS_RESOLVER_RES_BUF_SIZE 512 |
| 186 | #endif |
| 187 | |
| 188 | |
| 189 | /** |
| 190 | * Size of temporary pool buffer for parsing DNS packets in resolver. |
| 191 | * |
| 192 | * default: 4000 |
| 193 | */ |
| 194 | #ifndef PJ_DNS_RESOLVER_TMP_BUF_SIZE |
| 195 | # define PJ_DNS_RESOLVER_TMP_BUF_SIZE 4000 |
| 196 | #endif |
| 197 | |
| 198 | |
| 199 | /* ************************************************************************** |
| 200 | * SCANNER CONFIGURATION |
| 201 | */ |
| 202 | |
| 203 | |
| 204 | /** |
| 205 | * Macro PJ_SCANNER_USE_BITWISE is defined and non-zero (by default yes) |
| 206 | * will enable the use of bitwise for character input specification (cis). |
| 207 | * This would save several kilobytes of .bss memory in the SIP parser. |
| 208 | */ |
| 209 | #ifndef PJ_SCANNER_USE_BITWISE |
| 210 | # define PJ_SCANNER_USE_BITWISE 1 |
| 211 | #endif |
| 212 | |
| 213 | |
| 214 | |
| 215 | /* ************************************************************************** |
| 216 | * STUN CLIENT CONFIGURATION |
| 217 | */ |
| 218 | |
| 219 | /** |
| 220 | * Maximum number of attributes in the STUN packet (for the old STUN |
| 221 | * library). |
| 222 | * |
| 223 | * Default: 16 |
| 224 | */ |
| 225 | #ifndef PJSTUN_MAX_ATTR |
| 226 | # define PJSTUN_MAX_ATTR 16 |
| 227 | #endif |
| 228 | |
| 229 | |
| 230 | /** |
| 231 | * Maximum number of attributes in the STUN packet (for the new STUN |
| 232 | * library). |
| 233 | * |
| 234 | * Default: 16 |
| 235 | */ |
| 236 | #ifndef PJ_STUN_MAX_ATTR |
| 237 | # define PJ_STUN_MAX_ATTR 16 |
| 238 | #endif |
| 239 | |
| 240 | |
| 241 | /* ************************************************************************** |
| 242 | * ENCRYPTION |
| 243 | */ |
| 244 | |
| 245 | /** |
| 246 | * Specifies whether CRC32 algorithm should use the table based lookup table |
| 247 | * for faster calculation, at the expense of about 1KB table size on the |
| 248 | * executable. If zero, the CRC32 will use non-table based which is more than |
| 249 | * an order of magnitude slower. |
| 250 | * |
| 251 | * Default: 1 |
| 252 | */ |
| 253 | #ifndef PJ_CRC32_HAS_TABLES |
| 254 | # define PJ_CRC32_HAS_TABLES 1 |
| 255 | #endif |
| 256 | |
| 257 | |
| 258 | /* ************************************************************************** |
| 259 | * HTTP Client configuration |
| 260 | */ |
| 261 | /** |
| 262 | * Timeout value for HTTP request operation. The value is in ms. |
| 263 | * Default: 60000ms |
| 264 | */ |
| 265 | #ifndef PJ_HTTP_DEFAULT_TIMEOUT |
| 266 | # define PJ_HTTP_DEFAULT_TIMEOUT (60000) |
| 267 | #endif |
| 268 | |
| 269 | /* ************************************************************************** |
| 270 | * CLI configuration |
| 271 | */ |
| 272 | |
| 273 | /** |
| 274 | * Initial pool size for CLI. |
| 275 | * Default: 1024 bytes |
| 276 | */ |
| 277 | #ifndef PJ_CLI_POOL_SIZE |
| 278 | # define PJ_CLI_POOL_SIZE 1024 |
| 279 | #endif |
| 280 | |
| 281 | /** |
| 282 | * Pool increment size for CLI. |
| 283 | * Default: 512 bytes |
| 284 | */ |
| 285 | #ifndef PJ_CLI_POOL_INC |
| 286 | # define PJ_CLI_POOL_INC 512 |
| 287 | #endif |
| 288 | |
| 289 | /** |
| 290 | * Maximum length of command buffer. |
| 291 | * Default: 512 |
| 292 | */ |
| 293 | #ifndef PJ_CLI_MAX_CMDBUF |
| 294 | # define PJ_CLI_MAX_CMDBUF 512 |
| 295 | #endif |
| 296 | |
| 297 | /** |
| 298 | * Maximum command arguments. |
| 299 | * Default: 8 |
| 300 | */ |
| 301 | #ifndef PJ_CLI_MAX_ARGS |
| 302 | # define PJ_CLI_MAX_ARGS 8 |
| 303 | #endif |
| 304 | |
| 305 | /** |
| 306 | * Maximum number of hints. |
| 307 | * Default: 32 |
| 308 | */ |
| 309 | #ifndef PJ_CLI_MAX_HINTS |
| 310 | # define PJ_CLI_MAX_HINTS 32 |
| 311 | #endif |
| 312 | |
| 313 | /** |
| 314 | * Maximum short name version (shortcuts) for a command. |
| 315 | * Default: 4 |
| 316 | */ |
| 317 | #ifndef PJ_CLI_MAX_SHORTCUTS |
| 318 | # define PJ_CLI_MAX_SHORTCUTS 4 |
| 319 | #endif |
| 320 | |
| 321 | /** |
| 322 | * Initial pool size for console CLI. |
| 323 | * Default: 256 bytes |
| 324 | */ |
| 325 | #ifndef PJ_CLI_CONSOLE_POOL_SIZE |
| 326 | # define PJ_CLI_CONSOLE_POOL_SIZE 256 |
| 327 | #endif |
| 328 | |
| 329 | /** |
| 330 | * Pool increment size for console CLI. |
| 331 | * Default: 256 bytes |
| 332 | */ |
| 333 | #ifndef PJ_CLI_CONSOLE_POOL_INC |
| 334 | # define PJ_CLI_CONSOLE_POOL_INC 256 |
| 335 | #endif |
| 336 | |
| 337 | /** |
| 338 | * Initial pool size for telnet CLI. |
| 339 | * Default: 1024 bytes |
| 340 | */ |
| 341 | #ifndef PJ_CLI_TELNET_POOL_SIZE |
| 342 | # define PJ_CLI_TELNET_POOL_SIZE 1024 |
| 343 | #endif |
| 344 | |
| 345 | /** |
| 346 | * Pool increment size for telnet CLI. |
| 347 | * Default: 512 bytes |
| 348 | */ |
| 349 | #ifndef PJ_CLI_TELNET_POOL_INC |
| 350 | # define PJ_CLI_TELNET_POOL_INC 512 |
| 351 | #endif |
| 352 | |
| 353 | /** |
| 354 | * Maximum number of argument values of choice type. |
| 355 | * Default: 16 |
| 356 | */ |
| 357 | #ifndef PJ_CLI_MAX_CHOICE_VAL |
| 358 | # define PJ_CLI_MAX_CHOICE_VAL 16 |
| 359 | #endif |
| 360 | |
| 361 | /** |
| 362 | * Maximum number of command history. |
| 363 | * Default: 16 |
| 364 | */ |
| 365 | #ifndef PJ_CLI_MAX_CMD_HISTORY |
| 366 | # define PJ_CLI_MAX_CMD_HISTORY 16 |
| 367 | #endif |
| 368 | |
| 369 | /** |
| 370 | * @} |
| 371 | */ |
| 372 | |
| 373 | #endif /* __PJLIB_UTIL_CONFIG_H__ */ |
| 374 | |