1 /* 2 * Remmina - The GTK+ Remote Desktop Client 3 * Copyright (C) 2009-2011 Vic Lee 4 * Copyright (C) 2014-2015 Antenore Gatta, Fabio Castelli, Giovanni Panozzo 5 * Copyright (C) 2016-2021 Antenore Gatta, Giovanni Panozzo 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * Boston, MA 02110-1301, USA. 21 * 22 * In addition, as a special exception, the copyright holders give 23 * permission to link the code of portions of this program with the 24 * OpenSSL library under certain conditions as described in each 25 * individual source file, and distribute linked combinations 26 * including the two. 27 * You must obey the GNU General Public License in all respects 28 * for all of the code used other than OpenSSL. * If you modify 29 * file(s) with this exception, you may extend this exception to your 30 * version of the file(s), but you are not obligated to do so. * If you 31 * do not wish to do so, delete this exception statement from your 32 * version. * If you delete this exception statement from all source 33 * files in the program, then also delete it here. 34 * 35 */ 36 37 #include <pthread.h> 38 #include "remmina_protocol_widget.h" 39 #include "remmina_sftp_client.h" 40 #include "remmina_ftp_client.h" 41 #include "remmina_ssh_plugin.h" 42 43 typedef struct remmina_masterthread_exec_data { 44 enum { FUNC_GTK_LABEL_SET_TEXT, 45 FUNC_INIT_SAVE_CRED, FUNC_CHAT_RECEIVE, FUNC_FILE_GET_STRING, 46 FUNC_FTP_CLIENT_UPDATE_TASK, FUNC_FTP_CLIENT_GET_WAITING_TASK, 47 FUNC_SFTP_CLIENT_CONFIRM_RESUME, 48 FUNC_PROTOCOLWIDGET_EMIT_SIGNAL, 49 FUNC_PROTOCOLWIDGET_MPPROGRESS, 50 FUNC_PROTOCOLWIDGET_MPDESTROY, 51 FUNC_PROTOCOLWIDGET_MPSHOWRETRY, 52 FUNC_PROTOCOLWIDGET_PANELSHOWLISTEN, 53 FUNC_VTE_TERMINAL_SET_ENCODING_AND_PTY } func; 54 55 union { 56 struct { 57 GtkLabel * label; 58 const gchar * str; 59 } gtk_label_set_text; 60 struct { 61 RemminaProtocolWidget *gp; 62 } init_save_creds; 63 struct { 64 RemminaProtocolWidget * gp; 65 const gchar * text; 66 } chat_receive; 67 struct { 68 RemminaFile * remminafile; 69 const gchar * setting; 70 const gchar * retval; 71 } file_get_string; 72 struct { 73 RemminaFTPClient * client; 74 RemminaFTPTask * task; 75 } ftp_client_update_task; 76 struct { 77 RemminaFTPClient * client; 78 RemminaFTPTask * retval; 79 } ftp_client_get_waiting_task; 80 struct { 81 RemminaProtocolWidget * gp; 82 const gchar * signal_name; 83 } protocolwidget_emit_signal; 84 struct { 85 RemminaConnectionObject * cnnobj; 86 const gchar * message; 87 RemminaMessagePanelCallback response_callback; 88 gpointer response_callback_data; 89 RemminaMessagePanel * ret_mp; 90 } protocolwidget_mpprogress; 91 struct { 92 RemminaConnectionObject * cnnobj; 93 RemminaMessagePanel * mp; 94 } protocolwidget_mpdestroy; 95 struct { 96 RemminaProtocolWidget *gp; 97 } protocolwidget_mpshowretry; 98 struct { 99 RemminaProtocolWidget * gp; 100 int port; 101 } protocolwidget_panelshowlisten; 102 #ifdef HAVE_LIBSSH 103 struct { 104 RemminaSFTPClient * client; 105 const gchar * path; 106 gint retval; 107 } sftp_client_confirm_resume; 108 #endif 109 #ifdef HAVE_LIBVTE 110 struct { 111 VteTerminal * terminal; 112 const char * codeset; 113 int master; 114 int slave; 115 } vte_terminal_set_encoding_and_pty; 116 #endif 117 } p; 118 119 /* Mutex for thread synchronization */ 120 pthread_mutex_t pt_mutex; 121 pthread_cond_t pt_cond; 122 /* Flag to catch cancellations */ 123 gboolean cancelled; 124 gboolean complete; 125 } RemminaMTExecData; 126 127 void remmina_masterthread_exec_and_wait(RemminaMTExecData *d); 128 129 void remmina_masterthread_exec_save_main_thread_id(void); 130 gboolean remmina_masterthread_exec_is_main_thread(void); 131