Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __PJNATH_TURN_SOCK_H__
00021 #define __PJNATH_TURN_SOCK_H__
00022
00027 #include <pjnath/turn_session.h>
00028 #include <pj/sock_qos.h>
00029
00030
00031 PJ_BEGIN_DECL
00032
00033
00034
00062 typedef struct pj_turn_sock pj_turn_sock;
00063
00068 typedef struct pj_turn_sock_cb
00069 {
00083 void (*on_rx_data)(pj_turn_sock *turn_sock,
00084 void *pkt,
00085 unsigned pkt_len,
00086 const pj_sockaddr_t *peer_addr,
00087 unsigned addr_len);
00088
00097 void (*on_state)(pj_turn_sock *turn_sock,
00098 pj_turn_state_t old_state,
00099 pj_turn_state_t new_state);
00100
00101 } pj_turn_sock_cb;
00102
00103
00109 typedef struct pj_turn_sock_cfg
00110 {
00118 pj_qos_type qos_type;
00119
00127 pj_qos_params qos_params;
00128
00135 pj_bool_t qos_ignore_error;
00136
00137 } pj_turn_sock_cfg;
00138
00139
00143 PJ_DECL(void) pj_turn_sock_cfg_default(pj_turn_sock_cfg *cfg);
00144
00145
00171 PJ_DECL(pj_status_t) pj_turn_sock_create(pj_stun_config *cfg,
00172 int af,
00173 pj_turn_tp_type conn_type,
00174 const pj_turn_sock_cb *cb,
00175 const pj_turn_sock_cfg *setting,
00176 void *user_data,
00177 pj_turn_sock **p_turn_sock);
00178
00188 PJ_DECL(void) pj_turn_sock_destroy(pj_turn_sock *turn_sock);
00189
00190
00201 PJ_DECL(pj_status_t) pj_turn_sock_set_user_data(pj_turn_sock *turn_sock,
00202 void *user_data);
00203
00212 PJ_DECL(void*) pj_turn_sock_get_user_data(pj_turn_sock *turn_sock);
00213
00214
00225 PJ_DECL(pj_status_t) pj_turn_sock_get_info(pj_turn_sock *turn_sock,
00226 pj_turn_session_info *info);
00227
00238 PJ_DECL(pj_status_t) pj_turn_sock_lock(pj_turn_sock *turn_sock);
00239
00240
00249 PJ_DECL(pj_status_t) pj_turn_sock_unlock(pj_turn_sock *turn_sock);
00250
00251
00259 PJ_DECL(void) pj_turn_sock_set_log(pj_turn_sock *turn_sock,
00260 unsigned flags);
00261
00273 PJ_DECL(pj_status_t) pj_turn_sock_set_software_name(pj_turn_sock *turn_sock,
00274 const pj_str_t *sw);
00275
00276
00312 PJ_DECL(pj_status_t) pj_turn_sock_alloc(pj_turn_sock *turn_sock,
00313 const pj_str_t *domain,
00314 int default_port,
00315 pj_dns_resolver *resolver,
00316 const pj_stun_auth_cred *cred,
00317 const pj_turn_alloc_param *param);
00318
00337 PJ_DECL(pj_status_t) pj_turn_sock_set_perm(pj_turn_sock *turn_sock,
00338 unsigned addr_cnt,
00339 const pj_sockaddr addr[],
00340 unsigned options);
00341
00361 PJ_DECL(pj_status_t) pj_turn_sock_sendto(pj_turn_sock *turn_sock,
00362 const pj_uint8_t *pkt,
00363 unsigned pkt_len,
00364 const pj_sockaddr_t *peer_addr,
00365 unsigned addr_len);
00366
00383 PJ_DECL(pj_status_t) pj_turn_sock_bind_channel(pj_turn_sock *turn_sock,
00384 const pj_sockaddr_t *peer,
00385 unsigned addr_len);
00386
00387
00393 PJ_END_DECL
00394
00395
00396 #endif
00397