config.h 8.8 KB

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