00001 /* $Id: stun_config.h 3553 2011-05-05 06:14:19Z nanang $ */00002 /* 00003 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)00004 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>00005 *00006 * This program is free software; you can redistribute it and/or modify00007 * it under the terms of the GNU General Public License as published by00008 * the Free Software Foundation; either version 2 of the License, or00009 * (at your option) any later version.00010 *00011 * This program is distributed in the hope that it will be useful,00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the00014 * GNU General Public License for more details.00015 *00016 * You should have received a copy of the GNU General Public License00017 * along with this program; if not, write to the Free Software00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 */00020 #ifndef __PJNATH_STUN_CONFIG_H__00021 #define __PJNATH_STUN_CONFIG_H__00022
00028 #include <pjnath/stun_msg.h>00029 #include <pj/assert.h>00030 #include <pj/errno.h>00031 #include <pj/string.h>00032
00033
00034 PJ_BEGIN_DECL00035
00036
00037 /* **************************************************************************/00048typedefstruct pj_stun_config00049 {
00053pj_pool_factory *pf;
00054
00058pj_ioqueue_t *ioqueue;
00059
00063pj_timer_heap_t *timer_heap;
00064
00068unsignedoptions;
00069
00074unsignedrto_msec;
00075
00082unsignedres_cache_msec;
00083
00084 } pj_stun_config;
00085
00086
00087
00091PJ_INLINE(void) pj_stun_config_init(pj_stun_config *cfg,
00092 pj_pool_factory *factory,
00093 unsignedoptions,
00094 pj_ioqueue_t *ioqueue,
00095 pj_timer_heap_t *timer_heap)
00096 {
00097 pj_bzero(cfg, sizeof(*cfg));
00098
00099 cfg->pf = factory;
00100 cfg->options = options;
00101 cfg->ioqueue = ioqueue;
00102 cfg->timer_heap = timer_heap;
00103 cfg->rto_msec = PJ_STUN_RTO_VALUE;
00104 cfg->res_cache_msec = PJ_STUN_RES_CACHE_DURATION;
00105 }
00106
00107
00111PJ_INLINE(pj_status_t) pj_stun_config_check_valid(const pj_stun_config *cfg)
00112 {
00113 PJ_ASSERT_RETURN(cfg->ioqueue && cfg->pf && cfg->timer_heap &&
00114 cfg->rto_msec && cfg->res_cache_msec, PJ_EINVAL);
00115 returnPJ_SUCCESS;
00116 }
00117
00118
00124 PJ_END_DECL00125
00126
00127 #endif /* __PJNATH_STUN_CONFIG_H__ */00128
PJNATH - Open Source NAT traversal helper library supporting STUN, TURN, and ICE
Copyright (C) 2006-2009 Teluu Inc.