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 | * |
14 | * This program is free software; you can redistribute it and/or |
15 | * modify it under the terms of the GNU Library General Public |
16 | * License as published by the Free Software Foundation; either |
17 | * version 2 of the License, or (at your option) any later version. |
18 | * |
19 | * This program is distributed in the hope that it will be useful, |
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
22 | * Library General Public License for more details. |
23 | * |
24 | * You should have received a copy of the GNU Library General Public |
25 | * License along with this program; if not, write to the Free |
26 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
27 | */ |
28 | |
29 | #ifndef _CONNECT_H_ |
30 | #define _CONNECT_H_ |
31 | |
32 | #include <qtimer.h> |
33 | //Added by qt3to4: |
34 | #include <QTimerEvent> |
35 | #include <QCloseEvent> |
36 | #include <kpushbutton.h> |
37 | #include <qlabel.h> |
38 | #include <qevent.h> |
39 | |
40 | #include "kpppconfig.h" |
41 | #include "pwentry.h" |
42 | #include "docking.h" |
43 | #include "loginterm.h" |
44 | |
45 | #define MAXLOOPNEST (MAX_SCRIPT_ENTRIES/2) |
46 | |
47 | class PPPStats; |
48 | |
49 | class ConnectWidget : public QWidget { |
50 | Q_OBJECT |
51 | public: |
52 | ConnectWidget(QWidget *parent, const char *name, PPPStats *st); |
53 | ~ConnectWidget(); |
54 | |
55 | public: |
56 | void set_con_speed_string(); |
57 | void setMsg(const QString &); |
58 | void pppdDied(); |
59 | |
60 | // these are only necessary to prevent the user from clicking in the cancel |
61 | // button during the disconnect delay in KPPPWidget |
62 | void disableButtons(); |
63 | void enableButtons(); |
64 | |
65 | signals: |
66 | void connected(); |
67 | void aboutToConnect(); |
68 | |
69 | |
70 | protected: |
71 | void timerEvent(QTimerEvent *); |
72 | void closeEvent( QCloseEvent *e ); |
73 | |
74 | private slots: |
75 | void readChar(unsigned char); |
76 | void pause(); |
77 | void if_waiting_slot(); |
78 | |
79 | public slots: |
80 | void init(); |
81 | void preinit(); |
82 | void script_timed_out(); |
83 | void if_waiting_timed_out(); |
84 | void cancelbutton(); |
85 | |
86 | signals: |
87 | void if_waiting_signal(); |
88 | void debugMessage(const QString &); |
89 | void toggleDebugWindow(); |
90 | void closeDebugWindow(); |
91 | void debugPutChar(unsigned char); |
92 | void startAccounting(); |
93 | void stopAccounting(); |
94 | |
95 | public: |
96 | QString myreadbuffer; // we want to keep every thing in order to fish for the |
97 | |
98 | // connection speed later on |
99 | QPushButton *debug; |
100 | int main_timer_ID; |
101 | |
102 | private: |
103 | int vmain; |
104 | int substate; |
105 | int scriptindex; |
106 | QString scriptCommand, scriptArgument; |
107 | QStringList *comlist, *arglist; |
108 | |
109 | // static const int maxloopnest=(MAX_SCRIPT_ENTRIES/2); |
110 | int loopnest; |
111 | int loopstartindex[MAXLOOPNEST]; |
112 | bool loopend; |
113 | QString loopstr[MAXLOOPNEST]; |
114 | |
115 | bool semaphore; |
116 | QTimer *inittimer; |
117 | |
118 | QTimer *timeout_timer; |
119 | bool execppp(); |
120 | void writeline(const QString &); |
121 | void checkBuffers(); |
122 | |
123 | void setExpect(const QString &); |
124 | bool expecting; |
125 | QString expectstr; |
126 | |
127 | QString readbuffer; |
128 | |
129 | void setScan(const QString &); |
130 | QString scanvar; |
131 | QString scanstr; |
132 | QString scanbuffer; |
133 | bool scanning; |
134 | |
135 | bool pausing; |
136 | PWEntry *prompt; |
137 | LoginTerm *termwindow; |
138 | |
139 | int scriptTimeout; |
140 | QTimer *pausetimer; |
141 | QTimer *if_timer; |
142 | QTimer *if_timeout_timer; |
143 | |
144 | QLabel *messg; |
145 | KPushButton *cancel; |
146 | |
147 | bool firstrunID; |
148 | bool firstrunPW; |
149 | |
150 | int dialnumber; // the current number to dial |
151 | |
152 | PPPStats *stats; |
153 | }; |
154 | |
155 | |
156 | // non-member function to kill&wait on the pppd child process |
157 | extern void killppp(); |
158 | void adddns(); |
159 | void addpeerdns(); |
160 | void removedns(); |
161 | void add_domain(const QString & newdomain); |
162 | void auto_hostname(); |
163 | |
164 | #endif |
165 | |
166 | |