Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

lancard_NN.cpp

Go to the documentation of this file.
00001 #include "lancard_NN.h"
00002 #include "lancard_NNI.h"
00003 
00004 #include "netnodeinterface.h"
00005 
00006 static const char * LanCardNeeds[] = 
00007     { 0
00008     };
00009 
00010 static const char * LanCardProvides[] = 
00011     { "device",
00012       0
00013     };
00014 
00018 LanCardNetNode::LanCardNetNode() : ANetNode(tr("LAN card")), NICMACAddresses() {
00019     InstanceCount = 2;
00020 }
00021 
00025 LanCardNetNode::~LanCardNetNode(){
00026 }
00027 
00028 const QString LanCardNetNode::nodeDescription(){
00029       return tr("\
00030 <p>Sets up a wired regular LAN card.</p>\
00031 <p>Use this to set up 10/100/1000 MBit LAN cards.</p>\
00032 "
00033 );
00034 }
00035 
00036 ANetNodeInstance * LanCardNetNode::createInstance( void ) {
00037       return new ALanCard( this );
00038 }
00039 
00040 
00041 const char ** LanCardNetNode::needs( void ) {
00042       return LanCardNeeds;
00043 }
00044 
00045 const char ** LanCardNetNode::provides( void ) {
00046       return LanCardProvides;
00047 }
00048 
00049 QString LanCardNetNode::genNic( long nr ) { 
00050       QString S; 
00051       return S.sprintf( "eth%ld", nr );
00052 }
00053 
00054 void LanCardNetNode::setSpecificAttribute( QString & A, QString & V ) {
00055       if( A == "interfacecount" ) {
00056         InstanceCount = V.toLong();
00057       } else if ( A == "macaddress" ) {
00058         NICMACAddresses.append( V );
00059       }
00060 }
00061 
00062 void LanCardNetNode::saveSpecificAttribute( QTextStream & TS) {
00063       TS << "interfacecount="
00064          << InstanceCount
00065          << endl;
00066       for( QStringList::Iterator it = NICMACAddresses.begin();
00067            it != NICMACAddresses.end(); 
00068            ++it ) {
00069         TS << "macaddress="
00070            << (*it)
00071            << endl;
00072       }
00073 }
00074 
00075 OPIE_NS2_PLUGIN( NetNodeInterface_T<LanCardNetNode> )

Generated on Sat Nov 5 16:17:53 2005 for OPIE by  doxygen 1.4.2