summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/wlan
authorwimpie <wimpie>2004-08-12 12:46:55 (UTC)
committer wimpie <wimpie>2004-08-12 12:46:55 (UTC)
commit8f215ba9ceb395f262517855a99d7d2d303ca760 (patch) (unidiff)
treeaa5f9b14c249217b4d3fc30f4771bdaf1c3545d3 /noncore/settings/networksettings2/wlan
parentef64880308b5035cc8ca2e4e79325db613af525b (diff)
downloadopie-8f215ba9ceb395f262517855a99d7d2d303ca760.zip
opie-8f215ba9ceb395f262517855a99d7d2d303ca760.tar.gz
opie-8f215ba9ceb395f262517855a99d7d2d303ca760.tar.bz2
MANY changes
- now generates peers/pap-chap secrets files (no chatscript yet) (not all usefull ppp options included yet) - still not ready for prime time yet
Diffstat (limited to 'noncore/settings/networksettings2/wlan') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.cpp23
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.h9
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NNI.cpp107
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NNI.h20
4 files changed, 69 insertions, 90 deletions
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp
index ce8a734..e4c3f60 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp
+++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp
@@ -38,29 +38,6 @@ const char * WLanNetNode::provides( void ) {
38 return "device"; 38 return "device";
39} 39}
40 40
41bool WLanNetNode::generateProperFilesFor(
42 ANetNodeInstance * ) {
43 return 0;
44}
45
46bool WLanNetNode::hasDataFor( const QString & S ) {
47 return S == "interfaces";
48}
49
50bool WLanNetNode::generateDeviceDataForCommonFile(
51 SystemFile & S,
52 long DevNr ) {
53 QString NIC = genNic( DevNr );
54
55 if( S.name() == "interfaces" ) {
56 // generate mapping stanza for this interface
57 S << "# check if " << NIC << " can be brought UP" << endl;
58 S << "mapping " << NIC << endl;
59 S << " script networksettings2-request" << endl << endl;
60 }
61 return 0;
62}
63
64QString WLanNetNode::genNic( long nr ) { 41QString WLanNetNode::genNic( long nr ) {
65 QString S; 42 QString S;
66 return S.sprintf( "wlan%ld", nr ); 43 return S.sprintf( "wlan%ld", nr );
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.h b/noncore/settings/networksettings2/wlan/wlan_NN.h
index b5ff3fd..c13c05c 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NN.h
+++ b/noncore/settings/networksettings2/wlan/wlan_NN.h
@@ -18,21 +18,12 @@ public:
18 { return "Devices/wlan"; } 18 { return "Devices/wlan"; }
19 19
20 virtual const QString nodeDescription() ; 20 virtual const QString nodeDescription() ;
21
22 virtual ANetNodeInstance * createInstance( void ); 21 virtual ANetNodeInstance * createInstance( void );
23
24 virtual const char ** needs( void ); 22 virtual const char ** needs( void );
25 virtual const char * provides( void ); 23 virtual const char * provides( void );
26 24
27 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
28
29 virtual bool hasDataFor( const QString & S );
30 virtual bool generateDeviceDataForCommonFile(
31 SystemFile & SF, long DevNr );
32
33 virtual long instanceCount( void ) 25 virtual long instanceCount( void )
34 { return InstanceCount; } 26 { return InstanceCount; }
35
36 virtual QString genNic( long ); 27 virtual QString genNic( long );
37 28
38private: 29private:
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
index 61969f2..0e4fc4c 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
+++ b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
@@ -79,62 +79,73 @@ void AWLan::commit( void ) {
79 setModified( 1 ); 79 setModified( 1 );
80} 80}
81 81
82bool AWLan::generateDataForCommonFile( 82short AWLan::generateFileEmbedded( const QString & ID,
83 SystemFile & S, 83 const QString & Path,
84 long ) { 84 QTextStream & TS,
85 long DevNr ) {
85 86
86 S << " wireless_essid \"" 87 short rvl, rvd;
87 << Data.ESSID
88 << "\""
89 << endl;
90 88
91 if( ! Data.NodeName.isEmpty() ) { 89 rvl = 1;
92 if( Data.NodeName == tr("<UseHostName>") ) { 90
93 char Buf[100]; 91 if( ID == "interfaces" ) {
94 if( gethostname(Buf, sizeof(Buf) ) == 0 ) { 92 Log(("Generate WLanNNI for %s\n", ID.latin1() ));
95 Buf[99] = '\0'; // just to make sure 93 TS << " wireless_essid \""
96 S << " wireless_nick " 94 << Data.ESSID
97 << Buf 95 << "\""
98 << endl; 96 << endl;
97
98 if( ! Data.NodeName.isEmpty() ) {
99 if( Data.NodeName == tr("<UseHostName>") ) {
100 char Buf[100];
101 if( gethostname(Buf, sizeof(Buf) ) == 0 ) {
102 Buf[99] = '\0'; // just to make sure
103 TS << " wireless_nick "
104 << Buf
105 << endl;
106 }
107 } else {
108 TS << " wireless_nick \""
109 << Data.NodeName
110 << "\""
111 << endl;
99 } 112 }
100 } else {
101 S << " wireless_nick \""
102 << Data.NodeName
103 << "\""
104 << endl;
105 } 113 }
106 }
107 114
108 char * M; 115 char * M = "Auto";
109 switch ( Data.Mode ) { 116 switch ( Data.Mode ) {
110 case 0 : 117 case 0 :
111 M = "Auto"; 118 break;
112 break; 119 case 1 :
113 case 1 : 120 M = "Managed";
114 M = "Managed"; 121 break;
115 break; 122 case 2 :
116 case 2 : 123 M = "Ad-Hoc";
117 M = "Ad-Hoc"; 124 break;
118 break; 125 }
119 }
120 126
121 S << " wireless_mode " 127 TS << " wireless_mode "
122 << M 128 << M
123 << endl; 129 << endl;
124 if( Data.Encrypted ) { 130 if( Data.Encrypted ) {
125 for( int i = 0; i < 4; i ++ ) { 131 for( int i = 0; i < 4; i ++ ) {
126 if( ! Data.Key[i].isEmpty() ) { 132 if( ! Data.Key[i].isEmpty() ) {
127 S << " wireless_key" 133 TS << " wireless_key"
128 << i 134 << i
129 << " " 135 << " "
130 << Data.Key[i] 136 << Data.Key[i]
131 << endl; 137 << endl;
138 }
132 } 139 }
140 TS << " wireless_keymode "
141 << ((Data.AcceptNonEncrypted) ? "open" : "restricted")
142 << endl;
133 } 143 }
134 S << " wireless_keymode " 144 rvl = 0;
135 << ((Data.AcceptNonEncrypted) ? "open" : "restricted")
136 << endl;
137 } 145 }
138 return 0; 146 rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr);
147
148 return (rvd == 2 || rvl == 2 ) ? 2 :
149 (rvd == 0 || rvl == 0 ) ? 0 : 1;
139} 150}
140 151
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.h b/noncore/settings/networksettings2/wlan/wlan_NNI.h
index 2211c47..a9be65f 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NNI.h
+++ b/noncore/settings/networksettings2/wlan/wlan_NNI.h
@@ -14,23 +14,23 @@ public :
14 14
15 AWLan( WLanNetNode * PNN ); 15 AWLan( WLanNetNode * PNN );
16 16
17 RuntimeInfo * runtime( void )
18 { return
19 ( RT ) ? RT : ( RT = new WLanRun( this, Data ) );
20 }
21
17 QWidget * edit( QWidget * parent ); 22 QWidget * edit( QWidget * parent );
18 QString acceptable( void ); 23 QString acceptable( void );
19 void commit( void ); 24 void commit( void );
20 25
21 RuntimeInfo * runtime( void )
22 { if( RT == 0 )
23 RT = new WLanRun( this, Data );
24 return RT;
25 }
26
27 virtual void * data( void ) 26 virtual void * data( void )
28 { return (void *)&Data; } 27 { return (void *)&Data; }
29 28
30 virtual bool hasDataFor( const QString & ) 29 virtual short generateFileEmbedded( const QString & ID,
31 { return 1; } 30 const QString & Path,
32 virtual bool generateDataForCommonFile( 31 QTextStream & TS,
33 SystemFile & SF, long DevNr ); 32 long DevNr );
33
34protected : 34protected :
35 35
36 virtual void setSpecificAttribute( QString & Attr, QString & Value ); 36 virtual void setSpecificAttribute( QString & Attr, QString & Value );