summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/ppp/ppprun.cpp
blob: f54848357b5827c9b89fa2e72fc5477b78f0f075 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <resources.h>
#include "ppprun.h"

PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) :
          RuntimeInfo( NNI ), Pat( "eth[0-9]" ) { 
      D = &Data; 
}

State_t PPPRun::detectState( void ) {
    if( isMyPPPDRunning( ) ) {
      return ( isMyPPPUp() ) ? IsUp : Available;
    } 
    return Off;
}

QString PPPRun::setMyState( NetworkSetup * , Action_t , bool ) { 
    return QString();
}

bool PPPRun::isMyPPPDRunning( void ) {
    return 0;
}

bool PPPRun::isMyPPPUp( void ) {
    System & S = NSResources->system();
    InterfaceInfo * Run;
    QRegExp R( "ppp[0-9]" );

    for( QDictIterator<InterfaceInfo> It(S.interfaces());
         It.current();
         ++It ) {
      Run = It.current();
      if( R.match( Run->Name ) >= 0 &&
          Run->IsPointToPoint 
        ) {
        // this is a LAN card
        if( Run->assignedToNetworkSetup() == netNode()->networkSetup() ) {
          // assigned to us
          return 1;
        } 
      }
    }
    return 0;
}

bool PPPRun::handlesInterface( const QString & S ) {
    return Pat.match( S ) >= 0;
}

bool PPPRun::handlesInterface( InterfaceInfo * I ) {
    return handlesInterface( I->Name );
}