Diffstat (limited to 'noncore/settings/networksettings2/ppp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/ppp/ppp_NN.cpp | 9 | ||||
-rw-r--r-- | noncore/settings/networksettings2/ppp/ppp_NN.h | 4 | ||||
-rw-r--r-- | noncore/settings/networksettings2/ppp/ppprun.cpp | 10 | ||||
-rw-r--r-- | noncore/settings/networksettings2/ppp/ppprun.h | 8 |
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(){ | |||
23 | return tr("\ | 23 | return tr("\ |
24 | <p>Sets up IP using PPP.</p>\ | 24 | <p>Sets up IP using PPP.</p>\ |
25 | <p>Use this for dialup devices or serial setups</p>\ | 25 | <p>Use this for dialup devices or serial setups</p>\ |
26 | " | 26 | " |
27 | ); | 27 | ); |
28 | } | 28 | } |
29 | 29 | ||
30 | ANetNodeInstance * PPPNetNode::createInstance( void ) { | 30 | ANetNodeInstance * PPPNetNode::createInstance( void ) { |
31 | return new APPP( this ); | 31 | return new APPP( this ); |
32 | } | 32 | } |
33 | 33 | ||
34 | const char ** PPPNetNode::needs( void ) { | 34 | const char ** PPPNetNode::needs( void ) { |
35 | return PPPNeeds; | 35 | return PPPNeeds; |
36 | } | 36 | } |
37 | 37 | ||
38 | const char * PPPNetNode::provides( void ) { | 38 | const char * PPPNetNode::provides( void ) { |
39 | return "connection"; | 39 | return "connection"; |
40 | } | 40 | } |
41 | 41 | ||
42 | bool PPPNetNode::generateProperFilesFor( | 42 | bool PPPNetNode::generateProperFilesFor( |
43 | ANetNodeInstance * ) { | 43 | ANetNodeInstance * ) { |
44 | return 1; | 44 | return 1; |
45 | } | 45 | } |
46 | 46 | ||
47 | bool PPPNetNode::hasDataFor( const QString & ) { | 47 | bool PPPNetNode::hasDataFor( const QString &, bool ) { |
48 | return 0; | 48 | return 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | bool PPPNetNode::generateDataForCommonFile( | 51 | bool PPPNetNode::generateDataForCommonFile( |
52 | SystemFile & , | 52 | SystemFile & , |
53 | long, | 53 | long, |
54 | ANetNodeInstance * ) { | 54 | ANetNodeInstance * ) { |
55 | return 1; | 55 | return 1; |
56 | } | 56 | } |
57 | 57 | ||
58 | bool PPPNetNode::generateDeviceDataForCommonFile( | ||
59 | SystemFile & , | ||
60 | long , | ||
61 | ANetNodeInstance * ) { | ||
62 | return 1; | ||
63 | } | ||
64 | |||
58 | extern "C" { | 65 | extern "C" { |
59 | void create_plugin( QList<ANetNode> & PNN ) { | 66 | void create_plugin( QList<ANetNode> & PNN ) { |
60 | PNN.append( new PPPNetNode() ); | 67 | PNN.append( new PPPNetNode() ); |
61 | } | 68 | } |
62 | } | 69 | } |
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; | |||
7 | 7 | ||
8 | class PPPNetNode : public ANetNode{ | 8 | class PPPNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | PPPNetNode(); | 14 | PPPNetNode(); |
15 | virtual ~PPPNetNode(); | 15 | virtual ~PPPNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/ppp"; } | 18 | { return "Devices/ppp"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("PPP Connection"); } | 21 | { return tr("PPP Connection"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S, bool DS ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | virtual bool generateDeviceDataForCommonFile( | ||
35 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | 36 | ||
35 | private: | 37 | private: |
36 | 38 | ||
37 | }; | 39 | }; |
38 | 40 | ||
39 | extern "C" | 41 | extern "C" |
40 | { | 42 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 43 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 44 | }; |
43 | 45 | ||
44 | #endif | 46 | #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 @@ | |||
1 | #include <resources.h> | 1 | #include <resources.h> |
2 | #include "ppprun.h" | 2 | #include "ppprun.h" |
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 | AsConnection( NNI ), AsDevice( NNI ), Pat( "eth[0-9]" ) { |
6 | D = &Data; | 6 | D = &Data; |
7 | } | 7 | } |
8 | 8 | ||
9 | void PPPRun::detectState( NodeCollection * NC ) { | 9 | void PPPRun::detectState( NodeCollection * NC ) { |
10 | if( isMyPPPDRunning( ) ) { | 10 | if( isMyPPPDRunning( ) ) { |
11 | if( isMyPPPUp() ) { | 11 | if( isMyPPPUp() ) { |
12 | NC->setCurrentState( IsUp ); | 12 | NC->setCurrentState( IsUp ); |
13 | } else { | 13 | } else { |
14 | NC->setCurrentState( Available ); | 14 | NC->setCurrentState( Available ); |
15 | } | 15 | } |
16 | } else { | 16 | } else { |
17 | NC->setCurrentState( Off ); // at least this | 17 | NC->setCurrentState( Off ); // at least this |
18 | // but could also be unavailable | 18 | // but could also be unavailable |
19 | ANetNodeInstance * NNI; | 19 | AsDevice::netNode()->nextNode()->runtime()->detectState( NC ); |
20 | RuntimeInfo * RI; | ||
21 | NNI = AsDevice::netNode(); | ||
22 | printf( "%p\n", NNI ); | ||
23 | NNI = NNI->nextNode(); | ||
24 | printf( "%p\n", NNI ); | ||
25 | RI = NNI->runtime(); | ||
26 | printf( "%p\n", RI ); | ||
27 | RI->detectState( NC ); | ||
28 | } | 20 | } |
29 | } | 21 | } |
30 | 22 | ||
31 | bool PPPRun::setState( NodeCollection * NC, Action_t A ) { | 23 | bool PPPRun::setState( NodeCollection * NC, Action_t A ) { |
32 | switch( A ) { | 24 | switch( A ) { |
33 | case Activate : | 25 | case Activate : |
34 | NC->setCurrentState( Available ); | 26 | NC->setCurrentState( Available ); |
35 | // no | 27 | // no |
36 | break; | 28 | break; |
37 | case Deactivate : | 29 | case Deactivate : |
38 | if( NC->currentState() == IsUp ) { | 30 | if( NC->currentState() == IsUp ) { |
39 | NC->state( Down ); | 31 | NC->state( Down ); |
40 | } | 32 | } |
41 | // cannot really disable | 33 | // cannot really disable |
42 | NC->setCurrentState( Available ); | 34 | NC->setCurrentState( Available ); |
43 | break; | 35 | break; |
44 | case Up : | 36 | case Up : |
45 | if( NC->currentState() != IsUp ) { | 37 | if( NC->currentState() != IsUp ) { |
46 | // start my PPPD | 38 | // start my PPPD |
47 | NC->setCurrentState( IsUp ); | 39 | NC->setCurrentState( IsUp ); |
48 | } | 40 | } |
49 | break; | 41 | break; |
50 | case Down : | 42 | case Down : |
51 | if( NC->currentState() == IsUp ) { | 43 | 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 @@ | |||
1 | #ifndef PPPRUN_H | 1 | #ifndef PPPRUN_H |
2 | #define PPPRUN_H | 2 | #define PPPRUN_H |
3 | 3 | ||
4 | #include <qregexp.h> | 4 | #include <qregexp.h> |
5 | #include <asconnection.h> | 5 | #include <asconnection.h> |
6 | #include <asdevice.h> | 6 | #include <asdevice.h> |
7 | #include "pppdata.h" | 7 | #include "pppdata.h" |
8 | 8 | ||
9 | class PPPRun : public AsConnection, public AsDevice { | 9 | class PPPRun : public AsConnection, public AsDevice { |
10 | 10 | ||
11 | public : | 11 | public : |
12 | 12 | ||
13 | PPPRun( ANetNodeInstance * NNI, | 13 | PPPRun( ANetNodeInstance * NNI, |
14 | PPPData & Data ); | 14 | PPPData & Data ); |
15 | virtual QString genNic( long NicNr ) | 15 | virtual QString genNic( long NicNr ) |
16 | { QString S; return S.sprintf( "ppp%ld", NicNr ); } | 16 | { QString S; return S.sprintf( "ppp%ld", NicNr ); } |
17 | 17 | ||
18 | virtual AsDevice * asDevice( void ) | ||
19 | { return (AsDevice *)this; } | ||
20 | virtual AsConnection * asConnection( void ) | ||
21 | { return (AsConnection *)this; } | ||
22 | |||
18 | virtual AsDevice * device( void ) | 23 | virtual AsDevice * device( void ) |
19 | { return AsDevice::asDevice(); } | 24 | { return (AsDevice *)this; } |
25 | |||
20 | virtual RuntimeInfo * runtimeInfo( void ) | 26 | virtual RuntimeInfo * runtimeInfo( void ) |
21 | { return ( AsConnection *)this; } | 27 | { return ( AsConnection *)this; } |
22 | 28 | ||
23 | protected : | 29 | protected : |
24 | 30 | ||
25 | void detectState( NodeCollection * NC ); | 31 | void detectState( NodeCollection * NC ); |
26 | bool setState( NodeCollection * NC, Action_t A ); | 32 | bool setState( NodeCollection * NC, Action_t A ); |
27 | bool canSetState( State_t S, Action_t A ) | 33 | bool canSetState( State_t S, Action_t A ) |
28 | { return AsDevice::connection()->findNext( | 34 | { return AsDevice::connection()->findNext( |
29 | AsDevice::netNode() )->runtime()->canSetState( S,A ); } | 35 | AsDevice::netNode() )->runtime()->canSetState( S,A ); } |
30 | 36 | ||
31 | bool handlesInterface( const QString & I ); | 37 | bool handlesInterface( const QString & I ); |
32 | 38 | ||
33 | private : | 39 | private : |
34 | 40 | ||
35 | bool isMyPPPDRunning( void ); | 41 | bool isMyPPPDRunning( void ); |
36 | bool isMyPPPUp( void ); | 42 | bool isMyPPPUp( void ); |
37 | 43 | ||
38 | PPPData_t * D; | 44 | PPPData_t * D; |
39 | QRegExp Pat; | 45 | QRegExp Pat; |
40 | 46 | ||
41 | }; | 47 | }; |
42 | 48 | ||
43 | #endif | 49 | #endif |