summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/network/networkrun.cpp
authorwimpie <wimpie>2004-08-09 02:31:25 (UTC)
committer wimpie <wimpie>2004-08-09 02:31:25 (UTC)
commit0784cfdbd261c43856b45be6ab7439841e69b858 (patch) (unidiff)
treef6a27d6b2e1e6d8dcc908b2ef5836cd320ddfab1 /noncore/settings/networksettings2/network/networkrun.cpp
parent5e10278e748608766245ff9f59a54d1ae8ff6f7e (diff)
downloadopie-0784cfdbd261c43856b45be6ab7439841e69b858.zip
opie-0784cfdbd261c43856b45be6ab7439841e69b858.tar.gz
opie-0784cfdbd261c43856b45be6ab7439841e69b858.tar.bz2
Many changes :
bluetooth and usb seems to work added preliminary support for VPN on top of any network This version is still very much crippled yet is does DO some things
Diffstat (limited to 'noncore/settings/networksettings2/network/networkrun.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/network/networkrun.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/noncore/settings/networksettings2/network/networkrun.cpp b/noncore/settings/networksettings2/network/networkrun.cpp
index 41e1c53..3e24c5f 100644
--- a/noncore/settings/networksettings2/network/networkrun.cpp
+++ b/noncore/settings/networksettings2/network/networkrun.cpp
@@ -10,12 +10,13 @@ void NetworkRun::detectState( NodeCollection * NC ) {
10 if( II ) { 10 if( II ) {
11 // device has assigned interface 11 // device has assigned interface
12 NC->setCurrentState( (( II->IsUp ) ? IsUp : Available) ); 12 NC->setCurrentState( (( II->IsUp ) ? IsUp : Available) );
13 return; 13 return;
14 } 14 }
15 15
16 Log(( "%s not ! UP or ava\n", NC->name().latin1() ));
16 // has no interface -> delegate 17 // has no interface -> delegate
17 RI->detectState( NC ); 18 RI->detectState( NC );
18} 19}
19 20
20bool NetworkRun::setState( NodeCollection * NC, Action_t A, bool Force ) { 21bool NetworkRun::setState( NodeCollection * NC, Action_t A, bool Force ) {
21 // we handle UP and DOWN 22 // we handle UP and DOWN
@@ -31,23 +32,34 @@ bool NetworkRun::setState( NodeCollection * NC, Action_t A, bool Force ) {
31 II->Name.latin1(), II->Name.latin1(), 32 II->Name.latin1(), II->Name.latin1(),
32 connection()->number() ); 33 connection()->number() );
33 NSResources->system().runAsRoot( S ); 34 NSResources->system().runAsRoot( S );
34 } 35 }
35 return 1; 36 return 1;
36 } else if( A == Down ) { 37 } else if( A == Down ) {
37 if( NC->currentState() == IsUp || Force ) { 38 QString S;
38 QString S; 39 if( Force ) {
39 S.sprintf( "ifdown %s=%s-c%d-allowed", 40 Log(("Force mode %d\n", Force ));
40 II->Name.latin1(), II->Name.latin1(), 41 for( int i = 0;
41 connection()->number() ); 42 i < RI->netNode()->nodeClass()->instanceCount();
42 NSResources->system().runAsRoot( S ); 43 i ++ ) {
44 S.sprintf( "ifdown %s",
45 RI->netNode()->nodeClass()->genNic( i ).latin1() );
46 NSResources->system().runAsRoot( S );
47 }
48 } else {
49 if( NC->currentState() == IsUp ) {
50 S.sprintf( "ifdown %s=%s-c%d-allowed",
51 II->Name.latin1(), II->Name.latin1(),
52 connection()->number() );
53 NSResources->system().runAsRoot( S );
54 }
43 } 55 }
44 return 1; 56 return 1;
45 } 57 }
46 // delegate 58 // delegate
47 return RI->setState( NC, A ); 59 return RI->setState( NC, A, Force );
48} 60}
49 61
50bool NetworkRun::canSetState( State_t Curr, Action_t A ) { 62bool NetworkRun::canSetState( State_t Curr, Action_t A ) {
51 // we handle UP and DOWN 63 // we handle UP and DOWN
52 RuntimeInfo * RI = netNode()->nextNode()->runtime(); 64 RuntimeInfo * RI = netNode()->nextNode()->runtime();
53 65