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) (show 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
@@ -61,6 +61,8 @@ NetworkSettingsData::NetworkSettingsData( void ) {
61 if( NC ) { 61 if( NC ) {
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",
66 profilenr )); 68 profilenr ));
@@ -643,7 +645,8 @@ QString NetworkSettingsData::generateSettings( void ) {
643 return S; 645 return S;
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;
649 QList<NodeCollection> PossibleConnections; 652 QList<NodeCollection> PossibleConnections;
@@ -656,10 +659,11 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa
656 NC = it.current(); 659 NC = it.current();
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 }
665 } 669 }
@@ -673,7 +677,7 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa
673 if allowed, echo Interface-allowed else Interface-disallowed 677 if allowed, echo Interface-allowed else Interface-disallowed
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;
679 QList<NodeCollection> PossibleConnections; 683 QList<NodeCollection> PossibleConnections;
@@ -681,7 +685,7 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
681 PossibleConnections = collectPossible( Interface ); 685 PossibleConnections = collectPossible( 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
687 break; 691 break;
@@ -706,8 +710,8 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
706 { QString S= NC->setState( Activate ); 710 { QString S= NC->setState( Activate );
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 }
713 // interface assigned 717 // interface assigned
@@ -716,15 +720,15 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
716 case Available : 720 case Available :
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 }
723 } 727 }
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}
730 734
@@ -741,3 +745,43 @@ bool NetworkSettingsData::isModified( void ) {
741 } 745 }
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