]> sjero.net Git - linphone/commitdiff
fix tunnel code for android
authorJehan Monnier <jehan.monnier@linphone.org>
Fri, 18 May 2012 10:37:06 +0000 (12:37 +0200)
committerJehan Monnier <jehan.monnier@linphone.org>
Fri, 18 May 2012 10:38:08 +0000 (12:38 +0200)
coreapi/linphone_tunnel.cc
coreapi/linphone_tunnel.h
coreapi/linphonecore_jni.cc
java/common/org/linphone/core/LinphoneCore.java

index 1cc940f4b4c0a6d1065c2063c1e689a6e06b3eae..d36778bb8be811d71734b867de28d77b15fffe69 100644 (file)
@@ -196,7 +196,6 @@ void linphone_tunnel_configure(LinphoneTunnel *tunnel){
        linphone_tunnel_enable(tunnel, enabled);
 }
 
-
 #else
 
 /*stubs to avoid to have #ifdef TUNNEL_ENABLED in upper layers*/
@@ -225,8 +224,6 @@ bool_t linphone_tunnel_enabled(LinphoneTunnel *tunnel){
        return FALSE;
 }
 
-void linphone_tunnel_enable_logs(LinphoneTunnel *tunnel, bool_t enabled){
-}
 
 void linphone_tunnel_enable_logs_with_handler(LinphoneTunnel *tunnel, bool_t enabled, OrtpLogFunc logHandler){
 }
index 362c49f1a8569b489b4dc883f8f1f86ee2cd742a..539668904f654c95bfe6ff373ebc255ed582e655 100644 (file)
 
 #include "linphonecore.h"
 
-/*
- * Linphone VoIP tunnel extension API
+/**
+ * @addtogroup tunnel
+ * @{
 **/
 
+       /**
+        * This set of methods enhance  LinphoneCore functionalities in order to provide an easy to use API to
+        * - provision tunnel servers ip addresses and ports. This functionality is an option not implemented under GPL.
+        * - start/stop the tunneling service
+        * - perform auto-detection whether tunneling is required, based on a test of sending/receiving a flow of UDP packets.
+        *
+        * It takes in charge automatically the SIP registration procedure when connecting or disconnecting to a tunnel server.
+        * No other action on LinphoneCore is required to enable full operation in tunnel mode.
+       **/
+
 #ifdef __cplusplus
 extern "C"
 {
 #endif
 
-
+/**
+ * Add a tunnel server. At least one should be provided to be able to connect.
+ * When several addresses are provided, the tunnel client may try each of them until it gets connected.
+ * @param  tunnel object
+ * @param ip server ip address
+ * @param port tunnel server tls port, recommended value is 443
+ */
 void linphone_tunnel_add_server(LinphoneTunnel *tunnel, const char *host, int port);
+/**
+ *Add tunnel server with auto detection capabilities
+ *
+ * @param  tunnel object
+ * @param ip tunnel server ip address
+ * @param port tunnel server tls port, recommended value is 443
+ * @param remote_udp_mirror remote port on the tunnel server side  used to test udp reachability
+ * @param delay udp packet round trip delay in ms considered as acceptable. recommended value is 1000 ms.
+ */
 void linphone_tunnel_add_server_and_mirror(LinphoneTunnel *tunnel, const char *host, int port, int remote_udp_mirror, int delay);
-/*returns a string of space separated list of host:port of tunnel server addresses*/
+/**
+ * @param  tunnel object
+ * returns a string of space separated list of host:port of tunnel server addresses
+ * */
 char *linphone_tunnel_get_servers(LinphoneTunnel *tunnel);
+/**
+ * @param  tunnel object
+ * Removes all tunnel server address previously entered with addServer()
+**/
 void linphone_tunnel_clean_servers(LinphoneTunnel *tunnel);
+/**
+ * Sets whether tunneling of SIP and RTP is required.
+ * @param  tunnel object
+ * @param isEnabled If true enter in tunneled mode, if false exits from tunneled mode.
+ * The TunnelManager takes care of refreshing SIP registration when switching on or off the tunneled mode.
+ *
+**/
 void linphone_tunnel_enable(LinphoneTunnel *tunnel, bool_t enabled);
+/**
+ * @param  tunnel object
+ * Returns a boolean indicating whether tunneled operation is enabled.
+**/
 bool_t linphone_tunnel_enabled(LinphoneTunnel *tunnel);
+/**
+ * @param  tunnel object
+ * Forces reconnection to the tunnel server.
+ * This method is useful when the device switches from wifi to Edge/3G or vice versa. In most cases the tunnel client socket
+ * won't be notified promptly that its connection is now zombie, so it is recommended to call this method that will cause
+ * the lost connection to be closed and new connection to be issued.
+**/
 void linphone_tunnel_reconnect(LinphoneTunnel *tunnel);
+/**
+ * @param  tunnel object
+ * In auto detect mode, the tunnel manager try to establish a real time rtp cummunication with the tunnel server on  specified port.
+ *<br>In case of success, the tunnel is automatically turned off. Otherwise, if no udp commmunication is feasible, tunnel mode is turned on.
+ *<br> Call this method each time to run the auto detection algorithm
+ */
 void linphone_tunnel_auto_detect(LinphoneTunnel *tunnel);
 void linphone_tunnel_set_http_proxy(LinphoneTunnel *tunnel, const char *host, int port, const char* username,const char* passwd);
 void linphone_tunnel_set_http_proxy_auth_info(LinphoneTunnel*tunnel, const char* username,const char* passwd);
 
+void linphone_tunnel_enable_logs(LinphoneTunnel *tunnel, bool_t enabled);
 
 #ifdef __cplusplus
 }
index bec7bbba7d35c535d4b54d1839d233647925a3a8..61996143204ec7302d683ca6f9f679ff56aa1469 100644 (file)
@@ -1680,12 +1680,6 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelEnable(JNIEnv *env
 #endif
 }
 
-extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelEnableLogs(JNIEnv *env,jobject thiz,jlong pCore, jboolean enable) {
-#ifdef TUNNEL_ENABLED
-       LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel; if (!tunnel) return;
-       linphone_tunnel_enable_logs(tunnel, enable);
-#endif
-}
 
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUserAgent(JNIEnv *env,jobject thiz,jlong pCore, jstring name, jstring version){
        const char* cname=env->GetStringUTFChars(name, NULL);
index f33415b46cc9cbc6e4fd5d4f9401552b97ff6a8c..0d8e14ae9aa2af4ffb4e5cc6729237140ff27640 100644 (file)
@@ -741,7 +741,6 @@ public interface LinphoneCore {
        void setPlayFile(String path);
        void tunnelEnable(boolean enable);
        void tunnelAutoDetect();
-       void tunnelEnableLogs(boolean enable);
        void tunnelCleanServers();
        /**
         * @param host tunnel server ip address