summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/lancard/lancard_NN.cpp
blob: 520516c630fca0351b15017193ff14c3bad0cfb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "lancard_NN.h"
#include "lancard_NNI.h"

#include "netnodeinterface.h"

static const char * LanCardNeeds[] = 
    { 0
    };

static const char * LanCardProvides[] = 
    { "device",
      0
    };

/**
 * Constructor, find all of the possible interfaces
 */
LanCardNetNode::LanCardNetNode() : ANetNode(tr("LAN card")), NICMACAddresses() {
    InstanceCount = 2;
}

/**
 * Delete any interfaces that we own.
 */
LanCardNetNode::~LanCardNetNode(){
}

const QString LanCardNetNode::nodeDescription(){
      return tr("\
<p>Sets up a wired regular LAN card.</p>\
<p>Use this to set up 10/100/1000 MBit LAN cards.</p>\
"
);
}

ANetNodeInstance * LanCardNetNode::createInstance( void ) {
      return new ALanCard( this );
}


const char ** LanCardNetNode::needs( void ) {
      return LanCardNeeds;
}

const char ** LanCardNetNode::provides( void ) {
      return LanCardProvides;
}

QString LanCardNetNode::genNic( long nr ) { 
      QString S; 
      return S.sprintf( "eth%ld", nr );
}

void LanCardNetNode::setSpecificAttribute( QString & A, QString & V ) {
      if( A == "interfacecount" ) {
        InstanceCount = V.toLong();
      } else if ( A == "macaddress" ) {
        NICMACAddresses.append( V );
      }
}

void LanCardNetNode::saveSpecificAttribute( QTextStream & TS) {
      TS << "interfacecount="
         << InstanceCount
         << endl;
      for( QStringList::Iterator it = NICMACAddresses.begin();
           it != NICMACAddresses.end(); 
           ++it ) {
        TS << "macaddress="
           << (*it)
           << endl;
      }
}

OPIE_NS2_PLUGIN( NetNodeInterface_T<LanCardNetNode> )