summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/ppp/ppprun.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/ppp/ppprun.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/ppp/ppprun.cpp56
1 files changed, 13 insertions, 43 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
@@ -1,57 +1,23 @@
1#include <resources.h> 1#include <resources.h>
2#include "ppprun.h" 2#include "ppprun.h"
3 3
4PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) : 4PPPRun::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
9void PPPRun::detectState( NodeCollection * NC ) { 9State_t PPPRun::detectState( void ) {
10 if( isMyPPPDRunning( ) ) { 10 if( isMyPPPDRunning( ) ) {
11 if( isMyPPPUp() ) { 11 return ( isMyPPPUp() ) ? IsUp : Available;
12 NC->setCurrentState( IsUp ); 12 }
13 } else { 13 return Off;
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 }
21} 14}
22 15
23bool PPPRun::setState( NodeCollection * NC, Action_t A, bool ) { 16QString 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
54bool PPPRun::isMyPPPDRunning( void ) { 20bool PPPRun::isMyPPPDRunning( void ) {
55 return 0; 21 return 0;
56} 22}
57 23
@@ -65,18 +31,22 @@ bool PPPRun::isMyPPPUp( void ) {
65 ++It ) { 31 ++It ) {
66 Run = It.current(); 32 Run = It.current();
67 if( R.match( Run->Name ) >= 0 && 33 if( R.match( Run->Name ) >= 0 &&
68 Run->IsPointToPoint 34 Run->IsPointToPoint
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;
74 } 40 }
75 } 41 }
76 } 42 }
77 return 0; 43 return 0;
78} 44}
79 45
80bool PPPRun::handlesInterface( const QString & S ) { 46bool PPPRun::handlesInterface( const QString & S ) {
81 return Pat.match( S ) >= 0; 47 return Pat.match( S ) >= 0;
82} 48}
49
50bool PPPRun::handlesInterface( InterfaceInfo * I ) {
51 return handlesInterface( I->Name );
52}