summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/ppp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings2/ppp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.cpp9
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.h4
-rw-r--r--noncore/settings/networksettings2/ppp/ppprun.cpp10
-rw-r--r--noncore/settings/networksettings2/ppp/ppprun.h8
4 files changed, 19 insertions, 12 deletions
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
index 309c9a1..51d17ec 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
@@ -23,40 +23,47 @@ const QString PPPNetNode::nodeDescription(){
return tr("\
<p>Sets up IP using PPP.</p>\
<p>Use this for dialup devices or serial setups</p>\
"
);
}
ANetNodeInstance * PPPNetNode::createInstance( void ) {
return new APPP( this );
}
const char ** PPPNetNode::needs( void ) {
return PPPNeeds;
}
const char * PPPNetNode::provides( void ) {
return "connection";
}
bool PPPNetNode::generateProperFilesFor(
ANetNodeInstance * ) {
return 1;
}
-bool PPPNetNode::hasDataFor( const QString & ) {
+bool PPPNetNode::hasDataFor( const QString &, bool ) {
return 0;
}
bool PPPNetNode::generateDataForCommonFile(
SystemFile & ,
long,
ANetNodeInstance * ) {
return 1;
}
+bool PPPNetNode::generateDeviceDataForCommonFile(
+ SystemFile & ,
+ long ,
+ ANetNodeInstance * ) {
+ return 1;
+}
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new PPPNetNode() );
}
}
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h
index 3f9a338..8d56e7f 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.h
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.h
@@ -7,38 +7,40 @@ class APPP;
class PPPNetNode : public ANetNode{
Q_OBJECT
public:
PPPNetNode();
virtual ~PPPNetNode();
virtual const QString pixmapName()
{ return "Devices/ppp"; }
virtual const QString nodeName()
{ return tr("PPP Connection"); }
virtual const QString nodeDescription() ;
virtual ANetNodeInstance * createInstance( void );
virtual const char ** needs( void );
virtual const char * provides( void );
virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & S );
+ virtual bool hasDataFor( const QString & S, bool DS );
virtual bool generateDataForCommonFile(
SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ virtual bool generateDeviceDataForCommonFile(
+ SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
private:
};
extern "C"
{
void create_plugin( QList<ANetNode> & PNN );
};
#endif
diff --git a/noncore/settings/networksettings2/ppp/ppprun.cpp b/noncore/settings/networksettings2/ppp/ppprun.cpp
index 4ac0c5a..8c75df3 100644
--- a/noncore/settings/networksettings2/ppp/ppprun.cpp
+++ b/noncore/settings/networksettings2/ppp/ppprun.cpp
@@ -1,51 +1,43 @@
#include <resources.h>
#include "ppprun.h"
PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) :
AsConnection( NNI ), AsDevice( NNI ), Pat( "eth[0-9]" ) {
D = &Data;
}
void PPPRun::detectState( NodeCollection * NC ) {
if( isMyPPPDRunning( ) ) {
if( isMyPPPUp() ) {
NC->setCurrentState( IsUp );
} else {
NC->setCurrentState( Available );
}
} else {
NC->setCurrentState( Off ); // at least this
// but could also be unavailable
- ANetNodeInstance * NNI;
- RuntimeInfo * RI;
- NNI = AsDevice::netNode();
- printf( "%p\n", NNI );
- NNI = NNI->nextNode();
- printf( "%p\n", NNI );
- RI = NNI->runtime();
- printf( "%p\n", RI );
- RI->detectState( NC );
+ AsDevice::netNode()->nextNode()->runtime()->detectState( NC );
}
}
bool PPPRun::setState( NodeCollection * NC, Action_t A ) {
switch( A ) {
case Activate :
NC->setCurrentState( Available );
// no
break;
case Deactivate :
if( NC->currentState() == IsUp ) {
NC->state( Down );
}
// cannot really disable
NC->setCurrentState( Available );
break;
case Up :
if( NC->currentState() != IsUp ) {
// start my PPPD
NC->setCurrentState( IsUp );
}
break;
case Down :
if( NC->currentState() == IsUp ) {
diff --git a/noncore/settings/networksettings2/ppp/ppprun.h b/noncore/settings/networksettings2/ppp/ppprun.h
index abb9176..765aff2 100644
--- a/noncore/settings/networksettings2/ppp/ppprun.h
+++ b/noncore/settings/networksettings2/ppp/ppprun.h
@@ -1,43 +1,49 @@
#ifndef PPPRUN_H
#define PPPRUN_H
#include <qregexp.h>
#include <asconnection.h>
#include <asdevice.h>
#include "pppdata.h"
class PPPRun : public AsConnection, public AsDevice {
public :
PPPRun( ANetNodeInstance * NNI,
PPPData & Data );
virtual QString genNic( long NicNr )
{ QString S; return S.sprintf( "ppp%ld", NicNr ); }
+ virtual AsDevice * asDevice( void )
+ { return (AsDevice *)this; }
+ virtual AsConnection * asConnection( void )
+ { return (AsConnection *)this; }
+
virtual AsDevice * device( void )
- { return AsDevice::asDevice(); }
+ { return (AsDevice *)this; }
+
virtual RuntimeInfo * runtimeInfo( void )
{ return ( AsConnection *)this; }
protected :
void detectState( NodeCollection * NC );
bool setState( NodeCollection * NC, Action_t A );
bool canSetState( State_t S, Action_t A )
{ return AsDevice::connection()->findNext(
AsDevice::netNode() )->runtime()->canSetState( S,A ); }
bool handlesInterface( const QString & I );
private :
bool isMyPPPDRunning( void );
bool isMyPPPUp( void );
PPPData_t * D;
QRegExp Pat;
};
#endif