Diffstat (limited to 'noncore/settings/networksettings/ppp/pppdata.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdata.h | 465 |
1 files changed, 465 insertions, 0 deletions
diff --git a/noncore/settings/networksettings/ppp/pppdata.h b/noncore/settings/networksettings/ppp/pppdata.h new file mode 100644 index 0000000..e286b70 --- a/dev/null +++ b/noncore/settings/networksettings/ppp/pppdata.h | |||
@@ -0,0 +1,465 @@ | |||
1 | /* -*- C++ -*- | ||
2 | * | ||
3 | * kPPP: A pppd front end for the KDE project | ||
4 | * | ||
5 | * $Id$ | ||
6 | * | ||
7 | * Copyright (C) 1997 Bernd Johannes Wuebben | ||
8 | * wuebben@math.cornell.edu | ||
9 | * | ||
10 | * based on EzPPP: | ||
11 | * Copyright (C) 1997 Jay Painter | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU Library General Public | ||
15 | * License as published by the Free Software Foundation; either | ||
16 | * version 2 of the License, or (at your option) any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
21 | * Library General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU Library General Public | ||
24 | * License along with this program; if not, write to the Free | ||
25 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | */ | ||
27 | |||
28 | #ifndef _PPPDATA_H_ | ||
29 | #define _PPPDATA_H_ | ||
30 | |||
31 | #include <unistd.h> | ||
32 | #include <sys/types.h> | ||
33 | |||
34 | #include <qstring.h> | ||
35 | #include <qstringlist.h> | ||
36 | #include <qcolor.h> | ||
37 | |||
38 | #include "kpppconfig.h" | ||
39 | |||
40 | class Config; | ||
41 | |||
42 | // string lengths | ||
43 | |||
44 | #define PATH_SIZE 120 | ||
45 | #define MODEMSTR_SIZE 80 | ||
46 | #define ACCNAME_SIZE 50 | ||
47 | #define PHONENUMBER_SIZE 60 | ||
48 | #define COMMAND_SIZE 255 | ||
49 | #define IPADDR_SIZE 15 | ||
50 | #define DOMAIN_SIZE 50 | ||
51 | #define TIMEOUT_SIZE 60 | ||
52 | |||
53 | // | ||
54 | // keys for config file | ||
55 | // | ||
56 | |||
57 | // groups | ||
58 | #define GENERAL_GRP "General" | ||
59 | #define MODEM_GRP "Modem" | ||
60 | #define ACCOUNT_GRP "Account" | ||
61 | #define GRAPH_GRP "Graph" | ||
62 | #define WINPOS_GRP "WindowPosition" | ||
63 | |||
64 | // general | ||
65 | #define DEFAULTACCOUNT_KEY "DefaultAccount" | ||
66 | #define PPPDVERSION_KEY "pppdVersion" | ||
67 | #define PPPDTIMEOUT_KEY "pppdTimeout" | ||
68 | #define SHOWCLOCK_KEY "ShowClock" | ||
69 | #define SHOWLOGWIN_KEY "ShowLogWindow" | ||
70 | #define AUTOREDIAL_KEY "AutomaticRedial" | ||
71 | #define DISCONNECT_KEY "DisconnectOnXServerExit" | ||
72 | #define QUITONDISCONNECT_KEY "QuitOnDisconnect" | ||
73 | #define NUMACCOUNTS_KEY "NumberOfAccounts" | ||
74 | #define ID_KEY "ID" | ||
75 | |||
76 | // modem | ||
77 | #define MODEMDEV_KEY "Device" | ||
78 | #define LOCKFILE_KEY "UseLockFile" | ||
79 | #define FLOWCONTROL_KEY "FlowControl" | ||
80 | #define SPEED_KEY "Speed" | ||
81 | #define TIMEOUT_KEY "Timeout" | ||
82 | #define TONEDURATION_KEY "ToneDuration" | ||
83 | #define BUSYWAIT_KEY "BusyWait" | ||
84 | #define INITSTR_KEY "InitString" | ||
85 | #define INITRESP_KEY "InitResponse" | ||
86 | #define PREINITDELAY_KEY "PreInitDelay" | ||
87 | #define INITDELAY_KEY "InitDelay" | ||
88 | #define NODTDETECT_KEY "NoDialToneDetection" | ||
89 | #define DIALTONEWAIT_KEY "WaitForDialTone" | ||
90 | #define DIALSTR_KEY "DialString" | ||
91 | #define CONNECTRESP_KEY "ConnectResponse" | ||
92 | #define BUSYRESP_KEY "BusyResponse" | ||
93 | #define NOCARRIERRESP_KEY "NoCarrierResponse" | ||
94 | #define NODIALTONERESP_KEY "NoDialToneResp" | ||
95 | #define HANGUPSTR_KEY "HangupString" | ||
96 | #define HANGUPRESP_KEY "HangUpResponse" | ||
97 | #define ANSWERSTR_KEY "AnswerString" | ||
98 | #define RINGRESP_KEY "RingResponse" | ||
99 | #define ANSWERRESP_KEY "AnswerResponse" | ||
100 | #define ENTER_KEY "Enter" | ||
101 | #define ESCAPESTR_KEY "EscapeString" | ||
102 | #define ESCAPERESP_KEY "EscapeResponse" | ||
103 | #define ESCAPEGUARDTIME_KEY "EscapeGuardTime" | ||
104 | #define USECDLINE_KEY "UseCDLine" | ||
105 | #define VOLUME_HIGH "VolumeHigh" | ||
106 | #define VOLUME_MEDIUM "VolumeMedium" | ||
107 | #define VOLUME_OFF "VolumeOff" | ||
108 | #define VOLUME_KEY "Volume" | ||
109 | |||
110 | // account | ||
111 | #define NAME_KEY "Name" | ||
112 | #define PHONENUMBER_KEY "Phonenumber" | ||
113 | #define DIAL_PREFIX_KEY "DialPrefix" | ||
114 | #define AUTH_KEY "Authentication" | ||
115 | #define STORED_PASSWORD_KEY "Password" | ||
116 | #define STORED_USERNAME_KEY "Username" | ||
117 | #define STORE_PASSWORD_KEY "StorePassword" | ||
118 | #define BEFORE_CONNECT_KEY "BeforeConnect" | ||
119 | #define COMMAND_KEY "Command" | ||
120 | #define DISCONNECT_COMMAND_KEY "DisconnectCommand" | ||
121 | #define BEFORE_DISCONNECT_KEY "BeforeDisconnect" | ||
122 | #define IPADDR_KEY "IPAddr" | ||
123 | #define SUBNETMASK_KEY "SubnetMask" | ||
124 | #define ACCTENABLED_KEY "AccountingEnabled" | ||
125 | #define VOLACCTENABLED_KEY "VolumeAccountingEnabled" | ||
126 | #define ACCTFILE_KEY "AccountingFile" | ||
127 | #define AUTONAME_KEY "AutoName" | ||
128 | #define GATEWAY_KEY "Gateway" | ||
129 | #define DEFAULTROUTE_KEY "DefaultRoute" | ||
130 | #define DOMAIN_KEY "Domain" | ||
131 | #define DNS_KEY "DNS" | ||
132 | #define AUTODNS_KEY "AutoDNS" | ||
133 | #define EXDNSDISABLED_KEY "ExDNSDisabled" | ||
134 | #define SCRIPTCOM_KEY "ScriptCommands" | ||
135 | #define SCRIPTARG_KEY "ScriptArguments" | ||
136 | #define PPPDARG_KEY "pppdArguments" | ||
137 | #define PPP_DEBUG_OPTION "PPPDebug" | ||
138 | #define ICONIFY_ON_CONNECT_KEY "iconifyOnConnect" | ||
139 | #define DOCKING_KEY "DockIntoPanel" | ||
140 | #define TOTALCOSTS_KEY "TotalCosts" | ||
141 | #define TOTALBYTES_KEY "TotalBytes" | ||
142 | |||
143 | // graph colors | ||
144 | #define GENABLED "Enabled" | ||
145 | #define GCOLOR_BG "Background" | ||
146 | #define GCOLOR_TEXT "Text" | ||
147 | #define GCOLOR_IN "InBytes" | ||
148 | #define GCOLOR_OUT "OutBytes" | ||
149 | |||
150 | // pppd errors | ||
151 | #define E_IF_TIMEOUT 1 | ||
152 | #define E_PPPD_DIED 2 | ||
153 | |||
154 | // window position | ||
155 | #define WINPOS_CONWIN_X "WindowPositionConWinX" | ||
156 | #define WINPOS_CONWIN_Y "WindowPositionConWinY" | ||
157 | #define WINPOS_STATWIN_X "WindowPositionStatWinX" | ||
158 | #define WINPOS_STATWIN_Y "WindowPositionStatWinY" | ||
159 | |||
160 | class PPPData { | ||
161 | public: | ||
162 | PPPData(); | ||
163 | ~PPPData() {}; | ||
164 | |||
165 | enum { NumInitStrings = 2 }; | ||
166 | |||
167 | // general functions | ||
168 | bool open(); | ||
169 | void save(); | ||
170 | void cancel(); | ||
171 | int access() const; // read/write access | ||
172 | |||
173 | // function to read/write date to configuration file | ||
174 | QString readConfig(const QString &, const QString &, const QString &); | ||
175 | int readNumConfig(const QString &, const QString &, int); | ||
176 | bool readListConfig(const QString &, const QString &, | ||
177 | QStringList &, char sep = ','); | ||
178 | void writeConfig(const QString &, const QString &, const QString &); | ||
179 | void writeConfig(const QString &, const QString &, int); | ||
180 | void writeListConfig(const QString &, const QString &, | ||
181 | QStringList &, char sep = ','); | ||
182 | |||
183 | // return the current account group | ||
184 | QString currentGroup() { return cgroup; } | ||
185 | |||
186 | // functions to set/get general kppp info | ||
187 | QString password() const; | ||
188 | void setPassword(const QString &); | ||
189 | |||
190 | const QString defaultAccount(); | ||
191 | void setDefaultAccount(const QString &); | ||
192 | |||
193 | void set_xserver_exit_disconnect(bool set); | ||
194 | bool get_xserver_exit_disconnect(); | ||
195 | |||
196 | void setPPPDebug(bool set); | ||
197 | bool getPPPDebug(); | ||
198 | |||
199 | void set_quit_on_disconnect(bool); | ||
200 | bool quit_on_disconnect(); | ||
201 | |||
202 | void set_show_clock_on_caption(bool set); | ||
203 | bool get_show_clock_on_caption(); | ||
204 | |||
205 | void set_show_log_window(bool set); | ||
206 | bool get_show_log_window(); | ||
207 | |||
208 | void set_automatic_redial(bool set); | ||
209 | bool automatic_redial(); | ||
210 | |||
211 | void set_iconify_on_connect(bool set); | ||
212 | bool get_iconify_on_connect(); | ||
213 | |||
214 | void set_dock_into_panel(bool set); | ||
215 | bool get_dock_into_panel(); | ||
216 | |||
217 | const QString enter(); | ||
218 | void setEnter(const QString &); | ||
219 | |||
220 | QString pppdVersion(); | ||
221 | bool pppdVersionMin(int ver, int mod, int patch); | ||
222 | |||
223 | int pppdTimeout(); | ||
224 | void setpppdTimeout(int); | ||
225 | |||
226 | int busyWait(); | ||
227 | void setbusyWait(int); | ||
228 | |||
229 | bool modemLockFile(); | ||
230 | void setModemLockFile(bool set); | ||
231 | |||
232 | int modemEscapeGuardTime(); | ||
233 | void setModemEscapeGuardTime(int i); | ||
234 | |||
235 | void setModemEscapeStr(const QString &); | ||
236 | const QString modemEscapeStr(); | ||
237 | |||
238 | void setModemEscapeResp(const QString &); | ||
239 | const QString modemEscapeResp(); | ||
240 | |||
241 | const QString modemDevice(); | ||
242 | void setModemDevice(const QString &); | ||
243 | |||
244 | const QString flowcontrol(); | ||
245 | void setFlowcontrol(const QString &); | ||
246 | |||
247 | int modemTimeout(); | ||
248 | void setModemTimeout(int); | ||
249 | |||
250 | int modemToneDuration(); | ||
251 | void setModemToneDuration(int); | ||
252 | |||
253 | QString volumeInitString(); | ||
254 | int volume(); | ||
255 | void setVolume(int); | ||
256 | |||
257 | int waitForDialTone(); | ||
258 | void setWaitForDialTone(int i); | ||
259 | |||
260 | // modem command strings/responses | ||
261 | const QString modemInitStr(int i); | ||
262 | void setModemInitStr(int i, const QString &); | ||
263 | |||
264 | const QString modemInitResp(); | ||
265 | void setModemInitResp(const QString &); | ||
266 | |||
267 | int modemPreInitDelay(); | ||
268 | void setModemPreInitDelay(int); | ||
269 | |||
270 | int modemInitDelay(); | ||
271 | void setModemInitDelay(int); | ||
272 | |||
273 | QString modemNoDialToneDetectionStr(); | ||
274 | void setModemNoDialToneDetectionStr(const QString &); | ||
275 | |||
276 | const QString modemDialStr(); | ||
277 | void setModemDialStr(const QString &); | ||
278 | |||
279 | const QString modemConnectResp(); | ||
280 | void setModemConnectResp(const QString &); | ||
281 | |||
282 | const QString modemBusyResp(); | ||
283 | void setModemBusyResp(const QString &); | ||
284 | |||
285 | const QString modemNoCarrierResp(); | ||
286 | void setModemNoCarrierResp(const QString &); | ||
287 | |||
288 | const QString modemNoDialtoneResp(); | ||
289 | void setModemNoDialtoneResp(const QString &); | ||
290 | |||
291 | const QString modemHangupStr(); | ||
292 | void setModemHangupStr(const QString &); | ||
293 | |||
294 | const QString modemHangupResp(); | ||
295 | void setModemHangupResp(const QString &); | ||
296 | |||
297 | const QString modemAnswerStr(); | ||
298 | void setModemAnswerStr(const QString &); | ||
299 | |||
300 | const QString modemRingResp(); | ||
301 | void setModemRingResp(const QString &); | ||
302 | |||
303 | const QString modemAnswerResp(); | ||
304 | void setModemAnswerResp(const QString &); | ||
305 | |||
306 | QString volumeOff(); | ||
307 | void setVolumeOff(const QString &); | ||
308 | |||
309 | QString volumeMedium(); | ||
310 | void setVolumeMedium(const QString &); | ||
311 | |||
312 | QString volumeHigh(); | ||
313 | void setVolumeHigh(const QString &); | ||
314 | |||
315 | #if 0 | ||
316 | void setUseCDLine(const int n); | ||
317 | int UseCDLine(); | ||
318 | #endif | ||
319 | |||
320 | // functions to set/get account information | ||
321 | int count() const; | ||
322 | bool setAccount(const QString &); | ||
323 | bool setAccountbyIndex(int); | ||
324 | |||
325 | bool isUniqueAccname(const QString &); | ||
326 | |||
327 | bool deleteAccount(); | ||
328 | bool deleteAccount(const QString &); | ||
329 | int newaccount(); | ||
330 | int copyaccount(int i); | ||
331 | |||
332 | const QString accname(); | ||
333 | void setAccname(const QString &); | ||
334 | |||
335 | QStringList &phonenumbers(); | ||
336 | const QString phonenumber(); | ||
337 | void setPhonenumber(const QString &); | ||
338 | |||
339 | const QString dialPrefix(); | ||
340 | void setDialPrefix(const QString &); | ||
341 | |||
342 | int authMethod(); | ||
343 | void setAuthMethod(int); | ||
344 | |||
345 | const QString storedUsername(); | ||
346 | void setStoredUsername(const QString &); | ||
347 | |||
348 | const QString storedPassword(); | ||
349 | void setStoredPassword(const QString &); | ||
350 | |||
351 | bool storePassword(); | ||
352 | void setStorePassword(bool); | ||
353 | |||
354 | const QString speed(); | ||
355 | void setSpeed(const QString &); | ||
356 | |||
357 | const QString command_before_connect(); | ||
358 | void setCommand_before_connect(const QString &); | ||
359 | |||
360 | const QString command_on_connect(); | ||
361 | void setCommand_on_connect(const QString &); | ||
362 | |||
363 | const QString command_on_disconnect(); | ||
364 | void setCommand_on_disconnect(const QString &); | ||
365 | |||
366 | const QString command_before_disconnect(); | ||
367 | void setCommand_before_disconnect(const QString &); | ||
368 | |||
369 | const QString ipaddr(); | ||
370 | void setIpaddr(const QString &); | ||
371 | |||
372 | const QString subnetmask(); | ||
373 | void setSubnetmask(const QString &); | ||
374 | |||
375 | bool AcctEnabled(); | ||
376 | void setAcctEnabled(bool set); | ||
377 | |||
378 | int VolAcctEnabled(); | ||
379 | void setVolAcctEnabled(int set); | ||
380 | |||
381 | bool autoDNS(); | ||
382 | void setAutoDNS(bool set); | ||
383 | |||
384 | bool exDNSDisabled(); | ||
385 | void setExDNSDisabled(bool set); | ||
386 | |||
387 | bool autoname(); | ||
388 | void setAutoname(bool set); | ||
389 | |||
390 | const QString gateway(); | ||
391 | void setGateway(const QString &); | ||
392 | |||
393 | bool defaultroute(); | ||
394 | void setDefaultroute(bool set); | ||
395 | |||
396 | QStringList &dns(); | ||
397 | void setDns(QStringList &); | ||
398 | |||
399 | const QString domain(); | ||
400 | void setDomain(const QString &); | ||
401 | |||
402 | QStringList &scriptType(); | ||
403 | void setScriptType(QStringList &); | ||
404 | |||
405 | QStringList &script(); | ||
406 | void setScript(QStringList &); | ||
407 | |||
408 | QStringList &pppdArgument(); | ||
409 | void setpppdArgumentDefaults(); | ||
410 | void setpppdArgument(QStringList &); | ||
411 | |||
412 | //functions to change/set the child pppd process info | ||
413 | bool pppdRunning() const; | ||
414 | void setpppdRunning(bool set); | ||
415 | |||
416 | int pppdError() const; | ||
417 | void setpppdError(int err); | ||
418 | |||
419 | // functions to set/query the accounting info | ||
420 | const QString accountingFile(); | ||
421 | void setAccountingFile(const QString &); | ||
422 | |||
423 | const QString totalCosts(); | ||
424 | void setTotalCosts(const QString &); | ||
425 | |||
426 | int totalBytes(); | ||
427 | void setTotalBytes(int); | ||
428 | |||
429 | // graphing widget | ||
430 | void setGraphingOptions(bool enabled, | ||
431 | QColor bg, | ||
432 | QColor text, | ||
433 | QColor in, | ||
434 | QColor out); | ||
435 | void graphingOptions(bool &enabled, | ||
436 | QColor &bg, | ||
437 | QColor &text, | ||
438 | QColor &in, | ||
439 | QColor &out); | ||
440 | bool graphingEnabled(); | ||
441 | |||
442 | // window positions | ||
443 | void winPosConWin(int &, int &); | ||
444 | void setWinPosConWin(int, int); | ||
445 | void winPosStatWin(int &, int &); | ||
446 | void setWinPosStatWin(int, int); | ||
447 | |||
448 | private: | ||
449 | QString passwd; | ||
450 | Config* config; // configuration object | ||
451 | int highcount; // index of highest account | ||
452 | int caccount; // index of the current account | ||
453 | QString cgroup; // name of current config group | ||
454 | pid_t suidprocessid; // process ID of setuid child | ||
455 | bool pppdisrunning; // pppd process | ||
456 | // daemon | ||
457 | int pppderror; // error encounterd running pppd | ||
458 | int pppdVer, pppdMod, pppdPatch; // pppd version | ||
459 | |||
460 | QStringList phonelist; | ||
461 | }; | ||
462 | |||
463 | extern PPPData gpppdata; | ||
464 | |||
465 | #endif | ||