1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
|
/***************************************************************************
* Copyright (C) 2004 by Christoph Thielecke *
* crissi99@gmx.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef __KVPNCCONFIG_H__
#define __KVPNCCONFIG_H__
//BEGIN INCLUDES
#include <tqobject.h>
#include <tqptrlist.h>
#include <tqstring.h>
#include <tqapplication.h>
#include <tqcolor.h>
#include <tqpoint.h>
#include <tqsize.h>
#include <tqfile.h>
#include <tqtextstream.h>
#include <tqtextedit.h>
#include <tqcolor.h>
#include <tqstringlist.h>
#include <kconfig.h>
#include <kwallet.h>
#include <kstatusbar.h>
#include "toolinfo.h"
#include "vpnaccountdata.h"
// ID for statusbar
#define ID_STATUS_MSG 1
#define ID_CONNECTION_MSG 2
#define ID_FLASH_MSG 3
//END INCLUDES
/**
This class holds global configuration data.
@author Christoph Thielecke <crissi99@gmx.de>
*/
class KVpncConfig : public TQObject
{
public:
KVpncConfig(TQWidget *parent,KStatusBar *statusbar);
~KVpncConfig();
public:
enum ConnectionStatus {disconnected=0, connecting=1, connected=2};
enum LogType {info=0, remote=1, error=2, success=3, debug=4};
TQString pathToVpnc;
TQString pathToCiscoVpnc;
TQString pathToRacoon;
TQString pathToRacoonctl;
TQString pathToSetkey;
TQString pathToIptables;
TQString pathToOpenssl;
TQString pathToIpsec;
TQString pathToPppd;
TQString pathToPptp;
TQString pathToL2tpd;
TQString pathToXl2tpd;
TQString pathToOpenl2tp;
TQString pathToKill;
TQString pathToKillall;
TQString pathToPing;
TQString pathToOpenvpn;
TQString pathToIp;
TQString pathToIfconfig;
TQString pathToRoute;
TQString pathToNetstat;
TQString pathToPkcs11Tool;
TQString pathToVtund;
TQString pathToCiscoCertMgr;
TQString pathToTail;
TQString pathToSsh;
TQString pathToKsshAskpass;
TQString pathToGnomeSshAskpass;
TQString AutoConnectProfile;
TQString RacoonDebugLevel;
TQString Vpnc_pid_file;
TQString Pppd_pid_file;
TQString lastProfile;
TQString logfileName;
TQString InterpreterShell;
TQString TmpPassword; //< from enter password dialog
TQString TmpGroupPassword; //< from enter password dialog
TQString TmpUsername; //< from enter password dialog
TQString TmpPrivKeyPassStr;
TQString TmpGatewayIP;
TQString TmpXauthInterPasscode; //< from Xauth interactive passcode dialog
TQString TmpPrivateKeyPass;
TQString TmpHttpProxyPassword;
TQString DnsDevice; //< device which the dns entry was added
TQString OldDefaultGw; //< default gw before connect
TQString OldDefaultDev; //< default gw dev before connect
TQString NewDefaultGw;
TQStringList PlutoDebug;
TQStringList KlipsDebug;
bool minimizeAfterConnect;
bool showDebugConsole;
bool writeLogFile;
bool useDefaultPaths;
bool useSilentQuit;
bool holdGeneratedScripts;
bool programsInPath;
bool enableDebugPppd;
bool enableDebugPptpd;
bool enableDebugL2tpd;
bool enableDebugXl2tpd;
bool enableDebugOpenl2tp;
bool enableDebugXl2tpdNetwork;
bool enableDebugXl2tpdpacket;
bool enableDebugXl2tpdstate;
bool enableDebugXl2tpdtunnel;
bool enableFreeswanVerbose;
bool enableDebugOpenvpn;
bool useColorizedLogOutput;
bool showInterfaceIPinTooltip;
bool dontQuitOnCloseEvent;
bool doAutoConnectAtStartup;
bool useKwallet;
bool showStatusBar;
bool showToolBar;
bool hideMainWindow;
bool PppdDebugLevel;
bool firstUseOfKwallet; //< for importing passwords if there are stored before
bool shutdownIsCalled;
bool haveUserData; //< flag if user data already collected, set after data is entered and unset if authretry
bool skipKwalletStoring; //< true if save should skip saving into kwallet
bool hideOnCloseInfo;
bool feedbackMailSent;
bool doKillL2tpdIfStillRunning; //< kill l2tpd if its still running and not started from kvpnc
bool doKillXl2tpdIfStillRunning; //< kill xl2tpd if its still running and not started from kvpnc
bool doKillRacoonIfStillRunning; //< kill racoon if its still running and not started from kvpnc
bool showConnectionTimeInTooltip; //< True if the connection duration should be shown in kicker tooltip
bool WaitingForXauth; //< if waiting for xauth is set to true, needed to detect wrong xautn data on strongswan
bool prefDlgOpen; //< if true prefDlgOpen is open
bool OpenvpnNeedSecurityParameter;
int VpncDebugLevel;
int KvpncDebugLevel;
int OpenvpnDebugLevel;
int PptpLogLevel;
int PppdKernelLogLevel;
int SshDebugLevel;
int LogViewerFontSize;
int mainwindow_pos_x;
int mainwindow_pos_y;
int mainwindow_height;
int mainwindow_width;
int connectSleepDelay; //< time beetween retry
int connectSleepRetry; //< count of retries
int tryConnectTimeout; //< timeout in at connecting
int connectionStartTime;
int runningCheckCounter;
int runningCheckTimeout;
int OpenvpnManagementPort;
int AuthRetryCount; //< count of autn retry
int maxConnectRetry; // max connect tries
int currentConnectRetry;
TQPtrList<ToolInfo> *ToolList;
TQPtrList<VpnAccountData> *AccountList;
VpnAccountData *currentProfile;
TQColor InfoLogColor;
TQColor RemoteLogColor;
TQColor ErrorLogColor;
TQColor SuccessLogColor;
TQColor DebugLogColor;
TQColor DebugBackgroundcolor;
TQApplication *appPointer;
TQPoint pos;
ConnectionStatus status;
TQFile logfile;
TQTextStream logFileStream;
TQTextEdit *LogOutput;
KWallet::Wallet *wallet;
KConfig* config; //< configuration data
TQPoint WindowPos;
TQSize WindowSize;
struct IpsecImportSection {
TQString SectionName;
TQStringList SectionData;
};
TQPtrList<VpnAccountData> *ImportedAccountList;
TQWidget *parent;
KStatusBar *statusbar;
/**
* Appends a log enty to debug console and log file
* @param msg the text to append
* @param type the type of the msg (info, debug, error, etc)
*/
void appendLogEntry( TQString msg, LogType type );
/**
* Sets the output textedit for debug output
* @param LogOutput
*/
void setLogOutput(TQTextEdit *LogOutput);
/**
* save configuration
*/
void saveOptions(bool saveOneProfile=false, TQString Profile="" );
/**
* load configuration
*/
void loadOptions();
/**
* check the value of the paths
*/
void checkStandardPathValues();
/**
* collects the information of the external helper programs
*/
void getToolsInfo();
/**
* removes a entry from configuration file
* @param Name the entry which should be removed
*/
void removeEntry(TQString Name);
VpnAccountData* findProfile(TQPtrList<VpnAccountData> *list,const TQString& Name);
TQString removeWhiteSpaceAtBegin(const TQString);
void slotStatusMsg( const TQString &text, int id = ID_STATUS_MSG );
void doBackupConfig();
void restoreBackupConfig();
bool exportKvpncConfig(TQString filename);
bool importKvpncConfig(TQString filename, TQString& Name, bool& openProfileManager); //< true if profiles imported
bool importIpsecConfig(TQString filename, TQString& Name, bool& openProfileManager);
bool importFritzboxConfig(TQString filename, TQString& Name, bool& openProfileManager);
};
#endif
|