summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/ppp/ppp_NN.cpp
blob: ff4465c51077017c6d5ed6623566ccf9e9fc31bc (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
76
77
78
79
80
81
82
83
84
85
#include <qfile.h>
#include <qtextstream.h>
#include "ppp_NN.h"
#include "ppp_NNI.h"

QStringList * PPPNetNode::ProperFiles = 0;

static const char * PPPNeeds[] = 
    { "line", 
      "modem", 
      0
    };

/**
 * Constructor, find all of the possible interfaces
 */
PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) {

      // proper files : will leak
      ProperFiles =new QStringList;
      *ProperFiles << "peers";
      *ProperFiles << "chatscript";

      // system files
      NSResources->addSystemFile( 
        "pap-secrets", "/tmp/pap-secrets", 0 );
      NSResources->addSystemFile( 
        "chap-secrets", "/tmp/chap-secrets", 0 );
}

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

const QString PPPNetNode::nodeDescription(){
      return tr("\
<p>Sets up IP using PPP.</p>\
<p>Use this for dialup devices or serial setups</p>\
"
);
}

ANetNodeInstance * PPPNetNode::createInstance( void ) {
      return new APPP( this );
}

const char ** PPPNetNode::needs( void ) {
      return PPPNeeds;
}

const char * PPPNetNode::provides( void ) {
      return "connection";
}

QStringList * PPPNetNode::properFiles( void ) {
      return ProperFiles;

}

// need to generate :
//      /etc/ppp/pap-secrets
//      /etc/ppp/pap-secrets
bool PPPNetNode::hasDataForFile( const QString & S ) {
      return S == "pap-secrets" || 
             S == "chap-secrets" ;
}

QString PPPNetNode::genNic( long NicNr ) { 
      QString S; 
      return S.sprintf( "ppp%ld", NicNr ); 
}

void PPPNetNode::setSpecificAttribute( QString & , QString & ) {
}

void PPPNetNode::saveSpecificAttribute( QTextStream & ) {
}

extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
      PNN.append( new PPPNetNode() );
}
}