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/network_NNI.cpp | |
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/network_NNI.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/network/network_NNI.cpp | 122 |
1 files changed, 76 insertions, 46 deletions
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 @@ -90,100 +90,130 @@ QWidget * ANetwork::edit( QWidget * parent ) { return GUI; } QString ANetwork::acceptable( void ) { return ( GUI ) ? GUI->acceptable( ) : QString(); } void ANetwork::commit( void ) { if( GUI && GUI->commit( Data ) ) setModified( 1 ); } -bool ANetwork::hasDataFor( const QString & S ) { +bool ANetwork::hasDataForFile( const QString & S ) { return S == "interfaces"; } -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; // derive network address = IPAddress & netmask { QString NW; QStringList ipal = QStringList::split( '.', Data.IPAddress ); QStringList nmal = QStringList::split( '.', Data.NetMask ); NW = QString( "%1.%2.%3.%4" ). arg( ipal[0].toShort() & nmal[0].toShort() ). arg( ipal[1].toShort() & nmal[1].toShort() ). arg( ipal[2].toShort() & nmal[2].toShort() ). arg( ipal[3].toShort() & nmal[3].toShort() ); - S << " network " << NW << endl; + TS << " network " + << NW + << endl; } } for ( QStringList::Iterator it = Data.PreUp_SL.begin(); it != Data.PreUp_SL.end(); ++it ) { - S << " pre-up " << (*it) << endl; + TS << " pre-up " + << (*it) + << endl; } for ( QStringList::Iterator it = Data.PostUp_SL.begin(); it != Data.PostUp_SL.end(); ++it ) { - S << " up " << (*it) << endl; + TS << " up " + << (*it) + << endl; } for ( QStringList::Iterator it = Data.PreDown_SL.begin(); it != Data.PreDown_SL.end(); ++it ) { - S << " down " << (*it) << endl; + TS << " down " + << (*it) + << endl; } for ( QStringList::Iterator it = Data.PostDown_SL.begin(); it != Data.PostDown_SL.end(); ++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; } |