summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/ppp
authorwimpie <wimpie>2005-01-04 01:35:26 (UTC)
committer wimpie <wimpie>2005-01-04 01:35:26 (UTC)
commita9c188235c97e07b0eb96b13adbcdfd4bad64767 (patch) (side-by-side diff)
tree13f6ae5c499dc0c1d1bd4b763a1973a0fa8635cf /noncore/settings/networksettings2/ppp
parent48b6cd5966ec6cc0b968edf10ba1a1ad96ef165f (diff)
downloadopie-a9c188235c97e07b0eb96b13adbcdfd4bad64767.zip
opie-a9c188235c97e07b0eb96b13adbcdfd4bad64767.tar.gz
opie-a9c188235c97e07b0eb96b13adbcdfd4bad64767.tar.bz2
CONTROL files : changed version string
NS2 many changes and first release of OT2
Diffstat (limited to 'noncore/settings/networksettings2/ppp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/ppp/PPPAuthedit.cpp4
-rw-r--r--noncore/settings/networksettings2/ppp/PPPAuthedit.h4
-rw-r--r--noncore/settings/networksettings2/ppp/PPPDNSedit.cpp4
-rw-r--r--noncore/settings/networksettings2/ppp/PPPDNSedit.h4
-rw-r--r--noncore/settings/networksettings2/ppp/PPPGUI.ui20
-rw-r--r--noncore/settings/networksettings2/ppp/PPPIPGUI.ui255
-rw-r--r--noncore/settings/networksettings2/ppp/PPPIPedit.cpp37
-rw-r--r--noncore/settings/networksettings2/ppp/PPPIPedit.h4
-rw-r--r--noncore/settings/networksettings2/ppp/PPPedit.cpp11
-rw-r--r--noncore/settings/networksettings2/ppp/PPPedit.h14
-rw-r--r--noncore/settings/networksettings2/ppp/opie-networksettings2plugin-ppp.control2
-rw-r--r--noncore/settings/networksettings2/ppp/ppp.pro11
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.cpp36
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.h6
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NNI.cpp154
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NNI.h12
-rw-r--r--noncore/settings/networksettings2/ppp/pppdata.h22
-rw-r--r--noncore/settings/networksettings2/ppp/ppprun.cpp56
-rw-r--r--noncore/settings/networksettings2/ppp/ppprun.h34
19 files changed, 327 insertions, 363 deletions
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp b/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp
index 450d560..9403694 100644
--- a/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp
+++ b/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp
@@ -16,82 +16,82 @@ bool PPPAuthEdit::PAP_Checked( void ) {
);
}
QString PPPAuthEdit::acceptable( void ) {
if( Login_RB->isChecked() ) {
if( LoginSend_LE->text().isEmpty() )
return tr("Login send missing");
if( LoginExpect_LE->text().isEmpty() )
return tr("Login expect missing");
if( PasswordSend_LE->text().isEmpty() )
return tr("Password send missing");
if( PasswordExpect_LE->text().isEmpty() )
return tr("Password expect missing");
} else if( PAP_Checked() ) {
if( Client_LE->text().isEmpty() )
return tr("Pap/Chap/EAP client id missing");
if( Server_LE->text().isEmpty() )
return tr("Pap/Chap/EAP server id missing");
if( Secret_LE->text().isEmpty() )
return tr("Pap/Chap/EAP secret id missing");
}
return QString();
}
-bool PPPAuthEdit::commit( PPPData_t & D ) {
+bool PPPAuthEdit::commit( PPPData & D ) {
bool SM = 0;
if( ( D.Auth.Mode == 0 && ! Login_RB->isChecked() ) ||
( D.Auth.Mode == 1 && ! PAP_Checked() ) ||
( D.Auth.Mode == 2 && ! Terminal_RB->isChecked() ) ) {
// mode modifed
SM = 1;
D.Auth.Mode = ( Login_RB->isChecked() ) ?
0 :
( PAP_Checked() ) ? 1 : 2;
}
if( Login_RB->isChecked() ) {
TXTM( D.Auth.Login.Expect, LoginExpect_LE, SM );
TXTM( D.Auth.Login.Send, LoginSend_LE, SM );
TXTM( D.Auth.Password.Expect, PasswordExpect_LE, SM );
TXTM( D.Auth.Password.Send, PasswordSend_LE, SM );
} else if( PAP_Checked() ) {
TXTM( D.Auth.Client, Client_LE, SM );
TXTM( D.Auth.Server, Server_LE, SM );
TXTM( D.Auth.Secret, Secret_LE, SM );
if( Pap_RB->isChecked() ) {
D.Auth.PCEMode = 0;
} else if( Chap_RB->isChecked() ) {
D.Auth.PCEMode = 1;
} else if( EAP_RB->isChecked() ) {
D.Auth.PCEMode = 2;
}
}
return SM;
}
-void PPPAuthEdit::showData( PPPData_t & D ) {
+void PPPAuthEdit::showData( PPPData & D ) {
switch( D.Auth.Mode ) {
case 0 :
Login_RB->setChecked( TRUE );
break;
case 1 :
switch( D.Auth.PCEMode ) {
case 0 :
Pap_RB->setChecked( TRUE );
break;
case 1 :
Chap_RB->setChecked( TRUE );
break;
case 2 :
EAP_RB->setChecked( TRUE );
break;
}
break;
case 2 :
Terminal_RB->setChecked( TRUE );
break;
}
LoginExpect_LE->setText( D.Auth.Login.Expect );
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthedit.h b/noncore/settings/networksettings2/ppp/PPPAuthedit.h
index 2392569..7a06657 100644
--- a/noncore/settings/networksettings2/ppp/PPPAuthedit.h
+++ b/noncore/settings/networksettings2/ppp/PPPAuthedit.h
@@ -1,17 +1,17 @@
#include "pppdata.h"
#include "PPPAuthGUI.h"
class PPPAuthEdit : public PPPAuthGUI {
public :
PPPAuthEdit( QWidget * parent );
QString acceptable( void );
- bool commit( PPPData_t & Data );
- void showData( PPPData_t & Data );
+ bool commit( PPPData & Data );
+ void showData( PPPData & Data );
bool PAP_Checked( void );
private :
};
diff --git a/noncore/settings/networksettings2/ppp/PPPDNSedit.cpp b/noncore/settings/networksettings2/ppp/PPPDNSedit.cpp
index 22f8e59..270f695 100644
--- a/noncore/settings/networksettings2/ppp/PPPDNSedit.cpp
+++ b/noncore/settings/networksettings2/ppp/PPPDNSedit.cpp
@@ -2,49 +2,49 @@
#include <qmessagebox.h>
#include <qlistbox.h>
#include <qlineedit.h>
#include <qradiobutton.h>
#include <resources.h>
#include <GUIUtils.h>
#include "PPPDNSedit.h"
PPPDNSEdit::PPPDNSEdit( QWidget * Parent ) : PPPDNSGUI( Parent ){
Add_TB->setPixmap( NSResources->getPixmap( "add" ) );
Remove_TB->setPixmap( NSResources->getPixmap( "remove" ) );
}
QString PPPDNSEdit::acceptable( void ) {
if( DNSFixed_RB->isChecked() ) {
if( DomainName_LE->text().isEmpty() )
tr("Domainname needed");
if( Servers_LB->count() == 0 )
tr("DNS Servers needed");
}
return QString();
}
-bool PPPDNSEdit::commit( PPPData_t & D ) {
+bool PPPDNSEdit::commit( PPPData & D ) {
bool SM = 0;
CBM( D.DNS.ServerAssigned, DNSServerAssigned_RB, SM );
TXTM( D.DNS.DomainName, DomainName_LE, SM );
// new items in old ?
for ( unsigned i = 0; i < Servers_LB->count(); i++ ) {
QString S;
bool Found;
Found = 0;
S = Servers_LB->text(i);
for ( unsigned j = 0; j < D.DNS.Servers.size(); j++ ) {
if( *(D.DNS.Servers[i]) == S ) {
// still in list
Found = 1;
break;
}
}
if( ! Found ) {
SM = 1;
D.DNS.Servers.resize( D.DNS.Servers.size()+1 );
D.DNS.Servers[D.DNS.Servers.size()] = new QString( S );
}
}
@@ -54,49 +54,49 @@ bool PPPDNSEdit::commit( PPPData_t & D ) {
bool Found;
Found = 0;
for ( unsigned i = 0; i < Servers_LB->count(); i++ ) {
if( *(D.DNS.Servers[j]) == Servers_LB->text(i) ) {
// still in list
Found = 1;
break;
}
}
if( ! Found ) {
// old obsolete
SM = 1;
delete D.DNS.Servers[j];
for( unsigned i = j+1; i < D.DNS.Servers.size(); i ++ ) {
// compress array
D.DNS.Servers[i-1] = D.DNS.Servers[i];
}
// shrink
D.DNS.Servers.resize( D.DNS.Servers.size()-1 );
}
}
return SM;
}
-void PPPDNSEdit::showData( PPPData_t & D) {
+void PPPDNSEdit::showData( PPPData & D) {
DNSServerAssigned_RB->setChecked( D.DNS.ServerAssigned );
DomainName_LE->setText( D.DNS.DomainName );
for( unsigned i = 0; i < D.DNS.Servers.size(); i ++ ) {
Servers_LB->insertItem( *(D.DNS.Servers[i]) );
}
}
void PPPDNSEdit::SLOT_AddServer( void ) {
if( ServerAddress_LE->text().isEmpty() )
return;
Servers_LB->insertItem( ServerAddress_LE->text() );
ServerAddress_LE->setText( "" );
}
void PPPDNSEdit::SLOT_RemoveServer( void ) {
long i = Servers_LB->currentItem();
if( i < 0 )
return;
Servers_LB->removeItem( i );
if( (unsigned) i >= Servers_LB->count() ) {
i --;
diff --git a/noncore/settings/networksettings2/ppp/PPPDNSedit.h b/noncore/settings/networksettings2/ppp/PPPDNSedit.h
index 43e0067..1ca8c21 100644
--- a/noncore/settings/networksettings2/ppp/PPPDNSedit.h
+++ b/noncore/settings/networksettings2/ppp/PPPDNSedit.h
@@ -1,20 +1,20 @@
#include "pppdata.h"
#include "PPPDNSGUI.h"
class PPPDNSEdit : public PPPDNSGUI {
public :
PPPDNSEdit( QWidget * parent );
QString acceptable( void );
- bool commit( PPPData_t & Data );
- void showData( PPPData_t & Data );
+ bool commit( PPPData & Data );
+ void showData( PPPData & Data );
public slots :
void SLOT_AddServer( void );
void SLOT_RemoveServer( void );
private :
};
diff --git a/noncore/settings/networksettings2/ppp/PPPGUI.ui b/noncore/settings/networksettings2/ppp/PPPGUI.ui
index 777e4a9..4c79fe3 100644
--- a/noncore/settings/networksettings2/ppp/PPPGUI.ui
+++ b/noncore/settings/networksettings2/ppp/PPPGUI.ui
@@ -1,103 +1,115 @@
<!DOCTYPE UI><UI>
<class>PPPGUI</class>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>PPPGUI</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>124</width>
- <height>29</height>
+ <width>528</width>
+ <height>345</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>PPP</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
- <number>2</number>
+ <number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>2</number>
</property>
<widget>
<class>QComboBox</class>
<item>
<property>
<name>text</name>
<string>Authentication</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>IP settings</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>DNS Settings</string>
</property>
</item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Commands</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Dialing</string>
+ </property>
+ </item>
<property stdset="1">
<name>name</name>
<cstring>PPPOptions_CB</cstring>
</property>
</widget>
<widget>
<class>QWidgetStack</class>
<property stdset="1">
<name>name</name>
<cstring>Options_WS</cstring>
</property>
</widget>
</vbox>
</widget>
<customwidgets>
<customwidget>
<class>QWidgetStack</class>
<header location="global">qwidgetstack.h</header>
<sizehint>
<width>-1</width>
<height>-1</height>
</sizehint>
- <container>0</container>
+ <container>1</container>
<sizepolicy>
<hordata>7</hordata>
<verdata>7</verdata>
</sizepolicy>
<pixmap>image0</pixmap>
<slot access="public">raiseWidget( int )</slot>
</customwidget>
</customwidgets>
<images>
<image>
<name>image0</name>
<data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data>
</image>
</images>
<connections>
<connection>
<sender>PPPOptions_CB</sender>
<signal>activated(int)</signal>
<receiver>PPPGUI</receiver>
<slot>SLOT_SelectTopic( int )</slot>
</connection>
<slot access="public">SLOT_SelectTopic( int )</slot>
</connections>
</UI>
diff --git a/noncore/settings/networksettings2/ppp/PPPIPGUI.ui b/noncore/settings/networksettings2/ppp/PPPIPGUI.ui
index f3d5019..21bd29e 100644
--- a/noncore/settings/networksettings2/ppp/PPPIPGUI.ui
+++ b/noncore/settings/networksettings2/ppp/PPPIPGUI.ui
@@ -1,259 +1,188 @@
<!DOCTYPE UI><UI>
<class>PPPIPGUI</class>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>PPPIPGUI</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>133</width>
- <height>235</height>
+ <width>258</width>
+ <height>232</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>PPPIP</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
- <number>3</number>
+ <number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>2</number>
+ <number>1</number>
</property>
<widget>
- <class>QButtonGroup</class>
+ <class>QGroupBox</class>
<property stdset="1">
<name>name</name>
- <cstring>ButtonGroup4</cstring>
- </property>
- <property stdset="1">
- <name>frameShape</name>
- <enum>Box</enum>
+ <cstring>GroupBox1</cstring>
</property>
<property stdset="1">
<name>title</name>
<string>IP</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
- <vbox>
+ <grid>
<property stdset="1">
<name>margin</name>
- <number>2</number>
+ <number>3</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>2</number>
</property>
- <widget>
- <class>QRadioButton</class>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>IPServerAssigned_RB</cstring>
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
</property>
<property stdset="1">
<name>text</name>
- <string>Server assigned</string>
+ <string>Local</string>
</property>
+ </widget>
+ <widget row="0" column="1" >
+ <class>QLineEdit</class>
<property stdset="1">
- <name>checked</name>
+ <name>name</name>
+ <cstring>LocalAddress_LE</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
<bool>true</bool>
</property>
</widget>
- <widget>
- <class>QRadioButton</class>
+ <widget row="0" column="2" >
+ <class>QCheckBox</class>
<property stdset="1">
<name>name</name>
- <cstring>IPFixed_RB</cstring>
+ <cstring>ServerOverrulesLocal_CB</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Fixed</string>
+ <string>Server Overrules</string>
</property>
</widget>
- <widget>
- <class>QLayoutWidget</class>
+ <widget row="1" column="1" >
+ <class>QLineEdit</class>
<property stdset="1">
<name>name</name>
- <cstring>Layout11</cstring>
+ <cstring>RemoteAddress_LE</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
</property>
- <hbox>
- <property stdset="1">
- <name>margin</name>
- <number>0</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>6</number>
- </property>
- <spacer>
- <property>
- <name>name</name>
- <cstring>Spacer8</cstring>
- </property>
- <property stdset="1">
- <name>orientation</name>
- <enum>Horizontal</enum>
- </property>
- <property stdset="1">
- <name>sizeType</name>
- <enum>Fixed</enum>
- </property>
- <property>
- <name>sizeHint</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- <property>
- <name>layoutMargin</name>
- </property>
- <property>
- <name>layoutSpacing</name>
- </property>
- </spacer>
- <widget>
- <class>QFrame</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Frame8</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>false</bool>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>5</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>frameShape</name>
- <enum>NoFrame</enum>
- </property>
- <property stdset="1">
- <name>frameShadow</name>
- <enum>Raised</enum>
- </property>
- <property>
- <name>layoutMargin</name>
- </property>
- <property>
- <name>layoutSpacing</name>
- </property>
- <grid>
- <property stdset="1">
- <name>margin</name>
- <number>2</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>2</number>
- </property>
- <widget row="0" column="1" >
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>IPAddress_LE</cstring>
- </property>
- </widget>
- <widget row="1" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>TextLabel3</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Subnetmask</string>
- </property>
- </widget>
- <widget row="0" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>TextLabel2</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Address</string>
- </property>
- </widget>
- <widget row="1" column="1" >
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>IPSubMask_LE</cstring>
- </property>
- </widget>
- </grid>
- </widget>
- </hbox>
</widget>
- </vbox>
+ <widget row="1" column="2" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ServerOverrulesRemote_CB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Server Overrules</string>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Remote</string>
+ </property>
+ </widget>
+ </grid>
</widget>
<widget>
<class>QButtonGroup</class>
<property stdset="1">
<name>name</name>
<cstring>ButtonGroup5</cstring>
</property>
<property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
<name>title</name>
<string>Gateway</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
- <number>2</number>
+ <number>3</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>2</number>
</property>
<widget>
<class>QRadioButton</class>
<property stdset="1">
<name>name</name>
<cstring>GWServerAssigned_RB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Server assigned</string>
</property>
<property stdset="1">
<name>checked</name>
<bool>true</bool>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
@@ -357,88 +286,114 @@
<property stdset="1">
<name>name</name>
<cstring>TextLabel4</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Address</string>
</property>
</widget>
<widget row="0" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>GWAddress_LE</cstring>
</property>
</widget>
</grid>
</widget>
</hbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>Layout3</cstring>
+ <cstring>Layout4</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GWIsDefault_CB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Set as default</string>
+ </property>
+ </widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer3</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
- <cstring>GWIsDefault_CB</cstring>
+ <cstring>GWIfNotSet_CB</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Set as default</string>
+ <string>Only if not yet set</string>
</property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer4</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
</vbox>
</widget>
<connections>
<connection>
<sender>GWFixed_RB</sender>
<signal>toggled(bool)</signal>
<receiver>Frame9</receiver>
<slot>setEnabled(bool)</slot>
</connection>
- <connection>
- <sender>IPFixed_RB</sender>
- <signal>toggled(bool)</signal>
- <receiver>Frame8</receiver>
- <slot>setEnabled(bool)</slot>
- </connection>
</connections>
</UI>
diff --git a/noncore/settings/networksettings2/ppp/PPPIPedit.cpp b/noncore/settings/networksettings2/ppp/PPPIPedit.cpp
index 6965e5a..ef1b7c0 100644
--- a/noncore/settings/networksettings2/ppp/PPPIPedit.cpp
+++ b/noncore/settings/networksettings2/ppp/PPPIPedit.cpp
@@ -1,57 +1,54 @@
#include <qmessagebox.h>
#include <qcheckbox.h>
#include <qradiobutton.h>
#include <qlineedit.h>
#include <GUIUtils.h>
#include "PPPIPedit.h"
PPPIPEdit::PPPIPEdit( QWidget * Parent ) : PPPIPGUI( Parent ){
}
QString PPPIPEdit::acceptable( void ) {
- if( IPFixed_RB->isChecked() ) {
- if( IPAddress_LE->text().isEmpty() )
- return tr("IPAddress needed" );
- if( ! validIP( IPAddress_LE->text() ) )
- return tr("IPAddress not valid" );
- if( IPSubMask_LE->text().isEmpty() )
- return tr("Subnet mask needed" );
- if( ! validIP( IPSubMask_LE->text() ) )
- return tr("Subnet mask not valid" );
- } else if( GWFixed_RB->isChecked() ) {
+ if( GWFixed_RB->isChecked() ) {
if( GWAddress_LE->text().isEmpty() )
return tr("Gateway address needed" );
if( ! validIP( GWAddress_LE->text() ) )
return tr("Gateway address not valid" );
};
return QString();
}
-bool PPPIPEdit::commit( PPPData_t & D ) {
+bool PPPIPEdit::commit( PPPData & D ) {
bool SM = 0;
- CBM( D.IP.IPAutomatic, IPServerAssigned_RB, SM );
- if( ! D.IP.IPAutomatic ) {
- TXTM( D.IP.IPAddress, IPAddress_LE, SM );
- TXTM( D.IP.IPSubMask, IPSubMask_LE, SM );
- }
+ CBM( D.IP.LocalOverrule, ServerOverrulesLocal_CB, SM );
+ CBM( D.IP.RemoteOverrule, ServerOverrulesRemote_CB, SM );
+
+ TXTM( D.IP.LocalAddress, LocalAddress_LE, SM );
+ TXTM( D.IP.RemoteAddress, RemoteAddress_LE, SM );
CBM( D.IP.GWAutomatic, GWServerAssigned_RB, SM );
+
if( ! D.IP.GWAutomatic ) {
TXTM( D.IP.GWAddress, GWAddress_LE, SM );
}
CBM( D.IP.GWIsDefault, GWIsDefault_CB, SM );
+ CBM( D.IP.GWIfNotSet, GWIfNotSet_CB, SM );
+
return SM;
}
-void PPPIPEdit::showData( PPPData_t & D ) {
- IPServerAssigned_RB->setChecked( D.IP.IPAutomatic );
- IPAddress_LE->setText( D.IP.IPAddress );
- IPSubMask_LE->setText( D.IP.IPSubMask );
+void PPPIPEdit::showData( PPPData & D ) {
+ ServerOverrulesLocal_CB->setChecked( D.IP.LocalOverrule );
+ ServerOverrulesRemote_CB->setChecked( D.IP.RemoteOverrule );
+ LocalAddress_LE->setText( D.IP.LocalAddress );
+ RemoteAddress_LE->setText( D.IP.RemoteAddress );
+
GWServerAssigned_RB->setChecked( D.IP.GWAutomatic );
GWAddress_LE->setText( D.IP.GWAddress );
GWIsDefault_CB->setChecked( D.IP.GWIsDefault );
+ GWIfNotSet_CB->setChecked( D.IP.GWIfNotSet );
}
diff --git a/noncore/settings/networksettings2/ppp/PPPIPedit.h b/noncore/settings/networksettings2/ppp/PPPIPedit.h
index 153ee68..5ca4326 100644
--- a/noncore/settings/networksettings2/ppp/PPPIPedit.h
+++ b/noncore/settings/networksettings2/ppp/PPPIPedit.h
@@ -1,15 +1,15 @@
#include "pppdata.h"
#include "PPPIPGUI.h"
class PPPIPEdit : public PPPIPGUI {
public :
PPPIPEdit( QWidget * parent );
QString acceptable( void );
- bool commit( PPPData_t & Data );
- void showData( PPPData_t & Data );
+ bool commit( PPPData & Data );
+ void showData( PPPData & Data );
private :
};
diff --git a/noncore/settings/networksettings2/ppp/PPPedit.cpp b/noncore/settings/networksettings2/ppp/PPPedit.cpp
index eb4fdbf..17889aa 100644
--- a/noncore/settings/networksettings2/ppp/PPPedit.cpp
+++ b/noncore/settings/networksettings2/ppp/PPPedit.cpp
@@ -1,48 +1,55 @@
#include <qwidgetstack.h>
#include "PPPIPedit.h"
#include "PPPDNSedit.h"
#include "PPPAuthedit.h"
+#include "PPPRunedit.h"
+#include "PPPDialingedit.h"
#include "PPPedit.h"
PPPEdit::PPPEdit( QWidget * Parent ) : PPPGUI( Parent ){
Auth = new PPPAuthEdit( Options_WS );
IP = new PPPIPEdit( Options_WS );
DNS = new PPPDNSEdit( Options_WS );
+ Run = new PPPRunEdit( Options_WS );
+ Dialing = new PPPDialingEdit( Options_WS );
+
Options_WS->addWidget( Auth, 0 );
Options_WS->addWidget( IP, 1 );
Options_WS->addWidget( DNS, 2 );
+ Options_WS->addWidget( Run, 3 );
+ Options_WS->addWidget( Dialing, 4 );
Options_WS->raiseWidget( 0 );
}
QString PPPEdit::acceptable( void ) {
QString S;
S = Auth->acceptable();
if( S.isEmpty() ) {
S = IP->acceptable();
if( S.isEmpty() ) {
S = DNS->acceptable();
}
}
return S;
}
-bool PPPEdit::commit( PPPData_t & Data ) {
+bool PPPEdit::commit( PPPData & Data ) {
bool SM ;
SM = Auth->commit( Data );
SM |= IP->commit( Data );
SM |= DNS->commit( Data );
return SM;
}
-void PPPEdit::showData( PPPData_t & Data ) {
+void PPPEdit::showData( PPPData & Data ) {
Auth->showData( Data ) ;
IP->showData( Data );
DNS->showData( Data );
}
void PPPEdit::SLOT_SelectTopic( int v ) {
Options_WS->raiseWidget( v );
}
diff --git a/noncore/settings/networksettings2/ppp/PPPedit.h b/noncore/settings/networksettings2/ppp/PPPedit.h
index 57d38ee..f674b17 100644
--- a/noncore/settings/networksettings2/ppp/PPPedit.h
+++ b/noncore/settings/networksettings2/ppp/PPPedit.h
@@ -1,27 +1,31 @@
#include "pppdata.h"
#include "PPPGUI.h"
class PPPAuthEdit;
class PPPIPEdit;
class PPPDNSEdit;
+class PPPRunEdit;
+class PPPDialingEdit;
class PPPEdit : public PPPGUI {
public :
PPPEdit( QWidget * parent );
QString acceptable( void );
- bool commit( PPPData_t & Data );
- void showData( PPPData_t & Data );
+ bool commit( PPPData & Data );
+ void showData( PPPData & Data );
public slots :
void SLOT_SelectTopic( int );
private :
- PPPAuthEdit * Auth;
- PPPDNSEdit * DNS;
- PPPIPEdit * IP;
+ PPPAuthEdit * Auth;
+ PPPDNSEdit * DNS;
+ PPPIPEdit * IP;
+ PPPRunEdit * Run;
+ PPPDialingEdit * Dialing;
};
diff --git a/noncore/settings/networksettings2/ppp/opie-networksettings2plugin-ppp.control b/noncore/settings/networksettings2/ppp/opie-networksettings2plugin-ppp.control
index 7dfde38..19d1c89 100644
--- a/noncore/settings/networksettings2/ppp/opie-networksettings2plugin-ppp.control
+++ b/noncore/settings/networksettings2/ppp/opie-networksettings2plugin-ppp.control
@@ -1,9 +1,9 @@
-Package: opie-networksettingsplugin2-ppp
+Package: opie-networksettings2plugin-ppp
Files: plugins/networksettings2/libppp.so*
Priority: optional
Section: opie/settings
Maintainer: Wim Delvaux <wimpie@handhelds.org>
Architecture: arm
Depends: opie-networksettings2, libopiecore2, libopienet2
Description: Network settings ppp plugin.
Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/settings/networksettings2/ppp/ppp.pro b/noncore/settings/networksettings2/ppp/ppp.pro
index f866bee..dd3408c 100644
--- a/noncore/settings/networksettings2/ppp/ppp.pro
+++ b/noncore/settings/networksettings2/ppp/ppp.pro
@@ -1,24 +1,33 @@
TEMPLATE = lib
CONFIG += qt warn_on release
DESTDIR = $(OPIEDIR)/plugins/networksettings2
HEADERS = ppp_NN.h \
ppp_NNI.h \
PPPedit.h \
PPPAuthedit.h \
PPPDNSedit.h \
+ PPPRunedit.h \
+ PPPDialingedit.h \
PPPIPedit.h
SOURCES = ppp_NN.cpp \
ppp_NNI.cpp \
PPPedit.cpp \
PPPDNSedit.cpp \
+ PPPRunedit.cpp \
+ PPPDialingedit.cpp \
PPPAuthedit.cpp \
ppprun.cpp \
PPPIPedit.cpp
INCLUDEPATH += $(OPIEDIR)/include ../ ../networksettings2
DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2
LIBS += -lqpe
-INTERFACES = PPPGUI.ui PPPAuthGUI.ui PPPIPGUI.ui PPPDNSGUI.ui
+INTERFACES = PPPGUI.ui \
+ PPPAuthGUI.ui \
+ PPPIPGUI.ui \
+ PPPDNSGUI.ui \
+ PPPDialingGUI.ui \
+ PPPRunGUI.ui
TARGET = ppp
VERSION = 1.0.0
include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
index ff4465c..51ba27d 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
@@ -1,85 +1,85 @@
#include <qfile.h>
+#include <resources.h>
#include <qtextstream.h>
#include "ppp_NN.h"
#include "ppp_NNI.h"
QStringList * PPPNetNode::ProperFiles = 0;
static const char * PPPNeeds[] =
- { "line",
- "modem",
+ { "modem",
+ 0
+ };
+
+static const char * PPPProvides[] =
+ { "connection",
0
};
/**
* Constructor, find all of the possible interfaces
*/
PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) {
- // proper files : will leak
- ProperFiles =new QStringList;
- *ProperFiles << "peers";
- *ProperFiles << "chatscript";
-
- // system files
NSResources->addSystemFile(
- "pap-secrets", "/tmp/pap-secrets", 0 );
+ "pap-secrets", "/etc/ppp/pap-secrets", 0 );
NSResources->addSystemFile(
- "chap-secrets", "/tmp/chap-secrets", 0 );
+ "chap-secrets", "/etc/ppp/chap-secrets", 0 );
}
/**
* Delete any interfaces that we own.
*/
PPPNetNode::~PPPNetNode(){
}
const QString PPPNetNode::nodeDescription(){
return tr("\
<p>Sets up IP using PPP.</p>\
<p>Use this for dialup devices or serial setups</p>\
"
);
}
ANetNodeInstance * PPPNetNode::createInstance( void ) {
return new APPP( this );
}
const char ** PPPNetNode::needs( void ) {
return PPPNeeds;
}
-const char * PPPNetNode::provides( void ) {
- return "connection";
+const char ** PPPNetNode::provides( void ) {
+ return PPPProvides;
}
-QStringList * PPPNetNode::properFiles( void ) {
- return ProperFiles;
-
+QStringList PPPNetNode::properFiles( void ) {
+ QStringList SL;
+ SL << "peers" << "chatscripts";
+ return SL;
}
// need to generate :
// /etc/ppp/pap-secrets
// /etc/ppp/pap-secrets
-bool PPPNetNode::hasDataForFile( const QString & S ) {
- return S == "pap-secrets" ||
- S == "chap-secrets" ;
+bool PPPNetNode::hasDataForFile( SystemFile & S ) {
+ return S.name() == "pap-secrets" ||
+ S.name() == "chap-secrets" ;
}
QString PPPNetNode::genNic( long NicNr ) {
QString S;
return S.sprintf( "ppp%ld", NicNr );
}
void PPPNetNode::setSpecificAttribute( QString & , QString & ) {
}
void PPPNetNode::saveSpecificAttribute( QTextStream & ) {
}
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new PPPNetNode() );
}
}
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h
index 249be5a..3ead10e 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.h
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.h
@@ -1,43 +1,43 @@
#ifndef PPP_NETNODE_H
#define PPP_NETNODE_H
#include "netnode.h"
class APPP;
class PPPNetNode : public ANetNode{
Q_OBJECT
public:
PPPNetNode();
virtual ~PPPNetNode();
virtual const QString pixmapName()
{ return "Devices/ppp"; }
- virtual bool hasDataForFile( const QString & S );
+ virtual bool hasDataForFile( SystemFile & S );
virtual const QString nodeDescription() ;
virtual ANetNodeInstance * createInstance( void );
virtual const char ** needs( void );
- virtual const char * provides( void );
+ virtual const char ** provides( void );
virtual QString genNic( long NicNr );
- virtual QStringList * properFiles( void );
+ virtual QStringList properFiles( void );
private:
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
static QStringList * ProperFiles;
};
extern "C"
{
void create_plugin( QList<ANetNode> & PNN );
};
#endif
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
index ba639de..9e3bb64 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
+++ b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
@@ -1,221 +1,235 @@
#include <qfile.h>
#include <qfileinfo.h>
#include "PPPedit.h"
#include "ppp_NNI.h"
#include "ppp_NN.h"
APPP::APPP( PPPNetNode * PNN ) : ANetNodeInstance( PNN ) {
Data.DNS.ServerAssigned = 1;
Data.DNS.DomainName = "";
Data.Auth.Mode = 0;
Data.Auth.Login.Expect = "ogin:";
Data.Auth.Password.Expect = "assword:";
Data.Auth.PCEMode = 0;
Data.Auth.Client = "*";
Data.Auth.Server = "*";
Data.Auth.Secret = "";
- Data.IP.IPAutomatic = 1;
- Data.IP.IPAddress = "";
- Data.IP.IPSubMask = "";
+ Data.IP.LocalAddress = "10.0.0.1";
+ Data.IP.RemoteAddress = "10.0.0.2";
+ Data.IP.LocalOverrule = 1;
+ Data.IP.RemoteOverrule = 1;
+
Data.IP.GWAutomatic = 1;
Data.IP.GWAddress = "";
Data.IP.GWIsDefault = 1;
+ Data.IP.GWIfNotSet = 1;
+
+ Data.Run.PreConnect = "";
+ Data.Run.PostConnect = "";
+ Data.Run.PreDisconnect = "";
+ Data.Run.PostDisconnect = "";
+
GUI = 0;
RT = 0;
}
void APPP::setSpecificAttribute( QString & A, QString & V ) {
if( A.startsWith( "dns" ) ) {
if( A == "dnsserverassigned" ) {
Data.DNS.ServerAssigned = (V == "yes");
} else if( A == "dnsdomainname" ) {
Data.DNS.DomainName = V;
} else if( A == "dnsserver" ) {
Data.DNS.Servers.resize( Data.DNS.Servers.size()+1 );
Data.DNS.Servers[Data.DNS.Servers.size()-1] =
new QString( V );
}
} else if( A.startsWith( "auth" ) ) {
if( A == "authmode" ) {
Data.Auth.Mode = V.toShort();
} else if( A == "authloginexpect" ) {
Data.Auth.Login.Expect = V;
} else if( A == "authloginsend" ) {
Data.Auth.Login.Send = V;
} else if( A == "authpasswordexpect" ) {
Data.Auth.Password.Expect = V;
} else if( A == "authpasswordsend" ) {
Data.Auth.Password.Send = V;
} else if( A == "authpcemode" ) {
Data.Auth.PCEMode = V.toShort();
} else if( A == "authclient" ) {
Data.Auth.Client = V;
} else if( A == "authserver" ) {
Data.Auth.Server = V;
} else if( A == "authsecret" ) {
Data.Auth.Secret = V;
}
} else if( A.startsWith( "ip" ) ) {
- if( A == "ipautomatic" ) {
- Data.IP.IPAutomatic = (V == "yes");
- } else if( A == "gwautomatic" ) {
+ if( A == "iplocaloverrule" ) {
+ Data.IP.LocalOverrule = (V == "yes");
+ } else if( A == "ipremoteoverrule" ) {
+ Data.IP.RemoteOverrule = (V == "yes");
+ } else if( A == "ipgwautomatic" ) {
Data.IP.GWAutomatic = (V == "yes");
- } else if( A == "gwisdefault" ) {
+ } else if( A == "ipgwisdefault" ) {
Data.IP.GWIsDefault = (V == "yes");
- } else if( A == "ipaddress" ) {
- Data.IP.IPAddress = V;
- } else if( A == "ipsubmask" ) {
- Data.IP.IPSubMask = V;
- } else if( A == "gwaddress" ) {
+ } else if( A == "ipgwifnotset" ) {
+ Data.IP.GWIfNotSet = (V == "yes");
+ } else if( A == "iplocaladdress" ) {
+ Data.IP.LocalAddress = V;
+ } else if( A == "ipremoteaddress" ) {
+ Data.IP.RemoteAddress = V;
+ } else if( A == "ipgwaddress" ) {
Data.IP.GWAddress = V;
}
+ } else if( A.startsWith( "run" ) ) {
+ if( A == "runpreconnect" ) {
+ Data.Run.PreConnect = V;
+ } else if( A == "runpostconnect" ) {
+ Data.Run.PostConnect = V;
+ } else if( A == "runpredisconnect" ) {
+ Data.Run.PreDisconnect = V;
+ } else if( A == "runpostdisconnect" ) {
+ Data.Run.PostDisconnect = V;
+ }
}
}
void APPP::saveSpecificAttribute( QTextStream & TS ) {
TS << "dnsserverassigned=" <<
( ( Data.DNS.ServerAssigned ) ? "yes" : "no" ) << endl;
TS << "dnsdomainname=" << Data.DNS.DomainName << endl;
for( unsigned int i = 0; i < Data.DNS.Servers.size(); i ++ ) {
TS << "dnsserver=" << *(Data.DNS.Servers[i]) << endl;
}
TS << "authmode=" << Data.Auth.Mode << endl;
TS << "authloginexpect=" << quote( Data.Auth.Login.Expect ) << endl;
TS << "authloginsend=" << quote( Data.Auth.Login.Send ) << endl;
TS << "authpasswordexpect=" << quote( Data.Auth.Password.Expect ) << endl;
TS << "authpasswordsend=" << quote( Data.Auth.Password.Send ) << endl;
TS << "authpcemode=" << Data.Auth.PCEMode << endl;
TS << "authclient=" << Data.Auth.Client << endl;
TS << "authserver=" << Data.Auth.Server << endl;
TS << "authsecret=" << quote( Data.Auth.Secret ) << endl;
- TS << "ipautomatic=" << ( ( Data.IP.IPAutomatic ) ? "yes" : "no" ) << endl;
- TS << "gwautomatic=" << ( ( Data.IP.GWAutomatic ) ? "yes" : "no" ) << endl;
- TS << "gwisdefault=" << ( ( Data.IP.GWIsDefault ) ? "yes" : "no" ) << endl;
- TS << "ipaddress=" << Data.IP.IPAddress << endl;
- TS << "ipsubmask=" << Data.IP.IPSubMask << endl;
- TS << "gwaddress=" << Data.IP.GWAddress << endl;
+ TS << "ipgwautomatic=" << ( ( Data.IP.GWAutomatic ) ? "yes" : "no" ) << endl;
+ TS << "ipgwisdefault=" << ( ( Data.IP.GWIsDefault ) ? "yes" : "no" ) << endl;
+ TS << "ipgwifnotset=" << ( ( Data.IP.GWIfNotSet ) ? "yes" : "no" ) << endl;
+ TS << "iplocaloverrule=" << ( ( Data.IP.LocalOverrule ) ? "yes" : "no" ) << endl;
+ TS << "ipremoteoverrule=" << ( ( Data.IP.RemoteOverrule ) ? "yes" : "no" ) << endl;
+ TS << "iplocaladdress=" << Data.IP.LocalAddress << endl;
+ TS << "ipremoteaddress=" << Data.IP.RemoteAddress << endl;
+ TS << "ipgwaddress=" << Data.IP.GWAddress << endl;
+
+ TS << "runpreconnect=" << Data.Run.PreConnect << endl;
+ TS << "runpostconnect=" << Data.Run.PostConnect << endl;
+ TS << "runpredisconnect=" << Data.Run.PreDisconnect << endl;
+ TS << "runpostdisconnect=" << Data.Run.PostDisconnect << endl;
+
}
QWidget * APPP::edit( QWidget * parent ) {
GUI = new PPPEdit( parent );
GUI->showData( Data );
return GUI;
}
QString APPP::acceptable( void ) {
return ( GUI ) ? GUI->acceptable( ) : QString();
}
void APPP::commit( void ) {
if( GUI && GUI->commit( Data ) ) {
setModified( 1 );
}
}
-QFile * APPP::openFile( const QString & ID ) {
- QFile * F = 0;
- QString S;
-
- if( ID == "peers" ) {
- S = removeSpaces( QString("/tmp/") + connection()->name() );
-
- F = new QFile( S );
-
- if( ! F->open( IO_WriteOnly ) ) {
- Log(("Cannot open file %s\n", S.latin1() ));
- return 0;
- }
- } else if ( ID == "chatscripts" ) {
- S = removeSpaces( QString("/tmp/") + connection()->name() + ".chat" );
- F = new QFile( S );
-
- if( ! F->open( IO_WriteOnly ) ) {
- Log(("Cannot open file %s\n", S.latin1() ));
- return 0;
- }
+bool APPP::openFile( SystemFile & SF ) {
+ if( SF.name() == "peers" ) {
+ SF.setPath( removeSpaces(
+ QString( "/tmp/ppp/peers/" ) + connection()->name() ) );
+ return 1;
+ } else if ( SF.name() == "chatscripts" ) {
+ SF.setPath( removeSpaces(
+ QString( "/tmp/chatscripts/" ) + connection()->name() ) );
+ return 1;
}
- if( F ) {
- Log(("Generate proper file %s = %s\n",
- ID.latin1(), F->name().latin1()));
- }
- return F;
+ return 0;
}
-short APPP::generateFile( const QString & ID,
- const QString & Path,
- QTextStream & TS,
- long DevNr ) {
+short APPP::generateFile( SystemFile & SF, long DevNr ) {
short rvl, rvd;
rvl = 1;
rvd = 1;
- if( ID == "pap-secrets" ) {
- Log(("Generate PPP for %s\n", ID.latin1() ));
+ if( SF.name() == "pap-secrets" ) {
+ Log(("Generate PPP for %s\n", SF.name().latin1() ));
+
if( Data.Auth.Mode == 1 && Data.Auth.PCEMode == 0 ) {
- TS << "# secrets for "
+ SF << "# secrets for "
<< connection()->name().latin1()
<< endl;
- TS << Data.Auth.Client
+ SF << Data.Auth.Client
<< " "
<< Data.Auth.Server
<< " "
<< Data.Auth.Secret
<< endl;
rvl = 0;
rvd = connection()->getToplevel()->generateFileEmbedded(
- ID, Path, TS, DevNr );
+ SF, DevNr );
}
- } else if( ID == "chap-secrets" ) {
- Log(("Generate PPP for %s\n", ID.latin1() ));
+ } else if( SF.name() == "chap-secrets" ) {
+ Log(("Generate PPP for %s\n", SF.name().latin1() ));
if( Data.Auth.Mode == 1 && Data.Auth.PCEMode != 0 ) {
// used for both EAP and Chap
- TS << "# secrets for "
+ SF << "# secrets for "
<< connection()->name().latin1()
<< endl;
- TS << Data.Auth.Client
+ SF << Data.Auth.Client
<< " "
<< Data.Auth.Server
<< " "
<< Data.Auth.Secret
<< endl;
rvl = 0;
rvd = connection()->getToplevel()->generateFileEmbedded(
- ID, Path, TS, DevNr );
+ SF, DevNr );
}
- } else if ( ID == "peers" ) {
- QFileInfo FI(Path);
- Log(("Generate PPP for %s\n", ID.latin1() ));
+ } else if ( SF.name() == "peers" ) {
+
+ QFileInfo FI(SF.path());
+ Log(("Generate PPP for %s\n", SF.name().latin1() ));
- TS << "connect \"/usr/sbin/chat -v -f /etc/ppp/"
+ SF << "connect \"/usr/sbin/chat -v -f /etc/chatscripts/"
<< FI.baseName()
- << ".chat\""
+ << "\""
<< endl;
if( Data.IP.GWIsDefault ) {
- TS << "defaultroute"
+ SF << "defaultroute"
<< endl;
}
- TS << "linkname "
- << removeSpaces( ID.latin1() )
+ SF << "linkname "
+ << removeSpaces( SF.name().latin1() )
<< endl;
// insert other data here
rvl = 0;
rvd = connection()->getToplevel()->generateFileEmbedded(
- ID, Path, TS, DevNr );
- } else if ( ID == "chatscripts" ) {
- Log(("Generate PPP for %s\n", ID.latin1() ));
+ SF, DevNr );
+ } else if ( SF.name() == "chatscripts" ) {
+ Log(("Generate PPP for %s\n", SF.name().latin1() ));
rvl = 0;
rvd = connection()->getToplevel()->generateFileEmbedded(
- ID, Path, TS, DevNr );
+ SF, DevNr );
}
return (rvd == 2 || rvl == 2 ) ? 2 :
(rvd == 0 || rvl == 0 ) ? 0 : 1;
}
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.h b/noncore/settings/networksettings2/ppp/ppp_NNI.h
index 0bf8fa9..76afb21 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NNI.h
+++ b/noncore/settings/networksettings2/ppp/ppp_NNI.h
@@ -1,51 +1,45 @@
#ifndef PPP_H
#define PPP_H
#include <netnode.h>
#include "pppdata.h"
#include "ppprun.h"
class PPPNetNode;
class PPPEdit;
class QTextStream;
class APPP : public ANetNodeInstance {
public :
APPP( PPPNetNode * PNN );
RuntimeInfo * runtime( void )
- { if( RT == 0 ) {
- RT = new PPPRun( this, Data );
- }
- return RT->runtimeInfo();
- }
+ { return (RT) ? RT : (RT = new PPPRun( this, Data ) ); }
QWidget * edit( QWidget * parent );
QString acceptable( void );
void commit( void );
virtual void * data( void )
{ return (void *)&Data; }
- virtual QFile * openFile( const QString & ID );
- short generateFile( const QString & ID,
- const QString & Path,
- QTextStream & TS,
+ virtual bool openFile( SystemFile & Sf );
+ short generateFile( SystemFile & TS,
long DevNr );
protected :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
private :
PPPEdit * GUI;
PPPData Data;
PPPRun * RT;
};
#endif
diff --git a/noncore/settings/networksettings2/ppp/pppdata.h b/noncore/settings/networksettings2/ppp/pppdata.h
index 9e8543c..68666f8 100644
--- a/noncore/settings/networksettings2/ppp/pppdata.h
+++ b/noncore/settings/networksettings2/ppp/pppdata.h
@@ -1,38 +1,50 @@
#ifndef PPP_DATA_H
#define PPP_DATA_H
#include <qstring.h>
#include <qarray.h>
-typedef struct PPPData {
+class PPPData {
+
+public :
+
struct {
- bool IPAutomatic;
- QString IPAddress;
- QString IPSubMask;
+ bool LocalOverrule;
+ bool RemoteOverrule;
+ QString LocalAddress;
+ QString RemoteAddress;
bool GWAutomatic;
QString GWAddress;
bool GWIsDefault;
+ bool GWIfNotSet;
} IP;
+
struct {
short Mode; // 0 login, 1 chap/pap, 2 Terminal
struct {
QString Expect;
QString Send;
} Login;
struct {
QString Expect;
QString Send;
} Password;
short PCEMode; // 0 pap, 1, chap 2, EAP
QString Server;
QString Client;
QString Secret;
} Auth;
struct {
bool ServerAssigned;
QString DomainName;
QArray<QString *> Servers;
} DNS;
-} PPPData_t;
+ struct {
+ QString PreConnect;
+ QString PostConnect;
+ QString PreDisconnect;
+ QString PostDisconnect;
+ } Run;
+};
#endif
diff --git a/noncore/settings/networksettings2/ppp/ppprun.cpp b/noncore/settings/networksettings2/ppp/ppprun.cpp
index a8abc50..8403e6d 100644
--- a/noncore/settings/networksettings2/ppp/ppprun.cpp
+++ b/noncore/settings/networksettings2/ppp/ppprun.cpp
@@ -1,82 +1,52 @@
#include <resources.h>
#include "ppprun.h"
PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) :
- AsConnection( NNI ), AsDevice( NNI ), Pat( "eth[0-9]" ) {
- D = &Data;
+ RuntimeInfo( NNI ), Pat( "eth[0-9]" ) {
+ D = &Data;
}
-void PPPRun::detectState( NodeCollection * NC ) {
+State_t PPPRun::detectState( void ) {
if( isMyPPPDRunning( ) ) {
- if( isMyPPPUp() ) {
- NC->setCurrentState( IsUp );
- } else {
- NC->setCurrentState( Available );
- }
- } else {
- NC->setCurrentState( Off ); // at least this
- // but could also be unavailable
- AsDevice::netNode()->nextNode()->runtime()->detectState( NC );
- }
+ return ( isMyPPPUp() ) ? IsUp : Available;
+ }
+ return Off;
}
-bool PPPRun::setState( NodeCollection * NC, Action_t A, bool ) {
- switch( A ) {
- case Activate :
- NC->setCurrentState( Available );
- // no
- break;
- case Deactivate :
- if( NC->currentState() == IsUp ) {
- NC->state( Down );
- }
- // cannot really disable
- NC->setCurrentState( Available );
- break;
- case Up :
- if( NC->currentState() != IsUp ) {
- // start my PPPD
- NC->setCurrentState( IsUp );
- }
- break;
- case Down :
- if( NC->currentState() == IsUp ) {
- // stop my PPPD
- NC->setCurrentState( Available );
- }
- break;
- default : // FT
- break;
- }
- return 1;
+QString PPPRun::setMyState( NodeCollection * NC, Action_t A, bool ) {
+ return QString();
}
bool PPPRun::isMyPPPDRunning( void ) {
return 0;
}
bool PPPRun::isMyPPPUp( void ) {
System & S = NSResources->system();
InterfaceInfo * Run;
QRegExp R( "ppp[0-9]" );
for( QDictIterator<InterfaceInfo> It(S.interfaces());
It.current();
++It ) {
Run = It.current();
if( R.match( Run->Name ) >= 0 &&
Run->IsPointToPoint
) {
// this is a LAN card
- if( Run->assignedNode() == AsDevice::netNode() ) {
+ if( Run->assignedConnection() == netNode()->connection() ) {
// assigned to us
return 1;
}
}
}
return 0;
}
bool PPPRun::handlesInterface( const QString & S ) {
return Pat.match( S ) >= 0;
}
+
+bool PPPRun::handlesInterface( InterfaceInfo * I ) {
+ return handlesInterface( I->Name );
+}
diff --git a/noncore/settings/networksettings2/ppp/ppprun.h b/noncore/settings/networksettings2/ppp/ppprun.h
index 90a3f25..2990a96 100644
--- a/noncore/settings/networksettings2/ppp/ppprun.h
+++ b/noncore/settings/networksettings2/ppp/ppprun.h
@@ -1,47 +1,37 @@
#ifndef PPPRUN_H
#define PPPRUN_H
#include <qregexp.h>
-#include <asconnection.h>
-#include <asdevice.h>
+#include <netnode.h>
#include "pppdata.h"
-class PPPRun : public AsConnection, public AsDevice {
+class PPPRun : public RuntimeInfo {
public :
PPPRun( ANetNodeInstance * NNI,
PPPData & Data );
- virtual AsDevice * asDevice( void )
- { return (AsDevice *)this; }
- virtual AsConnection * asConnection( void )
- { return (AsConnection *)this; }
-
- virtual AsDevice * device( void )
- { return (AsDevice *)this; }
+ bool handlesInterface( const QString & I );
+ bool handlesInterface( InterfaceInfo * );
- virtual RuntimeInfo * runtimeInfo( void )
- { return ( AsConnection *)this; }
+ State_t detectState( void );
+ virtual RuntimeInfo * device( void )
+ { return this; }
+ virtual RuntimeInfo * connection( void )
+ { return this; }
- protected :
+protected :
- void detectState( NodeCollection * NC );
- bool setState( NodeCollection * NC, Action_t A, bool );
- bool canSetState( State_t S, Action_t A )
- { return AsDevice::connection()->findNext(
- AsDevice::netNode() )->runtime()->canSetState( S,A ); }
-
- bool handlesInterface( const QString & I );
+ QString setMyState( NodeCollection * , Action_t, bool );
private :
bool isMyPPPDRunning( void );
bool isMyPPPUp( void );
- PPPData_t * D;
+ PPPData * D;
QRegExp Pat;
-
};
#endif