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_session.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_SESSION_H__
20#define __PJNATH_TURN_SESSION_H__
21
26#include <pjnath/stun_session.h>
27#include <pjlib-util/resolver.h>
28
29
31
32
33/* **************************************************************************/
131
132
138typedef enum pj_turn_tp_type
139{
144
149
155 PJ_TURN_TP_TLS = 56
156
158
159
161typedef enum pj_turn_state_t
162{
167
173
179
185
191
197
203
208
210
211
212#pragma pack(1)
213
219{
223
224
225#pragma pack()
226
227
231typedef struct pj_turn_session_cb
232{
251 const pj_uint8_t *pkt,
252 unsigned pkt_len,
253 const pj_sockaddr_t *dst_addr,
254 unsigned addr_len);
255
273 const pj_uint8_t *pkt,
274 unsigned pkt_len,
275 const pj_sockaddr_t *dst_addr,
276 unsigned addr_len);
277
291 const pj_sockaddr_t *peer_addr,
292 unsigned addr_len,
293 unsigned ch_num);
294
308 void *pkt,
309 unsigned pkt_len,
310 const pj_sockaddr_t *peer_addr,
311 unsigned addr_len);
312
322 void (*on_state)(pj_turn_session *sess,
323 pj_turn_state_t old_state,
324 pj_turn_state_t new_state);
325
343 pj_uint32_t conn_id,
344 const pj_sockaddr_t *peer_addr,
345 unsigned addr_len);
346
358 pj_status_t status,
359 pj_uint32_t conn_id,
360 const pj_sockaddr_t *peer_addr,
361 unsigned addr_len);
362
374 pj_status_t status,
375 pj_uint32_t conn_id,
376 const pj_sockaddr_t *peer_addr,
377 unsigned addr_len);
378
380
381
389{
397
403
410
418 int af;
419
427
429
430
435{
440
445
450
455
460
465
470
472
473
478{
483 void *pkt;
484
489
494
499
503 unsigned src_addr_len;
504
506
507
514
515
525 const pj_turn_alloc_param *src);
526
534PJ_DECL(const char*) pj_turn_state_name(pj_turn_state_t state);
535
536
564 const char *name,
565 int af,
566 pj_turn_tp_type conn_type,
567 pj_grp_lock_t *grp_lock,
568 const pj_turn_session_cb *cb,
569 unsigned options,
570 void *user_data,
571 pj_turn_session **p_sess);
572
583
584
603 pj_status_t last_err);
604
605
619
631 void *user_data);
632
642
643
652
653
661 unsigned flags);
662
663
676 const pj_str_t *sw);
677
678
715 const pj_str_t *domain,
716 int default_port,
717 pj_dns_resolver *resolver);
718
719
732 const pj_stun_auth_cred *cred);
733
734
758 const pj_turn_alloc_param *param);
759
760
780 unsigned addr_cnt,
781 const pj_sockaddr addr[],
782 unsigned options);
783
784
811 const pj_uint8_t *pkt,
812 unsigned pkt_len,
813 const pj_sockaddr_t *peer_addr,
814 unsigned addr_len);
815
836 const pj_sockaddr_t *peer,
837 unsigned addr_len);
838
861 void *pkt,
862 pj_size_t pkt_len,
863 pj_size_t *parsed_len);
864
889 pj_turn_session *sess,
891
910 pj_turn_session *sess,
911 pj_pool_t *pool,
912 pj_uint32_t conn_id,
913 const pj_sockaddr_t *peer_addr,
914 unsigned addr_len);
936 const pj_sockaddr_t *peer_addr,
937 unsigned addr_len);
938
945
946
947#endif /* __PJNATH_TURN_SESSION_H__ */
948
pj_status_t pj_turn_session_set_software_name(pj_turn_session *sess, const pj_str_t *sw)
void * pj_turn_session_get_user_data(pj_turn_session *sess)
pj_status_t pj_turn_session_set_perm(pj_turn_session *sess, unsigned addr_cnt, const pj_sockaddr addr[], unsigned options)
pj_turn_tp_type
Definition: turn_session.h:139
pj_status_t pj_turn_session_alloc(pj_turn_session *sess, const pj_turn_alloc_param *param)
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_connection_bind(pj_turn_session *sess, pj_pool_t *pool, pj_uint32_t conn_id, const pj_sockaddr_t *peer_addr, unsigned addr_len)
pj_status_t pj_turn_session_on_rx_pkt2(pj_turn_session *sess, pj_turn_session_on_rx_pkt_param *prm)
pj_status_t pj_turn_session_get_info(pj_turn_session *sess, pj_turn_session_info *info)
pj_status_t pj_turn_session_set_credential(pj_turn_session *sess, const pj_stun_auth_cred *cred)
pj_status_t pj_turn_session_shutdown(pj_turn_session *sess)
pj_status_t pj_turn_session_bind_channel(pj_turn_session *sess, const pj_sockaddr_t *peer, unsigned addr_len)
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)
void pj_turn_session_set_log(pj_turn_session *sess, unsigned flags)
pj_status_t pj_turn_session_set_user_data(pj_turn_session *sess, void *user_data)
pj_status_t pj_turn_session_destroy(pj_turn_session *sess, pj_status_t last_err)
struct pj_turn_session pj_turn_session
Definition: turn_session.h:130
pj_status_t pj_turn_session_set_server(pj_turn_session *sess, const pj_str_t *domain, int default_port, pj_dns_resolver *resolver)
pj_grp_lock_t * pj_turn_session_get_grp_lock(pj_turn_session *sess)
pj_turn_state_t
Definition: turn_session.h:162
void pj_turn_alloc_param_copy(pj_pool_t *pool, pj_turn_alloc_param *dst, const pj_turn_alloc_param *src)
pj_status_t pj_turn_session_connect(pj_turn_session *sess, const pj_sockaddr_t *peer_addr, unsigned addr_len)
void pj_turn_alloc_param_default(pj_turn_alloc_param *prm)
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)
const char * pj_turn_state_name(pj_turn_state_t state)
@ PJ_TURN_TP_TCP
Definition: turn_session.h:148
@ PJ_TURN_TP_UDP
Definition: turn_session.h:143
@ PJ_TURN_TP_TLS
Definition: turn_session.h:155
@ PJ_TURN_STATE_NULL
Definition: turn_session.h:166
@ PJ_TURN_STATE_RESOLVING
Definition: turn_session.h:172
@ PJ_TURN_STATE_DEALLOCATED
Definition: turn_session.h:202
@ PJ_TURN_STATE_ALLOCATING
Definition: turn_session.h:184
@ PJ_TURN_STATE_READY
Definition: turn_session.h:190
@ PJ_TURN_STATE_DEALLOCATING
Definition: turn_session.h:196
@ PJ_TURN_STATE_DESTROYING
Definition: turn_session.h:207
@ PJ_TURN_STATE_RESOLVED
Definition: turn_session.h:178
unsigned char pj_uint8_t
unsigned short pj_uint16_t
size_t pj_size_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
Definition: stun_auth.h:114
Definition: stun_config.h:48
Definition: turn_session.h:389
pj_turn_tp_type peer_conn_type
Definition: turn_session.h:426
int ka_interval
Definition: turn_session.h:409
int bandwidth
Definition: turn_session.h:396
int af
Definition: turn_session.h:418
int lifetime
Definition: turn_session.h:402
Definition: turn_session.h:219
pj_uint16_t length
Definition: turn_session.h:221
pj_uint16_t ch_number
Definition: turn_session.h:220
Definition: turn_session.h:232
void(* on_connection_bind_status)(pj_turn_session *sess, pj_status_t status, pj_uint32_t conn_id, const pj_sockaddr_t *peer_addr, unsigned addr_len)
Definition: turn_session.h:357
pj_status_t(* on_stun_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:272
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:250
void(* on_connect_complete)(pj_turn_session *sess, pj_status_t status, pj_uint32_t conn_id, const pj_sockaddr_t *peer_addr, unsigned addr_len)
Definition: turn_session.h:373
void(* on_channel_bound)(pj_turn_session *sess, const pj_sockaddr_t *peer_addr, unsigned addr_len, unsigned ch_num)
Definition: turn_session.h:290
void(* on_connection_attempt)(pj_turn_session *sess, pj_uint32_t conn_id, const pj_sockaddr_t *peer_addr, unsigned addr_len)
Definition: turn_session.h:342
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:307
void(* on_state)(pj_turn_session *sess, pj_turn_state_t old_state, pj_turn_state_t new_state)
Definition: turn_session.h:322
Definition: turn_session.h:435
int lifetime
Definition: turn_session.h:469
pj_sockaddr server
Definition: turn_session.h:454
pj_sockaddr mapped_addr
Definition: turn_session.h:459
pj_turn_tp_type conn_type
Definition: turn_session.h:449
pj_sockaddr relay_addr
Definition: turn_session.h:464
pj_status_t last_status
Definition: turn_session.h:444
pj_turn_state_t state
Definition: turn_session.h:439
Definition: turn_session.h:478
const pj_sockaddr_t * src_addr
Definition: turn_session.h:498
void * pkt
Definition: turn_session.h:483
pj_size_t pkt_len
Definition: turn_session.h:488
unsigned src_addr_len
Definition: turn_session.h:503
pj_size_t parsed_len
Definition: turn_session.h:493
STUN session management for client/server.

 


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