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/wlan | |
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/wlan') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/wlan/wlan_NN.cpp | 23 | ||||
-rw-r--r-- | noncore/settings/networksettings2/wlan/wlan_NN.h | 9 | ||||
-rw-r--r-- | noncore/settings/networksettings2/wlan/wlan_NNI.cpp | 107 | ||||
-rw-r--r-- | noncore/settings/networksettings2/wlan/wlan_NNI.h | 20 |
4 files changed, 69 insertions, 90 deletions
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp index ce8a734..e4c3f60 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp +++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp @@ -33,39 +33,16 @@ ANetNodeInstance * WLanNetNode::createInstance( void ) { const char ** WLanNetNode::needs( void ) { return WLanNeeds; } const char * WLanNetNode::provides( void ) { return "device"; } -bool WLanNetNode::generateProperFilesFor( - ANetNodeInstance * ) { - return 0; -} - -bool WLanNetNode::hasDataFor( const QString & S ) { - return S == "interfaces"; -} - -bool WLanNetNode::generateDeviceDataForCommonFile( - SystemFile & S, - long DevNr ) { - QString NIC = genNic( DevNr ); - - if( S.name() == "interfaces" ) { - // generate mapping stanza for this interface - S << "# check if " << NIC << " can be brought UP" << endl; - S << "mapping " << NIC << endl; - S << " script networksettings2-request" << endl << endl; - } - return 0; -} - QString WLanNetNode::genNic( long nr ) { QString S; return S.sprintf( "wlan%ld", nr ); } void WLanNetNode::setSpecificAttribute( QString & A, QString & V ) { if( A == "interfacecount" ) { InstanceCount = V.toLong(); diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.h b/noncore/settings/networksettings2/wlan/wlan_NN.h index b5ff3fd..c13c05c 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.h +++ b/noncore/settings/networksettings2/wlan/wlan_NN.h @@ -13,31 +13,22 @@ public: WLanNetNode(); virtual ~WLanNetNode(); virtual const QString pixmapName() { return "Devices/wlan"; } virtual const QString nodeDescription() ; - virtual ANetNodeInstance * createInstance( void ); - virtual const char ** needs( void ); virtual const char * provides( void ); - virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); - - virtual bool hasDataFor( const QString & S ); - virtual bool generateDeviceDataForCommonFile( - SystemFile & SF, long DevNr ); - virtual long instanceCount( void ) { return InstanceCount; } - virtual QString genNic( long ); private: virtual void setSpecificAttribute( QString & Attr, QString & Value ); virtual void saveSpecificAttribute( QTextStream & TS ); // number of interfaces for this device diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp index 61969f2..0e4fc4c 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp +++ b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp @@ -74,67 +74,78 @@ QString AWLan::acceptable( void ) { return ( GUI ) ? GUI->acceptable( ) : QString(); } void AWLan::commit( void ) { if( GUI && GUI->commit( Data ) ) setModified( 1 ); } -bool AWLan::generateDataForCommonFile( - SystemFile & S, - long ) { +short AWLan::generateFileEmbedded( const QString & ID, + const QString & Path, + QTextStream & TS, + long DevNr ) { - S << " wireless_essid \"" - << Data.ESSID - << "\"" - << endl; + short rvl, rvd; - if( ! Data.NodeName.isEmpty() ) { - if( Data.NodeName == tr("<UseHostName>") ) { - char Buf[100]; - if( gethostname(Buf, sizeof(Buf) ) == 0 ) { - Buf[99] = '\0'; // just to make sure - S << " wireless_nick " - << Buf - << endl; + rvl = 1; + + if( ID == "interfaces" ) { + Log(("Generate WLanNNI for %s\n", ID.latin1() )); + TS << " wireless_essid \"" + << Data.ESSID + << "\"" + << endl; + + if( ! Data.NodeName.isEmpty() ) { + if( Data.NodeName == tr("<UseHostName>") ) { + char Buf[100]; + if( gethostname(Buf, sizeof(Buf) ) == 0 ) { + Buf[99] = '\0'; // just to make sure + TS << " wireless_nick " + << Buf + << endl; + } + } else { + TS << " wireless_nick \"" + << Data.NodeName + << "\"" + << endl; } - } else { - S << " wireless_nick \"" - << Data.NodeName - << "\"" - << endl; } - } - char * M; - switch ( Data.Mode ) { - case 0 : - M = "Auto"; - break; - case 1 : - M = "Managed"; - break; - case 2 : - M = "Ad-Hoc"; - break; - } + char * M = "Auto"; + switch ( Data.Mode ) { + case 0 : + break; + case 1 : + M = "Managed"; + break; + case 2 : + M = "Ad-Hoc"; + break; + } - S << " wireless_mode " - << M - << endl; - if( Data.Encrypted ) { - for( int i = 0; i < 4; i ++ ) { - if( ! Data.Key[i].isEmpty() ) { - S << " wireless_key" - << i - << " " - << Data.Key[i] - << endl; + TS << " wireless_mode " + << M + << endl; + if( Data.Encrypted ) { + for( int i = 0; i < 4; i ++ ) { + if( ! Data.Key[i].isEmpty() ) { + TS << " wireless_key" + << i + << " " + << Data.Key[i] + << endl; + } } + TS << " wireless_keymode " + << ((Data.AcceptNonEncrypted) ? "open" : "restricted") + << endl; } - S << " wireless_keymode " - << ((Data.AcceptNonEncrypted) ? "open" : "restricted") - << endl; + rvl = 0; } - return 0; + rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr); + + return (rvd == 2 || rvl == 2 ) ? 2 : + (rvd == 0 || rvl == 0 ) ? 0 : 1; } diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.h b/noncore/settings/networksettings2/wlan/wlan_NNI.h index 2211c47..a9be65f 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NNI.h +++ b/noncore/settings/networksettings2/wlan/wlan_NNI.h @@ -9,33 +9,33 @@ class WLanNetNode; class WLanEdit; class AWLan : public ANetNodeInstance { public : AWLan( WLanNetNode * PNN ); + RuntimeInfo * runtime( void ) + { return + ( RT ) ? RT : ( RT = new WLanRun( this, Data ) ); + } + QWidget * edit( QWidget * parent ); QString acceptable( void ); void commit( void ); - RuntimeInfo * runtime( void ) - { if( RT == 0 ) - RT = new WLanRun( this, Data ); - return RT; - } - virtual void * data( void ) { return (void *)&Data; } - virtual bool hasDataFor( const QString & ) - { return 1; } - virtual bool generateDataForCommonFile( - SystemFile & SF, long DevNr ); + virtual short generateFileEmbedded( const QString & ID, + const QString & Path, + QTextStream & TS, + long DevNr ); + protected : virtual void setSpecificAttribute( QString & Attr, QString & Value ); virtual void saveSpecificAttribute( QTextStream & TS ); private : WLanEdit * GUI; |