Diffstat (limited to 'noncore/settings/networksettings2/ppp/ppprun.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/ppp/ppprun.cpp | 52 |
1 files changed, 11 insertions, 41 deletions
diff --git a/noncore/settings/networksettings2/ppp/ppprun.cpp b/noncore/settings/networksettings2/ppp/ppprun.cpp index a8abc50..8403e6d 100644 --- a/noncore/settings/networksettings2/ppp/ppprun.cpp +++ b/noncore/settings/networksettings2/ppp/ppprun.cpp | |||
@@ -3,51 +3,17 @@ | |||
3 | 3 | ||
4 | PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) : | 4 | PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) : |
5 | AsConnection( NNI ), AsDevice( NNI ), Pat( "eth[0-9]" ) { | 5 | RuntimeInfo( NNI ), Pat( "eth[0-9]" ) { |
6 | D = &Data; | 6 | D = &Data; |
7 | } | 7 | } |
8 | 8 | ||
9 | void PPPRun::detectState( NodeCollection * NC ) { | 9 | State_t PPPRun::detectState( void ) { |
10 | if( isMyPPPDRunning( ) ) { | 10 | if( isMyPPPDRunning( ) ) { |
11 | if( isMyPPPUp() ) { | 11 | return ( isMyPPPUp() ) ? IsUp : Available; |
12 | NC->setCurrentState( IsUp ); | ||
13 | } else { | ||
14 | NC->setCurrentState( Available ); | ||
15 | } | ||
16 | } else { | ||
17 | NC->setCurrentState( Off ); // at least this | ||
18 | // but could also be unavailable | ||
19 | AsDevice::netNode()->nextNode()->runtime()->detectState( NC ); | ||
20 | } | 12 | } |
13 | return Off; | ||
21 | } | 14 | } |
22 | 15 | ||
23 | bool PPPRun::setState( NodeCollection * NC, Action_t A, bool ) { | 16 | QString PPPRun::setMyState( NodeCollection * NC, Action_t A, bool ) { |
24 | switch( A ) { | 17 | return QString(); |
25 | case Activate : | ||
26 | NC->setCurrentState( Available ); | ||
27 | // no | ||
28 | break; | ||
29 | case Deactivate : | ||
30 | if( NC->currentState() == IsUp ) { | ||
31 | NC->state( Down ); | ||
32 | } | ||
33 | // cannot really disable | ||
34 | NC->setCurrentState( Available ); | ||
35 | break; | ||
36 | case Up : | ||
37 | if( NC->currentState() != IsUp ) { | ||
38 | // start my PPPD | ||
39 | NC->setCurrentState( IsUp ); | ||
40 | } | ||
41 | break; | ||
42 | case Down : | ||
43 | if( NC->currentState() == IsUp ) { | ||
44 | // stop my PPPD | ||
45 | NC->setCurrentState( Available ); | ||
46 | } | ||
47 | break; | ||
48 | default : // FT | ||
49 | break; | ||
50 | } | ||
51 | return 1; | ||
52 | } | 18 | } |
53 | 19 | ||
@@ -69,5 +35,5 @@ bool PPPRun::isMyPPPUp( void ) { | |||
69 | ) { | 35 | ) { |
70 | // this is a LAN card | 36 | // this is a LAN card |
71 | if( Run->assignedNode() == AsDevice::netNode() ) { | 37 | if( Run->assignedConnection() == netNode()->connection() ) { |
72 | // assigned to us | 38 | // assigned to us |
73 | return 1; | 39 | return 1; |
@@ -81,2 +47,6 @@ bool PPPRun::handlesInterface( const QString & S ) { | |||
81 | return Pat.match( S ) >= 0; | 47 | return Pat.match( S ) >= 0; |
82 | } | 48 | } |
49 | |||
50 | bool PPPRun::handlesInterface( InterfaceInfo * I ) { | ||
51 | return handlesInterface( I->Name ); | ||
52 | } | ||