1
/* $Id: stun_config.h 3553 2011-05-05 06:14:19Z 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_STUN_CONFIG_H__
21
#define __PJNATH_STUN_CONFIG_H__
25
* @brief STUN endpoint.
28
#include <pjnath/stun_msg.h>
29
#include <pj/assert.h>
31
#include <pj/string.h>
37
/* **************************************************************************/
39
* @defgroup PJNATH_STUN_CONFIG STUN Config
41
* @ingroup PJNATH_STUN_BASE
48
typedef struct pj_stun_config
51
* Pool factory to be used.
58
pj_ioqueue_t *ioqueue;
61
* Timer heap instance.
63
pj_timer_heap_t *timer_heap;
71
* The default initial STUN round-trip time estimation in msecs.
72
* The value normally is PJ_STUN_RTO_VALUE.
77
* The interval to cache outgoing STUN response in the STUN session,
80
* Default 10000 (10 seconds).
82
unsigned res_cache_msec;
89
* Initialize STUN config.
91
PJ_INLINE(void) pj_stun_config_init(pj_stun_config *cfg,
92
pj_pool_factory *factory,
94
pj_ioqueue_t *ioqueue,
95
pj_timer_heap_t *timer_heap)
97
pj_bzero(cfg, sizeof(*cfg));
100
cfg->options = options;
101
cfg->ioqueue = ioqueue;
102
cfg->timer_heap = timer_heap;
103
cfg->rto_msec = PJ_STUN_RTO_VALUE;
104
cfg->res_cache_msec = PJ_STUN_RES_CACHE_DURATION;
109
* Check that STUN config is valid.
111
PJ_INLINE(pj_status_t) pj_stun_config_check_valid(const pj_stun_config *cfg)
113
PJ_ASSERT_RETURN(cfg->ioqueue && cfg->pf && cfg->timer_heap &&
114
cfg->rto_msec && cfg->res_cache_msec, PJ_EINVAL);
127
#endif /* __PJNATH_STUN_CONFIG_H__ */