BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJNATH Reference

ice_strans.h
Go to the documentation of this file.
1 /* $Id: ice_strans.h 5562 2017-03-03 02:11:02Z 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_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 {
348  int af;
349 
359 
367 
374 
384 
390  unsigned stun_tp_cnt;
391 
397 
406 
412  unsigned turn_tp_cnt;
413 
418 
425  struct {
435 
444 
460  unsigned so_rcvbuf_size;
461 
477  unsigned so_sndbuf_size;
478 
479  } comp[PJ_ICE_MAX_COMP];
480 
482 
483 
488 {
493 
498 
504 
509 
514 
520 
525 
527 
528 
534 PJ_DECL(void) pj_ice_strans_cfg_default(pj_ice_strans_cfg *cfg);
535 
536 
543 
544 
551 
552 
560 PJ_DECL(void) pj_ice_strans_cfg_copy(pj_pool_t *pool,
561  pj_ice_strans_cfg *dst,
562  const pj_ice_strans_cfg *src);
563 
564 
581 PJ_DECL(pj_status_t) pj_ice_strans_create(const char *name,
582  const pj_ice_strans_cfg *cfg,
583  unsigned comp_cnt,
584  void *user_data,
585  const pj_ice_strans_cb *cb,
586  pj_ice_strans **p_ice_st);
587 
596 
597 
605 PJ_DECL(const char*) pj_ice_strans_state_name(pj_ice_strans_state state);
606 
607 
618 
619 
627 PJ_DECL(void*) pj_ice_strans_get_user_data(pj_ice_strans *ice_st);
628 
629 
640  pj_ice_sess_options *opt);
641 
653  const pj_ice_sess_options *opt);
654 
663 
682  pj_ice_sess_role role,
683  const pj_str_t *local_ufrag,
684  const pj_str_t *local_passwd);
685 
696 
697 
707 
708 
718 
719 
731 PJ_DECL(unsigned) pj_ice_strans_get_running_comp_cnt(pj_ice_strans *ice_st);
732 
733 
761  pj_str_t *loc_ufrag,
762  pj_str_t *loc_pwd,
763  pj_str_t *rem_ufrag,
764  pj_str_t *rem_pwd);
765 
766 
775 PJ_DECL(unsigned) pj_ice_strans_get_cands_count(pj_ice_strans *ice_st,
776  unsigned comp_id);
777 
792  unsigned comp_id,
793  unsigned *count,
794  pj_ice_sess_cand cand[]);
795 
809  unsigned comp_id,
810  pj_ice_sess_cand *cand);
811 
821 
822 
836  pj_ice_sess_role new_role);
837 
838 
862  const pj_str_t *rem_ufrag,
863  const pj_str_t *rem_passwd,
864  unsigned rcand_cnt,
865  const pj_ice_sess_cand rcand[]);
866 
878 PJ_DECL(const pj_ice_sess_check*)
880  unsigned comp_id);
881 
905 
906 
929  unsigned comp_id,
930  const void *data,
931  pj_size_t data_len,
932  const pj_sockaddr_t *dst_addr,
933  int dst_addr_len);
934 
935 
942 
943 
944 
945 #endif /* __PJNATH_ICE_STRANS_H__ */
946 
pj_dns_resolver * resolver
Definition: ice_strans.h:366
void pj_ice_strans_cfg_default(pj_ice_strans_cfg *cfg)
pj_ice_strans_stun_cfg stun
Definition: ice_strans.h:383
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:412
int pj_bool_t
int af
Definition: ice_strans.h:187
Definition: ice_strans.h:497
Definition: stun_auth.h:114
int af
Definition: ice_strans.h:348
Definition: ice_strans.h:503
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
void(* on_ice_complete)(pj_ice_strans *ice_st, pj_ice_strans_op op, pj_status_t status)
Definition: ice_strans.h:170
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:358
Definition: ice_strans.h:513
unsigned stun_tp_cnt
Definition: ice_strans.h:390
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:405
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:460
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:524
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)
Definition: turn_sock.h:109
pj_qos_params qos_params
Definition: ice_strans.h:443
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)
#define PJ_END_DECL
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:519
unsigned so_sndbuf_size
Definition: ice_strans.h:477
Definition: ice_strans.h:508
ICE session management.
pj_qos_type qos_type
Definition: ice_strans.h:434
Definition: ice_session.h:365
#define PJ_BEGIN_DECL
pj_qos_type
Definition: ice_strans.h:262
pj_turn_sock_cfg cfg
Definition: ice_strans.h:276
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:487
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:373
STUN aware socket transport.
Definition: ice_strans.h:492
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
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.