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 @@ -39,3 +39,3 @@ QString PPPAuthEdit::acceptable( void ) { -bool PPPAuthEdit::commit( PPPData_t & D ) { +bool PPPAuthEdit::commit( PPPData & D ) { bool SM = 0; @@ -72,3 +72,3 @@ bool PPPAuthEdit::commit( PPPData_t & D ) { -void PPPAuthEdit::showData( PPPData_t & D ) { +void PPPAuthEdit::showData( PPPData & D ) { 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 @@ -9,4 +9,4 @@ public : 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 ); 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 @@ -25,3 +25,3 @@ QString PPPDNSEdit::acceptable( void ) { -bool PPPDNSEdit::commit( PPPData_t & D ) { +bool PPPDNSEdit::commit( PPPData & D ) { bool SM = 0; @@ -77,3 +77,3 @@ bool PPPDNSEdit::commit( PPPData_t & D ) { -void PPPDNSEdit::showData( PPPData_t & D) { +void PPPDNSEdit::showData( PPPData & D) { 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 @@ -9,4 +9,4 @@ public : QString acceptable( void ); - bool commit( PPPData_t & Data ); - void showData( PPPData_t & Data ); + bool commit( PPPData & Data ); + void showData( PPPData & Data ); 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 @@ -13,4 +13,4 @@ <y>0</y> - <width>124</width> - <height>29</height> + <width>528</width> + <height>345</height> </rect> @@ -30,3 +30,3 @@ <name>margin</name> - <number>2</number> + <number>0</number> </property> @@ -56,2 +56,14 @@ </item> + <item> + <property> + <name>text</name> + <string>Commands</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Dialing</string> + </property> + </item> <property stdset="1"> @@ -78,3 +90,3 @@ </sizehint> - <container>0</container> + <container>1</container> <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 @@ -13,4 +13,4 @@ <y>0</y> - <width>133</width> - <height>235</height> + <width>258</width> + <height>232</height> </rect> @@ -30,3 +30,3 @@ <name>margin</name> - <number>3</number> + <number>0</number> </property> @@ -34,13 +34,9 @@ <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> @@ -56,6 +52,6 @@ </property> - <vbox> + <grid> <property stdset="1"> <name>margin</name> - <number>2</number> + <number>3</number> </property> @@ -65,7 +61,11 @@ </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> @@ -73,6 +73,13 @@ <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> @@ -80,7 +87,7 @@ </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> @@ -88,128 +95,43 @@ <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> @@ -222,2 +144,9 @@ <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> <name>title</name> @@ -234,3 +163,3 @@ <name>margin</name> - <number>2</number> + <number>3</number> </property> @@ -380,3 +309,3 @@ <name>name</name> - <cstring>Layout3</cstring> + <cstring>Layout4</cstring> </property> @@ -391,2 +320,13 @@ </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> @@ -416,3 +356,3 @@ <name>name</name> - <cstring>GWIsDefault_CB</cstring> + <cstring>GWIfNotSet_CB</cstring> </property> @@ -420,3 +360,3 @@ <name>text</name> - <string>Set as default</string> + <string>Only if not yet set</string> </property> @@ -427,2 +367,23 @@ </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> @@ -436,8 +397,2 @@ </connection> - <connection> - <sender>IPFixed_RB</sender> - <signal>toggled(bool)</signal> - <receiver>Frame8</receiver> - <slot>setEnabled(bool)</slot> - </connection> </connections> 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 @@ -11,12 +11,3 @@ 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() ) @@ -30,3 +21,3 @@ QString PPPIPEdit::acceptable( void ) { -bool PPPIPEdit::commit( PPPData_t & D ) { +bool PPPIPEdit::commit( PPPData & D ) { @@ -34,9 +25,10 @@ bool PPPIPEdit::commit( PPPData_t & D ) { - 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 ) { @@ -46,2 +38,4 @@ bool PPPIPEdit::commit( PPPData_t & D ) { CBM( D.IP.GWIsDefault, GWIsDefault_CB, SM ); + CBM( D.IP.GWIfNotSet, GWIfNotSet_CB, SM ); + return SM; @@ -49,6 +43,8 @@ bool PPPIPEdit::commit( PPPData_t & D ) { -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 ); @@ -56,2 +52,3 @@ void PPPIPEdit::showData( PPPData_t & D ) { 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 @@ -9,4 +9,4 @@ public : QString acceptable( void ); - bool commit( PPPData_t & Data ); - void showData( PPPData_t & Data ); + bool commit( PPPData & Data ); + void showData( PPPData & Data ); 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 @@ -5,2 +5,4 @@ #include "PPPAuthedit.h" +#include "PPPRunedit.h" +#include "PPPDialingedit.h" #include "PPPedit.h" @@ -12,2 +14,5 @@ PPPEdit::PPPEdit( QWidget * Parent ) : PPPGUI( Parent ){ DNS = new PPPDNSEdit( Options_WS ); + Run = new PPPRunEdit( Options_WS ); + Dialing = new PPPDialingEdit( Options_WS ); + Options_WS->addWidget( Auth, 0 ); @@ -15,2 +20,4 @@ PPPEdit::PPPEdit( QWidget * Parent ) : PPPGUI( Parent ){ Options_WS->addWidget( DNS, 2 ); + Options_WS->addWidget( Run, 3 ); + Options_WS->addWidget( Dialing, 4 ); @@ -31,3 +38,3 @@ QString PPPEdit::acceptable( void ) { -bool PPPEdit::commit( PPPData_t & Data ) { +bool PPPEdit::commit( PPPData & Data ) { bool SM ; @@ -39,3 +46,3 @@ bool PPPEdit::commit( PPPData_t & Data ) { -void PPPEdit::showData( PPPData_t & Data ) { +void PPPEdit::showData( PPPData & Data ) { Auth->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 @@ -6,2 +6,4 @@ class PPPIPEdit; class PPPDNSEdit; +class PPPRunEdit; +class PPPDialingEdit; @@ -13,4 +15,4 @@ public : QString acceptable( void ); - bool commit( PPPData_t & Data ); - void showData( PPPData_t & Data ); + bool commit( PPPData & Data ); + void showData( PPPData & Data ); @@ -22,5 +24,7 @@ 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,2 +1,2 @@ -Package: opie-networksettingsplugin2-ppp +Package: opie-networksettings2plugin-ppp Files: plugins/networksettings2/libppp.so* 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 @@ -8,2 +8,4 @@ HEADERS = ppp_NN.h \ PPPDNSedit.h \ + PPPRunedit.h \ + PPPDialingedit.h \ PPPIPedit.h @@ -13,2 +15,4 @@ SOURCES = ppp_NN.cpp \ PPPDNSedit.cpp \ + PPPRunedit.cpp \ + PPPDialingedit.cpp \ PPPAuthedit.cpp \ @@ -19,3 +23,8 @@ 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 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,2 +1,3 @@ #include <qfile.h> +#include <resources.h> #include <qtextstream.h> @@ -8,4 +9,8 @@ QStringList * PPPNetNode::ProperFiles = 0; static const char * PPPNeeds[] = - { "line", - "modem", + { "modem", + 0 + }; + +static const char * PPPProvides[] = + { "connection", 0 @@ -18,12 +23,6 @@ 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 ); } @@ -52,9 +51,10 @@ const char ** PPPNetNode::needs( void ) { -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; } @@ -64,5 +64,5 @@ QStringList * PPPNetNode::properFiles( void ) { // /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" ; } 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 @@ -19,3 +19,3 @@ public: - virtual bool hasDataForFile( const QString & S ); + virtual bool hasDataForFile( SystemFile & S ); @@ -24,6 +24,6 @@ public: 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 ); 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 @@ -18,5 +18,7 @@ APPP::APPP( PPPNetNode * PNN ) : ANetNodeInstance( PNN ) { - 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; @@ -24,2 +26,9 @@ APPP::APPP( PPPNetNode * PNN ) : ANetNodeInstance( PNN ) { Data.IP.GWIsDefault = 1; + Data.IP.GWIfNotSet = 1; + + Data.Run.PreConnect = ""; + Data.Run.PostConnect = ""; + Data.Run.PreDisconnect = ""; + Data.Run.PostDisconnect = ""; + GUI = 0; @@ -61,15 +70,29 @@ void APPP::setSpecificAttribute( QString & A, QString & 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; + } } @@ -93,8 +116,16 @@ void APPP::saveSpecificAttribute( QTextStream & TS ) { 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; + } @@ -117,35 +148,16 @@ void APPP::commit( void ) { -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; @@ -155,9 +167,10 @@ short APPP::generateFile( const QString & ID, - 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 << " " @@ -169,12 +182,12 @@ short APPP::generateFile( const QString & ID, 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 << " " @@ -187,11 +200,12 @@ short APPP::generateFile( const QString & ID, 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; @@ -199,3 +213,3 @@ short APPP::generateFile( const QString & ID, if( Data.IP.GWIsDefault ) { - TS << "defaultroute" + SF << "defaultroute" << endl; @@ -203,4 +217,4 @@ short APPP::generateFile( const QString & ID, - TS << "linkname " - << removeSpaces( ID.latin1() ) + SF << "linkname " + << removeSpaces( SF.name().latin1() ) << endl; @@ -210,8 +224,8 @@ short APPP::generateFile( const QString & ID, 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 ); } 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 @@ -18,7 +18,3 @@ public : RuntimeInfo * runtime( void ) - { if( RT == 0 ) { - RT = new PPPRun( this, Data ); - } - return RT->runtimeInfo(); - } + { return (RT) ? RT : (RT = new PPPRun( this, Data ) ); } @@ -31,6 +27,4 @@ public : - 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 ); 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 @@ -6,7 +6,11 @@ -typedef struct PPPData { +class PPPData { + +public : + struct { - bool IPAutomatic; - QString IPAddress; - QString IPSubMask; + bool LocalOverrule; + bool RemoteOverrule; + QString LocalAddress; + QString RemoteAddress; bool GWAutomatic; @@ -14,3 +18,5 @@ typedef struct PPPData { bool GWIsDefault; + bool GWIfNotSet; } IP; + struct { @@ -35,3 +41,9 @@ typedef struct PPPData { } DNS; -} PPPData_t; + struct { + QString PreConnect; + QString PostConnect; + QString PreDisconnect; + QString PostDisconnect; + } Run; +}; 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 @@ -4,49 +4,15 @@ 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(); } @@ -70,3 +36,3 @@ bool PPPRun::isMyPPPUp( void ) { // this is a LAN card - if( Run->assignedNode() == AsDevice::netNode() ) { + if( Run->assignedConnection() == netNode()->connection() ) { // assigned to us @@ -82 +48,5 @@ bool PPPRun::handlesInterface( const QString & S ) { } + +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 @@ -4,7 +4,6 @@ #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 { @@ -15,22 +14,14 @@ public : - 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 ); @@ -41,5 +32,4 @@ private : - PPPData_t * D; + PPPData * D; QRegExp Pat; - }; |