Home --> Documentations --> PJNATH Reference

stun_sock.h
Go to the documentation of this file.
1 /* $Id: stun_sock.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_STUN_SOCK_H__
21 #define __PJNATH_STUN_SOCK_H__
22 
27 #include <pjnath/stun_config.h>
28 #include <pjlib-util/resolver.h>
29 #include <pj/ioqueue.h>
30 #include <pj/lock.h>
31 #include <pj/sock.h>
32 #include <pj/sock_qos.h>
33 
34 
36 
37 
62 typedef struct pj_stun_sock pj_stun_sock;
63 
69 typedef enum pj_stun_sock_op
70 {
75 
80 
86 
91 
92 
94 
95 
100 typedef struct pj_stun_sock_cb
101 {
117  void *pkt,
118  unsigned pkt_len,
119  const pj_sockaddr_t *src_addr,
120  unsigned addr_len);
121 
140  pj_ssize_t sent);
141 
171  pj_stun_sock_op op,
172  pj_status_t status);
173 
175 
176 
181 typedef struct pj_stun_sock_info
182 {
187 
192 
199 
204  unsigned alias_cnt;
205 
210 
212 
213 
219 typedef struct pj_stun_sock_cfg
220 {
228 
234  unsigned max_pkt_size;
235 
243  unsigned async_cnt;
244 
254 
263 
271 
280 
289 
297 
306  unsigned so_rcvbuf_size;
307 
316  unsigned so_sndbuf_size;
317 
319 
320 
321 
325 PJ_DECL(const char*) pj_stun_sock_op_name(pj_stun_sock_op op);
326 
327 
333 PJ_DECL(void) pj_stun_sock_cfg_default(pj_stun_sock_cfg *cfg);
334 
335 
358  const char *name,
359  int af,
360  const pj_stun_sock_cb *cb,
361  const pj_stun_sock_cfg *cfg,
362  void *user_data,
363  pj_stun_sock **p_sock);
364 
365 
396 PJ_DECL(pj_status_t) pj_stun_sock_start(pj_stun_sock *stun_sock,
397  const pj_str_t *domain,
398  pj_uint16_t default_port,
399  pj_dns_resolver *resolver);
400 
410 
411 
423  void *user_data);
424 
433 PJ_DECL(void*) pj_stun_sock_get_user_data(pj_stun_sock *stun_sock);
434 
435 
444 
445 
458 
459 
480 PJ_DECL(pj_status_t) pj_stun_sock_sendto(pj_stun_sock *stun_sock,
482  const void *pkt,
483  unsigned pkt_len,
484  unsigned flag,
485  const pj_sockaddr_t *dst_addr,
486  unsigned addr_len);
487 
493 PJ_END_DECL
494 
495 
496 #endif /* __PJNATH_STUN_SOCK_H__ */
497 
void pj_stun_sock_cfg_default(pj_stun_sock_cfg *cfg)
#define PJ_ICE_ST_MAX_CAND
Definition: config.h:244
Definition: stun_sock.h:79
struct pj_dns_resolver pj_dns_resolver
int pj_bool_t
void * user_data
Definition: stun_sock.h:219
Definition: stun_sock.h:90
pj_sockaddr bound_addr
Definition: stun_sock.h:186
pj_status_t pj_stun_sock_create(pj_stun_config *stun_cfg, const char *name, int af, const pj_stun_sock_cb *cb, const pj_stun_sock_cfg *cfg, void *user_data, pj_stun_sock **p_sock)
pj_status_t pj_stun_sock_destroy(pj_stun_sock *sock)
pj_status_t pj_stun_sock_start(pj_stun_sock *stun_sock, const pj_str_t *domain, pj_uint16_t default_port, pj_dns_resolver *resolver)
pj_status_t pj_stun_sock_set_user_data(pj_stun_sock *stun_sock, void *user_data)
int ka_interval
Definition: stun_sock.h:270
int pj_status_t
pj_bool_t(* on_data_sent)(pj_stun_sock *stun_sock, pj_ioqueue_op_key_t *send_key, pj_ssize_t sent)
Definition: stun_sock.h:138
unsigned max_pkt_size
Definition: stun_sock.h:234
Definition: stun_sock.h:74
Definition: stun_sock.h:100
Definition: stun_config.h:48
void pj_sockaddr_t
pj_sockaddr aliases[PJ_ICE_ST_MAX_CAND]
Definition: stun_sock.h:209
pj_bool_t(* on_status)(pj_stun_sock *stun_sock, pj_stun_sock_op op, pj_status_t status)
Definition: stun_sock.h:170
struct pj_grp_lock_t pj_grp_lock_t
pj_uint16_t port_range
Definition: stun_sock.h:262
pj_str_t info
pj_sockaddr srv_addr
Definition: stun_sock.h:191
unsigned so_sndbuf_size
Definition: stun_sock.h:316
pj_sockaddr bound_addr
Definition: stun_sock.h:253
#define PJ_BEGIN_DECL
pj_qos_type
const char * pj_stun_sock_op_name(pj_stun_sock_op op)
long pj_ssize_t
struct pj_stun_sock pj_stun_sock
Definition: stun_sock.h:62
pj_status_t pj_stun_sock_get_info(pj_stun_sock *stun_sock, pj_stun_sock_info *info)
unsigned alias_cnt
Definition: stun_sock.h:204
unsigned async_cnt
Definition: stun_sock.h:243
pj_grp_lock_t * grp_lock
Definition: stun_sock.h:227
pj_sockaddr mapped_addr
Definition: stun_sock.h:198
void * pj_stun_sock_get_user_data(pj_stun_sock *stun_sock)
pj_bool_t qos_ignore_error
Definition: stun_sock.h:296
STUN endpoint.
pj_stun_sock_op
Definition: stun_sock.h:69
Definition: stun_sock.h:181
pj_grp_lock_t * pj_stun_sock_get_grp_lock(pj_stun_sock *stun_sock)
pj_qos_type qos_type
Definition: stun_sock.h:279
unsigned short pj_uint16_t
pj_status_t pj_stun_sock_sendto(pj_stun_sock *stun_sock, pj_ioqueue_op_key_t *send_key, const void *pkt, unsigned pkt_len, unsigned flag, const pj_sockaddr_t *dst_addr, unsigned addr_len)
pj_bool_t(* on_rx_data)(pj_stun_sock *stun_sock, void *pkt, unsigned pkt_len, const pj_sockaddr_t *src_addr, unsigned addr_len)
Definition: stun_sock.h:116
unsigned so_rcvbuf_size
Definition: stun_sock.h:306
Definition: stun_sock.h:85
pj_qos_params qos_params
Definition: stun_sock.h:288

 


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