author | wimpie <wimpie> | 2004-08-12 12:46:55 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-08-12 12:46:55 (UTC) |
commit | 8f215ba9ceb395f262517855a99d7d2d303ca760 (patch) (unidiff) | |
tree | aa5f9b14c249217b4d3fc30f4771bdaf1c3545d3 /noncore/settings/networksettings2/ppp | |
parent | ef64880308b5035cc8ca2e4e79325db613af525b (diff) | |
download | opie-8f215ba9ceb395f262517855a99d7d2d303ca760.zip opie-8f215ba9ceb395f262517855a99d7d2d303ca760.tar.gz opie-8f215ba9ceb395f262517855a99d7d2d303ca760.tar.bz2 |
MANY changes
- now generates peers/pap-chap secrets files
(no chatscript yet)
(not all usefull ppp options included yet)
- still not ready for prime time yet
Diffstat (limited to 'noncore/settings/networksettings2/ppp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/ppp/PPPAuthGUI.ui | 158 | ||||
-rw-r--r-- | noncore/settings/networksettings2/ppp/PPPAuthedit.cpp | 42 | ||||
-rw-r--r-- | noncore/settings/networksettings2/ppp/PPPAuthedit.h | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings2/ppp/ppp_NN.cpp | 31 | ||||
-rw-r--r-- | noncore/settings/networksettings2/ppp/ppp_NN.h | 31 | ||||
-rw-r--r-- | noncore/settings/networksettings2/ppp/ppp_NNI.cpp | 108 | ||||
-rw-r--r-- | noncore/settings/networksettings2/ppp/ppp_NNI.h | 21 |
7 files changed, 263 insertions, 130 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 | |||
@@ -12,5 +12,5 @@ | |||
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>249</width> | 14 | <width>245</width> |
15 | <height>209</height> | 15 | <height>209</height> |
16 | </rect> | 16 | </rect> |
@@ -58,9 +58,9 @@ | |||
58 | <property stdset="1"> | 58 | <property stdset="1"> |
59 | <name>margin</name> | 59 | <name>margin</name> |
60 | <number>0</number> | 60 | <number>3</number> |
61 | </property> | 61 | </property> |
62 | <property stdset="1"> | 62 | <property stdset="1"> |
63 | <name>spacing</name> | 63 | <name>spacing</name> |
64 | <number>0</number> | 64 | <number>2</number> |
65 | </property> | 65 | </property> |
66 | <widget> | 66 | <widget> |
@@ -192,13 +192,52 @@ | |||
192 | </widget> | 192 | </widget> |
193 | <widget> | 193 | <widget> |
194 | <class>QRadioButton</class> | 194 | <class>QLayoutWidget</class> |
195 | <property stdset="1"> | 195 | <property stdset="1"> |
196 | <name>name</name> | 196 | <name>name</name> |
197 | <cstring>PapChap_RB</cstring> | 197 | <cstring>Layout3</cstring> |
198 | </property> | ||
199 | <property stdset="1"> | ||
200 | <name>text</name> | ||
201 | <string>Pap/Chap/EAP</string> | ||
202 | </property> | 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> | ||
231 | <class>QRadioButton</class> | ||
232 | <property stdset="1"> | ||
233 | <name>name</name> | ||
234 | <cstring>EAP_RB</cstring> | ||
235 | </property> | ||
236 | <property stdset="1"> | ||
237 | <name>text</name> | ||
238 | <string>EAP</string> | ||
239 | </property> | ||
240 | </widget> | ||
241 | </hbox> | ||
203 | </widget> | 242 | </widget> |
204 | <widget> | 243 | <widget> |
@@ -276,7 +315,7 @@ | |||
276 | <property stdset="1"> | 315 | <property stdset="1"> |
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> |
282 | <property stdset="1"> | 321 | <property stdset="1"> |
@@ -289,5 +328,5 @@ | |||
289 | </property> | 328 | </property> |
290 | </widget> | 329 | </widget> |
291 | <widget row="3" column="0" > | 330 | <widget row="2" column="0" > |
292 | <class>QLabel</class> | 331 | <class>QLabel</class> |
293 | <property stdset="1"> | 332 | <property stdset="1"> |
@@ -300,52 +339,23 @@ | |||
300 | </property> | 339 | </property> |
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> |
333 | <property stdset="1"> | 347 | <property stdset="1"> |
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> |
351 | <property stdset="1"> | 361 | <property stdset="1"> |
@@ -358,43 +368,15 @@ | |||
358 | </property> | 368 | </property> |
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> |
366 | <property stdset="1"> | 376 | <property stdset="1"> |
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> |
400 | </widget> | 382 | </widget> |
@@ -418,5 +400,5 @@ | |||
418 | <connections> | 400 | <connections> |
419 | <connection> | 401 | <connection> |
420 | <sender>PapChap_RB</sender> | 402 | <sender>Pap_RB</sender> |
421 | <signal>toggled(bool)</signal> | 403 | <signal>toggled(bool)</signal> |
422 | <receiver>GroupBox3</receiver> | 404 | <receiver>GroupBox3</receiver> |
@@ -429,4 +411,16 @@ | |||
429 | <slot>setEnabled(bool)</slot> | 411 | <slot>setEnabled(bool)</slot> |
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> |
432 | </UI> | 426 | </UI> |
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 | |||
@@ -10,4 +10,11 @@ PPPAuthEdit::PPPAuthEdit( QWidget * Parent ) : PPPAuthGUI( Parent ){ | |||
10 | } | 10 | } |
11 | 11 | ||
12 | bool PPPAuthEdit::PAP_Checked( void ) { | ||
13 | return ( Pap_RB->isChecked() || | ||
14 | Chap_RB->isChecked() || | ||
15 | EAP_RB->isChecked() | ||
16 | ); | ||
17 | } | ||
18 | |||
12 | QString PPPAuthEdit::acceptable( void ) { | 19 | QString PPPAuthEdit::acceptable( void ) { |
13 | if( Login_RB->isChecked() ) { | 20 | if( Login_RB->isChecked() ) { |
@@ -20,5 +27,5 @@ QString PPPAuthEdit::acceptable( void ) { | |||
20 | if( PasswordExpect_LE->text().isEmpty() ) | 27 | if( PasswordExpect_LE->text().isEmpty() ) |
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() ) |
24 | return tr("Pap/Chap/EAP client id missing"); | 31 | return tr("Pap/Chap/EAP client id missing"); |
@@ -35,5 +42,5 @@ bool PPPAuthEdit::commit( PPPData_t & D ) { | |||
35 | 42 | ||
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() ) ) { |
39 | // mode modifed | 46 | // mode modifed |
@@ -41,6 +48,5 @@ bool PPPAuthEdit::commit( PPPData_t & D ) { | |||
41 | D.Auth.Mode = ( Login_RB->isChecked() ) ? | 48 | D.Auth.Mode = ( Login_RB->isChecked() ) ? |
42 | 0 : | 49 | 0 : |
43 | ( ( PapChap_RB->isChecked() ) ? | 50 | ( PAP_Checked() ) ? 1 : 2; |
44 | 1 : 2 ); | ||
45 | } | 51 | } |
46 | 52 | ||
@@ -50,9 +56,15 @@ bool PPPAuthEdit::commit( PPPData_t & D ) { | |||
50 | TXTM( D.Auth.Password.Expect, PasswordExpect_LE, SM ); | 56 | TXTM( D.Auth.Password.Expect, PasswordExpect_LE, SM ); |
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 ); |
54 | TXTM( D.Auth.Server, Server_LE, SM ); | 60 | TXTM( D.Auth.Server, Server_LE, SM ); |
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 | } |
58 | return SM; | 70 | return SM; |
@@ -63,11 +75,21 @@ void PPPAuthEdit::showData( PPPData_t & D ) { | |||
63 | switch( D.Auth.Mode ) { | 75 | switch( D.Auth.Mode ) { |
64 | case 0 : | 76 | case 0 : |
65 | Login_RB->isChecked(); | 77 | Login_RB->setChecked( TRUE ); |
66 | break; | 78 | break; |
67 | case 1 : | 79 | case 1 : |
68 | PapChap_RB->isChecked(); | 80 | switch( D.Auth.PCEMode ) { |
81 | case 0 : | ||
82 | Pap_RB->setChecked( TRUE ); | ||
83 | break; | ||
84 | case 1 : | ||
85 | Chap_RB->setChecked( TRUE ); | ||
86 | break; | ||
87 | case 2 : | ||
88 | EAP_RB->setChecked( TRUE ); | ||
89 | break; | ||
90 | } | ||
69 | break; | 91 | break; |
70 | case 2 : | 92 | case 2 : |
71 | Terminal_RB->isChecked(); | 93 | Terminal_RB->setChecked( TRUE ); |
72 | break; | 94 | break; |
73 | } | 95 | } |
@@ -81,5 +103,3 @@ void PPPAuthEdit::showData( PPPData_t & D ) { | |||
81 | Server_LE->setText( D.Auth.Server ); | 103 | Server_LE->setText( D.Auth.Server ); |
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 | |||
@@ -10,4 +10,6 @@ public : | |||
10 | bool commit( PPPData_t & Data ); | 10 | bool commit( PPPData_t & Data ); |
11 | void showData( PPPData_t & Data ); | 11 | void showData( PPPData_t & Data ); |
12 | bool PAP_Checked( void ); | ||
13 | |||
12 | 14 | ||
13 | private : | 15 | private : |
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,5 +1,9 @@ | |||
1 | #include <qfile.h> | ||
2 | #include <qtextstream.h> | ||
1 | #include "ppp_NN.h" | 3 | #include "ppp_NN.h" |
2 | #include "ppp_NNI.h" | 4 | #include "ppp_NNI.h" |
3 | 5 | ||
6 | QStringList * PPPNetNode::ProperFiles = 0; | ||
7 | |||
4 | static const char * PPPNeeds[] = | 8 | static const char * PPPNeeds[] = |
5 | { "line", | 9 | { "line", |
@@ -12,4 +16,15 @@ static const char * PPPNeeds[] = | |||
12 | */ | 16 | */ |
13 | PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) { | 17 | PPPNetNode::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 | } |
15 | 30 | ||
@@ -40,13 +55,15 @@ const char * PPPNetNode::provides( void ) { | |||
40 | } | 55 | } |
41 | 56 | ||
42 | bool PPPNetNode::generateProperFilesFor( | 57 | QStringList * PPPNetNode::properFiles( void ) { |
43 | ANetNodeInstance * ) { | 58 | return ProperFiles; |
44 | return 0; | 59 | |
45 | } | 60 | } |
46 | 61 | ||
47 | bool PPPNetNode::generateDeviceDataForCommonFile( | 62 | // need to generate : |
48 | SystemFile & , | 63 | // /etc/ppp/pap-secrets |
49 | long ) { | 64 | // /etc/ppp/pap-secrets |
50 | return 0; | 65 | bool PPPNetNode::hasDataForFile( const QString & S ) { |
66 | return S == "pap-secrets" || | ||
67 | S == "chap-secrets" ; | ||
51 | } | 68 | } |
52 | 69 | ||
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 | |||
@@ -8,28 +8,23 @@ class APPP; | |||
8 | class PPPNetNode : public ANetNode{ | 8 | class PPPNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | PPPNetNode(); | 14 | PPPNetNode(); |
15 | virtual ~PPPNetNode(); | 15 | virtual ~PPPNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/ppp"; } | 18 | { return "Devices/ppp"; } |
19 | 19 | ||
20 | virtual const QString nodeDescription() ; | 20 | virtual bool hasDataForFile( const QString & S ); |
21 | 21 | ||
22 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual const QString nodeDescription() ; |
23 | virtual ANetNodeInstance * createInstance( void ); | ||
24 | virtual const char ** needs( void ); | ||
25 | virtual const char * provides( void ); | ||
23 | 26 | ||
24 | virtual const char ** needs( void ); | 27 | virtual QString genNic( long NicNr ); |
25 | virtual const char * provides( void ); | 28 | virtual QStringList * properFiles( void ); |
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 ); | ||
34 | 29 | ||
35 | private: | 30 | private: |
@@ -37,4 +32,6 @@ private: | |||
37 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
38 | virtual void saveSpecificAttribute( QTextStream & TS ); | 33 | virtual void saveSpecificAttribute( QTextStream & TS ); |
34 | |||
35 | static QStringList * ProperFiles; | ||
39 | }; | 36 | }; |
40 | 37 | ||
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,2 +1,4 @@ | |||
1 | #include <qfile.h> | ||
2 | #include <qfileinfo.h> | ||
1 | #include "PPPedit.h" | 3 | #include "PPPedit.h" |
2 | #include "ppp_NNI.h" | 4 | #include "ppp_NNI.h" |
@@ -114,8 +116,106 @@ void APPP::commit( void ) { | |||
114 | } | 116 | } |
115 | 117 | ||
116 | bool APPP::generateDataForCommonFile( | 118 | QFile * 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; | ||
130 | } | ||
131 | } else if ( ID == "chatscripts" ) { | ||
132 | S = removeSpaces( QString("/tmp/") + connection()->name() + ".chat" ); | ||
133 | F = new QFile( S ); | ||
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; | ||
120 | } | 145 | } |
121 | 146 | ||
147 | short 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 | |||
@@ -8,4 +8,5 @@ | |||
8 | class PPPNetNode; | 8 | class PPPNetNode; |
9 | class PPPEdit; | 9 | class PPPEdit; |
10 | class QTextStream; | ||
10 | 11 | ||
11 | class APPP : public ANetNodeInstance { | 12 | class APPP : public ANetNodeInstance { |
@@ -15,22 +16,24 @@ public : | |||
15 | APPP( PPPNetNode * PNN ); | 16 | APPP( PPPNetNode * PNN ); |
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(); |
25 | } | 23 | } |
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 ) |
28 | { return (void *)&Data; } | 30 | { return (void *)&Data; } |
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 ); | ||
35 | protected : | 38 | protected : |
36 | 39 | ||