BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJNATH Reference

stun_config.h
Go to the documentation of this file.
1 /* $Id: stun_config.h 4199 2012-07-05 10:52:55Z nanang $ */
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_STUN_CONFIG_H__
21 #define __PJNATH_STUN_CONFIG_H__
22 
28 #include <pjnath/stun_msg.h>
29 #include <pj/assert.h>
30 #include <pj/errno.h>
31 #include <pj/string.h>
32 
33 
35 
36 
37 /* **************************************************************************/
48 typedef struct pj_stun_config
49 {
54 
59 
64 
68  unsigned options;
69 
74  unsigned rto_msec;
75 
82  unsigned res_cache_msec;
83 
90 
92 
93 
94 
99  pj_pool_factory *factory,
100  unsigned options,
101  pj_ioqueue_t *ioqueue,
102  pj_timer_heap_t *timer_heap)
103 {
104  pj_bzero(cfg, sizeof(*cfg));
105 
106  cfg->pf = factory;
107  cfg->options = options;
108  cfg->ioqueue = ioqueue;
109  cfg->timer_heap = timer_heap;
110  cfg->rto_msec = PJ_STUN_RTO_VALUE;
111  cfg->res_cache_msec = PJ_STUN_RES_CACHE_DURATION;
112  cfg->software_name = pj_str((char*)PJNATH_STUN_SOFTWARE_NAME);
113 }
114 
115 
120 {
121  PJ_ASSERT_RETURN(cfg->ioqueue && cfg->pf && cfg->timer_heap &&
122  cfg->rto_msec && cfg->res_cache_msec, PJ_EINVAL);
123  return PJ_SUCCESS;
124 }
125 
126 
133 
134 
135 #endif /* __PJNATH_STUN_CONFIG_H__ */
136 
STUN message components.
pj_ioqueue_t * ioqueue
Definition: stun_config.h:58
struct pj_timer_heap_t pj_timer_heap_t
#define PJ_ASSERT_RETURN(expr, retval)
#define PJ_STUN_RTO_VALUE
Definition: config.h:76
unsigned res_cache_msec
Definition: stun_config.h:82
int pj_status_t
Definition: stun_config.h:48
struct pj_ioqueue_t pj_ioqueue_t
pj_pool_factory * pf
Definition: stun_config.h:53
#define PJ_END_DECL
unsigned options
Definition: stun_config.h:68
#define PJ_BEGIN_DECL
pj_str_t pj_str(char *str)
#define PJ_INLINE(type)
void pj_bzero(void *dst, pj_size_t size)
unsigned rto_msec
Definition: stun_config.h:74
pj_str_t software_name
Definition: stun_config.h:89
#define PJ_STUN_RES_CACHE_DURATION
Definition: config.h:108
void pj_stun_config_init(pj_stun_config *cfg, pj_pool_factory *factory, unsigned options, pj_ioqueue_t *ioqueue, pj_timer_heap_t *timer_heap)
Definition: stun_config.h:98
pj_status_t pj_stun_config_check_valid(const pj_stun_config *cfg)
Definition: stun_config.h:119
#define PJ_EINVAL
pj_timer_heap_t * timer_heap
Definition: stun_config.h:63

 


PJNATH - Open Source NAT traversal helper library supporting STUN, TURN, and ICE
Copyright (C) 2006-2009 Teluu Inc.