From 1e041d19522292597b51ca5d16df6a80893968ec Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Mon, 30 Sep 2013 16:33:45 +0200 Subject: [PATCH] Added new advanced configuration options for async. --- client/Android/FreeRDPCore/.classpath | 3 +- .../Android/FreeRDPCore/jni/android_freerdp.c | 21 ++++-- .../Android/FreeRDPCore/jni/android_freerdp.h | 5 +- .../jni/generated/android_freerdp_jni.c | 9 ++- ..._freerdp_freerdpcore_services_LibFreeRDP.h | 4 +- .../FreeRDPCore/res/values-es/strings.xml | 4 ++ .../FreeRDPCore/res/values-fr/strings.xml | 4 ++ .../FreeRDPCore/res/values-nl/strings.xml | 4 ++ .../FreeRDPCore/res/values/strings.xml | 4 ++ .../FreeRDPCore/res/xml/advanced_settings.xml | 4 ++ .../freerdpcore/domain/BookmarkBase.java | 68 ++++++++++++++++++- .../services/BookmarkBaseGateway.java | 20 ++++++ .../freerdpcore/services/BookmarkDB.java | 10 ++- .../freerdpcore/services/LibFreeRDP.java | 9 ++- .../freerdpcore/utils/RDPFileParser.java | 4 ++ 15 files changed, 158 insertions(+), 15 deletions(-) diff --git a/client/Android/FreeRDPCore/.classpath b/client/Android/FreeRDPCore/.classpath index a4763d1ee..7bc01d9a9 100644 --- a/client/Android/FreeRDPCore/.classpath +++ b/client/Android/FreeRDPCore/.classpath @@ -3,6 +3,7 @@ - + + diff --git a/client/Android/FreeRDPCore/jni/android_freerdp.c b/client/Android/FreeRDPCore/jni/android_freerdp.c index f0046dcc5..43734eab7 100644 --- a/client/Android/FreeRDPCore/jni/android_freerdp.c +++ b/client/Android/FreeRDPCore/jni/android_freerdp.c @@ -134,7 +134,9 @@ BOOL android_post_connect(freerdp* instance) { DEBUG_ANDROID("android_post_connect"); - freerdp_callback("OnSettingsChanged", "(IIII)V", instance, instance->settings->DesktopWidth, instance->settings->DesktopHeight, instance->settings->ColorDepth); + freerdp_callback("OnSettingsChanged", "(IIII)V", instance, + instance->settings->DesktopWidth, instance->settings->DesktopHeight, + instance->settings->ColorDepth); instance->context->cache = cache_new(instance->settings); @@ -553,8 +555,10 @@ JNIEXPORT void JNICALL jni_freerdp_set_connection_info(JNIEnv *env, jclass cls, } JNIEXPORT void JNICALL jni_freerdp_set_performance_flags( - JNIEnv *env, jclass cls, jint instance, jboolean remotefx, jboolean disableWallpaper, jboolean disableFullWindowDrag, - jboolean disableMenuAnimations, jboolean disableTheming, jboolean enableFontSmoothing, jboolean enableDesktopComposition) + JNIEnv *env, jclass cls, jint instance, jboolean remotefx, + jboolean disableWallpaper, jboolean disableFullWindowDrag, + jboolean disableMenuAnimations, jboolean disableTheming, + jboolean enableFontSmoothing, jboolean enableDesktopComposition) { freerdp* inst = (freerdp*)instance; rdpSettings * settings = inst->settings; @@ -617,7 +621,10 @@ JNIEXPORT void JNICALL jni_freerdp_set_performance_flags( DEBUG_ANDROID("performance_flags: %04X", settings->PerformanceFlags); } -JNIEXPORT void JNICALL jni_freerdp_set_advanced_settings(JNIEnv *env, jclass cls, jint instance, jstring jRemoteProgram, jstring jWorkDir) +JNIEXPORT void JNICALL jni_freerdp_set_advanced_settings(JNIEnv *env, jclass cls, + jint instance, jstring jRemoteProgram, jstring jWorkDir, + jboolean async_channel, jboolean async_transport, jboolean async_input, + jboolean async_update) { freerdp* inst = (freerdp*)instance; rdpSettings * settings = inst->settings; @@ -628,6 +635,12 @@ JNIEXPORT void JNICALL jni_freerdp_set_advanced_settings(JNIEnv *env, jclass cls DEBUG_ANDROID("Remote Program: %s", (char*) remote_program); DEBUG_ANDROID("Work Dir: %s", (char*) work_dir); + /* Enable async mode. */ + settings->AsyncUpdate = async_update; + settings->AsyncChannels = async_channel; + settings->AsyncTransport = async_transport; + settings->AsyncInput = async_input; + if(remote_program && strlen(remote_program) > 0) settings->AlternateShell = strdup(remote_program); diff --git a/client/Android/FreeRDPCore/jni/android_freerdp.h b/client/Android/FreeRDPCore/jni/android_freerdp.h index ad96bc398..a06ab0cc4 100644 --- a/client/Android/FreeRDPCore/jni/android_freerdp.h +++ b/client/Android/FreeRDPCore/jni/android_freerdp.h @@ -43,7 +43,10 @@ JNIEXPORT void JNICALL jni_freerdp_set_connection_info(JNIEnv *env, jclass cls, jint height, jint color_depth, jint port, jboolean console, jint security, jstring jcertname); JNIEXPORT void JNICALL jni_freerdp_set_performance_flags(JNIEnv *env, jclass cls, jint instance, jboolean remotefx, jboolean disableWallpaper, jboolean disableFullWindowDrag, jboolean disableMenuAnimations, jboolean disableTheming, jboolean enableFontSmoothing, jboolean enableDesktopComposition); -JNIEXPORT void JNICALL jni_freerdp_set_advanced_settings(JNIEnv *env, jclass cls, jint instance, jstring jRemoteProgram, jstring jWorkDir); +JNIEXPORT void JNICALL jni_freerdp_set_advanced_settings(JNIEnv *env, jclass cls, + jint instance, jstring jRemoteProgram, jstring jWorkDir, + jboolean async_channel, jboolean async_transport, jboolean async_input, + jboolean async_update); JNIEXPORT void JNICALL jni_freerdp_set_drive_redirection(JNIEnv *env, jclass cls, jint instance, jstring jpath); JNIEXPORT void JNICALL jni_freerdp_set_clipboard_redirection(JNIEnv *env, jclass cls, jint instance, jboolean enable); JNIEXPORT void JNICALL jni_freerdp_set_gateway_info(JNIEnv *env, jclass cls, jint instance, jstring jgatewayhostname, jint port, jstring jgatewayusername, jstring jgatewaypassword, jstring jgatewaydomain); diff --git a/client/Android/FreeRDPCore/jni/generated/android_freerdp_jni.c b/client/Android/FreeRDPCore/jni/generated/android_freerdp_jni.c index 1aa889abe..9a80fcd2a 100644 --- a/client/Android/FreeRDPCore/jni/generated/android_freerdp_jni.c +++ b/client/Android/FreeRDPCore/jni/generated/android_freerdp_jni.c @@ -53,9 +53,14 @@ JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_ width, height, color_depth, port, console, security, certname); } -JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1advanced_1settings(JNIEnv *env, jclass cls, jint instance, jstring remote_program, jstring work_dir) +JNIEXPORT void JNICALL +Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1advanced_1settings( + JNIEnv *env, jclass cls, jint instance, jstring remote_program, jstring work_dir, + jboolean async_channel, jboolean async_transport, jboolean async_input, + jboolean async_update) { - jni_freerdp_set_advanced_settings(env, cls, instance, remote_program, work_dir); + jni_freerdp_set_advanced_settings(env, cls, instance, remote_program, work_dir, + async_channel, async_transport, async_input, async_update); } JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1data_1directory(JNIEnv *env, jclass cls, jint instance, jstring directory) diff --git a/client/Android/FreeRDPCore/jni/generated/com_freerdp_freerdpcore_services_LibFreeRDP.h b/client/Android/FreeRDPCore/jni/generated/com_freerdp_freerdpcore_services_LibFreeRDP.h index 1e6be8dff..591919f3a 100644 --- a/client/Android/FreeRDPCore/jni/generated/com_freerdp_freerdpcore_services_LibFreeRDP.h +++ b/client/Android/FreeRDPCore/jni/generated/com_freerdp_freerdpcore_services_LibFreeRDP.h @@ -66,10 +66,10 @@ JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_ /* * Class: com_freerdp_freerdpcore_services_LibFreeRDP * Method: freerdp_set_advanced_settings - * Signature: (ILjava/lang/String;Ljava/lang/String;)V + * Signature: (ILjava/lang/String;Ljava/lang/String;ZZZZ)V */ JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1advanced_1settings - (JNIEnv *, jclass, jint, jstring, jstring); + (JNIEnv *, jclass, jint, jstring, jstring, jboolean, jboolean, jboolean, jboolean); /* * Class: com_freerdp_freerdpcore_services_LibFreeRDP diff --git a/client/Android/FreeRDPCore/res/values-es/strings.xml b/client/Android/FreeRDPCore/res/values-es/strings.xml index e539660de..88cd0db32 100644 --- a/client/Android/FreeRDPCore/res/values-es/strings.xml +++ b/client/Android/FreeRDPCore/res/values-es/strings.xml @@ -130,6 +130,10 @@ Programa Remoto Directorio de trabajo + Async channel + Async transport + Async input + Async update Modo Consola ******* diff --git a/client/Android/FreeRDPCore/res/values-fr/strings.xml b/client/Android/FreeRDPCore/res/values-fr/strings.xml index ffd74bf32..b851843c6 100644 --- a/client/Android/FreeRDPCore/res/values-fr/strings.xml +++ b/client/Android/FreeRDPCore/res/values-fr/strings.xml @@ -129,6 +129,10 @@ "Lancement de programme" "RĂ©pertoire de travail" + Async channel + Async transport + Async input + Async update "Mode console" "*******" diff --git a/client/Android/FreeRDPCore/res/values-nl/strings.xml b/client/Android/FreeRDPCore/res/values-nl/strings.xml index 03c694aa5..9092b07b3 100644 --- a/client/Android/FreeRDPCore/res/values-nl/strings.xml +++ b/client/Android/FreeRDPCore/res/values-nl/strings.xml @@ -130,6 +130,10 @@ Extern programma Werkmap + Async channel + Async transport + Async input + Async update Console modus ******* diff --git a/client/Android/FreeRDPCore/res/values/strings.xml b/client/Android/FreeRDPCore/res/values/strings.xml index 0f6aacded..1fdd5fa84 100644 --- a/client/Android/FreeRDPCore/res/values/strings.xml +++ b/client/Android/FreeRDPCore/res/values/strings.xml @@ -127,6 +127,10 @@ Remote Program Working Directory + Async channel + Async transport + Async input + Async update Console Mode ******* diff --git a/client/Android/FreeRDPCore/res/xml/advanced_settings.xml b/client/Android/FreeRDPCore/res/xml/advanced_settings.xml index 61cd61d19..b5d010170 100644 --- a/client/Android/FreeRDPCore/res/xml/advanced_settings.xml +++ b/client/Android/FreeRDPCore/res/xml/advanced_settings.xml @@ -39,6 +39,10 @@ + + + + diff --git a/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/domain/BookmarkBase.java b/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/domain/BookmarkBase.java index 8db15b864..efd80b38f 100644 --- a/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/domain/BookmarkBase.java +++ b/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/domain/BookmarkBase.java @@ -299,6 +299,10 @@ public class BookmarkBase implements Parcelable, Cloneable private boolean consoleMode; private String remoteProgram; private String workDir; + private boolean asyncChannel; + private boolean asyncTransport; + private boolean asyncInput; + private boolean asyncUpdate; public AdvancedSettings() { init(); @@ -312,7 +316,11 @@ public class BookmarkBase implements Parcelable, Cloneable security = parcel.readInt(); consoleMode = (parcel.readInt() == 1) ? true : false; remoteProgram = parcel.readString(); - workDir = parcel.readString(); + workDir = parcel.readString(); + asyncChannel = (parcel.readInt() == 1) ? true : false; + asyncTransport = (parcel.readInt() == 1) ? true : false; + asyncInput = (parcel.readInt() == 1) ? true : false; + asyncUpdate = (parcel.readInt() == 1) ? true : false; } private void init() { @@ -324,6 +332,10 @@ public class BookmarkBase implements Parcelable, Cloneable consoleMode = false; remoteProgram = ""; workDir = ""; + asyncChannel = true; + asyncTransport = true; + asyncInput = true; + asyncUpdate = true; } public void setEnable3GSettings(boolean enable3GSettings) { @@ -393,7 +405,47 @@ public class BookmarkBase implements Parcelable, Cloneable { return workDir; } - + + public boolean getAsyncTransport() + { + return asyncTransport; + } + + public void setAsyncTransport(boolean enabled) + { + asyncTransport = enabled; + } + + public boolean getAsyncUpdate() + { + return asyncUpdate; + } + + public void setAsyncUpdate(boolean enabled) + { + asyncUpdate = enabled; + } + + public boolean getAsyncInput() + { + return asyncInput; + } + + public void setAsyncInput(boolean enabled) + { + asyncInput = enabled; + } + + public void setAsyncChannel(boolean enabled) + { + asyncChannel = enabled; + } + + public boolean getAsyncChannel() + { + return asyncChannel; + } + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { public AdvancedSettings createFromParcel(Parcel in) { @@ -422,6 +474,10 @@ public class BookmarkBase implements Parcelable, Cloneable out.writeInt(consoleMode ? 1 : 0); out.writeString(remoteProgram); out.writeString(workDir); + out.writeInt(asyncChannel ? 1 : 0); + out.writeInt(asyncTransport ? 1 : 0); + out.writeInt(asyncInput ? 1 : 0); + out.writeInt(asyncUpdate ? 1 : 0); } } @@ -623,6 +679,10 @@ public class BookmarkBase implements Parcelable, Cloneable editor.putInt("bookmark.security", advancedSettings.getSecurity()); editor.putString("bookmark.remote_program", advancedSettings.getRemoteProgram()); editor.putString("bookmark.work_dir", advancedSettings.getWorkDir()); + editor.putBoolean("bookmark.async_channel", advancedSettings.getAsyncChannel()); + editor.putBoolean("bookmark.async_transport", advancedSettings.getAsyncTransport()); + editor.putBoolean("bookmark.async_input", advancedSettings.getAsyncInput()); + editor.putBoolean("bookmark.async_update", advancedSettings.getAsyncUpdate()); editor.putBoolean("bookmark.console_mode", advancedSettings.getConsoleMode()); editor.commit(); @@ -665,6 +725,10 @@ public class BookmarkBase implements Parcelable, Cloneable advancedSettings.setSecurity(sharedPrefs.getInt("bookmark.security", 0)); advancedSettings.setRemoteProgram(sharedPrefs.getString("bookmark.remote_program", "")); advancedSettings.setWorkDir(sharedPrefs.getString("bookmark.work_dir", "")); + advancedSettings.setAsyncChannel(sharedPrefs.getBoolean("bookmark.async_channel", true)); + advancedSettings.setAsyncTransport(sharedPrefs.getBoolean("bookmark.async_transport", true)); + advancedSettings.setAsyncInput(sharedPrefs.getBoolean("bookmark.async_input", true)); + advancedSettings.setAsyncUpdate(sharedPrefs.getBoolean("bookmark.async_update", true)); advancedSettings.setConsoleMode(sharedPrefs.getBoolean("bookmark.console_mode", false)); } diff --git a/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/services/BookmarkBaseGateway.java b/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/services/BookmarkBaseGateway.java index 7f6a939b1..22c728a2f 100644 --- a/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/services/BookmarkBaseGateway.java +++ b/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/services/BookmarkBaseGateway.java @@ -68,6 +68,10 @@ public abstract class BookmarkBaseGateway values.put("console_mode", bookmark.getAdvancedSettings().getConsoleMode()); values.put("remote_program", bookmark.getAdvancedSettings().getRemoteProgram()); values.put("work_dir", bookmark.getAdvancedSettings().getWorkDir()); + values.put("async_channel", bookmark.getAdvancedSettings().getAsyncChannel()); + values.put("async_transport", bookmark.getAdvancedSettings().getAsyncTransport()); + values.put("async_input", bookmark.getAdvancedSettings().getAsyncInput()); + values.put("async_update", bookmark.getAdvancedSettings().getAsyncUpdate()); // add any special columns addBookmarkSpecificColumns(bookmark, values); @@ -104,6 +108,10 @@ public abstract class BookmarkBaseGateway values.put("console_mode", bookmark.getAdvancedSettings().getConsoleMode()); values.put("remote_program", bookmark.getAdvancedSettings().getRemoteProgram()); values.put("work_dir", bookmark.getAdvancedSettings().getWorkDir()); + values.put("async_channel", bookmark.getAdvancedSettings().getAsyncChannel()); + values.put("async_transport", bookmark.getAdvancedSettings().getAsyncTransport()); + values.put("async_input", bookmark.getAdvancedSettings().getAsyncInput()); + values.put("async_update", bookmark.getAdvancedSettings().getAsyncUpdate()); addBookmarkSpecificColumns(bookmark, values); @@ -223,6 +231,10 @@ public abstract class BookmarkBaseGateway columns.add("console_mode"); columns.add("remote_program"); columns.add("work_dir"); + columns.add("async_channel"); + columns.add("async_transport"); + columns.add("async_input"); + columns.add("async_update"); addBookmarkSpecificColumns(columns); } @@ -281,6 +293,14 @@ public abstract class BookmarkBaseGateway bookmark.getAdvancedSettings().setConsoleMode(cursor.getInt(cursor.getColumnIndex("console_mode")) == 0 ? false : true); bookmark.getAdvancedSettings().setRemoteProgram(cursor.getString(cursor.getColumnIndex("remote_program"))); bookmark.getAdvancedSettings().setWorkDir(cursor.getString(cursor.getColumnIndex("work_dir"))); + bookmark.getAdvancedSettings().setAsyncChannel( + cursor.getInt(cursor.getColumnIndex("async_channel")) == 1 ? true : false); + bookmark.getAdvancedSettings().setAsyncTransport( + cursor.getInt(cursor.getColumnIndex("async_transport")) == 1 ? true : false); + bookmark.getAdvancedSettings().setAsyncInput( + cursor.getInt(cursor.getColumnIndex("async_input")) == 1 ? true : false); + bookmark.getAdvancedSettings().setAsyncUpdate( + cursor.getInt(cursor.getColumnIndex("async_update")) == 1 ? true : false); readBookmarkSpecificColumns(bookmark, cursor); diff --git a/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/services/BookmarkDB.java b/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/services/BookmarkDB.java index e54cc1502..9aa06202e 100644 --- a/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/services/BookmarkDB.java +++ b/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/services/BookmarkDB.java @@ -22,7 +22,7 @@ import android.database.sqlite.SQLiteOpenHelper; public class BookmarkDB extends SQLiteOpenHelper { - private static final int DB_VERSION = 3; + private static final int DB_VERSION = 5; private static final String DB_NAME = "bookmarks.db"; public static final String ID = BaseColumns._ID; @@ -104,6 +104,10 @@ public class BookmarkDB extends SQLiteOpenHelper + "security, " + "remote_program, " + "work_dir, " + + "async_channel, " + + "async_transport, " + + "async_input, " + + "async_update, " + "console_mode) " + "VALUES ( " + "'Test Server', " @@ -144,6 +148,10 @@ public class BookmarkDB extends SQLiteOpenHelper + "security INTEGER, " + "remote_program TEXT, " + "work_dir TEXT, " + + "async_channel INTEGER DEFAULT 0, " + + "async_transport INTEGER DEFAULT 0, " + + "async_input INTEGER DEFAULT 0, " + + "async_update INTEGER DEFAULT 0, " + "console_mode INTEGER, " + "FOREIGN KEY(screen_settings) REFERENCES tbl_screen_settings(" + ID + "), " diff --git a/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/services/LibFreeRDP.java b/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/services/LibFreeRDP.java index 54de217c9..331b47285 100644 --- a/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/services/LibFreeRDP.java +++ b/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/services/LibFreeRDP.java @@ -35,7 +35,9 @@ public class LibFreeRDP boolean disableMenuAnimations, boolean disableTheming, boolean enableFontSmoothing, boolean enableDesktopComposition); - private static native void freerdp_set_advanced_settings(int inst, String remoteProgram, String workDir); + private static native void freerdp_set_advanced_settings(int inst, + String remoteProgram, String workDir, boolean async_channel, + boolean async_transport, boolean async_input, boolean async_update); private static native void freerdp_set_data_directory(int inst, String directory); @@ -149,7 +151,10 @@ public class LibFreeRDP flags.getDesktopComposition()); BookmarkBase.AdvancedSettings advancedSettings = bookmark.getAdvancedSettings(); - freerdp_set_advanced_settings(inst, advancedSettings.getRemoteProgram(), advancedSettings.getWorkDir()); + freerdp_set_advanced_settings(inst, advancedSettings.getRemoteProgram(), + advancedSettings.getWorkDir(), advancedSettings.getAsyncChannel(), + advancedSettings.getAsyncTransport(), advancedSettings.getAsyncInput(), + advancedSettings.getAsyncUpdate()); // drive redirection enabled? if (advancedSettings.getRedirectSDCard()) diff --git a/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/utils/RDPFileParser.java b/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/utils/RDPFileParser.java index a903ed2eb..3ce52ff8d 100644 --- a/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/utils/RDPFileParser.java +++ b/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/utils/RDPFileParser.java @@ -52,7 +52,10 @@ public class RDPFileParser { lines++; ok = false; if (errors > MAX_ERRORS || lines > MAX_LINES) + { + br.close(); throw new IOException("Parsing limits exceeded"); + } String[] fields = line.split(":", 3); @@ -81,6 +84,7 @@ public class RDPFileParser { if (!ok) errors++; } + br.close(); } public String getString(String optionName)