Diffstat (limited to 'noncore/settings/networksettings2/ppp/ppp_NNI.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/ppp/ppp_NNI.cpp | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp new file mode 100644 index 0000000..d09ecf9 --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp | |||
@@ -0,0 +1,115 @@ | |||
1 | #include "PPPedit.h" | ||
2 | #include "ppp_NNI.h" | ||
3 | #include "ppp_NN.h" | ||
4 | |||
5 | APPP::APPP( PPPNetNode * PNN ) : ANetNodeInstance( PNN ) { | ||
6 | Data.DNS.ServerAssigned = 1; | ||
7 | Data.DNS.DomainName = ""; | ||
8 | |||
9 | Data.Auth.Mode = 0; | ||
10 | Data.Auth.Login.Expect = "ogin:"; | ||
11 | Data.Auth.Password.Expect = "assword:"; | ||
12 | Data.Auth.PCEMode = 0; | ||
13 | Data.Auth.Client = "*"; | ||
14 | Data.Auth.Server = "*"; | ||
15 | Data.Auth.Secret = ""; | ||
16 | |||
17 | Data.IP.IPAutomatic = 1; | ||
18 | Data.IP.IPAddress = ""; | ||
19 | Data.IP.IPSubMask = ""; | ||
20 | Data.IP.GWAutomatic = 1; | ||
21 | Data.IP.GWAddress = ""; | ||
22 | Data.IP.GWIsDefault = 1; | ||
23 | GUI = 0; | ||
24 | RT = 0; | ||
25 | |||
26 | } | ||
27 | |||
28 | void APPP::setSpecificAttribute( QString & A, QString & V ) { | ||
29 | if( A.startsWith( "dns" ) ) { | ||
30 | if( A == "dnsserverassigned" ) { | ||
31 | Data.DNS.ServerAssigned = (V == "yes"); | ||
32 | } else if( A == "dnsdomainname" ) { | ||
33 | Data.DNS.DomainName = V; | ||
34 | } else if( A == "dnsserver" ) { | ||
35 | Data.DNS.Servers.resize( Data.DNS.Servers.size()+1 ); | ||
36 | Data.DNS.Servers[Data.DNS.Servers.size()-1] = | ||
37 | new QString( V ); | ||
38 | } | ||
39 | } else if( A.startsWith( "auth" ) ) { | ||
40 | if( A == "authmode" ) { | ||
41 | Data.Auth.Mode = V.toShort(); | ||
42 | } else if( A == "authloginexpect" ) { | ||
43 | Data.Auth.Login.Expect = V; | ||
44 | } else if( A == "authloginsend" ) { | ||
45 | Data.Auth.Login.Send = V; | ||
46 | } else if( A == "authpasswordexpect" ) { | ||
47 | Data.Auth.Password.Expect = V; | ||
48 | } else if( A == "authpasswordsend" ) { | ||
49 | Data.Auth.Password.Send = V; | ||
50 | } else if( A == "authpcemode" ) { | ||
51 | Data.Auth.PCEMode = V.toShort(); | ||
52 | } else if( A == "authclient" ) { | ||
53 | Data.Auth.Client = V; | ||
54 | } else if( A == "authserver" ) { | ||
55 | Data.Auth.Server = V; | ||
56 | } else if( A == "authsecret" ) { | ||
57 | Data.Auth.Secret = V; | ||
58 | } | ||
59 | } else if( A.startsWith( "ip" ) ) { | ||
60 | if( A == "ipautomatic" ) { | ||
61 | Data.IP.IPAutomatic = (V == "yes"); | ||
62 | } else if( A == "gwautomatic" ) { | ||
63 | Data.IP.GWAutomatic = (V == "yes"); | ||
64 | } else if( A == "gwisdefault" ) { | ||
65 | Data.IP.GWIsDefault = (V == "yes"); | ||
66 | } else if( A == "ipaddress" ) { | ||
67 | Data.IP.IPAddress = V; | ||
68 | } else if( A == "ipsubmask" ) { | ||
69 | Data.IP.IPSubMask = V; | ||
70 | } else if( A == "gwaddress" ) { | ||
71 | Data.IP.GWAddress = V; | ||
72 | } | ||
73 | } | ||
74 | } | ||
75 | |||
76 | void APPP::saveSpecificAttribute( QTextStream & TS ) { | ||
77 | TS << "dnsserverassigned=" << | ||
78 | ( ( Data.DNS.ServerAssigned ) ? "yes" : "no" ) << endl; | ||
79 | TS << "dnsdomainname=" << Data.DNS.DomainName << endl; | ||
80 | for( unsigned int i = 0; i < Data.DNS.Servers.size(); i ++ ) { | ||
81 | TS << "dnsserver=" << *(Data.DNS.Servers[i]) << endl; | ||
82 | } | ||
83 | TS << "authmode=" << Data.Auth.Mode << endl; | ||
84 | TS << "authloginexpect=" << quote( Data.Auth.Login.Expect ) << endl; | ||
85 | TS << "authloginsend=" << quote( Data.Auth.Login.Send ) << endl; | ||
86 | TS << "authpasswordexpect=" << quote( Data.Auth.Password.Expect ) << endl; | ||
87 | TS << "authpasswordsend=" << quote( Data.Auth.Password.Send ) << endl; | ||
88 | TS << "authpcemode=" << Data.Auth.PCEMode << endl; | ||
89 | TS << "authclient=" << Data.Auth.Client << endl; | ||
90 | TS << "authserver=" << Data.Auth.Server << endl; | ||
91 | TS << "authsecret=" << quote( Data.Auth.Secret ) << endl; | ||
92 | TS << "ipautomatic=" << ( ( Data.IP.IPAutomatic ) ? "yes" : "no" ) << endl; | ||
93 | TS << "gwautomatic=" << ( ( Data.IP.GWAutomatic ) ? "yes" : "no" ) << endl; | ||
94 | TS << "gwisdefault=" << ( ( Data.IP.GWIsDefault ) ? "yes" : "no" ) << endl; | ||
95 | TS << "ipaddress=" << Data.IP.IPAddress << endl; | ||
96 | TS << "ipsubmask=" << Data.IP.IPSubMask << endl; | ||
97 | TS << "gwaddress=" << Data.IP.GWAddress << endl; | ||
98 | } | ||
99 | |||
100 | QWidget * APPP::edit( QWidget * parent ) { | ||
101 | GUI = new PPPEdit( parent ); | ||
102 | GUI->showData( Data ); | ||
103 | return GUI; | ||
104 | } | ||
105 | |||
106 | QString APPP::acceptable( void ) { | ||
107 | return ( GUI ) ? GUI->acceptable( ) : QString(); | ||
108 | } | ||
109 | |||
110 | void APPP::commit( void ) { | ||
111 | if( GUI && GUI->commit( Data ) ) { | ||
112 | setModified( 1 ); | ||
113 | } | ||
114 | } | ||
115 | |||