From 93e9e0fa3ce04804bc4c06b0809a33ca2447056e Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 22 Dec 2011 10:35:43 +0100 Subject: [PATCH 1/2] rename LinphoneTunnelManager LinphoneTunnel --- coreapi/linphone_tunnel_manager.cc | 40 +++++++++++++++--------------- coreapi/linphone_tunnel_manager.h | 32 ++++++++++++------------ coreapi/linphonecore.c | 2 +- coreapi/linphonecore_jni.cc | 10 ++++---- coreapi/private.h | 9 ++++--- gtk/propertybox.c | 6 ++--- 6 files changed, 51 insertions(+), 48 deletions(-) diff --git a/coreapi/linphone_tunnel_manager.cc b/coreapi/linphone_tunnel_manager.cc index 0bf2efa3f..6578b7495 100644 --- a/coreapi/linphone_tunnel_manager.cc +++ b/coreapi/linphone_tunnel_manager.cc @@ -30,86 +30,86 @@ #include "private.h" #include "lpconfig.h" -static inline belledonnecomm::TunnelManager *bcTunnel(LinphoneTunnelManager *tunnel){ +static inline belledonnecomm::TunnelManager *bcTunnel(LinphoneTunnel *tunnel){ return (belledonnecomm::TunnelManager *)tunnel; } -extern "C" LinphoneTunnelManager* linphone_core_tunnel_new(LinphoneCore *lc){ - LinphoneTunnelManager* tunnel= (LinphoneTunnelManager*) new belledonnecomm::TunnelManager(lc); +extern "C" LinphoneTunnel* linphone_core_tunnel_new(LinphoneCore *lc){ + LinphoneTunnel* tunnel= (LinphoneTunnel*) new belledonnecomm::TunnelManager(lc); return tunnel; } -LinphoneTunnelManager* linphone_tunnel_get(LinphoneCore *lc){ +LinphoneTunnel* linphone_tunnel_get(LinphoneCore *lc){ return lc->tunnel; } -void linphone_tunnel_destroy(LinphoneTunnelManager *tunnel){ +void linphone_tunnel_destroy(LinphoneTunnel *tunnel){ delete bcTunnel(tunnel); } -void linphone_tunnel_add_server(LinphoneTunnelManager *tunnel, const char *host, int port){ +void linphone_tunnel_add_server(LinphoneTunnel *tunnel, const char *host, int port){ bcTunnel(tunnel)->addServer(host, port); } -void linphone_tunnel_add_server_and_mirror(LinphoneTunnelManager *tunnel, const char *host, int port, int remote_udp_mirror, int delay){ +void linphone_tunnel_add_server_and_mirror(LinphoneTunnel *tunnel, const char *host, int port, int remote_udp_mirror, int delay){ bcTunnel(tunnel)->addServer(host, port, remote_udp_mirror, delay); } -void linphone_tunnel_clean_servers(LinphoneTunnelManager *tunnel){ +void linphone_tunnel_clean_servers(LinphoneTunnel *tunnel){ bcTunnel(tunnel)->cleanServers(); } -void linphone_tunnel_enable(LinphoneTunnelManager *tunnel, bool_t enabled){ +void linphone_tunnel_enable(LinphoneTunnel *tunnel, bool_t enabled){ bcTunnel(tunnel)->enable(enabled); } -bool_t linphone_tunnel_enabled(LinphoneTunnelManager *tunnel){ +bool_t linphone_tunnel_enabled(LinphoneTunnel *tunnel){ return bcTunnel(tunnel)->isEnabled(); } -void linphone_tunnel_enable_logs(LinphoneTunnelManager *tunnel, bool_t enabled){ +void linphone_tunnel_enable_logs(LinphoneTunnel *tunnel, bool_t enabled){ bcTunnel(tunnel)->enableLogs(enabled); } -void linphone_tunnel_enable_logs_with_handler(LinphoneTunnelManager *tunnel, bool_t enabled, LogHandler logHandler){ +void linphone_tunnel_enable_logs_with_handler(LinphoneTunnel *tunnel, bool_t enabled, LogHandler logHandler){ bcTunnel(tunnel)->enableLogs(enabled, logHandler); } -void linphone_tunnel_set_http_proxy_auth_info(LinphoneTunnelManager *tunnel, const char* username,const char* passwd){ +void linphone_tunnel_set_http_proxy_auth_info(LinphoneTunnel *tunnel, const char* username,const char* passwd){ bcTunnel(tunnel)->setHttpProxyAuthInfo(username, passwd); } -void linphone_tunnel_reconnect(LinphoneTunnelManager *tunnel){ +void linphone_tunnel_reconnect(LinphoneTunnel *tunnel){ bcTunnel(tunnel)->reconnect(); } -void linphone_tunnel_auto_detect(LinphoneTunnelManager *tunnel){ +void linphone_tunnel_auto_detect(LinphoneTunnel *tunnel){ bcTunnel(tunnel)->autoDetect(); } -static inline _LpConfig *config(LinphoneTunnelManager *tunnel){ +static inline _LpConfig *config(LinphoneTunnel *tunnel){ return ((belledonnecomm::TunnelManager *)tunnel)->getLinphoneCore()->config; } /** * Set tunnel server addresses. "host1:port1 host2:port2 host3:port3" **/ -void linphone_tunnel_set_server_addresses(LinphoneTunnelManager *tunnel, const char *addresses){ +void linphone_tunnel_set_server_addresses(LinphoneTunnel *tunnel, const char *addresses){ lp_config_set_string(config(tunnel),"tunnel","server_addresses",addresses); } /** * Get tunnel server addresses. "host1:port1 host2:port2 host3:port3" **/ -const char *linphone_tunnel_get_server_addresses(LinphoneTunnelManager *tunnel){ +const char *linphone_tunnel_get_server_addresses(LinphoneTunnel *tunnel){ return lp_config_get_string(config(tunnel),"tunnel","server_addresses", NULL); } /** * Set tunnel state. **/ -void linphone_tunnel_set_state(LinphoneTunnelManager *tunnel, LinphoneTunnelState state){ +void linphone_tunnel_set_state(LinphoneTunnel *tunnel, LinphoneTunnelState state){ switch (state) { case LinphoneTunnelEnabled: lp_config_set_string(config(tunnel),"tunnel","tunnel_state","enabled"); @@ -126,7 +126,7 @@ void linphone_tunnel_set_state(LinphoneTunnelManager *tunnel, LinphoneTunnelStat /** * Get tunnel state. **/ -LinphoneTunnelState linphone_tunnel_get_state(LinphoneTunnelManager *tunnel){ +LinphoneTunnelState linphone_tunnel_get_state(LinphoneTunnel *tunnel){ const char *state=lp_config_get_string(config(tunnel),"tunnel","tunnel_state","disabled"); if (0==strcmp("enabled", state)){ return LinphoneTunnelEnabled; diff --git a/coreapi/linphone_tunnel_manager.h b/coreapi/linphone_tunnel_manager.h index 2569534e7..45e0db167 100644 --- a/coreapi/linphone_tunnel_manager.h +++ b/coreapi/linphone_tunnel_manager.h @@ -33,21 +33,21 @@ extern "C" { #endif -typedef struct LinphoneTunnelManager LinphoneTunnelManager; +typedef struct LinphoneTunnel LinphoneTunnel; typedef void (*LogHandler)(int log_level, const char *str, va_list l); -LinphoneTunnelManager *linphone_tunnel_get(LinphoneCore *lc); -void linphone_tunnel_destroy(LinphoneTunnelManager *tunnel); -void linphone_tunnel_add_server(LinphoneTunnelManager *tunnel, const char *host, int port); -void linphone_tunnel_add_server_and_mirror(LinphoneTunnelManager *tunnel, const char *host, int port, int remote_udp_mirror, int delay); -void linphone_tunnel_clean_servers(LinphoneTunnelManager *tunnel); -void linphone_tunnel_enable(LinphoneTunnelManager *tunnel, bool_t enabled); -bool_t linphone_tunnel_enabled(LinphoneTunnelManager *tunnel); -void linphone_tunnel_enable_logs(LinphoneTunnelManager *tunnel, bool_t enabled); -void linphone_tunnel_enable_logs_with_handler(LinphoneTunnelManager *tunnel, bool_t enabled, LogHandler logHandler); -void linphone_tunnel_reconnect(LinphoneTunnelManager *tunnel); -void linphone_tunnel_auto_detect(LinphoneTunnelManager *tunnel); +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); +void linphone_tunnel_enable(LinphoneTunnel *tunnel, bool_t enabled); +bool_t linphone_tunnel_enabled(LinphoneTunnel *tunnel); +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); @@ -63,22 +63,22 @@ typedef enum _LinphoneTunnelState{ /** * Set tunnel addresses. **/ -void linphone_tunnel_set_server_addresses(LinphoneTunnelManager *tunnel, const char *lists); +void linphone_tunnel_set_server_addresses(LinphoneTunnel *tunnel, const char *lists); /** * Get tunnel addresses. **/ -const char *linphone_tunnel_get_server_addresses(LinphoneTunnelManager *tunnel); +const char *linphone_tunnel_get_server_addresses(LinphoneTunnel *tunnel); /** * Set tunnel state. **/ -void linphone_tunnel_set_state(LinphoneTunnelManager *tunnel, LinphoneTunnelState state); +void linphone_tunnel_set_state(LinphoneTunnel *tunnel, LinphoneTunnelState state); /** * Get tunnel state. **/ -LinphoneTunnelState linphone_tunnel_get_state(LinphoneTunnelManager *tunnel); +LinphoneTunnelState linphone_tunnel_get_state(LinphoneTunnel *tunnel); #ifdef __cplusplus diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index e9554b0a0..30f599762 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -998,7 +998,7 @@ static void misc_config_read (LinphoneCore *lc) { } #ifdef TUNNEL_ENABLED -static void tunnel_add_servers_from_config(LinphoneTunnelManager *tunnel, const char* confaddress){ +static void tunnel_add_servers_from_config(LinphoneTunnel *tunnel, const char* confaddress){ char *addresses=(char*)ms_strdup(confaddress); char *str1; for(str1=addresses;;str1=NULL){ diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index eca9152f4..0396fcd48 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1599,7 +1599,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setMaxCalls(JNIEnv *env, extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelAddServerAndMirror(JNIEnv *env,jobject thiz,jlong pCore, jstring jHost, jint port, jint mirror, jint delay) { #ifdef TUNNEL_ENABLED - LinphoneTunnelManager *tunnel=((LinphoneCore *) pCore)->tunnel; if (!tunnel) return; + LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel; if (!tunnel) return; const char* cHost=env->GetStringUTFChars(jHost, NULL); linphone_tunnel_add_server_and_mirror(tunnel, cHost, port, mirror, delay); env->ReleaseStringUTFChars(jHost, cHost); @@ -1608,28 +1608,28 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelAddServerAndMirror extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelAutoDetect(JNIEnv *env,jobject thiz,jlong pCore) { #ifdef TUNNEL_ENABLED - LinphoneTunnelManager *tunnel=((LinphoneCore *) pCore)->tunnel; if (!tunnel) return; + LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel; if (!tunnel) return; linphone_tunnel_auto_detect(tunnel); #endif } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelCleanServers(JNIEnv *env,jobject thiz,jlong pCore) { #ifdef TUNNEL_ENABLED - LinphoneTunnelManager *tunnel=((LinphoneCore *) pCore)->tunnel; if (!tunnel) return; + LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel; if (!tunnel) return; linphone_tunnel_clean_servers(tunnel); #endif } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelEnable(JNIEnv *env,jobject thiz,jlong pCore, jboolean enable) { #ifdef TUNNEL_ENABLED - LinphoneTunnelManager *tunnel=((LinphoneCore *) pCore)->tunnel; if (!tunnel) return; + LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel; if (!tunnel) return; linphone_tunnel_enable(tunnel, enable); #endif } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelEnableLogs(JNIEnv *env,jobject thiz,jlong pCore, jboolean enable) { #ifdef TUNNEL_ENABLED - LinphoneTunnelManager *tunnel=((LinphoneCore *) pCore)->tunnel; if (!tunnel) return; + LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel; if (!tunnel) return; linphone_tunnel_enable_logs(tunnel, enable); #endif } diff --git a/coreapi/private.h b/coreapi/private.h index bda52f016..987dd7951 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -476,11 +476,12 @@ struct _LinphoneCore int device_rotation; bool_t ringstream_autorelease; int max_calls; - LinphoneTunnelManager *tunnel; + LinphoneTunnel *tunnel; }; -LinphoneTunnelManager *linphone_core_tunnel_new(LinphoneCore *lc); - +LinphoneTunnel *linphone_core_tunnel_new(LinphoneCore *lc); +void linphone_tunnel_destroy(LinphoneTunnel *tunnel); + bool_t linphone_core_can_we_add_call(LinphoneCore *lc); int linphone_core_add_call( LinphoneCore *lc, LinphoneCall *call); int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call); @@ -544,6 +545,8 @@ void __linphone_core_invalidate_registers(LinphoneCore* lc); #endif void call_logs_write_to_config_file(LinphoneCore *lc); + + #ifdef __cplusplus } #endif diff --git a/gtk/propertybox.c b/gtk/propertybox.c index 7c414dc83..0e69550cd 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -1004,7 +1004,7 @@ void linphone_gtk_edit_tunnel_closed(GtkWidget *button){ } #ifdef TUNNEL_ENABLED -static void tunnel_get_server_host_and_port(LinphoneTunnelManager *tunnel, char *host, int size, int *port){ +static void tunnel_get_server_host_and_port(LinphoneTunnel *tunnel, char *host, int size, int *port){ char *colon; char *addresses=(char*)ms_strdup(linphone_tunnel_get_server_addresses(tunnel)); char *str1=addresses; @@ -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"); - LinphoneTunnelManager *tunnel=linphone_tunnel_get(lc); + LinphoneTunnel *tunnel=linphone_tunnel_get(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'}; - LinphoneTunnelManager *tunnel=linphone_tunnel_get(lc); + LinphoneTunnel *tunnel=linphone_tunnel_get(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"))); From 77cad2f045e1471d003c6bfb01ec87e19b1d86cc Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 22 Dec 2011 13:59:10 +0100 Subject: [PATCH 2/2] finilize tunnel api cleanup --- coreapi/Makefile.am | 11 +++++--- coreapi/TunnelManager.cc | 7 +++++- coreapi/TunnelManager.hh | 3 +++ ...e_tunnel_manager.cc => linphone_tunnel.cc} | 6 ++--- ...one_tunnel_manager.h => linphone_tunnel.h} | 8 ++---- coreapi/linphonecore.h | 25 +++++++++++-------- coreapi/linphonecore_jni.cc | 2 +- coreapi/private.h | 2 +- gtk/propertybox.c | 6 ++--- 9 files changed, 41 insertions(+), 29 deletions(-) rename coreapi/{linphone_tunnel_manager.cc => linphone_tunnel.cc} (97%) rename coreapi/{linphone_tunnel_manager.h => linphone_tunnel.h} (92%) diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index 20ab34878..659a9f78e 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -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 diff --git a/coreapi/TunnelManager.cc b/coreapi/TunnelManager.cc index 9d4ab7c35..2243119d4 100644 --- a/coreapi/TunnelManager.cc +++ b/coreapi/TunnelManager.cc @@ -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(){ diff --git a/coreapi/TunnelManager.hh b/coreapi/TunnelManager.hh index b6bc46723..89044cce7 100644 --- a/coreapi/TunnelManager.hh +++ b/coreapi/TunnelManager.hh @@ -11,6 +11,7 @@ #ifndef __TUNNEL_CLIENT_MANAGER_H__ #define __TUNNEL_CLIENT_MANAGER_H__ #include +#include #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; }; /** diff --git a/coreapi/linphone_tunnel_manager.cc b/coreapi/linphone_tunnel.cc similarity index 97% rename from coreapi/linphone_tunnel_manager.cc rename to coreapi/linphone_tunnel.cc index 6578b7495..5afccff3d 100644 --- a/coreapi/linphone_tunnel_manager.cc +++ b/coreapi/linphone_tunnel.cc @@ -1,5 +1,5 @@ /*************************************************************************** - * 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; } diff --git a/coreapi/linphone_tunnel_manager.h b/coreapi/linphone_tunnel.h similarity index 92% rename from coreapi/linphone_tunnel_manager.h rename to coreapi/linphone_tunnel.h index 45e0db167..6a2d5218e 100644 --- a/coreapi/linphone_tunnel_manager.h +++ b/coreapi/linphone_tunnel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * 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); /** diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index e32c4d0fa..b9cd9cae5 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -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 diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 0396fcd48..26dc0e035 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #ifdef TUNNEL_ENABLED -#include "linphone_tunnel_manager.h" +#include "linphone_tunnel.h" #endif extern "C" { diff --git a/coreapi/private.h b/coreapi/private.h index 987dd7951..a21fc8b20 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -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" diff --git a/gtk/propertybox.c b/gtk/propertybox.c index 0e69550cd..30890c765 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -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")));