Home --> Documentations --> PJNATH Reference

turn_session.h
Go to the documentation of this file.
1 /* $Id: turn_session.h 5481 2016-11-14 06:13:01Z 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_TURN_SESSION_H__
21 #define __PJNATH_TURN_SESSION_H__
22 
27 #include <pjnath/stun_session.h>
28 #include <pjlib-util/resolver.h>
29 
30 
32 
33 
34 /* **************************************************************************/
132 
133 
139 typedef enum pj_turn_tp_type
140 {
145 
150 
156 
158 
159 
161 typedef enum pj_turn_state_t
162 {
167 
173 
179 
185 
191 
197 
203 
208 
210 
211 
212 #pragma pack(1)
213 
218 typedef struct pj_turn_channel_data
219 {
223 
224 
225 #pragma pack()
226 
227 
231 typedef struct pj_turn_session_cb
232 {
248  const pj_uint8_t *pkt,
249  unsigned pkt_len,
250  const pj_sockaddr_t *dst_addr,
251  unsigned addr_len);
252 
266  const pj_sockaddr_t *peer_addr,
267  unsigned addr_len,
268  unsigned ch_num);
269 
283  void *pkt,
284  unsigned pkt_len,
285  const pj_sockaddr_t *peer_addr,
286  unsigned addr_len);
287 
297  void (*on_state)(pj_turn_session *sess,
298  pj_turn_state_t old_state,
299  pj_turn_state_t new_state);
300 
302 
303 
310 typedef struct pj_turn_alloc_param
311 {
319 
324  int lifetime;
325 
332 
340  int af;
341 
342 
344 
345 
349 typedef struct pj_turn_session_info
350 {
355 
360 
365 
370 
375 
380 
384  int lifetime;
385 
387 
388 
395 
396 
404 PJ_DECL(void) pj_turn_alloc_param_copy(pj_pool_t *pool,
405  pj_turn_alloc_param *dst,
406  const pj_turn_alloc_param *src);
407 
415 PJ_DECL(const char*) pj_turn_state_name(pj_turn_state_t state);
416 
417 
445  const char *name,
446  int af,
447  pj_turn_tp_type conn_type,
448  pj_grp_lock_t *grp_lock,
449  const pj_turn_session_cb *cb,
450  unsigned options,
451  void *user_data,
452  pj_turn_session **p_sess);
453 
464 
465 
484  pj_status_t last_err);
485 
486 
500 
512  void *user_data);
513 
522 PJ_DECL(void*) pj_turn_session_get_user_data(pj_turn_session *sess);
523 
524 
533 
534 
541 PJ_DECL(void) pj_turn_session_set_log(pj_turn_session *sess,
542  unsigned flags);
543 
544 
557  const pj_str_t *sw);
558 
559 
596  const pj_str_t *domain,
597  int default_port,
598  pj_dns_resolver *resolver);
599 
600 
613  const pj_stun_auth_cred *cred);
614 
615 
639  const pj_turn_alloc_param *param);
640 
641 
661  unsigned addr_cnt,
662  const pj_sockaddr addr[],
663  unsigned options);
664 
665 
690  const pj_uint8_t *pkt,
691  unsigned pkt_len,
692  const pj_sockaddr_t *peer_addr,
693  unsigned addr_len);
694 
715  const pj_sockaddr_t *peer,
716  unsigned addr_len);
717 
740  void *pkt,
741  pj_size_t pkt_len,
742  pj_size_t *parsed_len);
743 
744 
750 PJ_END_DECL
751 
752 
753 #endif /* __PJNATH_TURN_SESSION_H__ */
754 
void pj_turn_alloc_param_copy(pj_pool_t *pool, pj_turn_alloc_param *dst, const pj_turn_alloc_param *src)
Definition: turn_session.h:144
pj_uint16_t ch_number
Definition: turn_session.h:220
struct pj_dns_resolver pj_dns_resolver
pj_status_t pj_turn_session_set_credential(pj_turn_session *sess, const pj_stun_auth_cred *cred)
Definition: stun_auth.h:114
void * user_data
void(* on_rx_data)(pj_turn_session *sess, void *pkt, unsigned pkt_len, const pj_sockaddr_t *peer_addr, unsigned addr_len)
Definition: turn_session.h:282
pj_status_t(* on_send_pkt)(pj_turn_session *sess, const pj_uint8_t *pkt, unsigned pkt_len, const pj_sockaddr_t *dst_addr, unsigned addr_len)
Definition: turn_session.h:247
pj_turn_tp_type
Definition: turn_session.h:139
pj_status_t pj_turn_session_sendto(pj_turn_session *sess, const pj_uint8_t *pkt, unsigned pkt_len, const pj_sockaddr_t *peer_addr, unsigned addr_len)
Definition: turn_session.h:172
pj_status_t pj_turn_session_shutdown(pj_turn_session *sess)
pj_grp_lock_t * pj_turn_session_get_grp_lock(pj_turn_session *sess)
pj_status_t last_status
Definition: turn_session.h:359
void * pj_turn_session_get_user_data(pj_turn_session *sess)
int ka_interval
Definition: turn_session.h:331
Definition: turn_session.h:310
int pj_status_t
void(* on_state)(pj_turn_session *sess, pj_turn_state_t old_state, pj_turn_state_t new_state)
Definition: turn_session.h:297
void pj_turn_session_set_log(pj_turn_session *sess, unsigned flags)
Definition: stun_config.h:48
void pj_turn_alloc_param_default(pj_turn_alloc_param *prm)
void pj_sockaddr_t
struct pj_grp_lock_t pj_grp_lock_t
pj_turn_tp_type conn_type
Definition: turn_session.h:364
pj_str_t info
pj_status_t pj_turn_session_set_user_data(pj_turn_session *sess, void *user_data)
pj_sockaddr server
Definition: turn_session.h:369
Definition: turn_session.h:202
pj_sockaddr relay_addr
Definition: turn_session.h:379
Definition: turn_session.h:155
pj_status_t pj_turn_session_set_software_name(pj_turn_session *sess, const pj_str_t *sw)
Definition: turn_session.h:190
void(* on_channel_bound)(pj_turn_session *sess, const pj_sockaddr_t *peer_addr, unsigned addr_len, unsigned ch_num)
Definition: turn_session.h:265
int lifetime
Definition: turn_session.h:384
pj_uint32_t flags
STUN session management for client/server.
Definition: turn_session.h:196
#define PJ_BEGIN_DECL
int lifetime
Definition: turn_session.h:324
pj_uint16_t length
Definition: turn_session.h:221
const char * pj_turn_state_name(pj_turn_state_t state)
unsigned char pj_uint8_t
Definition: turn_session.h:349
Definition: turn_session.h:184
pj_turn_state_t
Definition: turn_session.h:161
pj_turn_state_t state
Definition: turn_session.h:354
pj_status_t pj_turn_session_on_rx_pkt(pj_turn_session *sess, void *pkt, pj_size_t pkt_len, pj_size_t *parsed_len)
pj_status_t pj_turn_session_destroy(pj_turn_session *sess, pj_status_t last_err)
Definition: turn_session.h:149
Definition: turn_session.h:231
pj_sockaddr mapped_addr
Definition: turn_session.h:374
Definition: turn_session.h:207
pj_status_t pj_turn_session_create(const pj_stun_config *cfg, const char *name, int af, pj_turn_tp_type conn_type, pj_grp_lock_t *grp_lock, const pj_turn_session_cb *cb, unsigned options, void *user_data, pj_turn_session **p_sess)
pj_status_t pj_turn_session_set_perm(pj_turn_session *sess, unsigned addr_cnt, const pj_sockaddr addr[], unsigned options)
pj_status_t pj_turn_session_alloc(pj_turn_session *sess, const pj_turn_alloc_param *param)
int bandwidth
Definition: turn_session.h:318
pj_status_t pj_turn_session_get_info(pj_turn_session *sess, pj_turn_session_info *info)
pj_status_t pj_turn_session_set_server(pj_turn_session *sess, const pj_str_t *domain, int default_port, pj_dns_resolver *resolver)
Definition: turn_session.h:218
Definition: turn_session.h:166
unsigned short pj_uint16_t
int af
Definition: turn_session.h:340
size_t pj_size_t
struct pj_turn_session pj_turn_session
Definition: turn_session.h:131
Definition: turn_session.h:178
pj_status_t pj_turn_session_bind_channel(pj_turn_session *sess, const pj_sockaddr_t *peer, unsigned addr_len)

 


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