00001 #include <resources.h> 00002 #include "ppprun.h" 00003 00004 PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) : 00005 RuntimeInfo( NNI ), Pat( "eth[0-9]" ) { 00006 D = &Data; 00007 } 00008 00009 State_t PPPRun::detectState( void ) { 00010 if( isMyPPPDRunning( ) ) { 00011 return ( isMyPPPUp() ) ? IsUp : Available; 00012 } 00013 return Off; 00014 } 00015 00016 QString PPPRun::setMyState( NetworkSetup * , Action_t , bool ) { 00017 return QString(); 00018 } 00019 00020 bool PPPRun::isMyPPPDRunning( void ) { 00021 return 0; 00022 } 00023 00024 bool PPPRun::isMyPPPUp( void ) { 00025 System & S = NSResources->system(); 00026 InterfaceInfo * Run; 00027 QRegExp R( "ppp[0-9]" ); 00028 00029 for( QDictIterator<InterfaceInfo> It(S.interfaces()); 00030 It.current(); 00031 ++It ) { 00032 Run = It.current(); 00033 if( R.match( Run->Name ) >= 0 && 00034 Run->IsPointToPoint 00035 ) { 00036 // this is a LAN card 00037 if( Run->assignedToNetworkSetup() == netNode()->networkSetup() ) { 00038 // assigned to us 00039 return 1; 00040 } 00041 } 00042 } 00043 return 0; 00044 } 00045 00046 bool PPPRun::handlesInterface( const QString & S ) { 00047 return Pat.match( S ) >= 0; 00048 } 00049 00050 bool PPPRun::handlesInterface( InterfaceInfo * I ) { 00051 return handlesInterface( I->Name ); 00052 }
1.4.2