WARNING: The online documentation has moved to https://docs.pjsip.org.

Visit the new documentation at https://docs.pjsip.org:

BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJNATH Reference

turn_sock.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#ifndef __PJNATH_TURN_SOCK_H__
20#define __PJNATH_TURN_SOCK_H__
21
26#include <pjnath/turn_session.h>
27#include <pj/sock_qos.h>
28#include <pj/ssl_sock.h>
29
30
32
33
34/* **************************************************************************/
63
68typedef 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
104 pj_ssize_t sent);
105
114 void (*on_state)(pj_turn_sock *turn_sock,
115 pj_turn_state_t old_state,
116 pj_turn_state_t new_state);
117
141 pj_uint32_t conn_id,
142 const pj_sockaddr_t *peer_addr,
143 unsigned addr_len);
144
156 pj_status_t status,
157 pj_uint32_t conn_id,
158 const pj_sockaddr_t *peer_addr,
159 unsigned addr_len);
160
162
163
168#ifndef PJ_TURN_TLS_DEFAULT_PROTO
169# define PJ_TURN_TLS_DEFAULT_PROTO (PJ_SSL_SOCK_PROTO_TLS1 | \
170 PJ_SSL_SOCK_PROTO_TLS1_1 | \
171 PJ_SSL_SOCK_PROTO_TLS1_2)
172#endif
173
178{
183
188
194
199
205
213
220
225
242
244
251
261 const pj_turn_sock_tls_cfg *src);
262
269
270
276typedef struct pj_turn_sock_cfg
277{
285
291 unsigned max_pkt_size;
292
301
310
318
326
335
345
355
361
363
364
369
370
397 int af,
398 pj_turn_tp_type conn_type,
399 const pj_turn_sock_cb *cb,
400 const pj_turn_sock_cfg *setting,
401 void *user_data,
402 pj_turn_sock **p_turn_sock);
403
413PJ_DECL(void) pj_turn_sock_destroy(pj_turn_sock *turn_sock);
414
415
427 void *user_data);
428
437PJ_DECL(void*) pj_turn_sock_get_user_data(pj_turn_sock *turn_sock);
438
439
448
449
462
474
475
485
486
494PJ_DECL(void) pj_turn_sock_set_log(pj_turn_sock *turn_sock,
495 unsigned flags);
496
509 const pj_str_t *sw);
510
511
548 const pj_str_t *domain,
549 int default_port,
550 pj_dns_resolver *resolver,
551 const pj_stun_auth_cred *cred,
552 const pj_turn_alloc_param *param);
553
573 unsigned addr_cnt,
574 const pj_sockaddr addr[],
575 unsigned options);
576
600 const pj_uint8_t *pkt,
601 unsigned pkt_len,
602 const pj_sockaddr_t *peer_addr,
603 unsigned addr_len);
604
622 const pj_sockaddr_t *peer,
623 unsigned addr_len);
644 const pj_sockaddr_t *peer,
645 unsigned addr_len);
659 const pj_sockaddr_t *peer,
660 unsigned addr_len);
661
662
669
670
671#endif /* __PJNATH_TURN_SOCK_H__ */
672
pj_turn_tp_type
Definition: turn_session.h:139
pj_turn_state_t
Definition: turn_session.h:162
pj_status_t pj_turn_sock_disconnect(pj_turn_sock *turn_sock, const pj_sockaddr_t *peer, unsigned addr_len)
void pj_turn_sock_set_log(pj_turn_sock *turn_sock, unsigned flags)
struct pj_turn_sock pj_turn_sock
Definition: turn_sock.h:62
pj_status_t pj_turn_sock_connect(pj_turn_sock *turn_sock, const pj_sockaddr_t *peer, unsigned addr_len)
void pj_turn_sock_tls_cfg_wipe_keys(pj_turn_sock_tls_cfg *tls_cfg)
void pj_turn_sock_tls_cfg_default(pj_turn_sock_tls_cfg *tls_cfg)
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)
pj_status_t pj_turn_sock_bind_channel(pj_turn_sock *turn_sock, const pj_sockaddr_t *peer, unsigned addr_len)
void * pj_turn_sock_get_user_data(pj_turn_sock *turn_sock)
void pj_turn_sock_destroy(pj_turn_sock *turn_sock)
pj_status_t pj_turn_sock_set_user_data(pj_turn_sock *turn_sock, void *user_data)
void pj_turn_sock_cfg_default(pj_turn_sock_cfg *cfg)
pj_status_t pj_turn_sock_get_info(pj_turn_sock *turn_sock, pj_turn_session_info *info)
pj_status_t pj_turn_sock_lock(pj_turn_sock *turn_sock)
void pj_turn_sock_tls_cfg_dup(pj_pool_t *pool, pj_turn_sock_tls_cfg *dst, const pj_turn_sock_tls_cfg *src)
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_set_software_name(pj_turn_sock *turn_sock, const pj_str_t *sw)
pj_status_t pj_turn_sock_set_perm(pj_turn_sock *turn_sock, unsigned addr_cnt, const pj_sockaddr addr[], unsigned options)
pj_status_t pj_turn_sock_unlock(pj_turn_sock *turn_sock)
pj_grp_lock_t * pj_turn_sock_get_grp_lock(pj_turn_sock *turn_sock)
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)
unsigned char pj_uint8_t
long pj_ssize_t
int pj_bool_t
unsigned short pj_uint16_t
void pj_sockaddr_t
int pj_status_t
struct pj_grp_lock_t pj_grp_lock_t
unsigned int pj_uint32_t
struct pj_dns_resolver pj_dns_resolver
#define PJ_BEGIN_DECL
#define PJ_END_DECL
pj_qos_type
Definition: stun_auth.h:114
Definition: stun_config.h:48
Definition: turn_session.h:389
Definition: turn_session.h:435
Definition: turn_sock.h:69
pj_bool_t(* on_data_sent)(pj_turn_sock *sock, pj_ssize_t sent)
Definition: turn_sock.h:103
void(* on_state)(pj_turn_sock *turn_sock, pj_turn_state_t old_state, pj_turn_state_t new_state)
Definition: turn_sock.h:114
pj_status_t(* on_connection_attempt)(pj_turn_sock *turn_sock, pj_uint32_t conn_id, const pj_sockaddr_t *peer_addr, unsigned addr_len)
Definition: turn_sock.h:140
void(* on_connection_status)(pj_turn_sock *turn_sock, pj_status_t status, pj_uint32_t conn_id, const pj_sockaddr_t *peer_addr, unsigned addr_len)
Definition: turn_sock.h:155
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
Definition: turn_sock.h:277
pj_bool_t qos_ignore_error
Definition: turn_sock.h:317
unsigned max_pkt_size
Definition: turn_sock.h:291
unsigned so_rcvbuf_size
Definition: turn_sock.h:344
pj_qos_params qos_params
Definition: turn_sock.h:309
pj_turn_sock_tls_cfg tls_cfg
Definition: turn_sock.h:360
pj_uint16_t port_range
Definition: turn_sock.h:334
unsigned so_sndbuf_size
Definition: turn_sock.h:354
pj_qos_type qos_type
Definition: turn_sock.h:300
pj_grp_lock_t * grp_lock
Definition: turn_sock.h:284
pj_sockaddr bound_addr
Definition: turn_sock.h:325
Definition: turn_sock.h:178
pj_ssl_cert_buffer cert_buf
Definition: turn_sock.h:212
pj_ssl_cert_buffer privkey_buf
Definition: turn_sock.h:219
pj_ssl_cert_buffer ca_buf
Definition: turn_sock.h:204
pj_str_t ca_list_file
Definition: turn_sock.h:182
pj_str_t ca_list_path
Definition: turn_sock.h:187
pj_str_t password
Definition: turn_sock.h:224
pj_ssl_sock_param ssock_param
Definition: turn_sock.h:241
pj_str_t privkey_file
Definition: turn_sock.h:198
pj_str_t cert_file
Definition: turn_sock.h:193
Transport independent TURN client session.

 


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