Home --> Documentations --> PJNATH Reference

ice_strans.h
Go to the documentation of this file.
1 /* $Id: ice_strans.h 5339 2016-06-08 03:17:45Z 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_ICE_STRANS_H__
21 #define __PJNATH_ICE_STRANS_H__
22 
23 
28 #include <pjnath/ice_session.h>
29 #include <pjnath/stun_sock.h>
30 #include <pjnath/turn_sock.h>
31 #include <pjlib-util/resolver.h>
32 #include <pj/ioqueue.h>
33 #include <pj/timer.h>
34 
35 
37 
38 
118 
120 typedef enum pj_ice_strans_op
121 {
124 
127 
132 
136 
138 
143 typedef struct pj_ice_strans_cb
144 {
157  void (*on_rx_data)(pj_ice_strans *ice_st,
158  unsigned comp_id,
159  void *pkt, pj_size_t size,
160  const pj_sockaddr_t *src_addr,
161  unsigned src_addr_len);
162 
170  void (*on_ice_complete)(pj_ice_strans *ice_st,
171  pj_ice_strans_op op,
172  pj_status_t status);
173 
175 
176 
181 {
187  int af;
188 
194 
201  unsigned max_host_cands;
202 
209 
235 
247 
255 
257 
258 
263 {
269  int af;
270 
277 
296 
308 
315 
323 
329 
331 
332 
338 typedef struct pj_ice_strans_cfg
339 {
345  int af;
346 
356 
364 
371 
381 
387  unsigned stun_tp_cnt;
388 
394 
403 
409  unsigned turn_tp_cnt;
410 
415 
422  struct {
432 
441 
457  unsigned so_rcvbuf_size;
458 
474  unsigned so_sndbuf_size;
475 
477 
479 
480 
485 {
490 
495 
501 
506 
511 
517 
522 
524 
525 
531 PJ_DECL(void) pj_ice_strans_cfg_default(pj_ice_strans_cfg *cfg);
532 
533 
540 
541 
548 
549 
557 PJ_DECL(void) pj_ice_strans_cfg_copy(pj_pool_t *pool,
558  pj_ice_strans_cfg *dst,
559  const pj_ice_strans_cfg *src);
560 
561 
578 PJ_DECL(pj_status_t) pj_ice_strans_create(const char *name,
579  const pj_ice_strans_cfg *cfg,
580  unsigned comp_cnt,
581  void *user_data,
582  const pj_ice_strans_cb *cb,
583  pj_ice_strans **p_ice_st);
584 
593 
594 
602 PJ_DECL(const char*) pj_ice_strans_state_name(pj_ice_strans_state state);
603 
604 
615 
616 
624 PJ_DECL(void*) pj_ice_strans_get_user_data(pj_ice_strans *ice_st);
625 
626 
637  pj_ice_sess_options *opt);
638 
650  const pj_ice_sess_options *opt);
651 
660 
679  pj_ice_sess_role role,
680  const pj_str_t *local_ufrag,
681  const pj_str_t *local_passwd);
682 
693 
694 
704 
705 
715 
716 
728 PJ_DECL(unsigned) pj_ice_strans_get_running_comp_cnt(pj_ice_strans *ice_st);
729 
730 
758  pj_str_t *loc_ufrag,
759  pj_str_t *loc_pwd,
760  pj_str_t *rem_ufrag,
761  pj_str_t *rem_pwd);
762 
763 
772 PJ_DECL(unsigned) pj_ice_strans_get_cands_count(pj_ice_strans *ice_st,
773  unsigned comp_id);
774 
789  unsigned comp_id,
790  unsigned *count,
791  pj_ice_sess_cand cand[]);
792 
806  unsigned comp_id,
807  pj_ice_sess_cand *cand);
808 
818 
819 
833  pj_ice_sess_role new_role);
834 
835 
859  const pj_str_t *rem_ufrag,
860  const pj_str_t *rem_passwd,
861  unsigned rcand_cnt,
862  const pj_ice_sess_cand rcand[]);
863 
875 PJ_DECL(const pj_ice_sess_check*)
877  unsigned comp_id);
878 
902 
903 
926  unsigned comp_id,
927  const void *data,
928  pj_size_t data_len,
929  const pj_sockaddr_t *dst_addr,
930  int dst_addr_len);
931 
932 
938 PJ_END_DECL
939 
940 
941 
942 #endif /* __PJNATH_ICE_STRANS_H__ */
943 
pj_dns_resolver * resolver
Definition: ice_strans.h:363
void pj_ice_strans_cfg_default(pj_ice_strans_cfg *cfg)
pj_ice_strans_stun_cfg stun
Definition: ice_strans.h:380
pj_bool_t loop_addr
Definition: ice_strans.h:208
pj_ice_sess_role
Definition: ice_session.h:521
pj_status_t pj_ice_strans_change_role(pj_ice_strans *ice_st, pj_ice_sess_role new_role)
pj_status_t pj_ice_strans_get_def_cand(pj_ice_strans *ice_st, unsigned comp_id, pj_ice_sess_cand *cand)
struct pj_dns_resolver pj_dns_resolver
unsigned turn_tp_cnt
Definition: ice_strans.h:409
int pj_bool_t
int af
Definition: ice_strans.h:187
Definition: ice_strans.h:494
Definition: stun_auth.h:114
int af
Definition: ice_strans.h:345
Definition: ice_strans.h:500
void pj_ice_strans_turn_cfg_default(pj_ice_strans_turn_cfg *cfg)
void * user_data
TURN relay using UDP client as transport protocol.
pj_status_t pj_ice_strans_sendto(pj_ice_strans *ice_st, unsigned comp_id, const void *data, pj_size_t data_len, const pj_sockaddr_t *dst_addr, int dst_addr_len)
Definition: ice_session.h:572
pj_stun_auth_cred auth_cred
Definition: ice_strans.h:322
Definition: stun_sock.h:219
unsigned max_host_cands
Definition: ice_strans.h:201
const pj_ice_sess_check * pj_ice_strans_get_valid_pair(const pj_ice_strans *ice_st, unsigned comp_id)
Definition: ice_strans.h:180
Definition: ice_session.h:238
pj_status_t pj_ice_strans_stop_ice(pj_ice_strans *ice_st)
int af
Definition: ice_strans.h:269
Definition: ice_strans.h:143
pj_stun_config stun_cfg
Definition: ice_strans.h:355
Definition: ice_strans.h:510
unsigned stun_tp_cnt
Definition: ice_strans.h:387
pj_turn_tp_type
Definition: turn_session.h:139
pj_status_t pj_ice_strans_enum_cands(pj_ice_strans *ice_st, unsigned comp_id, unsigned *count, pj_ice_sess_cand cand[])
Definition: ice_strans.h:123
pj_str_t server
Definition: ice_strans.h:295
pj_ice_strans_turn_cfg turn
Definition: ice_strans.h:402
pj_status_t pj_ice_strans_start_ice(pj_ice_strans *ice_st, const pj_str_t *rem_ufrag, const pj_str_t *rem_passwd, unsigned rcand_cnt, const pj_ice_sess_cand rcand[])
#define PJ_ICE_MAX_TURN
Definition: config.h:266
Definition: turn_session.h:310
unsigned so_rcvbuf_size
Definition: ice_strans.h:457
int pj_status_t
pj_grp_lock_t * pj_ice_strans_get_grp_lock(pj_ice_strans *ice_st)
pj_status_t pj_ice_strans_destroy(pj_ice_strans *ice_st)
pj_ice_strans_state pj_ice_strans_get_state(pj_ice_strans *ice_st)
Definition: ice_strans.h:521
Definition: ice_strans.h:126
Definition: stun_config.h:48
void pj_sockaddr_t
pj_status_t pj_ice_strans_get_options(pj_ice_strans *ice_st, pj_ice_sess_options *opt)
pj_stun_sock_cfg cfg
Definition: ice_strans.h:193
struct pj_grp_lock_t pj_grp_lock_t
pj_bool_t pj_ice_strans_sess_is_complete(pj_ice_strans *ice_st)
Definition: ice_strans.h:135
pj_status_t pj_ice_strans_set_options(pj_ice_strans *ice_st, const pj_ice_sess_options *opt)
unsigned pj_ice_strans_get_cands_count(pj_ice_strans *ice_st, unsigned comp_id)
pj_status_t pj_ice_strans_init_ice(pj_ice_strans *ice_st, pj_ice_sess_role role, const pj_str_t *local_ufrag, const pj_str_t *local_passwd)
void(* on_ice_complete)(pj_ice_strans *ice_st, pj_ice_strans_op op, pj_status_t status)
Definition: ice_strans.h:170
Definition: turn_sock.h:109
pj_qos_params qos_params
Definition: ice_strans.h:440
pj_status_t pj_ice_strans_create(const char *name, const pj_ice_strans_cfg *cfg, unsigned comp_cnt, void *user_data, const pj_ice_strans_cb *cb, pj_ice_strans **p_ice_st)
void * pj_ice_strans_get_user_data(pj_ice_strans *ice_st)
pj_bool_t ignore_stun_error
Definition: ice_strans.h:254
struct pj_ice_strans pj_ice_strans
Definition: ice_strans.h:117
#define PJ_ICE_MAX_STUN
Definition: config.h:255
Definition: ice_strans.h:516
unsigned so_sndbuf_size
Definition: ice_strans.h:474
void(* on_rx_data)(pj_ice_strans *ice_st, unsigned comp_id, void *pkt, pj_size_t size, const pj_sockaddr_t *src_addr, unsigned src_addr_len)
Definition: ice_strans.h:157
Definition: ice_strans.h:505
pj_ice_strans_stun_cfg stun_tp[PJ_ICE_MAX_STUN]
Definition: ice_strans.h:393
ICE session management.
pj_qos_type qos_type
Definition: ice_strans.h:431
Definition: ice_session.h:365
#define PJ_BEGIN_DECL
pj_qos_type
struct pj_ice_strans_cfg::@1 comp[PJ_ICE_MAX_COMP]
Definition: ice_strans.h:262
pj_turn_sock_cfg cfg
Definition: ice_strans.h:276
pj_ice_strans_turn_cfg turn_tp[PJ_ICE_MAX_TURN]
Definition: ice_strans.h:414
unsigned pj_ice_strans_get_running_comp_cnt(pj_ice_strans *ice_st)
pj_ice_strans_op
Definition: ice_strans.h:120
pj_str_t server
Definition: ice_strans.h:234
pj_ice_strans_state
Definition: ice_strans.h:484
pj_bool_t pj_ice_strans_sess_is_running(pj_ice_strans *ice_st)
pj_status_t pj_ice_strans_get_ufrag_pwd(pj_ice_strans *ice_st, pj_str_t *loc_ufrag, pj_str_t *loc_pwd, pj_str_t *rem_ufrag, pj_str_t *rem_pwd)
pj_uint16_t port
Definition: ice_strans.h:307
const char * pj_ice_strans_state_name(pj_ice_strans_state state)
pj_ice_sess_options opt
Definition: ice_strans.h:370
STUN aware socket transport.
Definition: ice_strans.h:489
pj_ice_sess_role pj_ice_strans_get_role(pj_ice_strans *ice_st)
pj_turn_alloc_param alloc_param
Definition: ice_strans.h:328
pj_bool_t pj_ice_strans_has_sess(pj_ice_strans *ice_st)
#define PJ_ICE_MAX_COMP
Definition: config.h:282
pj_uint16_t port
Definition: ice_strans.h:246
void pj_ice_strans_cfg_copy(pj_pool_t *pool, pj_ice_strans_cfg *dst, const pj_ice_strans_cfg *src)
unsigned short pj_uint16_t
void pj_ice_strans_stun_cfg_default(pj_ice_strans_stun_cfg *cfg)
size_t pj_size_t
Definition: ice_strans.h:338
Definition: ice_strans.h:131
pj_turn_tp_type conn_type
Definition: ice_strans.h:314

 


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