author | wimpie <wimpie> | 2004-08-12 12:46:55 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-08-12 12:46:55 (UTC) |
commit | 8f215ba9ceb395f262517855a99d7d2d303ca760 (patch) (side-by-side diff) | |
tree | aa5f9b14c249217b4d3fc30f4771bdaf1c3545d3 /noncore/settings/networksettings2/network | |
parent | ef64880308b5035cc8ca2e4e79325db613af525b (diff) | |
download | opie-8f215ba9ceb395f262517855a99d7d2d303ca760.zip opie-8f215ba9ceb395f262517855a99d7d2d303ca760.tar.gz opie-8f215ba9ceb395f262517855a99d7d2d303ca760.tar.bz2 |
MANY changes
- now generates peers/pap-chap secrets files
(no chatscript yet)
(not all usefull ppp options included yet)
- still not ready for prime time yet
Diffstat (limited to 'noncore/settings/networksettings2/network') (more/less context) (ignore whitespace changes)
4 files changed, 132 insertions, 82 deletions
diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp index b4313c4..1feffdb 100644 --- a/noncore/settings/networksettings2/network/network_NN.cpp +++ b/noncore/settings/networksettings2/network/network_NN.cpp @@ -1 +1,2 @@ +#include <asdevice.h> #include "network_NN.h" @@ -32,19 +33,38 @@ ANetNodeInstance * NetworkNetNode::createInstance( void ) { -const char ** NetworkNetNode::needs( void ) { - return NetworkNeeds; +bool NetworkNetNode::hasDataForFile( const QString & S ) { + return S == "interfaces"; } -const char * NetworkNetNode::provides( void ) { - return "connection"; +short NetworkNetNode::generateFile( const QString & ID, + const QString & , + QTextStream & TS, + ANetNodeInstance * NNI, + long DevNr ) { + + QString NIC = NNI->runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); + + if( ID == "interfaces" ) { + Log(("Generate entry for %s in %s\n", NIC.latin1(), ID.latin1() )); + // generate mapping stanza for this interface + TS << "# check if " + << NIC + << " can be brought UP" + << endl; + TS << "mapping " + << NIC + << endl; + TS << " script networksettings2-request" + << endl + << endl; + return 0; + } + return 1; } -bool NetworkNetNode::generateProperFilesFor( - ANetNodeInstance * ) { - return 0; +const char ** NetworkNetNode::needs( void ) { + return NetworkNeeds; } -bool NetworkNetNode::generateDeviceDataForCommonFile( - SystemFile & , - long ) { - return 0; +const char * NetworkNetNode::provides( void ) { + return "connection"; } diff --git a/noncore/settings/networksettings2/network/network_NN.h b/noncore/settings/networksettings2/network/network_NN.h index 6548c32..745d1a7 100644 --- a/noncore/settings/networksettings2/network/network_NN.h +++ b/noncore/settings/networksettings2/network/network_NN.h @@ -9,3 +9,3 @@ class NetworkNetNode : public ANetNode{ - Q_OBJECT + Q_OBJECT @@ -13,20 +13,19 @@ public: - NetworkNetNode(); - virtual ~NetworkNetNode(); + NetworkNetNode(); + virtual ~NetworkNetNode(); - virtual const QString pixmapName() - { return "Devices/tcpip"; } + virtual bool hasDataForFile( const QString & S ); - virtual const QString nodeDescription() ; + virtual short generateFile( const QString & ID, + const QString & Path, + QTextStream & TS, + ANetNodeInstance * NNI, + long DevNr ); + virtual const QString pixmapName() + { return "Devices/tcpip"; } - virtual ANetNodeInstance * createInstance( void ); - - virtual const char ** needs( void ); - virtual const char * provides( void ); - - virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); - virtual bool hasDataFor( const QString & ) - { return 0; } - virtual bool generateDeviceDataForCommonFile( - SystemFile & SF, long DevNr ); + virtual const QString nodeDescription() ; + virtual ANetNodeInstance * createInstance( void ); + virtual const char ** needs( void ); + virtual const char * provides( void ); diff --git a/noncore/settings/networksettings2/network/network_NNI.cpp b/noncore/settings/networksettings2/network/network_NNI.cpp index 3e368a2..324c6e2 100644 --- a/noncore/settings/networksettings2/network/network_NNI.cpp +++ b/noncore/settings/networksettings2/network/network_NNI.cpp @@ -101,3 +101,3 @@ void ANetwork::commit( void ) { -bool ANetwork::hasDataFor( const QString & S ) { +bool ANetwork::hasDataForFile( const QString & S ) { return S == "interfaces"; @@ -105,49 +105,63 @@ bool ANetwork::hasDataFor( const QString & S ) { -bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) { +short ANetwork::generateFile( const QString & ID, + const QString & Path, + QTextStream &TS, + long DevNr + ) { + + short rvl, rvd ; QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); - if( S.name() == "interfaces" ) { + rvl = 1; + if( ID == "interfaces" ) { + Log(("Generate Network for %s\n", ID.latin1() )); // we can safely call from here since device item is deeper if( Data.UseDHCP ) { - S << "iface " - << NIC - << "-c" - << connection()->number() - << "-allowed inet dhcp" - << endl; - S << " up echo \"" - << NIC - << "\" > /tmp/profile-" - << connection()->number() - << ".up" - << endl; + TS << "iface " + << NIC + << "-c" + << connection()->number() + << "-allowed inet dhcp" + << endl; + TS << " up echo \"" + << NIC + << "\" > /tmp/profile-" + << connection()->number() + << ".up" + << endl; if( Data.SendHostname ) { - S << " hostname " - << Data.Hostname - << endl; + TS << " hostname " + << Data.Hostname + << endl; } - S << " down rm -f /tmp/profile-" - << connection()->number() - << ".up" - << endl; + TS << " down rm -f /tmp/profile-" + << connection()->number() + << ".up" + << endl; } else { - S << "iface " - << NIC << "-c" - << connection()->number() - << "-allowed inet static" - << endl; - S << " up echo \"" - << NIC - << "\" > /tmp/profile-" - << connection()->number() - << ".up" - << endl; - S << " down rm -f /tmp/profile-" - << connection()->number() - << ".up" - << endl; - S << " address " << Data.IPAddress << endl; - S << " broadcast " << Data.Broadcast << endl; - S << " netmask " << Data.NetMask << endl; + TS << "iface " + << NIC << "-c" + << connection()->number() + << "-allowed inet static" + << endl; + TS << " up echo \"" + << NIC + << "\" > /tmp/profile-" + << connection()->number() + << ".up" + << endl; + TS << " down rm -f /tmp/profile-" + << connection()->number() + << ".up" + << endl; + TS << " address " + << Data.IPAddress + << endl; + TS << " broadcast " + << Data.Broadcast + << endl; + TS << " netmask " + << Data.NetMask + << endl; @@ -163,3 +177,5 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) { arg( ipal[3].toShort() & nmal[3].toShort() ); - S << " network " << NW << endl; + TS << " network " + << NW + << endl; } @@ -169,3 +185,5 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) { ++it ) { - S << " pre-up " << (*it) << endl; + TS << " pre-up " + << (*it) + << endl; } @@ -174,3 +192,5 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) { ++it ) { - S << " up " << (*it) << endl; + TS << " up " + << (*it) + << endl; } @@ -179,3 +199,5 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) { ++it ) { - S << " down " << (*it) << endl; + TS << " down " + << (*it) + << endl; } @@ -184,6 +206,14 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) { ++it ) { - S << " post-down " << (*it) << endl; + TS << " post-down " + << (*it) + << endl; } + rvl = 0; } - return 0; + + // embed other info in it + rvd = connection()->getToplevel()->generateFileEmbedded( ID, Path, TS, DevNr ); + + return (rvd == 2 || rvl == 2 ) ? 2 : + (rvd == 0 || rvl == 0 ) ? 0 : 1; } diff --git a/noncore/settings/networksettings2/network/network_NNI.h b/noncore/settings/networksettings2/network/network_NNI.h index 0058793..5e42503 100644 --- a/noncore/settings/networksettings2/network/network_NNI.h +++ b/noncore/settings/networksettings2/network/network_NNI.h @@ -17,2 +17,7 @@ public : + RuntimeInfo * runtime( void ) + { return + ( RT ) ? RT : ( RT = new NetworkRun( this, Data ) ); + } + QWidget * edit( QWidget * parent ); @@ -21,8 +26,2 @@ public : - RuntimeInfo * runtime( void ) - { if( RT == 0 ) - RT = new NetworkRun( this, Data ); - return RT; - } - virtual void * data( void ) @@ -30,5 +29,7 @@ public : - virtual bool hasDataFor( const QString & S ); - virtual bool generateDataForCommonFile( - SystemFile & SF, long DevNr ); + virtual bool hasDataForFile( const QString & S ); + virtual short generateFile( const QString & ID, + const QString & Path, + QTextStream &TS, + long DevNr ); |