2 * This file is part of vpngui
4 * Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef VPNGUI_PLUGIN_H
23 #define VPNGUI_PLUGIN_H
25 #include <libhildondesktop/libhildondesktop.h>
29 #define VPNGUI_TYPE_PLUGIN (vpngui_plugin_get_type ())
30 #define VPNGUI_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VPNGUI_TYPE_PLUGIN, PluginInfo))
31 #define VPNGUI_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VPNGUI_TYPE_PLUGIN, PluginInfoClass))
32 #define VPNGUI_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VPNGUI_TYPE_PLUGIN))
33 #define VPNGUI_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VPNGUI_TYPE_PLUGIN))
34 #define VPNGUI_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VPNGUI_TYPE_PLUGIN, PluginInfoClass))
37 #include <gconf/gconf-client.h>
39 #include "vpn_notify.h"
41 #define ICON_ACTIVE "/usr/share/pixmaps/hiro-vpn/vpngui-on.png"
42 #define ICON_INACTIVE "/usr/share/pixmaps/hiro-vpn/vpngui-off.png"
43 #define ICON_SUSPENDED "/usr/share/pixmaps/hiro-vpn/vpngui-pending.png"
44 #define ICON_ACTIVE_SMALL "/usr/share/pixmaps/hiro-vpn/vpngui-on-small.png"
45 #define ICON_SUSPENDED_SMALL "/usr/share/pixmaps/hiro-vpn/vpngui-pending-small.png"
46 #define VPNC_CONNECT "sudo /usr/sbin/vpngui-helper connect"
47 #define VPNC_DISCONNECT "sudo /usr/sbin/vpngui-helper disconnect"
50 #define VPN_GCONF_PATH "/apps/osso/vpngui/ap"
51 #define VPN_GCONF_AP_PATH VPN_GCONF_PATH "/%s"
52 #define VPN_GCONF_AP_PATH_NO VPN_GCONF_PATH "/%d"
53 /* allow future expansion for more than one access point */
54 #define VPN_GCONF_VPN_NAME VPN_GCONF_AP_PATH "/name"
55 #define VPN_GCONF_VPN_NAME_NO VPN_GCONF_AP_PATH_NO "/name"
56 #define VPN_GCONF_USER VPN_GCONF_AP_PATH "/username"
57 #define VPN_GCONF_PASSWD VPN_GCONF_AP_PATH "/password"
58 #define VPN_GCONF_PASSWD_OBF VPN_GCONF_AP_PATH "/password_obf"
59 #define VPN_GCONF_GWADDR VPN_GCONF_AP_PATH "/gateway"
60 #define VPN_GCONF_GROUP VPN_GCONF_AP_PATH "/group"
61 #define VPN_GCONF_SECRET VPN_GCONF_AP_PATH "/secret"
62 #define VPN_GCONF_SECRET_OBF VPN_GCONF_AP_PATH "/secret_obf"
63 #define VPN_GCONF_PROXY_MODE VPN_GCONF_AP_PATH "/proxytype"
64 #define VPN_GCONF_PROXY_SERVER VPN_GCONF_AP_PATH "/proxy_server"
65 #define VPN_GCONF_PROXY_PORT VPN_GCONF_AP_PATH "/proxy_port"
66 #define VPN_GCONF_PROXY_AUTOCONFIG_URL VPN_GCONF_AP_PATH "/proxy_autoconfig_url"
67 #define VPN_GCONF_PROXY_IGNORE_HOSTS VPN_GCONF_AP_PATH "/proxy_ignore_hosts"
70 #define VPN_GCONF_REKEY_INTERVAL VPN_GCONF_AP_PATH "/rekey_interval"
71 #define VPN_GCONF_NAT_KEEPALIVE VPN_GCONF_AP_PATH "/nat_keepalive"
73 /* Common for all connections */
74 //#define VPN_REKEY_INTERVAL 3000
75 #define VPN_REKEY_INTERVAL 17280
76 #define VPN_NAT_KEEPALIVE 50
77 #define VPN_DEFAULT_HIRO_VPN 0
78 #define VPNGUI_PLUGIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE (obj, VPNGUI_TYPE_PLUGIN, PluginInfoPrivate))
84 PIXBUF_SUSPENDED_SMALL,
94 VPN_DISCONNECT_FAILED,
95 VPN_FORCED_DISCONNECTING,
98 /** responses emitted by the settings dialog */
99 enum vpn_settings_dialogs_response {
100 VPN_ACCESS_POINT_NEW,
101 VPN_ACCESS_POINT_DELETE,
102 VPN_ACCESS_POINT_SETTINGS ,
103 VPN_ACCESS_POINT_CONNECT,
104 VPN_ACCESS_POINT_CANCEL
108 typedef struct _PluginInfo PluginInfo;
109 typedef struct _PluginInfoClass PluginInfoClass;
110 typedef struct _PluginInfoPrivate PluginInfoPrivate;
111 typedef struct _PrivateVpnDetails PrivateVpnDetails;
115 HDStatusMenuItem parent;
116 PluginInfoPrivate *priv;
119 struct _PluginInfoClass
121 HDStatusMenuItemClass parent;
124 GType vpngui_plugin_get_type (void);
126 struct _PrivateVpnDetails{
130 gboolean password_obf;
140 gchar *proxy_autoconfig_url;
141 GSList *proxy_ignore_hosts;
142 GConfChangeSet *proxy_saved;
145 struct _PluginInfoPrivate{
148 GtkWidget *button2; // for connect and disconnect
149 GtkWidget *connect_button; // for connect
150 GtkWidget *delete_button; // for delete
151 GtkWidget *settings_button; // for settings
153 GtkWidget *menu_connect;
154 GtkWidget *menu_disconnect;
155 GtkWidget *menu_settings;
161 GdkPixbuf *pixbuf[NUM_PIXBUFS];
164 gboolean have_network;
167 PrivateVpnDetails vpn_settings;
174 gboolean show_connect_dialog;
175 osso_context_t *osso_context;
177 VpnNotify *vpn_notify;
178 GtkDialog *main_dialog;
179 int connected_vpn_ap_ui;
180 int connected_vpn_ap_gconf;
182 //have to remove them eventually- Rakesh
183 GtkWidget* container_hbox;
186 GtkWidget* sync_name_label;
187 GtkWidget* prof_name_label;
188 int total_items ; //Total number of VPN access points
193 //} _PluginInfoPrivate;
194 void error_msg(const char *format, ...);
195 void set_state(PluginInfo *info, int state);
197 gboolean vpnc_start(PluginInfo *info);
198 gboolean vpnc_stop(PluginInfo *info, const gboolean forced);
199 gboolean vpnc_restart(PluginInfo *info);
200 gboolean vpnc_config_write (PluginInfo *info);