blob: 5a30f703239da682605a9cb72b3dbd088033501a [file] [log] [blame]
Tristan Matthews0a329cc2013-07-17 13:20:14 -04001/* $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 __PJNATH_CONFIG_H__
21#define __PJNATH_CONFIG_H__
22
23
24/**
25 * @file config.h
26 * @brief Compile time settings
27 */
28
29#include <pj/types.h>
30
31/**
32 * @defgroup PJNATH_CONFIG Compile-time configurations
33 * @brief Various compile time settings
34 * @ingroup PJNATH_STUN_BASE
35 * @{
36 */
37
38
39/* **************************************************************************
40 * GENERAL
41 */
42
43/**
44 * The log level for PJNATH error display.
45 *
46 * default 1
47 */
48#ifndef PJNATH_ERROR_LEVEL
49# define PJNATH_ERROR_LEVEL 1
50#endif
51
52
53/* **************************************************************************
54 * STUN CONFIGURATION
55 */
56
57/**
58 * Maximum number of attributes in the STUN packet (for the new STUN
59 * library).
60 *
61 * Default: 16
62 */
63#ifndef PJ_STUN_MAX_ATTR
64# define PJ_STUN_MAX_ATTR 16
65#endif
66
67/**
68 * The default initial STUN round-trip time estimation (the RTO value
69 * in RFC 3489-bis), in miliseconds.
70 * This value is used to control the STUN request
71 * retransmit time. The initial value of retransmission interval
72 * would be set to this value, and will be doubled after each
73 * retransmission.
74 */
75#ifndef PJ_STUN_RTO_VALUE
76# define PJ_STUN_RTO_VALUE 100
77#endif
78
79
80/**
81 * The STUN transaction timeout value, in miliseconds.
82 * After the last retransmission is sent and if no response is received
83 * after this time, the STUN transaction will be considered to have failed.
84 *
85 * The default value is 16x RTO (as per RFC 3489-bis).
86 */
87#ifndef PJ_STUN_TIMEOUT_VALUE
88# define PJ_STUN_TIMEOUT_VALUE (16 * PJ_STUN_RTO_VALUE)
89#endif
90
91
92/**
93 * Maximum number of STUN transmission count.
94 *
95 * Default: 7 (as per RFC 3489-bis)
96 */
97#ifndef PJ_STUN_MAX_TRANSMIT_COUNT
98# define PJ_STUN_MAX_TRANSMIT_COUNT 7
99#endif
100
101
102/**
103 * Duration to keep response in the cache, in msec.
104 *
105 * Default: 10000 (as per RFC 3489-bis)
106 */
107#ifndef PJ_STUN_RES_CACHE_DURATION
108# define PJ_STUN_RES_CACHE_DURATION 10000
109#endif
110
111
112/**
113 * Maximum size of STUN message.
114 */
115#ifndef PJ_STUN_MAX_PKT_LEN
116# define PJ_STUN_MAX_PKT_LEN 800
117#endif
118
119
120/**
121 * Default STUN port as defined by RFC 3489.
122 */
123#define PJ_STUN_PORT 3478
124
125
126/**
127 * Padding character for string attributes.
128 *
129 * Default: ASCII 0
130 */
131#ifndef PJ_STUN_STRING_ATTR_PAD_CHR
132# define PJ_STUN_STRING_ATTR_PAD_CHR 0
133#endif
134
135
136/**
137 * Enable pre-RFC3489bis-07 style of STUN MESSAGE-INTEGRITY and FINGERPRINT
138 * calculation. By default this should be disabled since the calculation is
139 * not backward compatible with current STUN specification.
140 */
141#ifndef PJ_STUN_OLD_STYLE_MI_FINGERPRINT
142# define PJ_STUN_OLD_STYLE_MI_FINGERPRINT 0
143#endif
144
145
146/* **************************************************************************
147 * STUN TRANSPORT CONFIGURATION
148 */
149
150/**
151 * The packet buffer size for the STUN transport.
152 */
153#ifndef PJ_STUN_SOCK_PKT_LEN
154# define PJ_STUN_SOCK_PKT_LEN 2000
155#endif
156
157
158/**
159 * The duration of the STUN keep-alive period, in seconds.
160 */
161#ifndef PJ_STUN_KEEP_ALIVE_SEC
162# define PJ_STUN_KEEP_ALIVE_SEC 15
163#endif
164
165
166/* **************************************************************************
167 * TURN CONFIGURATION
168 */
169
170/**
171 * Maximum DNS SRV entries to be processed in the DNS SRV response
172 */
173#ifndef PJ_TURN_MAX_DNS_SRV_CNT
174# define PJ_TURN_MAX_DNS_SRV_CNT 4
175#endif
176
177
178/**
179 * Maximum TURN packet size to be supported.
180 */
181#ifndef PJ_TURN_MAX_PKT_LEN
182# define PJ_TURN_MAX_PKT_LEN 3000
183#endif
184
185
186/**
187 * The TURN permission lifetime setting. This value should be taken from the
188 * TURN protocol specification.
189 */
190#ifndef PJ_TURN_PERM_TIMEOUT
191# define PJ_TURN_PERM_TIMEOUT 300
192#endif
193
194
195/**
196 * The TURN channel binding lifetime. This value should be taken from the
197 * TURN protocol specification.
198 */
199#ifndef PJ_TURN_CHANNEL_TIMEOUT
200# define PJ_TURN_CHANNEL_TIMEOUT 600
201#endif
202
203
204/**
205 * Number of seconds to refresh the permission/channel binding before the
206 * permission/channel binding expires. This value should be greater than
207 * PJ_TURN_PERM_TIMEOUT setting.
208 */
209#ifndef PJ_TURN_REFRESH_SEC_BEFORE
210# define PJ_TURN_REFRESH_SEC_BEFORE 60
211#endif
212
213
214/**
215 * The TURN session timer heart beat interval. When this timer occurs, the
216 * TURN session will scan all the permissions/channel bindings to see which
217 * need to be refreshed.
218 */
219#ifndef PJ_TURN_KEEP_ALIVE_SEC
220# define PJ_TURN_KEEP_ALIVE_SEC 15
221#endif
222
223
224/* **************************************************************************
225 * ICE CONFIGURATION
226 */
227
228/**
229 * Maximum number of ICE candidates.
230 *
231 * Default: 16
232 */
233#ifndef PJ_ICE_MAX_CAND
234# define PJ_ICE_MAX_CAND 16
235#endif
236
237
238/**
239 * Maximum number of candidates for each ICE stream transport component.
240 *
241 * Default: 8
242 */
243#ifndef PJ_ICE_ST_MAX_CAND
244# define PJ_ICE_ST_MAX_CAND 8
245#endif
246
247
248/**
249 * The number of bits to represent component IDs. This will affect
250 * the maximum number of components (PJ_ICE_MAX_COMP) value.
251 */
252#ifndef PJ_ICE_COMP_BITS
253# define PJ_ICE_COMP_BITS 1
254#endif
255
256
257/**
258 * Maximum number of ICE components.
259 */
260#define PJ_ICE_MAX_COMP (2<<PJ_ICE_COMP_BITS)
261
262/**
263 * Use the priority value according to the ice-draft.
264 */
265#ifndef PJNATH_ICE_PRIO_STD
266# define PJNATH_ICE_PRIO_STD 1
267#endif
268
269
270/**
271 * The number of bits to represent candidate type preference.
272 */
273#ifndef PJ_ICE_CAND_TYPE_PREF_BITS
274# if PJNATH_ICE_PRIO_STD
275# define PJ_ICE_CAND_TYPE_PREF_BITS 8
276# else
277# define PJ_ICE_CAND_TYPE_PREF_BITS 2
278# endif
279#endif
280
281
282/**
283 * The number of bits to represent ICE candidate's local preference. The
284 * local preference is used to specify preference among candidates with
285 * the same type, and ICE draft suggests 65535 as the default local
286 * preference, which means we need 16 bits to represent the value. But
287 * since we don't have the facility to specify local preference, we'll
288 * just disable this feature and let the preference sorted by the
289 * type only.
290 *
291 * Default: 0
292 */
293#ifndef PJ_ICE_LOCAL_PREF_BITS
294# define PJ_ICE_LOCAL_PREF_BITS 0
295#endif
296
297
298/**
299 * Maximum number of ICE checks.
300 *
301 * Default: 32
302 */
303#ifndef PJ_ICE_MAX_CHECKS
304# define PJ_ICE_MAX_CHECKS 32
305#endif
306
307
308/**
309 * Default timer interval (in miliseconds) for starting ICE periodic checks.
310 *
311 * Default: 20
312 */
313#ifndef PJ_ICE_TA_VAL
314# define PJ_ICE_TA_VAL 20
315#endif
316
317
318/**
319 * According to ICE Section 8.2. Updating States, if an In-Progress pair in
320 * the check list is for the same component as a nominated pair, the agent
321 * SHOULD cease retransmissions for its check if its pair priority is lower
322 * than the lowest priority nominated pair for that component.
323 *
324 * If a higher priority check is In Progress, this rule would cause that
325 * check to be performed even when it most likely will fail.
326 *
327 * The macro here controls if ICE session should cancel all In Progress
328 * checks for the same component regardless of its priority.
329 *
330 * Default: 1 (yes, cancel all)
331 */
332#ifndef PJ_ICE_CANCEL_ALL
333# define PJ_ICE_CANCEL_ALL 1
334#endif
335
336
337/**
338 * For a controlled agent, specify how long it wants to wait (in milliseconds)
339 * for the controlling agent to complete sending connectivity check with
340 * nominated flag set to true for all components after the controlled agent
341 * has found that all connectivity checks in its checklist have been completed
342 * and there is at least one successful (but not nominated) check for every
343 * component.
344 *
345 * When selecting the value, bear in mind that the connectivity check from
346 * controlling agent may be delayed because of delay in receiving SDP answer
347 * from the controlled agent.
348 *
349 * Application may set this value to -1 to disable this timer.
350 *
351 * Default: 10000 (milliseconds)
352 */
353#ifndef ICE_CONTROLLED_AGENT_WAIT_NOMINATION_TIMEOUT
354# define ICE_CONTROLLED_AGENT_WAIT_NOMINATION_TIMEOUT 10000
355#endif
356
357
358/**
359 * For controlling agent if it uses regular nomination, specify the delay to
360 * perform nominated check (connectivity check with USE-CANDIDATE attribute)
361 * after all components have a valid pair.
362 *
363 * Default: 4*PJ_STUN_RTO_VALUE (milliseconds)
364 */
365#ifndef PJ_ICE_NOMINATED_CHECK_DELAY
366# define PJ_ICE_NOMINATED_CHECK_DELAY (4*PJ_STUN_RTO_VALUE)
367#endif
368
369
370/**
371 * Minimum interval value to be used for sending STUN keep-alive on the ICE
372 * session, in seconds. This minimum interval, plus a random value
373 * which maximum is PJ_ICE_SESS_KEEP_ALIVE_MAX_RAND, specify the actual interval
374 * of the STUN keep-alive.
375 *
376 * Default: 15 seconds
377 *
378 * @see PJ_ICE_SESS_KEEP_ALIVE_MAX_RAND
379 */
380#ifndef PJ_ICE_SESS_KEEP_ALIVE_MIN
381# define PJ_ICE_SESS_KEEP_ALIVE_MIN 20
382#endif
383
384/* Warn about deprecated macro */
385#ifdef PJ_ICE_ST_KEEP_ALIVE_MIN
386# error PJ_ICE_ST_KEEP_ALIVE_MIN is deprecated
387#endif
388
389/**
390 * To prevent STUN keep-alives to be sent simultaneously, application should
391 * add random interval to minimum interval (PJ_ICE_SESS_KEEP_ALIVE_MIN). This
392 * setting specifies the maximum random value to be added to the minimum
393 * interval, in seconds.
394 *
395 * Default: 5 seconds
396 *
397 * @see PJ_ICE_SESS_KEEP_ALIVE_MIN
398 */
399#ifndef PJ_ICE_SESS_KEEP_ALIVE_MAX_RAND
400# define PJ_ICE_SESS_KEEP_ALIVE_MAX_RAND 5
401#endif
402
403/* Warn about deprecated macro */
404#ifdef PJ_ICE_ST_KEEP_ALIVE_MAX_RAND
405# error PJ_ICE_ST_KEEP_ALIVE_MAX_RAND is deprecated
406#endif
407
408
409/**
410 * This constant specifies the length of random string generated for ICE
411 * ufrag and password.
412 *
413 * Default: 8 (characters)
414 */
415#ifndef PJ_ICE_UFRAG_LEN
416# define PJ_ICE_UFRAG_LEN 8
417#endif
418
419
420/** ICE session pool initial size. */
421#ifndef PJNATH_POOL_LEN_ICE_SESS
422# define PJNATH_POOL_LEN_ICE_SESS 512
423#endif
424
425/** ICE session pool increment size */
426#ifndef PJNATH_POOL_INC_ICE_SESS
427# define PJNATH_POOL_INC_ICE_SESS 512
428#endif
429
430/** ICE stream transport pool initial size. */
431#ifndef PJNATH_POOL_LEN_ICE_STRANS
432# define PJNATH_POOL_LEN_ICE_STRANS 1000
433#endif
434
435/** ICE stream transport pool increment size */
436#ifndef PJNATH_POOL_INC_ICE_STRANS
437# define PJNATH_POOL_INC_ICE_STRANS 512
438#endif
439
440/** NAT detect pool initial size */
441#ifndef PJNATH_POOL_LEN_NATCK
442# define PJNATH_POOL_LEN_NATCK 512
443#endif
444
445/** NAT detect pool increment size */
446#ifndef PJNATH_POOL_INC_NATCK
447# define PJNATH_POOL_INC_NATCK 512
448#endif
449
450/** STUN session pool initial size */
451#ifndef PJNATH_POOL_LEN_STUN_SESS
452# define PJNATH_POOL_LEN_STUN_SESS 1000
453#endif
454
455/** STUN session pool increment size */
456#ifndef PJNATH_POOL_INC_STUN_SESS
457# define PJNATH_POOL_INC_STUN_SESS 1000
458#endif
459
460/** STUN session transmit data pool initial size */
461#ifndef PJNATH_POOL_LEN_STUN_TDATA
462# define PJNATH_POOL_LEN_STUN_TDATA 1000
463#endif
464
465/** STUN session transmit data pool increment size */
466#ifndef PJNATH_POOL_INC_STUN_TDATA
467# define PJNATH_POOL_INC_STUN_TDATA 1000
468#endif
469
470/** TURN session initial pool size */
471#ifndef PJNATH_POOL_LEN_TURN_SESS
472# define PJNATH_POOL_LEN_TURN_SESS 1000
473#endif
474
475/** TURN session pool increment size */
476#ifndef PJNATH_POOL_INC_TURN_SESS
477# define PJNATH_POOL_INC_TURN_SESS 1000
478#endif
479
480/** TURN socket initial pool size */
481#ifndef PJNATH_POOL_LEN_TURN_SOCK
482# define PJNATH_POOL_LEN_TURN_SOCK 1000
483#endif
484
485/** TURN socket pool increment size */
486#ifndef PJNATH_POOL_INC_TURN_SOCK
487# define PJNATH_POOL_INC_TURN_SOCK 1000
488#endif
489
490/** Default STUN software name */
491#ifndef PJNATH_STUN_SOFTWARE_NAME
492# define PJNATH_MAKE_SW_NAME(a,b,c,d) "pjnath-" #a "." #b "." #c d
493# define PJNATH_MAKE_SW_NAME2(a,b,c,d) PJNATH_MAKE_SW_NAME(a,b,c,d)
494# define PJNATH_STUN_SOFTWARE_NAME PJNATH_MAKE_SW_NAME2( \
495 PJ_VERSION_NUM_MAJOR, \
496 PJ_VERSION_NUM_MINOR, \
497 PJ_VERSION_NUM_REV, \
498 PJ_VERSION_NUM_EXTRA)
499#endif
500
501/**
502 * @}
503 */
504
505#endif /* __PJNATH_CONFIG_H__ */
506