summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/nsdata.cpp
authorwimpie <wimpie>2005-01-11 15:35:46 (UTC)
committer wimpie <wimpie>2005-01-11 15:35:46 (UTC)
commit4c4cdd76caea5a8be4a971892375c7c6b4f4a8b9 (patch) (unidiff)
tree0e8adcc616a1d20b637aad3de568dcb45af05f71 /noncore/settings/networksettings2/nsdata.cpp
parent32e8aa951218c0bd6118ee04bb22ef83b3b7ec2e (diff)
downloadopie-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) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/nsdata.cpp66
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
@@ -62,4 +62,6 @@ NetworkSettingsData::NetworkSettingsData( void ) {
62 NC->assignInterface( 62 NC->assignInterface(
63 NSResources->system().findInterface( interfacename ) ); 63 NSResources->system().findInterface( interfacename ) );
64 Log(( "Assign interface %p\n",
65 NC->assignedInterface() ));
64 } else { 66 } else {
65 Log(( "Profile nr %d no longer defined\n", 67 Log(( "Profile nr %d no longer defined\n",
@@ -644,5 +646,6 @@ QString NetworkSettingsData::generateSettings( void ) {
644} 646}
645 647
646QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interface ) { 648QList<NodeCollection> NetworkSettingsData::collectPossible(
649 const QString & Interface ) {
647 // collect connections that can work on top of this interface 650 // collect connections that can work on top of this interface
648 NodeCollection * NC; 651 NodeCollection * NC;
@@ -657,8 +660,9 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa
657 // check if this profile handles the requested interface 660 // check if this profile handles the requested interface
658 if( NC->handlesInterface( Interface ) && // if different Intf. 661 if( NC->handlesInterface( Interface ) && // if different Intf.
659 NC->state() != Disabled && // if not enabled 662 NC->state() != Disabled && // if enabled
660 NC->state() != IsUp // if already used 663 NC->state() != IsUp // if already used
661 ) { 664 ) {
662 Log( ( "Append %s for %s\n", NC->name().latin1(), Interface)); 665 Log( ( "Append %s for %s\n",
666 NC->name().latin1(), Interface.latin1() ));
663 PossibleConnections.append( NC ); 667 PossibleConnections.append( NC );
664 } 668 }
@@ -674,5 +678,5 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa
674*/ 678*/
675 679
676bool NetworkSettingsData::canStart( const char * Interface ) { 680bool NetworkSettingsData::canStart( const QString & Interface ) {
677 // load situation 681 // load situation
678 NodeCollection * NC = 0; 682 NodeCollection * NC = 0;
@@ -682,5 +686,5 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
682 686
683 Log( ( "for %s : Possiblilies %d\n", 687 Log( ( "for %s : Possiblilies %d\n",
684 Interface, PossibleConnections.count() )); 688 Interface.latin1(), PossibleConnections.count() ));
685 switch( PossibleConnections.count() ) { 689 switch( PossibleConnections.count() ) {
686 case 0 : // no connections 690 case 0 : // no connections
@@ -707,6 +711,6 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
707 if( ! S.isEmpty() ) { 711 if( ! S.isEmpty() ) {
708 // could not bring device Online -> try other alters 712 // could not bring device Online -> try other alters
709 Log(( "%s-c%d-disallowed : %s\n", 713 Log(( "disallow %ld for %s : %s\n",
710 Interface, NC->number(), S.latin1() )); 714 NC->number(), Interface.latin1(), S.latin1() ));
711 break; 715 break;
712 } 716 }
@@ -717,6 +721,6 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
717 case IsUp : // also called for 'ifdown' 721 case IsUp : // also called for 'ifdown'
718 // device is ready -> done 722 // device is ready -> done
719 Log(( "%s-c%d-allowed\n", Interface, NC->number() )); 723 Log(( "allow %ld for %s\n", NC->number(), Interface.latin1()));
720 printf( "%s-c%d-allowed\n", Interface, NC->number() ); 724 printf( "A%ld%s\n", NC->number(), Interface.latin1() );
721 return 0; 725 return 0;
722 } 726 }
@@ -724,6 +728,6 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
724 728
725 // if we come here no alternatives are possible 729 // if we come here no alternatives are possible
726 Log(( "%s-cnn-disallowed\n", Interface )); 730 Log(( "disallow %s\n", Interface.latin1()));
727 printf( "%s-cnn-disallowed\n", Interface ); 731 printf( "D-%s\n", Interface.latin1() );
728 return 0; 732 return 0;
729} 733}
@@ -742,2 +746,42 @@ bool NetworkSettingsData::isModified( void ) {
742 return 0; 746 return 0;
743} 747}
748
749bool NetworkSettingsData::couldBeTriggered( const QString & Interface ) {
750 // load situation
751 QList<NodeCollection> PossibleTriggered;
752
753 PossibleTriggered = collectTriggered( Interface );
754
755 Log( ( "for %s : Possiblilies %d\n",
756 Interface.latin1(), PossibleTriggered.count() ));
757
758 return ( PossibleTriggered.count() ) ? 1 : 0;
759}
760
761QList<NodeCollection> NetworkSettingsData::collectTriggered(
762 const QString & Interface ) {
763
764 // collect connections that could be triggered by this interface
765 NodeCollection * NC;
766 QList<NodeCollection> PossibleTriggered;
767
768 // for all connections
769 Name2Connection_t & M = NSResources->connections();
770
771 for( QDictIterator<NodeCollection> it(M);
772 it.current();
773 ++it ) {
774 NC = it.current();
775 // check if this profile handles the requested interface
776 if( NC->triggeredBy( Interface ) && // if different Intf.
777 NC->state() != Disabled && // if enabled
778 NC->state() != IsUp // if already used
779 ) {
780 Log( ( "Append %s for %s\n",
781 NC->name().latin1(), Interface.latin1() ));
782 PossibleTriggered.append( NC );
783 }
784 }
785 return PossibleTriggered;
786}
787