00001 /* -*- C++ -*- 00002 * 00003 * kPPP: A pppd front end for the KDE project 00004 * 00005 * $Id: connect.h,v 1.3 2003/08/09 17:14:55 kergoth Exp $ 00006 * 00007 * Copyright (C) 1997 Bernd Johannes Wuebben 00008 * wuebben@math.cornell.edu 00009 * 00010 * based on EzPPP: 00011 * Copyright (C) 1997 Jay Painter 00012 * 00013 * 00014 * This program is free software; you can redistribute it and/or 00015 * modify it under the terms of the GNU Library General Public 00016 * License as published by the Free Software Foundation; either 00017 * version 2 of the License, or (at your option) any later version. 00018 * 00019 * This program is distributed in the hope that it will be useful, 00020 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00022 * Library General Public License for more details. 00023 * 00024 * You should have received a copy of the GNU Library General Public 00025 * License along with this program; if not, write to the Free 00026 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00027 */ 00028 00029 #ifndef _CONNECT_H_ 00030 #define _CONNECT_H_ 00031 00032 #include <qtimer.h> 00033 #include <qpushbutton.h> 00034 #include <qlabel.h> 00035 #include <qevent.h> 00036 00037 #include "kpppconfig.h" 00038 #include "pwentry.h" 00039 00040 00041 #define MAXLOOPNEST (MAX_SCRIPT_ENTRIES/2) 00042 00043 class InterfacePPP; 00044 class PPPData; 00045 00046 class ConnectWidget : public QWidget { 00047 Q_OBJECT 00048 public: 00049 ConnectWidget(InterfacePPP*, QWidget *parent, const char *name); 00050 ~ConnectWidget(); 00051 00052 public: 00053 void set_con_speed_string(); 00054 void setMsg(const QString &); 00055 void pppdDied(); 00056 00057 protected: 00058 void timerEvent(QTimerEvent *); 00059 void closeEvent( QCloseEvent *e ); 00060 00061 private slots: 00062 void readChar(unsigned char); 00063 void pause(); 00064 void if_waiting_slot(); 00065 void refresh(); 00066 00067 public slots: 00068 void init(); 00069 void preinit(); 00070 void script_timed_out(); 00071 void if_waiting_timed_out(); 00072 void cancelbutton(); 00073 00074 signals: 00075 void if_waiting_signal(); 00076 void debugMessage(const QString &); 00077 void toggleDebugWindow(); 00078 void closeDebugWindow(); 00079 void debugPutChar(unsigned char); 00080 void startAccounting(); 00081 void stopAccounting(); 00082 00083 public: 00084 QString myreadbuffer; // we want to keep every thing in order to fish for the 00085 00086 // connection speed later on 00087 QPushButton *debug; 00088 int main_timer_ID; 00089 00090 private: 00091 int vmain; 00092 int substate; 00093 int scriptindex; 00094 QString scriptCommand, scriptArgument; 00095 QStringList *comlist, *arglist; 00096 00097 // static const int maxloopnest=(MAX_SCRIPT_ENTRIES/2); 00098 int loopnest; 00099 int loopstartindex[MAXLOOPNEST]; 00100 bool loopend; 00101 QString loopstr[MAXLOOPNEST]; 00102 00103 bool semaphore; 00104 QTimer *inittimer; 00105 00106 QTimer *timeout_timer; 00107 bool execppp(); 00108 void writeline(const QString &); 00109 void checkBuffers(); 00110 00111 void setExpect(const QString &); 00112 bool expecting; 00113 QString expectstr; 00114 00115 QString readbuffer; 00116 00117 void setScan(const QString &); 00118 QString scanvar; 00119 QString scanstr; 00120 QString scanbuffer; 00121 bool scanning; 00122 00123 bool pausing; 00124 PWEntry *prompt; 00125 // LoginTerm *termwindow; 00126 00127 int scriptTimeout; 00128 QTimer *pausetimer; 00129 QTimer *if_timer; 00130 QTimer *if_timeout_timer; 00131 QTimer *m_refreshTimer; 00132 00133 QLabel *messg; 00134 QPushButton *cancel; 00135 00136 bool firstrunID; 00137 bool firstrunPW; 00138 00139 unsigned int dialnumber; // the current number to dial 00140 00141 InterfacePPP *_ifaceppp; 00142 }; 00143 00144 00145 // non-member function to kill&wait on the pppd child process 00146 extern void killppp(PPPData*); 00147 void adddns(InterfacePPP*); 00148 void addpeerdns(InterfacePPP*); 00149 void removedns(InterfacePPP*); 00150 void add_domain(const QString & newdomain, InterfacePPP*); 00151 void auto_hostname(InterfacePPP*); 00152 00153 #endif 00154
1.4.2