Diffstat (limited to 'noncore/settings/networksettings2/lancard/lancard_NN.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/lancard/lancard_NN.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.cpp b/noncore/settings/networksettings2/lancard/lancard_NN.cpp index 7d36918..480ddf9 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NN.cpp +++ b/noncore/settings/networksettings2/lancard/lancard_NN.cpp | |||
@@ -21,47 +21,52 @@ const QString LanCardNetNode::nodeDescription(){ | |||
21 | <p>Sets up a wired regular LAN card.</p>\ | 21 | <p>Sets up a wired regular LAN card.</p>\ |
22 | <p>Use this to set up 10/100/1000 MBit LAN cards.</p>\ | 22 | <p>Use this to set up 10/100/1000 MBit LAN cards.</p>\ |
23 | " | 23 | " |
24 | ); | 24 | ); |
25 | } | 25 | } |
26 | 26 | ||
27 | ANetNodeInstance * LanCardNetNode::createInstance( void ) { | 27 | ANetNodeInstance * LanCardNetNode::createInstance( void ) { |
28 | return new ALanCard( this ); | 28 | return new ALanCard( this ); |
29 | } | 29 | } |
30 | 30 | ||
31 | 31 | ||
32 | const char ** LanCardNetNode::needs( void ) { | 32 | const char ** LanCardNetNode::needs( void ) { |
33 | return LanCardNeeds; | 33 | return LanCardNeeds; |
34 | } | 34 | } |
35 | 35 | ||
36 | const char * LanCardNetNode::provides( void ) { | 36 | const char * LanCardNetNode::provides( void ) { |
37 | return "device"; | 37 | return "device"; |
38 | } | 38 | } |
39 | 39 | ||
40 | bool LanCardNetNode::generateProperFilesFor( | 40 | bool LanCardNetNode::generateProperFilesFor( |
41 | ANetNodeInstance * ) { | 41 | ANetNodeInstance * ) { |
42 | return 1; | 42 | return 1; |
43 | } | 43 | } |
44 | 44 | ||
45 | bool LanCardNetNode::hasDataFor( const QString & S, bool DS ) { | 45 | bool LanCardNetNode::hasDataFor( const QString & S ) { |
46 | return DS && S == "interfaces"; | 46 | return S == "interfaces"; |
47 | } | ||
48 | |||
49 | bool LanCardNetNode::generateDataForCommonFile( | ||
50 | SystemFile & , | ||
51 | long , | ||
52 | ANetNodeInstance * ) { | ||
53 | return 1; | ||
54 | } | 47 | } |
55 | 48 | ||
56 | bool LanCardNetNode::generateDeviceDataForCommonFile( | 49 | bool LanCardNetNode::generateDeviceDataForCommonFile( |
57 | SystemFile & S , | 50 | SystemFile & S , |
58 | long DevNr , | 51 | long DevNr ) { |
59 | ANetNodeInstance * NNI ) { | 52 | QString NIC = genNic( DevNr ); |
60 | return ((ALanCard *)NNI)->generateDeviceDataForCommonFile(S, DevNr); | 53 | |
54 | if( S.name() == "interfaces" ) { | ||
55 | // generate mapping stanza for this interface | ||
56 | S << "# check if " << NIC << " can be brought UP" << endl; | ||
57 | S << "mapping " << NIC << endl; | ||
58 | S << " script networksettings2-request" << endl << endl; | ||
59 | } | ||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | QString LanCardNetNode::genNic( long nr ) { | ||
64 | QString S; | ||
65 | return S.sprintf( "eth%ld", nr ); | ||
61 | } | 66 | } |
62 | 67 | ||
63 | extern "C" { | 68 | extern "C" { |
64 | void create_plugin( QList<ANetNode> & PNN ) { | 69 | void create_plugin( QList<ANetNode> & PNN ) { |
65 | PNN.append( new LanCardNetNode() ); | 70 | PNN.append( new LanCardNetNode() ); |
66 | } | 71 | } |
67 | } | 72 | } |