Home --> Documentations --> PJNATH Reference

turn_sock.h
Go to the documentation of this file.
1 /* $Id: turn_sock.h 4606 2013-10-01 05:00:57Z ming $ */
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_SOCK_H__
21 #define __PJNATH_TURN_SOCK_H__
22 
27 #include <pjnath/turn_session.h>
28 #include <pj/sock_qos.h>
29 
30 
32 
33 
34 /* **************************************************************************/
62 typedef struct pj_turn_sock pj_turn_sock;
63 
68 typedef struct pj_turn_sock_cb
69 {
83  void (*on_rx_data)(pj_turn_sock *turn_sock,
84  void *pkt,
85  unsigned pkt_len,
86  const pj_sockaddr_t *peer_addr,
87  unsigned addr_len);
88 
97  void (*on_state)(pj_turn_sock *turn_sock,
98  pj_turn_state_t old_state,
99  pj_turn_state_t new_state);
100 
102 
103 
109 typedef struct pj_turn_sock_cfg
110 {
118 
124  unsigned max_pkt_size;
125 
134 
143 
151 
159 
168 
177  unsigned so_rcvbuf_size;
178 
187  unsigned so_sndbuf_size;
188 
190 
191 
195 PJ_DECL(void) pj_turn_sock_cfg_default(pj_turn_sock_cfg *cfg);
196 
197 
224  int af,
225  pj_turn_tp_type conn_type,
226  const pj_turn_sock_cb *cb,
227  const pj_turn_sock_cfg *setting,
228  void *user_data,
229  pj_turn_sock **p_turn_sock);
230 
240 PJ_DECL(void) pj_turn_sock_destroy(pj_turn_sock *turn_sock);
241 
242 
254  void *user_data);
255 
264 PJ_DECL(void*) pj_turn_sock_get_user_data(pj_turn_sock *turn_sock);
265 
266 
275 
276 
289 
300 PJ_DECL(pj_status_t) pj_turn_sock_lock(pj_turn_sock *turn_sock);
301 
302 
311 PJ_DECL(pj_status_t) pj_turn_sock_unlock(pj_turn_sock *turn_sock);
312 
313 
321 PJ_DECL(void) pj_turn_sock_set_log(pj_turn_sock *turn_sock,
322  unsigned flags);
323 
336  const pj_str_t *sw);
337 
338 
374 PJ_DECL(pj_status_t) pj_turn_sock_alloc(pj_turn_sock *turn_sock,
375  const pj_str_t *domain,
376  int default_port,
377  pj_dns_resolver *resolver,
378  const pj_stun_auth_cred *cred,
379  const pj_turn_alloc_param *param);
380 
400  unsigned addr_cnt,
401  const pj_sockaddr addr[],
402  unsigned options);
403 
423 PJ_DECL(pj_status_t) pj_turn_sock_sendto(pj_turn_sock *turn_sock,
424  const pj_uint8_t *pkt,
425  unsigned pkt_len,
426  const pj_sockaddr_t *peer_addr,
427  unsigned addr_len);
428 
446  const pj_sockaddr_t *peer,
447  unsigned addr_len);
448 
449 
455 PJ_END_DECL
456 
457 
458 #endif /* __PJNATH_TURN_SOCK_H__ */
459 
struct pj_dns_resolver pj_dns_resolver
int pj_bool_t
Definition: stun_auth.h:114
void * user_data
pj_turn_tp_type
Definition: turn_session.h:139
pj_status_t pj_turn_sock_set_software_name(pj_turn_sock *turn_sock, const pj_str_t *sw)
void(* on_state)(pj_turn_sock *turn_sock, pj_turn_state_t old_state, pj_turn_state_t new_state)
Definition: turn_sock.h:97
Definition: turn_session.h:310
unsigned max_pkt_size
Definition: turn_sock.h:124
int pj_status_t
Definition: stun_config.h:48
void pj_sockaddr_t
struct pj_grp_lock_t pj_grp_lock_t
pj_qos_params qos_params
Definition: turn_sock.h:142
pj_status_t pj_turn_sock_sendto(pj_turn_sock *turn_sock, const pj_uint8_t *pkt, unsigned pkt_len, const pj_sockaddr_t *peer_addr, unsigned addr_len)
pj_status_t pj_turn_sock_set_user_data(pj_turn_sock *turn_sock, void *user_data)
pj_str_t info
pj_grp_lock_t * pj_turn_sock_get_grp_lock(pj_turn_sock *turn_sock)
Definition: turn_sock.h:109
pj_status_t pj_turn_sock_get_info(pj_turn_sock *turn_sock, pj_turn_session_info *info)
void * pj_turn_sock_get_user_data(pj_turn_sock *turn_sock)
unsigned so_rcvbuf_size
Definition: turn_sock.h:177
pj_uint32_t flags
void pj_turn_sock_destroy(pj_turn_sock *turn_sock)
pj_status_t pj_turn_sock_lock(pj_turn_sock *turn_sock)
unsigned so_sndbuf_size
Definition: turn_sock.h:187
pj_grp_lock_t * grp_lock
Definition: turn_sock.h:117
#define PJ_BEGIN_DECL
pj_qos_type
void pj_turn_sock_set_log(pj_turn_sock *turn_sock, unsigned flags)
pj_status_t pj_turn_sock_set_perm(pj_turn_sock *turn_sock, unsigned addr_cnt, const pj_sockaddr addr[], unsigned options)
void(* on_rx_data)(pj_turn_sock *turn_sock, void *pkt, unsigned pkt_len, const pj_sockaddr_t *peer_addr, unsigned addr_len)
Definition: turn_sock.h:83
unsigned char pj_uint8_t
Definition: turn_session.h:349
pj_turn_state_t
Definition: turn_session.h:161
pj_status_t pj_turn_sock_unlock(pj_turn_sock *turn_sock)
Definition: turn_sock.h:68
pj_bool_t qos_ignore_error
Definition: turn_sock.h:150
pj_status_t pj_turn_sock_alloc(pj_turn_sock *turn_sock, const pj_str_t *domain, int default_port, pj_dns_resolver *resolver, const pj_stun_auth_cred *cred, const pj_turn_alloc_param *param)
pj_status_t pj_turn_sock_bind_channel(pj_turn_sock *turn_sock, const pj_sockaddr_t *peer, unsigned addr_len)
pj_qos_type qos_type
Definition: turn_sock.h:133
void pj_turn_sock_cfg_default(pj_turn_sock_cfg *cfg)
Transport independent TURN client session.
struct pj_turn_sock pj_turn_sock
Definition: turn_sock.h:62
pj_sockaddr bound_addr
Definition: turn_sock.h:158
pj_uint16_t port_range
Definition: turn_sock.h:167
unsigned short pj_uint16_t
pj_status_t pj_turn_sock_create(pj_stun_config *cfg, int af, pj_turn_tp_type conn_type, const pj_turn_sock_cb *cb, const pj_turn_sock_cfg *setting, void *user_data, pj_turn_sock **p_turn_sock)

 


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