Commit 77cad2f0 authored by jehan's avatar jehan
Browse files

finilize tunnel api cleanup

parent 93e9e0fa
......@@ -6,7 +6,11 @@ EXTRA_DIST=linphonecore_jni.cc
## Process this file with automake to produce Makefile.in
linphone_includedir=$(includedir)/linphone
linphone_include_HEADERS=linphonecore.h linphonefriend.h linphonecore_utils.h ../config.h lpconfig.h sipsetup.h
linphone_include_HEADERS=linphonecore.h linphonefriend.h linphonecore_utils.h ../config.h lpconfig.h sipsetup.h
if BUILD_TUNNEL
linphone_include_HEADERS+=linphone_tunnel.h
endif
INCLUDES = \
-I$(top_srcdir)
......@@ -36,11 +40,10 @@ liblinphone_la_SOURCES=\
siplogin.c \
lsd.c linphonecore_utils.h \
ec-calibrator.c \
conference.c \
linphone_tunnel_manager.h
conference.c
if BUILD_TUNNEL
liblinphone_la_SOURCES+=TunnelManager.cc TunnelManager.hh linphone_tunnel_manager.cc
liblinphone_la_SOURCES+=TunnelManager.cc TunnelManager.hh linphone_tunnel.cc
endif
......
......@@ -190,6 +190,9 @@ void TunnelManager::start() {
const ServerAddr &addr=*it;
mTunnelClient->addServer(addr.mAddr.c_str(), addr.mPort);
}
if(!mHttpUserName.empty()) {
mTunnelClient->setHttpProxyAuthInfo(mHttpUserName.c_str(), mHttpPasswd.c_str());
}
}
mTunnelClient->start();
......@@ -426,7 +429,9 @@ void TunnelManager::autoDetect() {
}
void TunnelManager::setHttpProxyAuthInfo(const char* username,const char* passwd) {
mTunnelClient->setHttpProxyAuthInfo(username,passwd);
mHttpUserName=username?username:"";
mHttpPasswd=passwd?passwd:"";
if (mTunnelClient) mTunnelClient->setHttpProxyAuthInfo(username,passwd);
}
LinphoneCore *TunnelManager::getLinphoneCore(){
......
......@@ -11,6 +11,7 @@
#ifndef __TUNNEL_CLIENT_MANAGER_H__
#define __TUNNEL_CLIENT_MANAGER_H__
#include <list>
#include <string>
#include "linphonecore.h"
#include "tunnel/client.hh"
extern "C" {
......@@ -156,6 +157,8 @@ class UdpMirrorClient;
static Mutex sMutex;
bool mAutoDetectStarted;
LinphoneRtpTransportFactories mTransportFactories;
std::string mHttpUserName;
std::string mHttpPasswd;
};
/**
......
/***************************************************************************
* linphone_tunnel_manager.cc
* linphone_tunnel.cc
*
* Fri Dec 9, 2011
* Copyright 2011 Belledonne Communications
......@@ -24,7 +24,7 @@
*/
#include "linphone_tunnel_manager.h"
#include "linphone_tunnel.h"
#include "TunnelManager.hh"
#include "linphonecore.h"
#include "private.h"
......@@ -39,7 +39,7 @@ extern "C" LinphoneTunnel* linphone_core_tunnel_new(LinphoneCore *lc){
return tunnel;
}
LinphoneTunnel* linphone_tunnel_get(LinphoneCore *lc){
LinphoneTunnel* linphone_core_get_tunnel(LinphoneCore *lc){
return lc->tunnel;
}
......
/***************************************************************************
* linphone_tunnel_manager.h
* linphone_tunnel.h
*
* Fri Dec 9, 2011
* Copyright 2011 Belledonne Communications
......@@ -33,12 +33,8 @@ extern "C"
{
#endif
typedef struct LinphoneTunnel LinphoneTunnel;
typedef void (*LogHandler)(int log_level, const char *str, va_list l);
LinphoneTunnel *linphone_tunnel_get(LinphoneCore *lc);
void linphone_tunnel_add_server(LinphoneTunnel *tunnel, const char *host, int port);
void linphone_tunnel_add_server_and_mirror(LinphoneTunnel *tunnel, const char *host, int port, int remote_udp_mirror, int delay);
void linphone_tunnel_clean_servers(LinphoneTunnel *tunnel);
......@@ -48,7 +44,7 @@ void linphone_tunnel_enable_logs(LinphoneTunnel *tunnel, bool_t enabled);
void linphone_tunnel_enable_logs_with_handler(LinphoneTunnel *tunnel, bool_t enabled, LogHandler logHandler);
void linphone_tunnel_reconnect(LinphoneTunnel *tunnel);
void linphone_tunnel_auto_detect(LinphoneTunnel *tunnel);
void linphone_tunnel_set_http_proxy_auth_info(const char* username,const char* passwd);
void linphone_tunnel_set_http_proxy_auth_info(LinphoneTunnel*tunnel, const char* username,const char* passwd);
/**
......
......@@ -344,16 +344,6 @@ typedef enum _LinphoneRegistrationState{
*/
const char *linphone_registration_state_to_string(LinphoneRegistrationState cs);
/**
* True if tunnel support was compiled.
*/
bool_t linphone_core_tunnel_available();
/**
* Update tunnel using configuration.
*/
void linphone_core_update_tunnel(LinphoneCore *lc);
LinphoneProxyConfig *linphone_proxy_config_new(void);
int linphone_proxy_config_set_server_addr(LinphoneProxyConfig *obj, const char *server_addr);
int linphone_proxy_config_set_identity(LinphoneProxyConfig *obj, const char *identity);
......@@ -1084,6 +1074,21 @@ void linphone_core_set_media_encryption_mandatory(LinphoneCore *lc, bool_t m);
*/
void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *params);
/**
* True if tunnel support was compiled.
*/
bool_t linphone_core_tunnel_available();
/**
* Update tunnel using configuration.
*/
void linphone_core_update_tunnel(LinphoneCore *lc);
typedef struct LinphoneTunnel LinphoneTunnel;
/**
* get tunnel instance if available
*/
LinphoneTunnel *linphone_core_get_tunnel(LinphoneCore *lc);
#ifdef __cplusplus
}
#endif
......
......@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <ortp/zrtp.h>
#ifdef TUNNEL_ENABLED
#include "linphone_tunnel_manager.h"
#include "linphone_tunnel.h"
#endif
extern "C" {
......
......@@ -28,7 +28,7 @@
extern "C" {
#endif
#include "linphonecore.h"
#include "linphone_tunnel_manager.h"
#include "linphone_tunnel.h"
#include "linphonecore_utils.h"
#include "sal.h"
......
......@@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphone.h"
#include "linphone_tunnel_manager.h"
#include "linphone_tunnel.h"
typedef enum {
CAP_IGNORE,
......@@ -1023,7 +1023,7 @@ void linphone_gtk_edit_tunnel(GtkButton *button){
#ifdef TUNNEL_ENABLED
LinphoneCore *lc=linphone_gtk_get_core();
GtkWidget *w=linphone_gtk_create_window("tunnel_config");
LinphoneTunnel *tunnel=linphone_tunnel_get(lc);
LinphoneTunnel *tunnel=linphone_core_get_tunnel(lc);
char host[50]={'\0'};
int port=0;
tunnel_get_server_host_and_port(tunnel, host, sizeof(host), &port);
......@@ -1050,7 +1050,7 @@ void linphone_gtk_tunnel_ok(GtkButton *button){
LinphoneCore *lc=linphone_gtk_get_core();
GtkWidget *w=gtk_widget_get_toplevel(GTK_WIDGET(button));
char address[50]={'\0'};
LinphoneTunnel *tunnel=linphone_tunnel_get(lc);
LinphoneTunnel *tunnel=linphone_core_get_tunnel(lc);
gint port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(w,"port")));
gboolean enabled=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(w,"radio_enable")));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment