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

stun_session.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_STUN_SESSION_H__
20#define __PJNATH_STUN_SESSION_H__
21
27#include <pjnath/stun_msg.h>
28#include <pjnath/stun_auth.h>
29#include <pjnath/stun_config.h>
31#include <pj/list.h>
32#include <pj/lock.h>
33#include <pj/timer.h>
34
36
37
38/* **************************************************************************/
168typedef struct pj_stun_tx_data pj_stun_tx_data;
169
171typedef struct pj_stun_rx_data pj_stun_rx_data;
172
175
176
182typedef struct pj_stun_session_cb
183{
206 void *token,
207 const void *pkt,
208 pj_size_t pkt_size,
209 const pj_sockaddr_t *dst_addr,
210 unsigned addr_len);
211
236 const pj_uint8_t *pkt,
237 unsigned pkt_len,
238 const pj_stun_rx_data *rdata,
239 void *token,
240 const pj_sockaddr_t *src_addr,
241 unsigned src_addr_len);
242
274 pj_status_t status,
275 void *token,
276 pj_stun_tx_data *tdata,
277 const pj_stun_msg *response,
278 const pj_sockaddr_t *src_addr,
279 unsigned src_addr_len);
280
281
302 const pj_uint8_t *pkt,
303 unsigned pkt_len,
304 const pj_stun_msg *msg,
305 void *token,
306 const pj_sockaddr_t *src_addr,
307 unsigned src_addr_len);
308
310
311
316{
321
328};
329
330
336{
339
345 void *token;
356 void *pkt;
357 unsigned max_len;
360 unsigned addr_len;
364};
365
366
371{
380
381
397 const char *name,
398 const pj_stun_session_cb *cb,
399 pj_bool_t fingerprint,
400 pj_grp_lock_t *grp_lock,
401 pj_stun_session **p_sess);
402
416
427 void *user_data);
428
438
447
459 const pj_str_t *sw);
460
477 pj_stun_auth_type auth_type,
478 const pj_stun_auth_cred *cred);
486 unsigned flags);
498 pj_bool_t use);
499
516 int msg_type,
517 pj_uint32_t magic,
518 const pj_uint8_t tsx_id[12],
519 pj_stun_tx_data **p_tdata);
520
536 int msg_type,
537 pj_stun_tx_data **p_tdata);
538
561 const pj_stun_rx_data *rdata,
562 unsigned err_code,
563 const pj_str_t *err_msg,
564 pj_stun_tx_data **p_tdata);
565
603 void *token,
604 pj_bool_t cache_res,
605 pj_bool_t retransmit,
606 const pj_sockaddr_t *dst_addr,
607 unsigned addr_len,
608 pj_stun_tx_data *tdata);
609
646 const pj_stun_rx_data *rdata,
647 unsigned code,
648 const char *err_msg,
649 void *token,
650 pj_bool_t cache,
651 const pj_sockaddr_t *dst_addr,
652 unsigned addr_len);
653
673 pj_stun_tx_data *tdata,
674 pj_bool_t notify,
675 pj_status_t status);
676
693 pj_stun_tx_data *tdata,
694 pj_bool_t mod_count);
695
696
734 const void *packet,
735 pj_size_t pkt_size,
736 unsigned options,
737 void *token,
738 pj_size_t *parsed_len,
739 const pj_sockaddr_t *src_addr,
740 unsigned src_addr_len);
741
752 pj_stun_tx_data *tdata);
753
754
761
762#endif /* __PJNATH_STUN_SESSION_H__ */
763
pj_stun_auth_type
Definition: stun_auth.h:45
pj_status_t pj_stun_session_create_res(pj_stun_session *sess, const pj_stun_rx_data *rdata, unsigned err_code, const pj_str_t *err_msg, pj_stun_tx_data **p_tdata)
pj_bool_t pj_stun_session_use_fingerprint(pj_stun_session *sess, pj_bool_t use)
pj_status_t pj_stun_session_on_rx_pkt(pj_stun_session *sess, const void *packet, pj_size_t pkt_size, unsigned options, void *token, pj_size_t *parsed_len, const pj_sockaddr_t *src_addr, unsigned src_addr_len)
void * pj_stun_session_get_user_data(pj_stun_session *sess)
void pj_stun_msg_destroy_tdata(pj_stun_session *sess, pj_stun_tx_data *tdata)
pj_status_t pj_stun_session_create_req(pj_stun_session *sess, int msg_type, pj_uint32_t magic, const pj_uint8_t tsx_id[12], pj_stun_tx_data **p_tdata)
pj_status_t pj_stun_session_set_user_data(pj_stun_session *sess, void *user_data)
pj_stun_sess_msg_log_flag
Definition: stun_session.h:371
pj_status_t pj_stun_session_send_msg(pj_stun_session *sess, void *token, pj_bool_t cache_res, pj_bool_t retransmit, const pj_sockaddr_t *dst_addr, unsigned addr_len, pj_stun_tx_data *tdata)
void pj_stun_session_set_log(pj_stun_session *sess, unsigned flags)
pj_status_t pj_stun_session_create_ind(pj_stun_session *sess, int msg_type, pj_stun_tx_data **p_tdata)
pj_status_t pj_stun_session_cancel_req(pj_stun_session *sess, pj_stun_tx_data *tdata, pj_bool_t notify, pj_status_t status)
pj_status_t pj_stun_session_respond(pj_stun_session *sess, const pj_stun_rx_data *rdata, unsigned code, const char *err_msg, void *token, pj_bool_t cache, const pj_sockaddr_t *dst_addr, unsigned addr_len)
pj_status_t pj_stun_session_create(pj_stun_config *cfg, const char *name, const pj_stun_session_cb *cb, pj_bool_t fingerprint, pj_grp_lock_t *grp_lock, pj_stun_session **p_sess)
pj_status_t pj_stun_session_destroy(pj_stun_session *sess)
pj_status_t pj_stun_session_set_software_name(pj_stun_session *sess, const pj_str_t *sw)
struct pj_stun_session pj_stun_session
Definition: stun_session.h:174
pj_grp_lock_t * pj_stun_session_get_grp_lock(pj_stun_session *sess)
pj_status_t pj_stun_session_set_credential(pj_stun_session *sess, pj_stun_auth_type auth_type, const pj_stun_auth_cred *cred)
pj_status_t pj_stun_session_retransmit_req(pj_stun_session *sess, pj_stun_tx_data *tdata, pj_bool_t mod_count)
@ PJ_STUN_SESS_LOG_RX_IND
Definition: stun_session.h:378
@ PJ_STUN_SESS_LOG_TX_RES
Definition: stun_session.h:373
@ PJ_STUN_SESS_LOG_RX_REQ
Definition: stun_session.h:376
@ PJ_STUN_SESS_LOG_TX_IND
Definition: stun_session.h:374
@ PJ_STUN_SESS_LOG_TX_REQ
Definition: stun_session.h:372
@ PJ_STUN_SESS_LOG_RX_RES
Definition: stun_session.h:377
struct pj_stun_client_tsx pj_stun_client_tsx
Definition: stun_transaction.h:58
unsigned char pj_uint8_t
int pj_bool_t
size_t pj_size_t
void pj_sockaddr_t
int pj_status_t
struct pj_grp_lock_t pj_grp_lock_t
unsigned int pj_uint32_t
#define PJ_BEGIN_DECL
#define PJ_END_DECL
Definition: stun_auth.h:114
Definition: stun_config.h:48
Definition: stun_msg.h:1172
Definition: stun_auth.h:299
Definition: stun_session.h:316
pj_stun_req_cred_info info
Definition: stun_session.h:327
pj_stun_msg * msg
Definition: stun_session.h:320
Definition: stun_session.h:183
pj_status_t(* on_send_msg)(pj_stun_session *sess, void *token, const void *pkt, pj_size_t pkt_size, const pj_sockaddr_t *dst_addr, unsigned addr_len)
Definition: stun_session.h:205
pj_status_t(* on_rx_request)(pj_stun_session *sess, const pj_uint8_t *pkt, unsigned pkt_len, const pj_stun_rx_data *rdata, void *token, const pj_sockaddr_t *src_addr, unsigned src_addr_len)
Definition: stun_session.h:235
void(* on_request_complete)(pj_stun_session *sess, pj_status_t status, void *token, pj_stun_tx_data *tdata, const pj_stun_msg *response, const pj_sockaddr_t *src_addr, unsigned src_addr_len)
Definition: stun_session.h:273
pj_status_t(* on_rx_indication)(pj_stun_session *sess, const pj_uint8_t *pkt, unsigned pkt_len, const pj_stun_msg *msg, void *token, const pj_sockaddr_t *src_addr, unsigned src_addr_len)
Definition: stun_session.h:301
Definition: stun_session.h:336
pj_uint8_t msg_key[12]
Definition: stun_session.h:350
void * token
Definition: stun_session.h:345
pj_stun_req_cred_info auth_info
Definition: stun_session.h:354
pj_stun_msg * msg
Definition: stun_session.h:342
const pj_sockaddr_t * dst_addr
Definition: stun_session.h:361
unsigned max_len
Definition: stun_session.h:357
pj_uint32_t msg_magic
Definition: stun_session.h:349
pj_pool_t * pool
Definition: stun_session.h:340
pj_stun_session * sess
Definition: stun_session.h:341
PJ_DECL_LIST_MEMBER(struct pj_stun_tx_data)
pj_stun_client_tsx * client_tsx
Definition: stun_session.h:347
pj_bool_t retransmit
Definition: stun_session.h:348
pj_bool_t is_destroying
Definition: stun_session.h:343
pj_size_t pkt_size
Definition: stun_session.h:358
unsigned addr_len
Definition: stun_session.h:360
pj_grp_lock_t * grp_lock
Definition: stun_session.h:352
pj_timer_entry res_timer
Definition: stun_session.h:363
void * pkt
Definition: stun_session.h:356
STUN authentication.
STUN endpoint.
STUN message components.
STUN transaction.

 


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