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

ice_strans.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_ICE_STRANS_H__
20#define __PJNATH_ICE_STRANS_H__
21
22
27#include <pjnath/ice_session.h>
28#include <pjnath/stun_sock.h>
29#include <pjnath/turn_sock.h>
30#include <pjlib-util/resolver.h>
31#include <pj/ioqueue.h>
32#include <pj/timer.h>
33
34
36
37
119#ifndef DEPRECATED_FOR_TICKET_2229
120# define DEPRECATED_FOR_TICKET_2229 0
121#endif
122
125
128{
131
134
139
143
145
150typedef struct pj_ice_strans_cb
151{
164 void (*on_rx_data)(pj_ice_strans *ice_st,
165 unsigned comp_id,
166 void *pkt, pj_size_t size,
167 const pj_sockaddr_t *src_addr,
168 unsigned src_addr_len);
169
181 pj_ssize_t sent);
182
189 void (*on_valid_pair)(pj_ice_strans *ice_st);
190
200 pj_status_t status);
201
218 const pj_ice_sess_cand *cand,
219 pj_bool_t end_of_cand);
220
222
223
228{
234 int af;
235
241
249
256
282
294
302
304
305
310{
316 int af;
317
324
343
355
362
370
376
378
379
385typedef struct pj_ice_strans_cfg
386{
395 int af;
396
406
414
421
431
437 unsigned stun_tp_cnt;
438
444
453
459 unsigned turn_tp_cnt;
460
465
477 unsigned num_send_buf;
478
485
492 struct {
502
511
528
545
547
549
550
555{
560
565
571
576
581
587
592
594
595
602
603
610
611
618
619
629 const pj_ice_strans_cfg *src);
630
631
648PJ_DECL(pj_status_t) pj_ice_strans_create(const char *name,
649 const pj_ice_strans_cfg *cfg,
650 unsigned comp_cnt,
651 void *user_data,
652 const pj_ice_strans_cb *cb,
653 pj_ice_strans **p_ice_st);
654
663
664
673
674
685
686
695
696
708
720 const pj_ice_sess_options *opt);
721
733 unsigned comp_cnt);
734
743
762 pj_ice_sess_role role,
763 const pj_str_t *local_ufrag,
764 const pj_str_t *local_passwd);
765
776
777
787
788
798
799
812
813
841 pj_str_t *loc_ufrag,
842 pj_str_t *loc_pwd,
843 pj_str_t *rem_ufrag,
844 pj_str_t *rem_pwd);
845
846
856 unsigned comp_id);
857
872 unsigned comp_id,
873 unsigned *count,
874 pj_ice_sess_cand cand[]);
875
889 unsigned comp_id,
890 pj_ice_sess_cand *cand);
891
901
902
916 pj_ice_sess_role new_role);
917
918
942 const pj_str_t *rem_ufrag,
943 const pj_str_t *rem_passwd,
944 unsigned rcand_cnt,
945 const pj_ice_sess_cand rcand[]);
946
947
970 pj_ice_strans *ice_st,
971 const pj_str_t *rem_ufrag,
972 const pj_str_t *rem_passwd,
973 unsigned rcand_cnt,
974 const pj_ice_sess_cand rcand[],
975 pj_bool_t rcand_end);
976
988PJ_DECL(const pj_ice_sess_check*)
990 unsigned comp_id);
991
1015
1016
1017#if !DEPRECATED_FOR_TICKET_2229
1054 unsigned comp_id,
1055 const void *data,
1056 pj_size_t data_len,
1057 const pj_sockaddr_t *dst_addr,
1058 int dst_addr_len);
1059#endif
1060
1061
1095 unsigned comp_id,
1096 const void *data,
1097 pj_size_t data_len,
1098 const pj_sockaddr_t *dst_addr,
1099 int dst_addr_len);
1100
1101
1108
1109
1110
1111#endif /* __PJNATH_ICE_STRANS_H__ */
1112
#define PJ_ICE_MAX_TURN
Definition: config.h:272
#define PJ_ICE_MAX_STUN
Definition: config.h:261
#define PJ_ICE_MAX_COMP
Definition: config.h:288
pj_ice_sess_role
Definition: ice_session.h:553
void pj_ice_strans_cfg_copy(pj_pool_t *pool, pj_ice_strans_cfg *dst, const pj_ice_strans_cfg *src)
pj_status_t pj_ice_strans_set_options(pj_ice_strans *ice_st, const pj_ice_sess_options *opt)
pj_status_t pj_ice_strans_update_check_list(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[], pj_bool_t rcand_end)
pj_bool_t pj_ice_strans_sess_is_complete(pj_ice_strans *ice_st)
pj_status_t pj_ice_strans_destroy(pj_ice_strans *ice_st)
pj_bool_t pj_ice_strans_sess_is_running(pj_ice_strans *ice_st)
pj_status_t pj_ice_strans_change_role(pj_ice_strans *ice_st, pj_ice_sess_role new_role)
pj_grp_lock_t * pj_ice_strans_get_grp_lock(pj_ice_strans *ice_st)
pj_status_t pj_ice_strans_sendto2(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)
void pj_ice_strans_turn_cfg_default(pj_ice_strans_turn_cfg *cfg)
pj_ice_sess_role pj_ice_strans_get_role(pj_ice_strans *ice_st)
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[])
pj_bool_t pj_ice_strans_has_sess(pj_ice_strans *ice_st)
pj_status_t pj_ice_strans_enum_cands(pj_ice_strans *ice_st, unsigned comp_id, unsigned *count, pj_ice_sess_cand cand[])
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)
pj_ice_strans_state pj_ice_strans_get_state(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)
unsigned pj_ice_strans_get_running_comp_cnt(pj_ice_strans *ice_st)
pj_ice_strans_op
Definition: ice_strans.h:128
unsigned pj_ice_strans_get_cands_count(pj_ice_strans *ice_st, unsigned comp_id)
const pj_ice_sess_check * pj_ice_strans_get_valid_pair(const pj_ice_strans *ice_st, unsigned comp_id)
void pj_ice_strans_stun_cfg_default(pj_ice_strans_stun_cfg *cfg)
pj_ice_strans_state
Definition: ice_strans.h:555
void pj_ice_strans_cfg_default(pj_ice_strans_cfg *cfg)
struct pj_ice_strans pj_ice_strans
Definition: ice_strans.h:124
pj_status_t pj_ice_strans_stop_ice(pj_ice_strans *ice_st)
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 * pj_ice_strans_get_user_data(pj_ice_strans *ice_st)
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)
const char * pj_ice_strans_state_name(pj_ice_strans_state state)
pj_status_t pj_ice_strans_get_options(pj_ice_strans *ice_st, pj_ice_sess_options *opt)
pj_status_t pj_ice_strans_get_def_cand(pj_ice_strans *ice_st, unsigned comp_id, pj_ice_sess_cand *cand)
pj_status_t pj_ice_strans_update_comp_cnt(pj_ice_strans *ice_st, unsigned comp_cnt)
@ PJ_ICE_STRANS_OP_INIT
Definition: ice_strans.h:130
@ PJ_ICE_STRANS_OP_NEGOTIATION
Definition: ice_strans.h:133
@ PJ_ICE_STRANS_OP_KEEP_ALIVE
Definition: ice_strans.h:138
@ PJ_ICE_STRANS_OP_ADDR_CHANGE
Definition: ice_strans.h:142
@ PJ_ICE_STRANS_STATE_FAILED
Definition: ice_strans.h:591
@ PJ_ICE_STRANS_STATE_RUNNING
Definition: ice_strans.h:586
@ PJ_ICE_STRANS_STATE_INIT
Definition: ice_strans.h:564
@ PJ_ICE_STRANS_STATE_SESS_READY
Definition: ice_strans.h:575
@ PJ_ICE_STRANS_STATE_READY
Definition: ice_strans.h:570
@ PJ_ICE_STRANS_STATE_NEGO
Definition: ice_strans.h:580
@ PJ_ICE_STRANS_STATE_NULL
Definition: ice_strans.h:559
pj_turn_tp_type
Definition: turn_session.h:139
long pj_ssize_t
int pj_bool_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
struct pj_dns_resolver pj_dns_resolver
#define PJ_BEGIN_DECL
#define PJ_END_DECL
pj_qos_type
ICE session management.
Definition: ice_session.h:242
Definition: ice_session.h:374
Definition: ice_session.h:637
Definition: ice_strans.h:151
void(* on_data_sent)(pj_ice_strans *sock, pj_ssize_t sent)
Definition: ice_strans.h:180
void(* on_valid_pair)(pj_ice_strans *ice_st)
Definition: ice_strans.h:189
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:164
void(* on_new_candidate)(pj_ice_strans *ice_st, const pj_ice_sess_cand *cand, pj_bool_t end_of_cand)
Definition: ice_strans.h:217
void(* on_ice_complete)(pj_ice_strans *ice_st, pj_ice_strans_op op, pj_status_t status)
Definition: ice_strans.h:198
Definition: ice_strans.h:386
pj_ice_strans_turn_cfg turn_tp[PJ_ICE_MAX_TURN]
Definition: ice_strans.h:464
pj_ice_strans_stun_cfg stun
Definition: ice_strans.h:430
unsigned num_send_buf
Definition: ice_strans.h:477
pj_dns_resolver * resolver
Definition: ice_strans.h:413
pj_qos_type qos_type
Definition: ice_strans.h:501
pj_qos_params qos_params
Definition: ice_strans.h:510
unsigned turn_tp_cnt
Definition: ice_strans.h:459
unsigned so_sndbuf_size
Definition: ice_strans.h:544
pj_ice_sess_options opt
Definition: ice_strans.h:420
unsigned stun_tp_cnt
Definition: ice_strans.h:437
pj_ice_strans_turn_cfg turn
Definition: ice_strans.h:452
int af
Definition: ice_strans.h:395
unsigned so_rcvbuf_size
Definition: ice_strans.h:527
unsigned send_buf_size
Definition: ice_strans.h:484
pj_stun_config stun_cfg
Definition: ice_strans.h:405
pj_ice_strans_stun_cfg stun_tp[PJ_ICE_MAX_STUN]
Definition: ice_strans.h:443
struct pj_ice_strans_cfg::@1 comp[PJ_ICE_MAX_COMP]
Definition: ice_strans.h:228
pj_bool_t ignore_stun_error
Definition: ice_strans.h:301
unsigned max_host_cands
Definition: ice_strans.h:248
pj_uint16_t port
Definition: ice_strans.h:293
pj_stun_sock_cfg cfg
Definition: ice_strans.h:240
pj_bool_t loop_addr
Definition: ice_strans.h:255
pj_str_t server
Definition: ice_strans.h:281
int af
Definition: ice_strans.h:234
Definition: ice_strans.h:310
pj_turn_tp_type conn_type
Definition: ice_strans.h:361
int af
Definition: ice_strans.h:316
pj_turn_sock_cfg cfg
Definition: ice_strans.h:323
pj_turn_alloc_param alloc_param
Definition: ice_strans.h:375
pj_uint16_t port
Definition: ice_strans.h:354
pj_str_t server
Definition: ice_strans.h:342
pj_stun_auth_cred auth_cred
Definition: ice_strans.h:369
Definition: stun_auth.h:114
Definition: stun_config.h:48
Definition: stun_sock.h:219
Definition: turn_session.h:389
Definition: turn_sock.h:277
STUN aware socket transport.
TURN relay using UDP client as transport protocol.

 


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