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

network_NN.cpp

Go to the documentation of this file.
00001 #include <qpe/qpeapplication.h>
00002 #include <resources.h>
00003 #include <netnode.h>
00004 #include "network_NN.h"
00005 #include "network_NNI.h"
00006 
00007 #include "netnodeinterface.h"
00008 
00009 static const char * NetworkNeeds[] = 
00010     { "device", 
00011       0
00012     };
00013 
00014 static const char * NetworkProvides[] = 
00015     { "connection",
00016       0
00017     };
00018 
00022 NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) {
00023 
00024       NSResources->addSystemFile(
00025         "interfaces", "/etc/network/interfaces", 1 );
00026 }
00027 
00031 NetworkNetNode::~NetworkNetNode(){
00032 }
00033 
00034 const QString NetworkNetNode::nodeDescription(){
00035       return tr("\
00036 <p>Sets up TCP/IP options.</p>\
00037 <p>Use this to configure the TCP/IP protocol</p>\
00038 "
00039 );
00040 }
00041 
00042 ANetNodeInstance * NetworkNetNode::createInstance( void ) {
00043       return new ANetwork( this );
00044 }
00045 
00046 bool NetworkNetNode::hasDataForFile( SystemFile & S ) {
00047       return S.name() == "interfaces";
00048 }
00049 
00050 short NetworkNetNode::generateFile( SystemFile & SF, 
00051                                    ANetNodeInstance * NNI,
00052                                    long DevNr ) {
00053                                    
00054       if( DevNr < 0 ) {
00055         // generate device specific but common part
00056         return 1;
00057       }
00058 
00059       QString NIC = NNI->runtime()->device()->netNode()->nodeClass()->genNic( DevNr );
00060 
00061       if( SF.name() == "interfaces" ) {
00062         Log(("Generate entry for %s in %s\n", NIC.latin1(), SF.name().latin1() ));
00063         // generate mapping stanza for this interface
00064         SF << "# check if " 
00065            << NIC 
00066            << " can be brought UP" 
00067            << endl;
00068         SF << "mapping " 
00069            << NIC 
00070            << endl;
00071         SF << "  script "
00072            << QPEApplication::qpeDir()
00073            << "bin/networksettings2-request" 
00074            << endl 
00075            << endl;
00076         return 0;
00077       }
00078       return 1;
00079 }
00080 
00081 const char ** NetworkNetNode::needs( void ) {
00082       return NetworkNeeds;
00083 }
00084 
00085 const char ** NetworkNetNode::provides( void ) {
00086       return NetworkProvides;
00087 }
00088 
00089 void NetworkNetNode::setSpecificAttribute( QString & , QString & ) {
00090 }
00091 
00092 void NetworkNetNode::saveSpecificAttribute( QTextStream & ) {
00093 }
00094 
00095 OPIE_NS2_PLUGIN( NetNodeInterface_T<NetworkNetNode> )

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