From db008cd32f829b64577052786d1ca75a72ee765c Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 4 May 2018 15:33:56 +0200 Subject: [PATCH] Fixed tunnel compilation issues --- coreapi/TunnelManager.cc | 18 +++++++++--------- coreapi/linphone_tunnel.cc | 13 +++++++------ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/coreapi/TunnelManager.cc b/coreapi/TunnelManager.cc index 8a51c392c..d7348c093 100644 --- a/coreapi/TunnelManager.cc +++ b/coreapi/TunnelManager.cc @@ -33,7 +33,7 @@ void TunnelManager::addServer(const char *ip, int port,unsigned int udpMirrorPor return; } addServer(ip,port); - mUdpMirrorClients.push_back(UdpMirrorClient(ServerAddr(ip,udpMirrorPort),delay)); + mUdpMirrorClients.push_back(UdpMirrorClient(ServerAddr(ip, (int)udpMirrorPort), delay)); } void TunnelManager::addServer(const char *ip, int port) { @@ -58,7 +58,7 @@ void TunnelManager::addServerPair(const char *ip1, int port1, const char *ip2, i return; } addServerPair(ip1, port1, ip2, port2); - mUdpMirrorClients.push_back(UdpMirrorClient(ServerAddr(ip1, udpMirrorPort), delay)); + mUdpMirrorClients.push_back(UdpMirrorClient(ServerAddr(ip1, (int)udpMirrorPort), delay)); } void TunnelManager::addServerPair(const char *ip1, int port1, const char *ip2, int port2) { @@ -159,7 +159,7 @@ void TunnelManager::startClient() { mTunnelClient = TunnelClient::create(TRUE); } - sal_set_tunnel(mCore->sal, mTunnelClient); + mCore->sal->set_tunnel(mTunnelClient); if (!mUseDualClient) { static_cast(mTunnelClient)->setCallback(tunnelCallback,this); } else { @@ -220,21 +220,21 @@ bool TunnelManager::isConnected() const { int TunnelManager::customSendto(struct _RtpTransport *t, mblk_t *msg , int flags, const struct sockaddr *to, socklen_t tolen){ int size; DualSocket *ds = (DualSocket *)t->data; - msgpullup(msg,-1); - size=msgdsize(msg); - ds->sendSocket->sendto(msg->b_rptr,size,to,tolen); + msgpullup(msg, (size_t)-1); + size = (int)msgdsize(msg); + ds->sendSocket->sendto(msg->b_rptr, (size_t)size, to, tolen); return size; } int TunnelManager::customRecvfrom(struct _RtpTransport *t, mblk_t *msg, int flags, struct sockaddr *from, socklen_t *fromlen){ DualSocket *ds = (DualSocket *)t->data; memset(&msg->recv_addr,0,sizeof(msg->recv_addr)); - int err=ds->recvSocket->recvfrom(msg->b_wptr,dblk_lim(msg->b_datap)-dblk_base(msg->b_datap),from,*fromlen); + long err=ds->recvSocket->recvfrom(msg->b_wptr, (size_t)(dblk_lim(msg->b_datap) - dblk_base(msg->b_datap)), from, *fromlen); //to make ice happy inet_aton(((TunnelManager*)(ds->recvSocket)->getUserPointer())->mLocalAddr,&msg->recv_addr.addr.ipi_addr); msg->recv_addr.family = AF_INET; msg->recv_addr.port = htons((unsigned short)(ds->recvSocket)->getPort()); - if (err>0) return err; + if (err>0) return (int)err; return 0; } @@ -281,7 +281,7 @@ TunnelManager::~TunnelManager(){ mTunnelClient->stop(); delete mTunnelClient; } - sal_set_tunnel(mCore->sal,NULL); + mCore->sal->set_tunnel(NULL); linphone_core_remove_listener(mCore, mVTable); linphone_core_v_table_destroy(mVTable); } diff --git a/coreapi/linphone_tunnel.cc b/coreapi/linphone_tunnel.cc index c82876105..6c3589147 100644 --- a/coreapi/linphone_tunnel.cc +++ b/coreapi/linphone_tunnel.cc @@ -28,6 +28,7 @@ #include "linphone/core.h" #include "private.h" #include "linphone/lpconfig.h" +#include "c-wrapper/c-wrapper.h" LinphoneTunnel* linphone_core_get_tunnel(const LinphoneCore *lc){ return lc->tunnel; @@ -42,13 +43,13 @@ struct _LinphoneTunnel { static void _linphone_tunnel_uninit(LinphoneTunnel *tunnel); BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneTunnel); -BELLE_SIP_DECLARE_VPTR(LinphoneTunnel); +BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneTunnel); BELLE_SIP_INSTANCIATE_VPTR(LinphoneTunnel, belle_sip_object_t, _linphone_tunnel_uninit, // uninit NULL, // clone NULL, // marshal FALSE // unowned -) +); extern "C" LinphoneTunnel* linphone_core_tunnel_new(LinphoneCore *lc){ LinphoneTunnel* tunnel = belle_sip_object_new(LinphoneTunnel); @@ -231,13 +232,13 @@ static void linphone_tunnel_add_server_intern(LinphoneTunnel *tunnel, LinphoneTu linphone_tunnel_config_get_port(tunnel_config), linphone_tunnel_config_get_host2(tunnel_config), linphone_tunnel_config_get_port2(tunnel_config), - linphone_tunnel_config_get_remote_udp_mirror_port(tunnel_config), - linphone_tunnel_config_get_delay(tunnel_config)); + (unsigned int)linphone_tunnel_config_get_remote_udp_mirror_port(tunnel_config), + (unsigned int)linphone_tunnel_config_get_delay(tunnel_config)); } else { bcTunnel(tunnel)->addServer(linphone_tunnel_config_get_host(tunnel_config), linphone_tunnel_config_get_port(tunnel_config), - linphone_tunnel_config_get_remote_udp_mirror_port(tunnel_config), - linphone_tunnel_config_get_delay(tunnel_config)); + (unsigned int)linphone_tunnel_config_get_remote_udp_mirror_port(tunnel_config), + (unsigned int)linphone_tunnel_config_get_delay(tunnel_config)); } } else if (linphone_tunnel_config_get_host2(tunnel_config) != NULL) { bcTunnel(tunnel)->addServerPair(linphone_tunnel_config_get_host(tunnel_config),