Commit d938694f authored by Sébastien Blin's avatar Sébastien Blin Committed by Olivier Dion

pjproject: bump to 2.11

Note:

Merged upstream (so deleted):
0010-fix-pkgconfig.patch
0014-Add-new-compile-time-setting-PJ_ICE_ST_USE_TURN_PERM.patch
0015-update-local-preference-for-peer-reflexive-candidate.patch
0016-use-addrinfo-instead-CFHOST.patch
0017-CVE-2020-15260.patch
0018-CVE-2021-21375.patch

Merged for 2.12:
0019-ignore-down-interfaces.patch
0020-ignore-addresses-for-RFC7335.patch

Also, fix the assertion in ice_transport.cpp cause
user_mapping_cnt can be equals to PJ_ICE_MAX_COMP.

Change-Id: If6fee261e89c34640519a6b61e94391b57363a22
GitLab: #509
parent d3b425f5
This diff is collapsed.
pjnath/src/pjnath/ice_session.c | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
pjnath/src/pjnath/ice_session.c | 176 ++++++++++++++++++++++++++++++++
1 file changed, 176 insertions(+)
diff --git a/pjnath/src/pjnath/ice_session.c b/pjnath/src/pjnath/ice_session.c
index 2a4125bc5..542acf7b4 100644
index a3869d9ca..9df0bc08a 100644
--- a/pjnath/src/pjnath/ice_session.c
+++ b/pjnath/src/pjnath/ice_session.c
@@ -29,6 +29,21 @@
@@ -30,6 +30,21 @@
#include <pj/rand.h>
#include <pj/string.h>
......@@ -27,7 +27,7 @@ index 2a4125bc5..542acf7b4 100644
/* String names for candidate types */
static const char *cand_type_names[] =
{
@@ -703,6 +718,144 @@ static pj_uint32_t CALC_CAND_PRIO(pj_ice_sess *ice,
@@ -731,6 +746,144 @@ static pj_uint32_t CALC_CAND_PRIO(pj_ice_sess *ice,
#endif
}
......@@ -172,9 +172,9 @@ index 2a4125bc5..542acf7b4 100644
/*
* Add ICE candidate
@@ -719,6 +872,29 @@ PJ_DEF(pj_status_t) pj_ice_sess_add_cand(pj_ice_sess *ice,
int addr_len,
unsigned *p_cand_id)
@@ -748,6 +901,29 @@ PJ_DEF(pj_status_t) pj_ice_sess_add_cand(pj_ice_sess *ice,
unsigned *p_cand_id,
pj_ice_cand_transport transport)
{
+ /**
+ * RFC 2466: an ip address can have the status DEPRECATED and SHOULD NOT
......
......@@ -12,14 +12,14 @@ Subject: [PATCH 3/9] add tcp keep alive
pjnath/include/pjnath/ice_session.h | 5 ++++
pjnath/include/pjnath/ice_strans.h | 7 +++++
pjnath/src/pjnath/ice_session.c | 6 ++++
pjnath/src/pjnath/ice_strans.c | 10 +++++++
9 files changed, 149 insertions(+)
pjnath/src/pjnath/ice_strans.c | 11 +++++++
9 files changed, 150 insertions(+)
diff --git a/pjlib/include/pj/sock.h b/pjlib/include/pj/sock.h
index 4daf298c5..095a38335 100644
index 292b364e7..7542045b1 100644
--- a/pjlib/include/pj/sock.h
+++ b/pjlib/include/pj/sock.h
@@ -313,6 +313,11 @@ extern const pj_uint16_t PJ_SO_REUSEADDR;
@@ -314,6 +314,11 @@ extern const pj_uint16_t PJ_SO_REUSEADDR;
/** Do not generate SIGPIPE. @see pj_SO_NOSIGPIPE */
extern const pj_uint16_t PJ_SO_NOSIGPIPE;
......@@ -31,7 +31,7 @@ index 4daf298c5..095a38335 100644
/** Set the protocol-defined priority for all packets to be sent on socket.
*/
extern const pj_uint16_t PJ_SO_PRIORITY;
@@ -343,9 +348,21 @@ extern const pj_uint16_t PJ_IP_DROP_MEMBERSHIP;
@@ -344,9 +349,21 @@ extern const pj_uint16_t PJ_IP_DROP_MEMBERSHIP;
/** Get #PJ_SO_SNDBUF constant */
PJ_DECL(pj_uint16_t) pj_SO_SNDBUF(void);
......@@ -53,7 +53,7 @@ index 4daf298c5..095a38335 100644
/** Get #PJ_SO_REUSEADDR constant */
PJ_DECL(pj_uint16_t) pj_SO_REUSEADDR(void);
@@ -379,9 +396,21 @@ extern const pj_uint16_t PJ_IP_DROP_MEMBERSHIP;
@@ -380,9 +397,21 @@ extern const pj_uint16_t PJ_IP_DROP_MEMBERSHIP;
/** Get #PJ_SO_SNDBUF constant */
# define pj_SO_SNDBUF() PJ_SO_SNDBUF
......@@ -76,7 +76,7 @@ index 4daf298c5..095a38335 100644
# define pj_SO_REUSEADDR() PJ_SO_REUSEADDR
diff --git a/pjlib/src/pj/sock_bsd.c b/pjlib/src/pj/sock_bsd.c
index e416991de..0e9bfdbe9 100644
index ce23101c4..f9e8ffa82 100644
--- a/pjlib/src/pj/sock_bsd.c
+++ b/pjlib/src/pj/sock_bsd.c
@@ -28,6 +28,15 @@
......@@ -154,7 +154,7 @@ index e416991de..0e9bfdbe9 100644
#if defined(PJ_SOCK_HAS_IPV6_V6ONLY) && PJ_SOCK_HAS_IPV6_V6ONLY != 0
if (af == PJ_AF_INET6) {
diff --git a/pjlib/src/pj/sock_common.c b/pjlib/src/pj/sock_common.c
index 693f3af62..6beb28590 100644
index 96cd6b540..671d63f4a 100644
--- a/pjlib/src/pj/sock_common.c
+++ b/pjlib/src/pj/sock_common.c
@@ -1346,11 +1346,31 @@ PJ_DEF(pj_uint16_t) pj_SO_SNDBUF(void)
......@@ -190,7 +190,7 @@ index 693f3af62..6beb28590 100644
{
return PJ_SO_REUSEADDR;
diff --git a/pjlib/src/pj/sock_uwp.cpp b/pjlib/src/pj/sock_uwp.cpp
index 876c3287a..34baebcee 100644
index 40250bf8d..148571aa8 100644
--- a/pjlib/src/pj/sock_uwp.cpp
+++ b/pjlib/src/pj/sock_uwp.cpp
@@ -69,6 +69,24 @@ const pj_uint16_t PJ_SOL_IP = IPPROTO_IP;
......@@ -246,10 +246,10 @@ index ab83af956..966a9fc43 100644
PJ_EXPORT_SYMBOL(PJ_SOL_UDP)
PJ_EXPORT_SYMBOL(PJ_SOL_IPV6)
diff --git a/pjnath/include/pjnath/ice_session.h b/pjnath/include/pjnath/ice_session.h
index 4cccd7c64..9f29b828e 100644
index 5362c72e9..97069ed9e 100644
--- a/pjnath/include/pjnath/ice_session.h
+++ b/pjnath/include/pjnath/ice_session.h
@@ -628,6 +628,11 @@ typedef struct pj_ice_sess_cb
@@ -648,6 +648,11 @@ typedef struct pj_ice_sess_cb
pj_ice_sess_checklist *clist,
unsigned check_id);
......@@ -262,12 +262,12 @@ index 4cccd7c64..9f29b828e 100644
diff --git a/pjnath/include/pjnath/ice_strans.h b/pjnath/include/pjnath/ice_strans.h
index 9eb74b35f..1269442cd 100644
index 1c20729e8..1fed15f6f 100644
--- a/pjnath/include/pjnath/ice_strans.h
+++ b/pjnath/include/pjnath/ice_strans.h
@@ -192,6 +192,13 @@ typedef struct pj_ice_strans_cb
pj_ice_strans_op op,
pj_status_t status);
@@ -219,6 +219,13 @@ typedef struct pj_ice_strans_cb
const pj_ice_sess_cand *cand,
pj_bool_t end_of_cand);
+ /**
+ * This callback is called if an internal operation fails
......@@ -280,10 +280,10 @@ index 9eb74b35f..1269442cd 100644
diff --git a/pjnath/src/pjnath/ice_session.c b/pjnath/src/pjnath/ice_session.c
index 20ba47a48..f1094932b 100644
index 9df0bc08a..f6a34e62d 100644
--- a/pjnath/src/pjnath/ice_session.c
+++ b/pjnath/src/pjnath/ice_session.c
@@ -1435,6 +1435,12 @@ static void ice_keep_alive(pj_ice_sess *ice, pj_bool_t send_now)
@@ -1533,6 +1533,12 @@ static void ice_keep_alive(pj_ice_sess *ice, pj_bool_t send_now)
PJ_FALSE, PJ_FALSE,
&the_check->rcand->addr,
addr_len, tdata);
......@@ -297,18 +297,18 @@ index 20ba47a48..f1094932b 100644
/* Restore FINGERPRINT usage */
pj_stun_session_use_fingerprint(comp->stun_sess, saved);
diff --git a/pjnath/src/pjnath/ice_strans.c b/pjnath/src/pjnath/ice_strans.c
index 82175e9e8..c1647bebf 100644
index 025724520..b935811aa 100644
--- a/pjnath/src/pjnath/ice_strans.c
+++ b/pjnath/src/pjnath/ice_strans.c
@@ -98,6 +98,7 @@ static pj_uint16_t GETVAL16H(const pj_uint8_t *buf1, const pj_uint8_t *buf2)
//////////////////////////////////////////////////////////////////////////////
@@ -99,6 +99,7 @@ static pj_uint16_t GETVAL16H(const pj_uint8_t *buf1, const pj_uint8_t *buf2)
/* ICE callbacks */
static void on_valid_pair(pj_ice_sess *ice);
+static void on_ice_destroy(pj_ice_sess *ice);
static void on_ice_complete(pj_ice_sess *ice, pj_status_t status);
static pj_status_t ice_tx_pkt(pj_ice_sess *ice,
unsigned comp_id,
@@ -1313,6 +1314,7 @@ PJ_DEF(pj_status_t) pj_ice_strans_init_ice(pj_ice_strans *ice_st,
@@ -1383,6 +1384,7 @@ PJ_DEF(pj_status_t) pj_ice_strans_init_ice(pj_ice_strans *ice_st,
ice_cb.wait_tcp_connection = &ice_wait_tcp_connection;
ice_cb.reconnect_tcp_connection = &ice_reconnect_tcp_connection;
ice_cb.close_tcp_connection = &ice_close_tcp_connection;
......@@ -316,8 +316,8 @@ index 82175e9e8..c1647bebf 100644
#endif
/* Create! */
@@ -1935,6 +1937,14 @@ PJ_DEF(pj_status_t) pj_ice_strans_sendto2(pj_ice_strans *ice_st,
dst_addr_len, PJ_TRUE, PJ_FALSE);
@@ -2190,6 +2192,15 @@ static void on_valid_pair(pj_ice_sess *ice)
pj_grp_lock_dec_ref(ice_st->grp_lock);
}
+static void on_ice_destroy(pj_ice_sess *ice)
......@@ -328,8 +328,9 @@ index 82175e9e8..c1647bebf 100644
+ (*ice_st->cb.on_destroy)(ice_st);
+ }
+}
+
/*
* Callback called by ICE session when ICE processing is complete, either
* successfully or with failure.
--
2.26.2
\ No newline at end of file
2.30.2
\ No newline at end of file
......@@ -4,14 +4,14 @@ Date: Thu, 20 Feb 2020 12:26:02 -0500
Subject: [PATCH] multiple_listeners
---
pjsip/src/pjsip/sip_transport.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
pjsip/src/pjsip/sip_transport.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/pjsip/src/pjsip/sip_transport.c b/pjsip/src/pjsip/sip_transport.c
index 24b59153b..a336a8648 100644
index 7fac20f41..d5bd8fdda 100644
--- a/pjsip/src/pjsip/sip_transport.c
+++ b/pjsip/src/pjsip/sip_transport.c
@@ -1471,10 +1471,16 @@ PJ_DEF(pj_status_t) pjsip_tpmgr_register_tpfactory( pjsip_tpmgr *mgr,
@@ -1488,10 +1488,16 @@ PJ_DEF(pj_status_t) pjsip_tpmgr_register_tpfactory( pjsip_tpmgr *mgr,
/* Check that no same factory has been registered. */
status = PJ_SUCCESS;
for (p=mgr->factory_list.next; p!=&mgr->factory_list; p=p->next) {
......@@ -32,19 +32,7 @@ index 24b59153b..a336a8648 100644
}
if (status != PJ_SUCCESS) {
@@ -2327,10 +2333,10 @@ PJ_DEF(pj_status_t) pjsip_tpmgr_acquire_transport2(pjsip_tpmgr *mgr,
}
}
+ unsigned flag = pjsip_transport_get_flag_from_type(type);
if (tp_ref == NULL &&
(!sel || sel->disable_connection_reuse == PJ_FALSE))
{
- unsigned flag = pjsip_transport_get_flag_from_type(type);
const pj_sockaddr *remote_addr = (const pj_sockaddr*)remote;
@@ -2429,6 +2435,14 @@ PJ_DEF(pj_status_t) pjsip_tpmgr_acquire_transport2(pjsip_tpmgr *mgr,
@@ -2467,6 +2473,14 @@ PJ_DEF(pj_status_t) pjsip_tpmgr_acquire_transport2(pjsip_tpmgr *mgr,
} else {
......@@ -60,5 +48,4 @@ index 24b59153b..a336a8648 100644
factory = mgr->factory_list.next;
while (factory != &mgr->factory_list) {
--
2.24.1
2.30.2
\ No newline at end of file
From a9a8cc6b62dc08e34ed4f7893a822809dd051572 Mon Sep 17 00:00:00 2001
From: jrun <darwinskernel@gmail.com>
Date: Wed, 19 Feb 2020 15:17:38 -0500
Subject: [PATCH 5/9] fix_ebusy_turn
Subject: [PATCH] fix_ebusy_turn
---
pjnath/include/pjnath/turn_session.h | 126 ++++++++++++++++++++-------
pjnath/include/pjnath/turn_sock.h | 27 ++++++
pjnath/src/pjnath/ice_strans.c | 2 +-
pjnath/src/pjnath/turn_session.c | 39 ++++++---
pjnath/src/pjnath/turn_sock.c | 102 +++++++++++++++++++++-
5 files changed, 248 insertions(+), 48 deletions(-)
pjnath/include/pjnath/turn_session.h | 65 +++++++++++++++++++
pjnath/include/pjnath/turn_sock.h | 27 ++++++++
pjnath/src/pjnath/turn_session.c | 24 +++++--
pjnath/src/pjnath/turn_sock.c | 96 ++++++++++++++++++++++++++++
4 files changed, 207 insertions(+), 5 deletions(-)
diff --git a/pjnath/include/pjnath/turn_session.h b/pjnath/include/pjnath/turn_session.h
index 956f57bf0..04add93db 100644
index 956f57bf0..f546d7e18 100644
--- a/pjnath/include/pjnath/turn_session.h
+++ b/pjnath/include/pjnath/turn_session.h
@@ -1,5 +1,5 @@
/* $Id$ */
-/*
+/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
*
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __PJNATH_TURN_SESSION_H__
#define __PJNATH_TURN_SESSION_H__
@@ -50,10 +50,10 @@ or to support new transport types to TURN, such as TLS.
These steps describes how to use the TURN session:
- <b>Creating the session</b>:\n
- use #pj_turn_session_create() to create the session.
+ use #pj_turn_session_create() to create the session.
- <b>Configuring credential</b>:\n
- all TURN operations requires the use of authentication (it uses STUN
+ all TURN operations requires the use of authentication (it uses STUN
long term autentication method). Use #pj_turn_session_set_credential()
to configure the TURN credential to be used by the session.
@@ -62,8 +62,8 @@ These steps describes how to use the TURN session:
Allocate request (with pj_turn_session_alloc()). This function will
resolve the TURN server using DNS SRV resolution if the \a resolver
is set. The server resolution process will complete asynchronously,
- and application will be notified in \a on_state() callback of the
- #pj_turn_session_cb structurewith the session state set to
+ and application will be notified in \a on_state() callback of the
+ #pj_turn_session_cb structurewith the session state set to
PJ_TURN_STATE_RESOLVED.
- <b>Creating allocation</b>:\n
@@ -75,40 +75,40 @@ These steps describes how to use the TURN session:
- <b>Getting the allocation result</b>:\n
if allocation is successful, the session state will progress to
- \a PJ_TURN_STATE_READY, otherwise the state will be
+ \a PJ_TURN_STATE_READY, otherwise the state will be
\a PJ_TURN_STATE_DEALLOCATED or higher. Session state progression is
- reported in the \a on_state() callback of the #pj_turn_session_cb
+ reported in the \a on_state() callback of the #pj_turn_session_cb
structure. On successful allocation, application may retrieve the
allocation info by calling #pj_turn_session_get_info().
- <b>Sending data through the relay</b>.\n
- Once allocation has been created, client may send data to any remote
+ Once allocation has been created, client may send data to any remote
endpoints (called peers in TURN terminology) via the "relay port". It does
- so by calling #pj_turn_session_sendto(), giving the peer address
+ so by calling #pj_turn_session_sendto(), giving the peer address
in the function argument. But note that at this point peers are not allowed
to send data towards the client (via the "relay port") before permission is
installed for that peer.
- <b>Creating permissions</b>.\n
- Permission needs to be created in the TURN server so that a peer can send
+ Permission needs to be created in the TURN server so that a peer can send
data to the client via the relay port (a peer in this case is identified by
its IP address). Without this, when the TURN server receives data from the
peer in the "relay port", it will drop this data. Create the permission by
calling #pj_turn_session_set_perm(), specifying the peer IP address in the
- argument (the port part of the address is ignored). More than one IP
+ argument (the port part of the address is ignored). More than one IP
addresses may be specified.
- <b>Receiving data from peers</b>.\n
- Once permission has been installed for the peer, any data received by the
- TURN server (from that peer) in the "relay port" will be relayed back to
+ Once permission has been installed for the peer, any data received by the
+ TURN server (from that peer) in the "relay port" will be relayed back to
client by the server, and application will be notified via \a on_rx_data
callback of the #pj_turn_session_cb.
- <b>Using ChannelData</b>.\n
- TURN provides optimized framing to the data by using ChannelData
+ TURN provides optimized framing to the data by using ChannelData
packetization. The client activates this format for the specified peer by
calling #pj_turn_session_bind_channel(). Data sent or received to/for
- this peer will then use ChannelData format instead of Send or Data
+ this peer will then use ChannelData format instead of Send or Data
Indications.
- <b>Refreshing the allocation, permissions, and channel bindings</b>.\n
@@ -125,15 +125,15 @@ These steps describes how to use the TURN session:
*/
-/**
+/**
* Opaque declaration for TURN client session.
*/
typedef struct pj_turn_session pj_turn_session;
-/**
- * TURN transport types, which will be used both to specify the connection
- * type for reaching TURN server and the type of allocation transport to be
+/**
+ * TURN transport types, which will be used both to specify the connection
+ * type for reaching TURN server and the type of allocation transport to be
* requested to server (the REQUESTED-TRANSPORT attribute).
*/
typedef enum pj_turn_tp_type
@@ -246,7 +246,7 @@ typedef struct pj_turn_session_cb
* @param addr_len Length of the destination address.
*
* @return The callback should return the status of the
- * send operation.
+ * send operation.
*/
pj_status_t (*on_send_pkt)(pj_turn_session *sess,
const pj_uint8_t *pkt,
@@ -254,6 +254,35 @@ typedef struct pj_turn_session_cb
const pj_sockaddr_t *dst_addr,
unsigned addr_len);
......@@ -171,87 +50,6 @@ index 956f57bf0..04add93db 100644
/**
* This callback will be called by the TURN session whenever it
* needs to send outgoing STUN requests/messages for TURN signalling
@@ -268,7 +297,7 @@ typedef struct pj_turn_session_cb
* @param addr_len Length of the destination address.
*
* @return The callback should return the status of the
- * send operation.
+ * send operation.
*/
pj_status_t (*on_stun_send_pkt)(pj_turn_session *sess,
const pj_uint8_t *pkt,
@@ -277,7 +306,7 @@ typedef struct pj_turn_session_cb
unsigned addr_len);
/**
- * Notification when peer address has been bound successfully to
+ * Notification when peer address has been bound successfully to
* a channel number.
*
* This callback is optional since the nature of this callback is
@@ -320,7 +349,7 @@ typedef struct pj_turn_session_cb
* @param old_state The previous state of the session.
* @param new_state The current state of the session.
*/
- void (*on_state)(pj_turn_session *sess,
+ void (*on_state)(pj_turn_session *sess,
pj_turn_state_t old_state,
pj_turn_state_t new_state);
@@ -365,7 +394,7 @@ typedef struct pj_turn_session_cb
/**
- * Allocation parameter, which can be given when application calls
+ * Allocation parameter, which can be given when application calls
* pj_turn_session_alloc() to allocate relay address in the TURN server.
* Application should call pj_turn_alloc_param_default() to initialize
* this structure with the default values.
@@ -505,7 +534,7 @@ PJ_DECL(void) pj_turn_alloc_param_default(pj_turn_alloc_param *prm);
* @param dst Destination parameter.
* @param src Source parameter.
*/
-PJ_DECL(void) pj_turn_alloc_param_copy(pj_pool_t *pool,
+PJ_DECL(void) pj_turn_alloc_param_copy(pj_pool_t *pool,
pj_turn_alloc_param *dst,
const pj_turn_alloc_param *src);
@@ -703,7 +732,7 @@ PJ_DECL(pj_status_t) pj_turn_session_set_server(pj_turn_session *sess,
/**
- * Set credential to be used to authenticate against TURN server.
+ * Set credential to be used to authenticate against TURN server.
* Application must call this function before sending Allocate request
* with pj_turn_session_alloc().
*
@@ -724,7 +753,7 @@ PJ_DECL(pj_status_t) pj_turn_session_set_credential(pj_turn_session *sess,
* used with pj_turn_session_set_credential() before calling this function.
*
* This function will complete asynchronously, and the application will be
- * notified about the allocation result in \a on_state() callback. The
+ * notified about the allocation result in \a on_state() callback. The
* TURN session state will move to PJ_TURN_STATE_READY if allocation is
* successful, and PJ_TURN_STATE_DEALLOCATING or greater state if allocation
* has failed.
@@ -768,7 +797,7 @@ PJ_DECL(pj_status_t) pj_turn_session_set_perm(pj_turn_session *sess,
/**
- * Send a data to the specified peer address via the TURN relay. This
+ * Send a data to the specified peer address via the TURN relay. This
* function will encapsulate the data as STUN Send Indication or TURN
* ChannelData packet and send the message to the TURN server. The TURN
* server then will send the data to the peer.
@@ -777,7 +806,7 @@ PJ_DECL(pj_status_t) pj_turn_session_set_perm(pj_turn_session *sess,
* created before application can relay any data.
*
* Since TURN session is transport independent, this function will
- * ultimately call \a on_send_pkt() callback to request the application
+ * ultimately call \a on_send_pkt() callback to request the application
* to actually send the packet containing the data to the TURN server.
*
* @param sess The TURN client session.
@@ -798,6 +827,42 @@ PJ_DECL(pj_status_t) pj_turn_session_sendto(pj_turn_session *sess,
const pj_sockaddr_t *peer_addr,
unsigned addr_len);
......@@ -295,18 +93,13 @@ index 956f57bf0..04add93db 100644
/**
* Optionally establish channel binding for the specified a peer address.
* This function will assign a unique channel number for the peer address
@@ -907,4 +972,3 @@ PJ_END_DECL
#endif /* __PJNATH_TURN_SESSION_H__ */
-
diff --git a/pjnath/include/pjnath/turn_sock.h b/pjnath/include/pjnath/turn_sock.h
index 35388809f..645c414fe 100644
index 35388809f..05b5cafbe 100644
--- a/pjnath/include/pjnath/turn_sock.h
+++ b/pjnath/include/pjnath/turn_sock.h
@@ -603,6 +603,33 @@ PJ_DECL(pj_status_t) pj_turn_sock_sendto(pj_turn_sock *turn_sock,
const pj_sockaddr_t *peer_addr,
unsigned addr_len);
@@ -623,6 +623,33 @@ PJ_DECL(pj_status_t) pj_turn_sock_bind_channel(pj_turn_sock *turn_sock,
const pj_sockaddr_t *peer,
unsigned addr_len);
+/**
+ * Send a data to the specified peer address via the TURN relay. This
......@@ -336,40 +129,25 @@ index 35388809f..645c414fe 100644
+ unsigned* sent);
+
/**
* Optionally establish channel binding for the specified a peer address.
* This function will assign a unique channel number for the peer address
diff --git a/pjnath/src/pjnath/ice_strans.c b/pjnath/src/pjnath/ice_strans.c
index 4adc9bc70..643bbbac9 100644
--- a/pjnath/src/pjnath/ice_strans.c
+++ b/pjnath/src/pjnath/ice_strans.c
@@ -1937,7 +1937,7 @@ PJ_DEF(pj_status_t) pj_ice_strans_sendto2(pj_ice_strans *ice_st,
{
ice_st->call_send_cb = PJ_TRUE;
return send_data(ice_st, comp_id, data, data_len, dst_addr,
- dst_addr_len, PJ_TRUE, PJ_FALSE);
+ dst_addr_len, PJ_TRUE, PJ_FALSE);
}
static void on_ice_destroy(pj_ice_sess *ice)
* Check if peer is a dataconn
*
diff --git a/pjnath/src/pjnath/turn_session.c b/pjnath/src/pjnath/turn_session.c
index 88985af69..12738c8e7 100644
index 3a7df799a..374b70b59 100644
--- a/pjnath/src/pjnath/turn_session.c
+++ b/pjnath/src/pjnath/turn_session.c
@@ -971,10 +971,21 @@ on_error:
@@ -975,11 +975,23 @@ on_error:
/**
* Relay data to the specified peer through the session.
*/
+
PJ_DEF(pj_status_t) pj_turn_session_sendto( pj_turn_session *sess,
- const pj_uint8_t *pkt,
- unsigned pkt_len,
- const pj_sockaddr_t *addr,
- unsigned addr_len)
+ const pj_uint8_t *pkt,
+ unsigned pkt_len,
+ const pj_sockaddr_t *addr,
+ unsigned addr_len)
const pj_uint8_t *pkt,
unsigned pkt_len,
const pj_sockaddr_t *addr,
unsigned addr_len)
+{
+ unsigned sent;
+ return pj_turn_session_sendto2(sess, pkt, pkt_len, addr, addr_len, &sent);
+ unsigned sent;
+ return pj_turn_session_sendto2(sess, pkt, pkt_len, addr, addr_len, &sent);
+}
+
+PJ_DEF(pj_status_t) pj_turn_session_sendto2(pj_turn_session *sess,
......@@ -381,56 +159,44 @@ index 88985af69..12738c8e7 100644
{
struct ch_t *ch;
struct perm_t *perm;
@@ -1011,7 +1022,8 @@ PJ_DEF(pj_status_t) pj_turn_session_sendto( pj_turn_session *sess,
@@ -1016,7 +1028,7 @@ PJ_DEF(pj_status_t) pj_turn_session_sendto( pj_turn_session *sess,
/* If peer connection is TCP (RFC 6062), send it directly */
if (sess->alloc_param.peer_conn_type == PJ_TURN_TP_TCP) {
- status = sess->cb.on_send_pkt(sess, pkt, pkt_len, addr, addr_len);
+ status = sess->cb.on_send_pkt2(sess, pkt, pkt_len, addr, addr_len,sent,
+ pkt_len);
+ status = sess->cb.on_send_pkt2(sess, pkt, pkt_len, addr, addr_len, sent, pkt_len);
goto on_return;
}
@@ -1039,9 +1051,10 @@ PJ_DEF(pj_status_t) pj_turn_session_sendto( pj_turn_session *sess,
@@ -1044,9 +1056,10 @@ PJ_DEF(pj_status_t) pj_turn_session_sendto( pj_turn_session *sess,
pj_assert(sess->srv_addr != NULL);
- status = sess->cb.on_send_pkt(sess, sess->tx_pkt, total_len,
- sess->srv_addr,
+ status = sess->cb.on_send_pkt2(sess, sess->tx_pkt, total_len,
sess->srv_addr,
- pj_sockaddr_get_len(sess->srv_addr));
+ status = sess->cb.on_send_pkt2(sess, sess->tx_pkt, total_len,
+ sess->srv_addr,
+ pj_sockaddr_get_len(sess->srv_addr),
+ sent, pkt_len);
+ pj_sockaddr_get_len(sess->srv_addr),
+ sent, pkt_len);
} else {
/* Use Send Indication. */
@@ -1079,10 +1092,11 @@ PJ_DEF(pj_status_t) pj_turn_session_sendto( pj_turn_session *sess,
@@ -1084,10 +1097,11 @@ PJ_DEF(pj_status_t) pj_turn_session_sendto( pj_turn_session *sess,
goto on_return;
/* Send the Send Indication */
- status = sess->cb.on_send_pkt(sess, sess->tx_pkt,
- (unsigned)send_ind_len,
- sess->srv_addr,
+ status = sess->cb.on_send_pkt2(sess, sess->tx_pkt,
(unsigned)send_ind_len,
sess->srv_addr,
- pj_sockaddr_get_len(sess->srv_addr));
+ status = sess->cb.on_send_pkt2(sess, sess->tx_pkt,
+ (unsigned)send_ind_len,
+ sess->srv_addr,
+ pj_sockaddr_get_len(sess->srv_addr),
+ sent, pkt_len);
+ pj_sockaddr_get_len(sess->srv_addr),
+ sent, pkt_len);
}
on_return:
@@ -1090,7 +1104,6 @@ on_return:
return status;
}
-
/**
* Bind a peer address to a channel number.
*/
diff --git a/pjnath/src/pjnath/turn_sock.c b/pjnath/src/pjnath/turn_sock.c
index 9b69a6a21..bacc80859 100644
index a6e192e9f..88f61b7e2 100644
--- a/pjnath/src/pjnath/turn_sock.c
+++ b/pjnath/src/pjnath/turn_sock.c
@@ -100,6 +100,10 @@ struct pj_turn_sock
......@@ -444,10 +210,10 @@ index 9b69a6a21..bacc80859 100644
};
@@ -111,6 +115,13 @@ static pj_status_t turn_on_send_pkt(pj_turn_session *sess,
unsigned pkt_len,
const pj_sockaddr_t *dst_addr,
unsigned dst_addr_len);
@@ -116,6 +120,13 @@ static pj_status_t turn_on_stun_send_pkt(pj_turn_session *sess,
unsigned pkt_len,
const pj_sockaddr_t *dst_addr,