00001 /* 00002 * This file is part of connectionMgr. 00003 * 00004 * connectionMgr is free software: you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation, either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * connectionMgr is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00028 #ifndef _CONNECTION_MGR_H_ 00029 #define _CONNECTION_MGR_H_ 00030 00031 #include <gtk/gtk.h> 00032 #include <gdk/gdkkeysyms.h> 00033 #include <glib.h> 00034 #include <liberregxml/erregapi.h> 00035 #ifdef ECDC_LIBRARY 00036 #include "ecdc.h" 00037 #else 00038 #include "ecdc_err.h" 00039 #endif 00040 #include "commonData.h" 00041 #include "connectScan.h" 00042 #include "connectPing.h" 00043 #include "connectScreen.h" 00044 #include "editScreen.h" 00045 00046 // connection manager constants 00047 #define COMMAND_WIRED "wired.sh" 00048 #define COMMAND_IFUP_WIRED "wired.sh start" 00049 00050 #define COMMAND_WIRELESS "wireless.sh" 00051 #define COMMAND_IFUP_WIRELESS "wireless.sh start" 00052 #define COMMAND_IFDOWN_ALL "cifs.sh umount ; wireless.sh stop ; wired.sh stop ; dialup.sh stop" 00053 #define COMMAND_SCAN_WIRELESS "wireless.sh scan" 00054 #define COMMAND_STATUS_WIRELESS "wireless.sh status" 00055 #define COMMAND_DIALUP "dialup.sh" 00056 #define COMMAND_STATUS_DIALUP "dialup.sh status" 00057 00058 #define INTERFACE_WIRED "eth0" 00059 #define INTERFACE_WIRELESS "wlan0" 00060 00061 #define INTERFACES_FILE_TMP "/tmp/interfaces.tmp" 00062 #define RESOLVE_CONF_FILE_TMP "/tmp/resolv.conf.tmp" 00063 #define HTTP_PROXY_FILE_TMP "/tmp/http_proxy.tmp" 00064 00065 #define COMMAND_MOUNT_SAMBA "cifs.sh" 00066 00067 // Note: the options passed to the program, are hardcoded 00068 #define DOWNLOADMGR_EXECUTABLE "/usr/bin/downloadMgr" 00069 #define PCSHAREMGR_EXECUTABLE "/usr/bin/pcshareMgr" 00070 00071 // Screen-set actually displayed 00072 typedef enum 00073 { 00074 cmgrScreenConnect_e = 0, 00075 cmgrScreenEdit_e, 00076 cmgrScreenUndef_e 00077 } cmgrScreen_t; 00078 00079 typedef struct 00080 { 00081 cmgrScreen_t screen; 00082 int page; 00083 }screenPage_t; 00084 00085 typedef void (*on_tbsync_action_t) (void); 00086 00087 #ifdef __cplusplus 00088 extern "C" 00089 { 00090 #endif /* __cplusplus */ 00091 00092 // command-line options 00093 gboolean main_get_background(void); 00094 cmgrConnectType_t main_get_connect_type(void); 00095 gboolean main_get_edit_only(void); 00096 gboolean main_get_use_last_connected(void); 00097 gboolean main_get_connect_after_reboot(void); 00098 gboolean main_get_wifi_disabled(void); 00099 gboolean main_get_dialup_disabled(void); 00100 char* main_get_screen_title(void); 00101 00102 // screen management 00103 void cmgr_set_screen_mode(cmgrScreen_t mode); 00104 cmgrScreen_t cmgr_get_screen_mode(void); 00105 00106 GtkWidget* cmgr_screens_create(void); 00107 void cmgr_set_pagebar(); 00108 00109 void cmgr_add_on_toolbar_sync_action(on_tbsync_action_t action); 00110 00111 guint on_cmgr_keypress(GtkWidget *widget, 00112 GdkEventKey *event, 00113 gpointer data); 00114 00115 void main_start_child_process(void); 00116 void main_quit(void); 00117 00118 void show_keyboard(gboolean show); 00119 00120 // UP/BACK one page 00121 void cmgr_get_back_page(const screenPage_t *curPage, 00122 screenPage_t *backPage); 00123 void cmgr_up_page(void); 00124 void cmgr_back_page(void); 00125 00126 // IPC 00127 gboolean cmgrInstallIpcServer(void); 00128 gboolean cmgrStartIpcClientSetup(void); 00129 00130 // registry 00131 void prepare_registry_write( void); 00132 void do_registry_write(void); 00133 00134 // enable/disable network 00135 void cmgr_scan_ctxt_init(void); 00136 void cmgr_scan_ctxt_destory(void); 00137 scanContext_t *cmgr_get_scan_ctxt(void); 00138 void cmgr_ping_ctxt_init(void); 00139 void cmgr_ping_ctxt_destory(void); 00140 pingContext_t *cmgr_get_ping_ctxt(void); 00141 00142 void connect_disable_network(void); 00143 ecd_err_t connect_enable_network(const regNetworkProfile_t *setting); 00144 void connect_enable_network_abort(void); 00145 00146 void main_set_exit_value(int exitValue); 00147 gboolean on_cmgr_quit(gpointer data); 00148 00149 #ifdef __cplusplus 00150 } 00151 #endif /* __cplusplus */ 00152 00153 #endif //_CONNECTION_MGR_H_ 00154 00155 00156