author | wimpie <wimpie> | 2005-01-04 01:35:26 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-04 01:35:26 (UTC) |
commit | a9c188235c97e07b0eb96b13adbcdfd4bad64767 (patch) (side-by-side diff) | |
tree | 13f6ae5c499dc0c1d1bd4b763a1973a0fa8635cf /noncore/settings/networksettings2/ppp | |
parent | 48b6cd5966ec6cc0b968edf10ba1a1ad96ef165f (diff) | |
download | opie-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)
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 @@ -36,9 +36,9 @@ QString PPPAuthEdit::acceptable( void ) { } 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() ) || @@ -69,9 +69,9 @@ bool PPPAuthEdit::commit( PPPData_t & D ) { } return SM; } -void PPPAuthEdit::showData( PPPData_t & D ) { +void PPPAuthEdit::showData( PPPData & D ) { switch( D.Auth.Mode ) { case 0 : Login_RB->setChecked( TRUE ); 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 @@ -6,10 +6,10 @@ 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 @@ -22,9 +22,9 @@ QString PPPDNSEdit::acceptable( void ) { } 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 ); @@ -74,9 +74,9 @@ bool PPPDNSEdit::commit( PPPData_t & D ) { } 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 ); 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 @@ -6,10 +6,10 @@ 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 ); 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 @@ -10,10 +10,10 @@ <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> @@ -27,9 +27,9 @@ </property> <vbox> <property stdset="1"> <name>margin</name> - <number>2</number> + <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>2</number> @@ -53,8 +53,20 @@ <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> @@ -75,9 +87,9 @@ <sizehint> <width>-1</width> <height>-1</height> </sizehint> - <container>0</container> + <container>1</container> <sizepolicy> <hordata>7</hordata> <verdata>7</verdata> </sizepolicy> 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 @@ -10,10 +10,10 @@ <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> @@ -27,23 +27,19 @@ </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> @@ -53,174 +49,107 @@ </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> @@ -231,9 +160,9 @@ </property> <vbox> <property stdset="1"> <name>margin</name> - <number>2</number> + <number>3</number> </property> <property stdset="1"> <name>spacing</name> <number>2</number> @@ -377,9 +306,9 @@ <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> - <cstring>Layout3</cstring> + <cstring>Layout4</cstring> </property> <hbox> <property stdset="1"> <name>margin</name> @@ -388,8 +317,19 @@ <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> @@ -413,19 +353,40 @@ <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> @@ -433,12 +394,6 @@ <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 @@ -8,18 +8,9 @@ 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" ); @@ -27,31 +18,37 @@ QString PPPIPEdit::acceptable( void ) { 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 @@ -6,10 +6,10 @@ 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 @@ -2,18 +2,25 @@ #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 ); } @@ -28,17 +35,17 @@ QString PPPEdit::acceptable( void ) { } 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 ); } 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 @@ -3,25 +3,29 @@ 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,5 +1,5 @@ -Package: opie-networksettingsplugin2-ppp +Package: opie-networksettings2plugin-ppp Files: plugins/networksettings2/libppp.so* Priority: optional Section: opie/settings Maintainer: Wim Delvaux <wimpie@handhelds.org> 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 @@ -5,20 +5,29 @@ 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,32 +1,31 @@ #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. @@ -49,23 +48,24 @@ ANetNodeInstance * PPPNetNode::createInstance( void ) { 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; 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 @@ -16,17 +16,17 @@ public: 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 ); 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 @@ -15,14 +15,23 @@ APPP::APPP( PPPNetNode * PNN ) : ANetNodeInstance( PNN ) { 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; } @@ -58,21 +67,35 @@ void APPP::setSpecificAttribute( QString & A, QString & 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 ) { @@ -90,14 +113,22 @@ void APPP::saveSpecificAttribute( QTextStream & TS ) { 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 ); @@ -114,107 +145,90 @@ void APPP::commit( void ) { 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 @@ -15,25 +15,19 @@ 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 : 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 @@ -3,17 +3,23 @@ #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; @@ -32,7 +38,13 @@ typedef struct PPPData { 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,55 +1,21 @@ #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; @@ -67,9 +33,9 @@ bool PPPRun::isMyPPPUp( void ) { 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; } } @@ -79,4 +45,8 @@ bool PPPRun::isMyPPPUp( void ) { 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 |