author | wimpie <wimpie> | 2004-04-04 00:27:59 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-04-04 00:27:59 (UTC) |
commit | a416c6c9630d6d63ee63cf520953b86af8b7cddc (patch) (unidiff) | |
tree | dbd0f5173728129f5a3faffdafd4f73d8cc72407 /noncore/settings/networksettings2/ppp | |
parent | 152ffce2a4e8191d28738e3b40d8a726250a8767 (diff) | |
download | opie-a416c6c9630d6d63ee63cf520953b86af8b7cddc.zip opie-a416c6c9630d6d63ee63cf520953b86af8b7cddc.tar.gz opie-a416c6c9630d6d63ee63cf520953b86af8b7cddc.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'noncore/settings/networksettings2/ppp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/ppp/ppp_NN.h | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings2/ppp/ppp_NNI.h | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings2/ppp/ppprun.cpp | 19 | ||||
-rw-r--r-- | noncore/settings/networksettings2/ppp/ppprun.h | 20 |
4 files changed, 31 insertions, 12 deletions
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h index a933523..3f9a338 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NN.h +++ b/noncore/settings/networksettings2/ppp/ppp_NN.h | |||
@@ -6,25 +6,25 @@ | |||
6 | class APPP; | 6 | 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 "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 ); |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.h b/noncore/settings/networksettings2/ppp/ppp_NNI.h index 08dca1d..a17721a 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NNI.h +++ b/noncore/settings/networksettings2/ppp/ppp_NNI.h | |||
@@ -12,25 +12,25 @@ class APPP : public ANetNodeInstance { | |||
12 | 12 | ||
13 | public : | 13 | public : |
14 | 14 | ||
15 | APPP( PPPNetNode * PNN ); | 15 | APPP( PPPNetNode * PNN ); |
16 | 16 | ||
17 | QWidget * edit( QWidget * parent ); | 17 | QWidget * edit( QWidget * parent ); |
18 | QString acceptable( void ); | 18 | QString acceptable( void ); |
19 | void commit( void ); | 19 | void commit( void ); |
20 | 20 | ||
21 | RuntimeInfo * runtime( void ) | 21 | RuntimeInfo * runtime( void ) |
22 | { if( RT == 0 ) | 22 | { if( RT == 0 ) |
23 | RT = new PPPRun( this, Data ); | 23 | RT = new PPPRun( this, Data ); |
24 | return RT; | 24 | return RT->runtimeInfo(); |
25 | } | 25 | } |
26 | 26 | ||
27 | virtual void * data( void ) | 27 | virtual void * data( void ) |
28 | { return (void *)&Data; } | 28 | { return (void *)&Data; } |
29 | 29 | ||
30 | protected : | 30 | protected : |
31 | 31 | ||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | 33 | virtual void saveSpecificAttribute( QTextStream & TS ); |
34 | 34 | ||
35 | private : | 35 | private : |
36 | 36 | ||
diff --git a/noncore/settings/networksettings2/ppp/ppprun.cpp b/noncore/settings/networksettings2/ppp/ppprun.cpp index 8933f85..4ac0c5a 100644 --- a/noncore/settings/networksettings2/ppp/ppprun.cpp +++ b/noncore/settings/networksettings2/ppp/ppprun.cpp | |||
@@ -1,26 +1,39 @@ | |||
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 ) : | ||
5 | AsConnection( NNI ), AsDevice( NNI ), Pat( "eth[0-9]" ) { | ||
6 | D = &Data; | ||
7 | } | ||
8 | |||
4 | void PPPRun::detectState( NodeCollection * NC ) { | 9 | void PPPRun::detectState( NodeCollection * NC ) { |
5 | if( isMyPPPDRunning( ) ) { | 10 | if( isMyPPPDRunning( ) ) { |
6 | if( isMyPPPUp() ) { | 11 | if( isMyPPPUp() ) { |
7 | NC->setCurrentState( IsUp ); | 12 | NC->setCurrentState( IsUp ); |
8 | } else { | 13 | } else { |
9 | NC->setCurrentState( Available ); | 14 | NC->setCurrentState( Available ); |
10 | } | 15 | } |
11 | } else { | 16 | } else { |
12 | NC->setCurrentState( Off ); // at least this | 17 | NC->setCurrentState( Off ); // at least this |
13 | // but could also be unavailable | 18 | // but could also be unavailable |
14 | netNode()->nextNode()->runtime()->detectState( NC ); | 19 | ANetNodeInstance * NNI; |
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 ); | ||
15 | } | 28 | } |
16 | } | 29 | } |
17 | 30 | ||
18 | bool PPPRun::setState( NodeCollection * NC, Action_t A ) { | 31 | bool PPPRun::setState( NodeCollection * NC, Action_t A ) { |
19 | switch( A ) { | 32 | switch( A ) { |
20 | case Activate : | 33 | case Activate : |
21 | NC->setCurrentState( Available ); | 34 | NC->setCurrentState( Available ); |
22 | // no | 35 | // no |
23 | break; | 36 | break; |
24 | case Deactivate : | 37 | case Deactivate : |
25 | if( NC->currentState() == IsUp ) { | 38 | if( NC->currentState() == IsUp ) { |
26 | NC->state( Down ); | 39 | NC->state( Down ); |
@@ -43,35 +56,35 @@ bool PPPRun::setState( NodeCollection * NC, Action_t A ) { | |||
43 | default : // FT | 56 | default : // FT |
44 | break; | 57 | break; |
45 | } | 58 | } |
46 | return 1; | 59 | return 1; |
47 | } | 60 | } |
48 | 61 | ||
49 | bool PPPRun::isMyPPPDRunning( void ) { | 62 | bool PPPRun::isMyPPPDRunning( void ) { |
50 | return 0; | 63 | return 0; |
51 | } | 64 | } |
52 | 65 | ||
53 | bool PPPRun::isMyPPPUp( void ) { | 66 | bool PPPRun::isMyPPPUp( void ) { |
54 | System & S = NSResources->system(); | 67 | System & S = NSResources->system(); |
55 | InterfaceInfo * best = 0, * Run; | 68 | InterfaceInfo * Run; |
56 | QRegExp R( "ppp[0-9]" ); | 69 | QRegExp R( "ppp[0-9]" ); |
57 | 70 | ||
58 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | 71 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); |
59 | It.current(); | 72 | It.current(); |
60 | ++It ) { | 73 | ++It ) { |
61 | Run = It.current(); | 74 | Run = It.current(); |
62 | if( R.match( Run->Name ) >= 0 && | 75 | if( R.match( Run->Name ) >= 0 && |
63 | Run->IsPointToPoint | 76 | Run->IsPointToPoint |
64 | ) { | 77 | ) { |
65 | // this is a LAN card | 78 | // this is a LAN card |
66 | if( Run->assignedNode() == netNode() ) { | 79 | if( Run->assignedNode() == AsDevice::netNode() ) { |
67 | // assigned to us | 80 | // assigned to us |
68 | return 1; | 81 | return 1; |
69 | } | 82 | } |
70 | } | 83 | } |
71 | } | 84 | } |
72 | return 0; | 85 | return 0; |
73 | } | 86 | } |
74 | 87 | ||
75 | bool PPPRun::handlesInterface( const QString & S ) { | 88 | bool PPPRun::handlesInterface( const QString & S ) { |
76 | return Pat.match( S ) >= 0; | 89 | return Pat.match( S ) >= 0; |
77 | } | 90 | } |
diff --git a/noncore/settings/networksettings2/ppp/ppprun.h b/noncore/settings/networksettings2/ppp/ppprun.h index 76a05be..abb9176 100644 --- a/noncore/settings/networksettings2/ppp/ppprun.h +++ b/noncore/settings/networksettings2/ppp/ppprun.h | |||
@@ -1,35 +1,41 @@ | |||
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 "pppdata.h" | 7 | #include "pppdata.h" |
7 | 8 | ||
8 | class PPPRun : public AsConnection { | 9 | class PPPRun : public AsConnection, public AsDevice { |
9 | 10 | ||
10 | public : | 11 | public : |
11 | 12 | ||
12 | PPPRun( ANetNodeInstance * NNI, | 13 | PPPRun( ANetNodeInstance * NNI, |
13 | PPPData & Data ) : | 14 | PPPData & Data ); |
14 | AsConnection( NNI ), | 15 | virtual QString genNic( long NicNr ) |
15 | Pat( "eth[0-9]" ) | 16 | { QString S; return S.sprintf( "ppp%ld", NicNr ); } |
16 | { D = &Data; } | ||
17 | 17 | ||
18 | protected : | 18 | virtual AsDevice * device( void ) |
19 | { return AsDevice::asDevice(); } | ||
20 | virtual RuntimeInfo * runtimeInfo( void ) | ||
21 | { return ( AsConnection *)this; } | ||
22 | |||
23 | protected : | ||
19 | 24 | ||
20 | void detectState( NodeCollection * NC ); | 25 | void detectState( NodeCollection * NC ); |
21 | bool setState( NodeCollection * NC, Action_t A ); | 26 | bool setState( NodeCollection * NC, Action_t A ); |
22 | bool canSetState( State_t S, Action_t A ) | 27 | bool canSetState( State_t S, Action_t A ) |
23 | { return connection()->findNext( netNode() )->runtime()->canSetState( S,A ); } | 28 | { return AsDevice::connection()->findNext( |
29 | AsDevice::netNode() )->runtime()->canSetState( S,A ); } | ||
24 | 30 | ||
25 | bool handlesInterface( const QString & I ); | 31 | bool handlesInterface( const QString & I ); |
26 | 32 | ||
27 | private : | 33 | private : |
28 | 34 | ||
29 | bool isMyPPPDRunning( void ); | 35 | bool isMyPPPDRunning( void ); |
30 | bool isMyPPPUp( void ); | 36 | bool isMyPPPUp( void ); |
31 | 37 | ||
32 | PPPData_t * D; | 38 | PPPData_t * D; |
33 | QRegExp Pat; | 39 | QRegExp Pat; |
34 | 40 | ||
35 | }; | 41 | }; |