author | wimpie <wimpie> | 2005-01-11 15:35:46 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-11 15:35:46 (UTC) |
commit | 4c4cdd76caea5a8be4a971892375c7c6b4f4a8b9 (patch) (side-by-side diff) | |
tree | 0e8adcc616a1d20b637aad3de568dcb45af05f71 /noncore/settings/networksettings2/nsdata.cpp | |
parent | 32e8aa951218c0bd6118ee04bb22ef83b3b7ec2e (diff) | |
download | opie-4c4cdd76caea5a8be4a971892375c7c6b4f4a8b9.zip opie-4c4cdd76caea5a8be4a971892375c7c6b4f4a8b9.tar.gz opie-4c4cdd76caea5a8be4a971892375c7c6b4f4a8b9.tar.bz2 |
vpn should now work IF only the vpn plugin would do something.
shortened logical interface names (busybox only supports 10 characters
and then ONLY if you recompile it with mappings enabled)
Other small fixes
Diffstat (limited to 'noncore/settings/networksettings2/nsdata.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/nsdata.cpp | 66 |
1 files changed, 55 insertions, 11 deletions
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp index d76353a..39031ed 100644 --- a/noncore/settings/networksettings2/nsdata.cpp +++ b/noncore/settings/networksettings2/nsdata.cpp @@ -61,6 +61,8 @@ NetworkSettingsData::NetworkSettingsData( void ) { if( NC ) { NC->assignInterface( NSResources->system().findInterface( interfacename ) ); + Log(( "Assign interface %p\n", + NC->assignedInterface() )); } else { Log(( "Profile nr %d no longer defined\n", profilenr )); @@ -643,7 +645,8 @@ QString NetworkSettingsData::generateSettings( void ) { return S; } -QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interface ) { +QList<NodeCollection> NetworkSettingsData::collectPossible( + const QString & Interface ) { // collect connections that can work on top of this interface NodeCollection * NC; QList<NodeCollection> PossibleConnections; @@ -656,10 +659,11 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa NC = it.current(); // check if this profile handles the requested interface if( NC->handlesInterface( Interface ) && // if different Intf. - NC->state() != Disabled && // if not enabled + NC->state() != Disabled && // if enabled NC->state() != IsUp // if already used ) { - Log( ( "Append %s for %s\n", NC->name().latin1(), Interface)); + Log( ( "Append %s for %s\n", + NC->name().latin1(), Interface.latin1() )); PossibleConnections.append( NC ); } } @@ -673,7 +677,7 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa if allowed, echo Interface-allowed else Interface-disallowed */ -bool NetworkSettingsData::canStart( const char * Interface ) { +bool NetworkSettingsData::canStart( const QString & Interface ) { // load situation NodeCollection * NC = 0; QList<NodeCollection> PossibleConnections; @@ -681,7 +685,7 @@ bool NetworkSettingsData::canStart( const char * Interface ) { PossibleConnections = collectPossible( Interface ); Log( ( "for %s : Possiblilies %d\n", - Interface, PossibleConnections.count() )); + Interface.latin1(), PossibleConnections.count() )); switch( PossibleConnections.count() ) { case 0 : // no connections break; @@ -706,8 +710,8 @@ bool NetworkSettingsData::canStart( const char * Interface ) { { QString S= NC->setState( Activate ); if( ! S.isEmpty() ) { // could not bring device Online -> try other alters - Log(( "%s-c%d-disallowed : %s\n", - Interface, NC->number(), S.latin1() )); + Log(( "disallow %ld for %s : %s\n", + NC->number(), Interface.latin1(), S.latin1() )); break; } // interface assigned @@ -716,15 +720,15 @@ bool NetworkSettingsData::canStart( const char * Interface ) { case Available : case IsUp : // also called for 'ifdown' // device is ready -> done - Log(( "%s-c%d-allowed\n", Interface, NC->number() )); - printf( "%s-c%d-allowed\n", Interface, NC->number() ); + Log(( "allow %ld for %s\n", NC->number(), Interface.latin1())); + printf( "A%ld%s\n", NC->number(), Interface.latin1() ); return 0; } } // if we come here no alternatives are possible - Log(( "%s-cnn-disallowed\n", Interface )); - printf( "%s-cnn-disallowed\n", Interface ); + Log(( "disallow %s\n", Interface.latin1())); + printf( "D-%s\n", Interface.latin1() ); return 0; } @@ -741,3 +745,43 @@ bool NetworkSettingsData::isModified( void ) { } return 0; } + +bool NetworkSettingsData::couldBeTriggered( const QString & Interface ) { + // load situation + QList<NodeCollection> PossibleTriggered; + + PossibleTriggered = collectTriggered( Interface ); + + Log( ( "for %s : Possiblilies %d\n", + Interface.latin1(), PossibleTriggered.count() )); + + return ( PossibleTriggered.count() ) ? 1 : 0; +} + +QList<NodeCollection> NetworkSettingsData::collectTriggered( + const QString & Interface ) { + + // collect connections that could be triggered by this interface + NodeCollection * NC; + QList<NodeCollection> PossibleTriggered; + + // for all connections + Name2Connection_t & M = NSResources->connections(); + + for( QDictIterator<NodeCollection> it(M); + it.current(); + ++it ) { + NC = it.current(); + // check if this profile handles the requested interface + if( NC->triggeredBy( Interface ) && // if different Intf. + NC->state() != Disabled && // if enabled + NC->state() != IsUp // if already used + ) { + Log( ( "Append %s for %s\n", + NC->name().latin1(), Interface.latin1() )); + PossibleTriggered.append( NC ); + } + } + return PossibleTriggered; +} + |