summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/ppp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/ppp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/ppp/PPPAuthGUI.ui150
-rw-r--r--noncore/settings/networksettings2/ppp/PPPAuthedit.cpp42
-rw-r--r--noncore/settings/networksettings2/ppp/PPPAuthedit.h2
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.cpp31
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.h13
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NNI.cpp108
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NNI.h21
7 files changed, 250 insertions, 117 deletions
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthGUI.ui b/noncore/settings/networksettings2/ppp/PPPAuthGUI.ui
index 826843a..0c5f4c8 100644
--- a/noncore/settings/networksettings2/ppp/PPPAuthGUI.ui
+++ b/noncore/settings/networksettings2/ppp/PPPAuthGUI.ui
@@ -13,3 +13,3 @@
13 <y>0</y> 13 <y>0</y>
14 <width>249</width> 14 <width>245</width>
15 <height>209</height> 15 <height>209</height>
@@ -59,3 +59,3 @@
59 <name>margin</name> 59 <name>margin</name>
60 <number>0</number> 60 <number>3</number>
61 </property> 61 </property>
@@ -63,3 +63,3 @@
63 <name>spacing</name> 63 <name>spacing</name>
64 <number>0</number> 64 <number>2</number>
65 </property> 65 </property>
@@ -193,2 +193,39 @@
193 <widget> 193 <widget>
194 <class>QLayoutWidget</class>
195 <property stdset="1">
196 <name>name</name>
197 <cstring>Layout3</cstring>
198 </property>
199 <hbox>
200 <property stdset="1">
201 <name>margin</name>
202 <number>0</number>
203 </property>
204 <property stdset="1">
205 <name>spacing</name>
206 <number>6</number>
207 </property>
208 <widget>
209 <class>QRadioButton</class>
210 <property stdset="1">
211 <name>name</name>
212 <cstring>Pap_RB</cstring>
213 </property>
214 <property stdset="1">
215 <name>text</name>
216 <string>Pap</string>
217 </property>
218 </widget>
219 <widget>
220 <class>QRadioButton</class>
221 <property stdset="1">
222 <name>name</name>
223 <cstring>Chap_RB</cstring>
224 </property>
225 <property stdset="1">
226 <name>text</name>
227 <string>Chap</string>
228 </property>
229 </widget>
230 <widget>
194 <class>QRadioButton</class> 231 <class>QRadioButton</class>
@@ -196,3 +233,3 @@
196 <name>name</name> 233 <name>name</name>
197 <cstring>PapChap_RB</cstring> 234 <cstring>EAP_RB</cstring>
198 </property> 235 </property>
@@ -200,5 +237,7 @@
200 <name>text</name> 237 <name>text</name>
201 <string>Pap/Chap/EAP</string> 238 <string>EAP</string>
202 </property> 239 </property>
203 </widget> 240 </widget>
241 </hbox>
242 </widget>
204 <widget> 243 <widget>
@@ -277,5 +316,5 @@
277 <name>spacing</name> 316 <name>spacing</name>
278 <number>1</number> 317 <number>2</number>
279 </property> 318 </property>
280 <widget row="2" column="0" > 319 <widget row="1" column="0" >
281 <class>QLabel</class> 320 <class>QLabel</class>
@@ -290,3 +329,3 @@
290 </widget> 329 </widget>
291 <widget row="3" column="0" > 330 <widget row="2" column="0" >
292 <class>QLabel</class> 331 <class>QLabel</class>
@@ -301,32 +340,7 @@
301 </widget> 340 </widget>
302 <widget row="0" column="1" > 341 <widget row="1" column="1" >
303 <class>QComboBox</class> 342 <class>QLineEdit</class>
304 <item>
305 <property>
306 <name>text</name>
307 <string>PAP</string>
308 </property>
309 </item>
310 <item>
311 <property>
312 <name>text</name>
313 <string>CHAP</string>
314 </property>
315 </item>
316 <item>
317 <property>
318 <name>text</name>
319 <string>EAP</string>
320 </property>
321 </item>
322 <property stdset="1">
323 <name>name</name>
324 <cstring>AuthMethod_CB</cstring>
325 </property>
326 </widget>
327 <widget row="1" column="0" >
328 <class>QLabel</class>
329 <property stdset="1"> 343 <property stdset="1">
330 <name>name</name> 344 <name>name</name>
331 <cstring>TextLabel1</cstring> 345 <cstring>Server_LE</cstring>
332 </property> 346 </property>
@@ -334,17 +348,13 @@
334 <name>text</name> 348 <name>text</name>
335 <string>Client</string> 349 <string>*</string>
336 </property> 350 </property>
337 </widget> 351 </widget>
338 <widget row="0" column="0" > 352 <widget row="2" column="1" >
339 <class>QLabel</class> 353 <class>QLineEdit</class>
340 <property stdset="1"> 354 <property stdset="1">
341 <name>name</name> 355 <name>name</name>
342 <cstring>TextLabel1_4</cstring> 356 <cstring>Secret_LE</cstring>
343 </property>
344 <property stdset="1">
345 <name>text</name>
346 <string>Method</string>
347 </property> 357 </property>
348 </widget> 358 </widget>
349 <widget row="1" column="1" rowspan="1" colspan="2" > 359 <widget row="0" column="1" >
350 <class>QLineEdit</class> 360 <class>QLineEdit</class>
@@ -359,7 +369,7 @@
359 </widget> 369 </widget>
360 <widget row="2" column="1" rowspan="1" colspan="2" > 370 <widget row="0" column="0" >
361 <class>QLineEdit</class> 371 <class>QLabel</class>
362 <property stdset="1"> 372 <property stdset="1">
363 <name>name</name> 373 <name>name</name>
364 <cstring>Server_LE</cstring> 374 <cstring>TextLabel1</cstring>
365 </property> 375 </property>
@@ -367,33 +377,5 @@
367 <name>text</name> 377 <name>text</name>
368 <string>*</string> 378 <string>Client</string>
369 </property>
370 </widget>
371 <widget row="3" column="1" rowspan="1" colspan="2" >
372 <class>QLineEdit</class>
373 <property stdset="1">
374 <name>name</name>
375 <cstring>Secret_LE</cstring>
376 </property> 379 </property>
377 </widget> 380 </widget>
378 <spacer row="0" column="2" >
379 <property>
380 <name>name</name>
381 <cstring>Spacer7</cstring>
382 </property>
383 <property stdset="1">
384 <name>orientation</name>
385 <enum>Horizontal</enum>
386 </property>
387 <property stdset="1">
388 <name>sizeType</name>
389 <enum>Expanding</enum>
390 </property>
391 <property>
392 <name>sizeHint</name>
393 <size>
394 <width>20</width>
395 <height>20</height>
396 </size>
397 </property>
398 </spacer>
399 </grid> 381 </grid>
@@ -419,3 +401,3 @@
419 <connection> 401 <connection>
420 <sender>PapChap_RB</sender> 402 <sender>Pap_RB</sender>
421 <signal>toggled(bool)</signal> 403 <signal>toggled(bool)</signal>
@@ -430,2 +412,14 @@
430 </connection> 412 </connection>
413 <connection>
414 <sender>Chap_RB</sender>
415 <signal>toggled(bool)</signal>
416 <receiver>GroupBox3</receiver>
417 <slot>setEnabled(bool)</slot>
418 </connection>
419 <connection>
420 <sender>EAP_RB</sender>
421 <signal>toggled(bool)</signal>
422 <receiver>GroupBox3</receiver>
423 <slot>setEnabled(bool)</slot>
424 </connection>
431</connections> 425</connections>
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp b/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp
index f305cc4..450d560 100644
--- a/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp
+++ b/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp
@@ -11,2 +11,9 @@ PPPAuthEdit::PPPAuthEdit( QWidget * Parent ) : PPPAuthGUI( Parent ){
11 11
12bool PPPAuthEdit::PAP_Checked( void ) {
13 return ( Pap_RB->isChecked() ||
14 Chap_RB->isChecked() ||
15 EAP_RB->isChecked()
16 );
17}
18
12QString PPPAuthEdit::acceptable( void ) { 19QString PPPAuthEdit::acceptable( void ) {
@@ -21,3 +28,3 @@ QString PPPAuthEdit::acceptable( void ) {
21 return tr("Password expect missing"); 28 return tr("Password expect missing");
22 } else if( PapChap_RB->isChecked() ) { 29 } else if( PAP_Checked() ) {
23 if( Client_LE->text().isEmpty() ) 30 if( Client_LE->text().isEmpty() )
@@ -36,3 +43,3 @@ bool PPPAuthEdit::commit( PPPData_t & D ) {
36 if( ( D.Auth.Mode == 0 && ! Login_RB->isChecked() ) || 43 if( ( D.Auth.Mode == 0 && ! Login_RB->isChecked() ) ||
37 ( D.Auth.Mode == 1 && ! PapChap_RB->isChecked() ) || 44 ( D.Auth.Mode == 1 && ! PAP_Checked() ) ||
38 ( D.Auth.Mode == 2 && ! Terminal_RB->isChecked() ) ) { 45 ( D.Auth.Mode == 2 && ! Terminal_RB->isChecked() ) ) {
@@ -42,4 +49,3 @@ bool PPPAuthEdit::commit( PPPData_t & D ) {
42 0 : 49 0 :
43 ( ( PapChap_RB->isChecked() ) ? 50 ( PAP_Checked() ) ? 1 : 2;
44 1 : 2 );
45 } 51 }
@@ -51,3 +57,3 @@ bool PPPAuthEdit::commit( PPPData_t & D ) {
51 TXTM( D.Auth.Password.Send, PasswordSend_LE, SM ); 57 TXTM( D.Auth.Password.Send, PasswordSend_LE, SM );
52 } else if( PapChap_RB->isChecked() ) { 58 } else if( PAP_Checked() ) {
53 TXTM( D.Auth.Client, Client_LE, SM ); 59 TXTM( D.Auth.Client, Client_LE, SM );
@@ -55,3 +61,9 @@ bool PPPAuthEdit::commit( PPPData_t & D ) {
55 TXTM( D.Auth.Secret, Secret_LE, SM ); 61 TXTM( D.Auth.Secret, Secret_LE, SM );
56 CIM( D.Auth.PCEMode, AuthMethod_CB, SM ); 62 if( Pap_RB->isChecked() ) {
63 D.Auth.PCEMode = 0;
64 } else if( Chap_RB->isChecked() ) {
65 D.Auth.PCEMode = 1;
66 } else if( EAP_RB->isChecked() ) {
67 D.Auth.PCEMode = 2;
68 }
57 } 69 }
@@ -64,9 +76,19 @@ void PPPAuthEdit::showData( PPPData_t & D ) {
64 case 0 : 76 case 0 :
65 Login_RB->isChecked(); 77 Login_RB->setChecked( TRUE );
78 break;
79 case 1 :
80 switch( D.Auth.PCEMode ) {
81 case 0 :
82 Pap_RB->setChecked( TRUE );
66 break; 83 break;
67 case 1 : 84 case 1 :
68 PapChap_RB->isChecked(); 85 Chap_RB->setChecked( TRUE );
69 break; 86 break;
70 case 2 : 87 case 2 :
71 Terminal_RB->isChecked(); 88 EAP_RB->setChecked( TRUE );
89 break;
90 }
91 break;
92 case 2 :
93 Terminal_RB->setChecked( TRUE );
72 break; 94 break;
@@ -82,4 +104,2 @@ void PPPAuthEdit::showData( PPPData_t & D ) {
82 Secret_LE->setText( D.Auth.Secret ); 104 Secret_LE->setText( D.Auth.Secret );
83
84 AuthMethod_CB->setCurrentItem( D.Auth.PCEMode );
85} 105}
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthedit.h b/noncore/settings/networksettings2/ppp/PPPAuthedit.h
index cbd540e..2392569 100644
--- a/noncore/settings/networksettings2/ppp/PPPAuthedit.h
+++ b/noncore/settings/networksettings2/ppp/PPPAuthedit.h
@@ -11,2 +11,4 @@ public :
11 void showData( PPPData_t & Data ); 11 void showData( PPPData_t & Data );
12 bool PAP_Checked( void );
13
12 14
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
index b7edf87..ff4465c 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
@@ -1 +1,3 @@
1#include <qfile.h>
2#include <qtextstream.h>
1#include "ppp_NN.h" 3#include "ppp_NN.h"
@@ -3,2 +5,4 @@
3 5
6QStringList * PPPNetNode::ProperFiles = 0;
7
4static const char * PPPNeeds[] = 8static const char * PPPNeeds[] =
@@ -13,2 +17,13 @@ static const char * PPPNeeds[] =
13PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) { 17PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) {
18
19 // proper files : will leak
20 ProperFiles =new QStringList;
21 *ProperFiles << "peers";
22 *ProperFiles << "chatscript";
23
24 // system files
25 NSResources->addSystemFile(
26 "pap-secrets", "/tmp/pap-secrets", 0 );
27 NSResources->addSystemFile(
28 "chap-secrets", "/tmp/chap-secrets", 0 );
14} 29}
@@ -41,11 +56,13 @@ const char * PPPNetNode::provides( void ) {
41 56
42bool PPPNetNode::generateProperFilesFor( 57QStringList * PPPNetNode::properFiles( void ) {
43 ANetNodeInstance * ) { 58 return ProperFiles;
44 return 0; 59
45} 60}
46 61
47bool PPPNetNode::generateDeviceDataForCommonFile( 62// need to generate :
48 SystemFile & , 63// /etc/ppp/pap-secrets
49 long ) { 64// /etc/ppp/pap-secrets
50 return 0; 65bool PPPNetNode::hasDataForFile( const QString & S ) {
66 return S == "pap-secrets" ||
67 S == "chap-secrets" ;
51} 68}
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h
index b1483c4..249be5a 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.h
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.h
@@ -19,6 +19,6 @@ public:
19 19
20 virtual const QString nodeDescription() ; 20 virtual bool hasDataForFile( const QString & S );
21 21
22 virtual const QString nodeDescription() ;
22 virtual ANetNodeInstance * createInstance( void ); 23 virtual ANetNodeInstance * createInstance( void );
23
24 virtual const char ** needs( void ); 24 virtual const char ** needs( void );
@@ -26,9 +26,4 @@ public:
26 26
27 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
28 virtual bool hasDataFor( const QString & )
29 { return 0; }
30 virtual bool generateDeviceDataForCommonFile(
31 SystemFile & SF, long DevNr );
32
33 virtual QString genNic( long NicNr ); 27 virtual QString genNic( long NicNr );
28 virtual QStringList * properFiles( void );
34 29
@@ -38,2 +33,4 @@ private:
38 virtual void saveSpecificAttribute( QTextStream & TS ); 33 virtual void saveSpecificAttribute( QTextStream & TS );
34
35 static QStringList * ProperFiles;
39}; 36};
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
index d0fd31c..ba639de 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
+++ b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
@@ -1 +1,3 @@
1#include <qfile.h>
2#include <qfileinfo.h>
1#include "PPPedit.h" 3#include "PPPedit.h"
@@ -115,7 +117,105 @@ void APPP::commit( void ) {
115 117
116bool APPP::generateDataForCommonFile( 118QFile * APPP::openFile( const QString & ID ) {
117 SystemFile & , 119 QFile * F = 0;
118 long) { 120 QString S;
119 return 1; 121
122 if( ID == "peers" ) {
123 S = removeSpaces( QString("/tmp/") + connection()->name() );
124
125 F = new QFile( S );
126
127 if( ! F->open( IO_WriteOnly ) ) {
128 Log(("Cannot open file %s\n", S.latin1() ));
129 return 0;
120} 130}
131 } else if ( ID == "chatscripts" ) {
132 S = removeSpaces( QString("/tmp/") + connection()->name() + ".chat" );
133 F = new QFile( S );
121 134
135 if( ! F->open( IO_WriteOnly ) ) {
136 Log(("Cannot open file %s\n", S.latin1() ));
137 return 0;
138 }
139 }
140 if( F ) {
141 Log(("Generate proper file %s = %s\n",
142 ID.latin1(), F->name().latin1()));
143 }
144 return F;
145}
146
147short APPP::generateFile( const QString & ID,
148 const QString & Path,
149 QTextStream & TS,
150 long DevNr ) {
151 short rvl, rvd;
152
153 rvl = 1;
154 rvd = 1;
155
156 if( ID == "pap-secrets" ) {
157 Log(("Generate PPP for %s\n", ID.latin1() ));
158 if( Data.Auth.Mode == 1 && Data.Auth.PCEMode == 0 ) {
159 TS << "# secrets for "
160 << connection()->name().latin1()
161 << endl;
162 TS << Data.Auth.Client
163 << " "
164 << Data.Auth.Server
165 << " "
166 << Data.Auth.Secret
167 << endl;
168 rvl = 0;
169 rvd = connection()->getToplevel()->generateFileEmbedded(
170 ID, Path, TS, DevNr );
171 }
172 } else if( ID == "chap-secrets" ) {
173 Log(("Generate PPP for %s\n", ID.latin1() ));
174 if( Data.Auth.Mode == 1 && Data.Auth.PCEMode != 0 ) {
175 // used for both EAP and Chap
176 TS << "# secrets for "
177 << connection()->name().latin1()
178 << endl;
179 TS << Data.Auth.Client
180 << " "
181 << Data.Auth.Server
182 << " "
183 << Data.Auth.Secret
184 << endl;
185
186 rvl = 0;
187 rvd = connection()->getToplevel()->generateFileEmbedded(
188 ID, Path, TS, DevNr );
189 }
190 } else if ( ID == "peers" ) {
191 QFileInfo FI(Path);
192 Log(("Generate PPP for %s\n", ID.latin1() ));
193
194 TS << "connect \"/usr/sbin/chat -v -f /etc/ppp/"
195 << FI.baseName()
196 << ".chat\""
197 << endl;
198
199 if( Data.IP.GWIsDefault ) {
200 TS << "defaultroute"
201 << endl;
202 }
203
204 TS << "linkname "
205 << removeSpaces( ID.latin1() )
206 << endl;
207
208 // insert other data here
209 rvl = 0;
210 rvd = connection()->getToplevel()->generateFileEmbedded(
211 ID, Path, TS, DevNr );
212 } else if ( ID == "chatscripts" ) {
213 Log(("Generate PPP for %s\n", ID.latin1() ));
214 rvl = 0;
215 rvd = connection()->getToplevel()->generateFileEmbedded(
216 ID, Path, TS, DevNr );
217 }
218
219 return (rvd == 2 || rvl == 2 ) ? 2 :
220 (rvd == 0 || rvl == 0 ) ? 0 : 1;
221}
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.h b/noncore/settings/networksettings2/ppp/ppp_NNI.h
index 989c2f0..0bf8fa9 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NNI.h
+++ b/noncore/settings/networksettings2/ppp/ppp_NNI.h
@@ -9,2 +9,3 @@ class PPPNetNode;
9class PPPEdit; 9class PPPEdit;
10class QTextStream;
10 11
@@ -16,9 +17,6 @@ public :
16 17
17 QWidget * edit( QWidget * parent );
18 QString acceptable( void );
19 void commit( void );
20
21 RuntimeInfo * runtime( void ) 18 RuntimeInfo * runtime( void )
22 { if( RT == 0 ) 19 { if( RT == 0 ) {
23 RT = new PPPRun( this, Data ); 20 RT = new PPPRun( this, Data );
21 }
24 return RT->runtimeInfo(); 22 return RT->runtimeInfo();
@@ -26,2 +24,6 @@ public :
26 24
25 QWidget * edit( QWidget * parent );
26 QString acceptable( void );
27 void commit( void );
28
27 virtual void * data( void ) 29 virtual void * data( void )
@@ -29,7 +31,8 @@ public :
29 31
30 virtual bool hasDataFor( const QString & ) 32 virtual QFile * openFile( const QString & ID );
31 { return 0; } 33 short generateFile( const QString & ID,
34 const QString & Path,
35 QTextStream & TS,
36 long DevNr );
32 37
33 virtual bool generateDataForCommonFile(
34 SystemFile & SF, long DevNr );
35protected : 38protected :