1
/* $Id: config.h 4199 2012-07-05 10:52:55Z nanang $ */
3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
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.
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.
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
20
#ifndef __PJNATH_CONFIG_H__
21
#define __PJNATH_CONFIG_H__
26
* @brief Compile time settings
32
* @defgroup PJNATH_CONFIG Compile-time configurations
33
* @brief Various compile time settings
34
* @ingroup PJNATH_STUN_BASE
39
/* **************************************************************************
44
* The log level for PJNATH error display.
48
#ifndef PJNATH_ERROR_LEVEL
49
# define PJNATH_ERROR_LEVEL 1
53
/* **************************************************************************
58
* Maximum number of attributes in the STUN packet (for the new STUN
63
#ifndef PJ_STUN_MAX_ATTR
64
# define PJ_STUN_MAX_ATTR 16
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
75
#ifndef PJ_STUN_RTO_VALUE
76
# define PJ_STUN_RTO_VALUE 100
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.
85
* The default value is 16x RTO (as per RFC 3489-bis).
87
#ifndef PJ_STUN_TIMEOUT_VALUE
88
# define PJ_STUN_TIMEOUT_VALUE (16 * PJ_STUN_RTO_VALUE)
93
* Maximum number of STUN transmission count.
95
* Default: 7 (as per RFC 3489-bis)
97
#ifndef PJ_STUN_MAX_TRANSMIT_COUNT
98
# define PJ_STUN_MAX_TRANSMIT_COUNT 7
103
* Duration to keep response in the cache, in msec.
105
* Default: 10000 (as per RFC 3489-bis)
107
#ifndef PJ_STUN_RES_CACHE_DURATION
108
# define PJ_STUN_RES_CACHE_DURATION 10000
113
* Maximum size of STUN message.
115
#ifndef PJ_STUN_MAX_PKT_LEN
116
# define PJ_STUN_MAX_PKT_LEN 800
121
* Default STUN port as defined by RFC 3489.
123
#define PJ_STUN_PORT 3478
127
* Padding character for string attributes.
131
#ifndef PJ_STUN_STRING_ATTR_PAD_CHR
132
# define PJ_STUN_STRING_ATTR_PAD_CHR 0
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.
141
#ifndef PJ_STUN_OLD_STYLE_MI_FINGERPRINT
142
# define PJ_STUN_OLD_STYLE_MI_FINGERPRINT 0
146
/* **************************************************************************
147
* STUN TRANSPORT CONFIGURATION
151
* The packet buffer size for the STUN transport.
153
#ifndef PJ_STUN_SOCK_PKT_LEN
154
# define PJ_STUN_SOCK_PKT_LEN 2000
159
* The duration of the STUN keep-alive period, in seconds.
161
#ifndef PJ_STUN_KEEP_ALIVE_SEC
162
# define PJ_STUN_KEEP_ALIVE_SEC 15
166
/* **************************************************************************
171
* Maximum DNS SRV entries to be processed in the DNS SRV response
173
#ifndef PJ_TURN_MAX_DNS_SRV_CNT
174
# define PJ_TURN_MAX_DNS_SRV_CNT 4
179
* Maximum TURN packet size to be supported.
181
#ifndef PJ_TURN_MAX_PKT_LEN
182
# define PJ_TURN_MAX_PKT_LEN 3000
187
* The TURN permission lifetime setting. This value should be taken from the
188
* TURN protocol specification.
190
#ifndef PJ_TURN_PERM_TIMEOUT
191
# define PJ_TURN_PERM_TIMEOUT 300
196
* The TURN channel binding lifetime. This value should be taken from the
197
* TURN protocol specification.
199
#ifndef PJ_TURN_CHANNEL_TIMEOUT
200
# define PJ_TURN_CHANNEL_TIMEOUT 600
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.
209
#ifndef PJ_TURN_REFRESH_SEC_BEFORE
210
# define PJ_TURN_REFRESH_SEC_BEFORE 60
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.
219
#ifndef PJ_TURN_KEEP_ALIVE_SEC
220
# define PJ_TURN_KEEP_ALIVE_SEC 15
224
/* **************************************************************************
229
* Maximum number of ICE candidates.
233
#ifndef PJ_ICE_MAX_CAND
234
# define PJ_ICE_MAX_CAND 16
239
* Maximum number of candidates for each ICE stream transport component.
243
#ifndef PJ_ICE_ST_MAX_CAND
244
# define PJ_ICE_ST_MAX_CAND 8
249
* The number of bits to represent component IDs. This will affect
250
* the maximum number of components (PJ_ICE_MAX_COMP) value.
252
#ifndef PJ_ICE_COMP_BITS
253
# define PJ_ICE_COMP_BITS 1
258
* Maximum number of ICE components.
260
#define PJ_ICE_MAX_COMP (2<<PJ_ICE_COMP_BITS)
263
* Use the priority value according to the ice-draft.
265
#ifndef PJNATH_ICE_PRIO_STD
266
# define PJNATH_ICE_PRIO_STD 1
271
* The number of bits to represent candidate type preference.
273
#ifndef PJ_ICE_CAND_TYPE_PREF_BITS
274
# if PJNATH_ICE_PRIO_STD
275
# define PJ_ICE_CAND_TYPE_PREF_BITS 8
277
# define PJ_ICE_CAND_TYPE_PREF_BITS 2
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
293
#ifndef PJ_ICE_LOCAL_PREF_BITS
294
# define PJ_ICE_LOCAL_PREF_BITS 0
299
* Maximum number of ICE checks.
303
#ifndef PJ_ICE_MAX_CHECKS
304
# define PJ_ICE_MAX_CHECKS 32
309
* Default timer interval (in miliseconds) for starting ICE periodic checks.
313
#ifndef PJ_ICE_TA_VAL
314
# define PJ_ICE_TA_VAL 20
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.
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.
327
* The macro here controls if ICE session should cancel all In Progress
328
* checks for the same component regardless of its priority.
330
* Default: 1 (yes, cancel all)
332
#ifndef PJ_ICE_CANCEL_ALL
333
# define PJ_ICE_CANCEL_ALL 1
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
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.
349
* Application may set this value to -1 to disable this timer.
351
* Default: 10000 (milliseconds)
353
#ifndef ICE_CONTROLLED_AGENT_WAIT_NOMINATION_TIMEOUT
354
# define ICE_CONTROLLED_AGENT_WAIT_NOMINATION_TIMEOUT 10000
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.
363
* Default: 4*PJ_STUN_RTO_VALUE (milliseconds)
365
#ifndef PJ_ICE_NOMINATED_CHECK_DELAY
366
# define PJ_ICE_NOMINATED_CHECK_DELAY (4*PJ_STUN_RTO_VALUE)
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.
376
* Default: 15 seconds
378
* @see PJ_ICE_SESS_KEEP_ALIVE_MAX_RAND
380
#ifndef PJ_ICE_SESS_KEEP_ALIVE_MIN
381
# define PJ_ICE_SESS_KEEP_ALIVE_MIN 20
384
/* Warn about deprecated macro */
385
#ifdef PJ_ICE_ST_KEEP_ALIVE_MIN
386
# error PJ_ICE_ST_KEEP_ALIVE_MIN is deprecated
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.
397
* @see PJ_ICE_SESS_KEEP_ALIVE_MIN
399
#ifndef PJ_ICE_SESS_KEEP_ALIVE_MAX_RAND
400
# define PJ_ICE_SESS_KEEP_ALIVE_MAX_RAND 5
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
410
* This constant specifies the length of random string generated for ICE
411
* ufrag and password.
413
* Default: 8 (characters)
415
#ifndef PJ_ICE_UFRAG_LEN
416
# define PJ_ICE_UFRAG_LEN 8
420
/** ICE session pool initial size. */
421
#ifndef PJNATH_POOL_LEN_ICE_SESS
422
# define PJNATH_POOL_LEN_ICE_SESS 512
425
/** ICE session pool increment size */
426
#ifndef PJNATH_POOL_INC_ICE_SESS
427
# define PJNATH_POOL_INC_ICE_SESS 512
430
/** ICE stream transport pool initial size. */
431
#ifndef PJNATH_POOL_LEN_ICE_STRANS
432
# define PJNATH_POOL_LEN_ICE_STRANS 1000
435
/** ICE stream transport pool increment size */
436
#ifndef PJNATH_POOL_INC_ICE_STRANS
437
# define PJNATH_POOL_INC_ICE_STRANS 512
440
/** NAT detect pool initial size */
441
#ifndef PJNATH_POOL_LEN_NATCK
442
# define PJNATH_POOL_LEN_NATCK 512
445
/** NAT detect pool increment size */
446
#ifndef PJNATH_POOL_INC_NATCK
447
# define PJNATH_POOL_INC_NATCK 512
450
/** STUN session pool initial size */
451
#ifndef PJNATH_POOL_LEN_STUN_SESS
452
# define PJNATH_POOL_LEN_STUN_SESS 1000
455
/** STUN session pool increment size */
456
#ifndef PJNATH_POOL_INC_STUN_SESS
457
# define PJNATH_POOL_INC_STUN_SESS 1000
460
/** STUN session transmit data pool initial size */
461
#ifndef PJNATH_POOL_LEN_STUN_TDATA
462
# define PJNATH_POOL_LEN_STUN_TDATA 1000
465
/** STUN session transmit data pool increment size */
466
#ifndef PJNATH_POOL_INC_STUN_TDATA
467
# define PJNATH_POOL_INC_STUN_TDATA 1000
470
/** TURN session initial pool size */
471
#ifndef PJNATH_POOL_LEN_TURN_SESS
472
# define PJNATH_POOL_LEN_TURN_SESS 1000
475
/** TURN session pool increment size */
476
#ifndef PJNATH_POOL_INC_TURN_SESS
477
# define PJNATH_POOL_INC_TURN_SESS 1000
480
/** TURN socket initial pool size */
481
#ifndef PJNATH_POOL_LEN_TURN_SOCK
482
# define PJNATH_POOL_LEN_TURN_SOCK 1000
485
/** TURN socket pool increment size */
486
#ifndef PJNATH_POOL_INC_TURN_SOCK
487
# define PJNATH_POOL_INC_TURN_SOCK 1000
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)
505
#endif /* __PJNATH_CONFIG_H__ */