|
1 /* |
|
2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation of the class CProcessorLan |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 |
|
23 #include "cdcprocessorlan.h" |
|
24 #include "cdclogger.h" |
|
25 #include "cdctagcontainer.h" |
|
26 |
|
27 #include <cmpluginlandef.h> |
|
28 #include <cmpluginlanbasedef.h> |
|
29 #include <cmpluginbaseeng.h> |
|
30 #include <cmconnectionmethoddef.h> |
|
31 #include <cmmanagerext.h> |
|
32 #include <datamobilitycommsdattypes.h> |
|
33 |
|
34 using namespace CMManager; |
|
35 |
|
36 // CONSTANTS |
|
37 |
|
38 const TUint32 KDefaultPortNum = 80; |
|
39 |
|
40 // These constants are used to identify tags of iInFile. |
|
41 |
|
42 //Connection type |
|
43 _LIT16( KStrContinuous, "Continuous" ); |
|
44 _LIT16( KStrTemporary, "Temporary" ); |
|
45 |
|
46 _LIT16( KStrTrue, "True" ); |
|
47 _LIT16( KStrFalse, "False" ); |
|
48 |
|
49 |
|
50 // ================= MEMBER FUNCTIONS ======================= |
|
51 |
|
52 // --------------------------------------------------------- |
|
53 // CProcessorLan::NewL |
|
54 // --------------------------------------------------------- |
|
55 // |
|
56 CProcessorLan* CProcessorLan::NewL( CReaderBase* aFileReader, |
|
57 RCmManagerExt& aCmManager, |
|
58 RPointerArray< RCmConnectionMethodExt >& aPluginArray, |
|
59 RPointerArray< HBufC >& aPluginNames ) |
|
60 { |
|
61 CProcessorLan* self = new ( ELeave ) CProcessorLan( aFileReader, |
|
62 aCmManager, |
|
63 aPluginArray, |
|
64 aPluginNames ); |
|
65 CleanupStack::PushL( self ); |
|
66 |
|
67 // From base class |
|
68 self->ConstructL(); |
|
69 CleanupStack::Pop( self ); // self |
|
70 return self; |
|
71 } |
|
72 |
|
73 |
|
74 // --------------------------------------------------------- |
|
75 // CProcessorLan::~CProcessorLan |
|
76 // --------------------------------------------------------- |
|
77 // |
|
78 CProcessorLan::~CProcessorLan() |
|
79 { |
|
80 } |
|
81 |
|
82 |
|
83 // --------------------------------------------------------- |
|
84 // CProcessorLan::ConstructL |
|
85 // --------------------------------------------------------- |
|
86 // |
|
87 void CProcessorLan::ConstructL() |
|
88 { |
|
89 } |
|
90 |
|
91 |
|
92 // --------------------------------------------------------- |
|
93 // CProcessorLan::CProcessorLan |
|
94 // --------------------------------------------------------- |
|
95 // |
|
96 CProcessorLan::CProcessorLan( CReaderBase* aFileReader, |
|
97 RCmManagerExt& aCmManager, |
|
98 RPointerArray< RCmConnectionMethodExt >& aPluginArray, |
|
99 RPointerArray< HBufC >& aPluginNames) : |
|
100 CProcessorBase( aFileReader, |
|
101 aCmManager, |
|
102 aPluginArray, |
|
103 aPluginNames ) |
|
104 { |
|
105 iBearerType = KUidLanBearerType; |
|
106 } |
|
107 |
|
108 |
|
109 // --------------------------------------------------------- |
|
110 // CProcessorLan::ProcessTagL |
|
111 // --------------------------------------------------------- |
|
112 // |
|
113 void CProcessorLan::ProcessSpecialFieldsL( TInt aField, HBufC* aPtrTag, TInt /*aDx*/ ) |
|
114 { |
|
115 switch ( aField ) |
|
116 { |
|
117 case ECmWapIPGatewayAddress: |
|
118 { |
|
119 // Unicode 16-bit text |
|
120 if ( aPtrTag->Length() ) |
|
121 { |
|
122 iPlugin.SetStringAttributeL( aField, *aPtrTag ); |
|
123 } |
|
124 |
|
125 break; |
|
126 } |
|
127 case ECmWapIPSecurity: |
|
128 { |
|
129 // TBool |
|
130 if ( !aPtrTag->CompareF( KStrOn ) ) |
|
131 { |
|
132 iPlugin.SetBoolAttributeL( aField, ETrue ); |
|
133 } |
|
134 else if ( !aPtrTag->CompareF( KStrOff ) ) |
|
135 { |
|
136 iPlugin.SetBoolAttributeL( aField, EFalse ); |
|
137 } |
|
138 else |
|
139 { |
|
140 //no valid data is given - default data is used |
|
141 iPlugin.SetBoolAttributeL( aField, ETrue ); |
|
142 CLOG_WRITE( "! Error : Invalid WTLS security setting. Default:On"); |
|
143 } |
|
144 |
|
145 break; |
|
146 } |
|
147 case ELanIpAddrFromServer: |
|
148 case ELanIpDNSAddrFromServer: |
|
149 { |
|
150 // TBool |
|
151 if ( !aPtrTag->CompareF( KStrTrue ) ) |
|
152 { |
|
153 iPlugin.SetBoolAttributeL( aField, ETrue ); |
|
154 } |
|
155 else if ( !aPtrTag->CompareF( KStrFalse ) ) |
|
156 { |
|
157 iPlugin.SetBoolAttributeL( aField, EFalse ); |
|
158 } |
|
159 else |
|
160 { |
|
161 //no valid data is given - default data is used |
|
162 iPlugin.SetBoolAttributeL( aField, ETrue ); |
|
163 CLOG_WRITE( "! Error : Invalid LAN server setting. Default:On"); |
|
164 } |
|
165 break; |
|
166 } |
|
167 case ECmWapIPWSPOption: |
|
168 { |
|
169 // UInt |
|
170 if ( !aPtrTag->CompareF( KStrContinuous ) ) |
|
171 { |
|
172 iPlugin.SetIntAttributeL( aField, |
|
173 EWapWspOptionConnectionOriented ); |
|
174 } |
|
175 else if ( !aPtrTag->CompareF( KStrTemporary ) ) |
|
176 { |
|
177 iPlugin.SetIntAttributeL( aField, |
|
178 EWapWspOptionConnectionless ); |
|
179 } |
|
180 else |
|
181 { |
|
182 //no valid data is given - default data is used |
|
183 iPlugin.SetIntAttributeL( aField, |
|
184 EWapWspOptionConnectionOriented ); |
|
185 CLOG_WRITE( "! Error : Invalid connection type. Default:Continuous"); |
|
186 } |
|
187 |
|
188 break; |
|
189 } |
|
190 case ECmProxyProtocolName: |
|
191 { |
|
192 // Do not enable proxy in this case yet |
|
193 iPlugin.SetStringAttributeL( aField, *aPtrTag ); |
|
194 break; |
|
195 } |
|
196 |
|
197 case ECmProxyServerName: |
|
198 { |
|
199 // First set proxy usage to enabled |
|
200 if( !iProxyEnabled ) |
|
201 { |
|
202 iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue ); |
|
203 iProxyEnabled = ETrue; |
|
204 } |
|
205 // Long text |
|
206 iPlugin.SetStringAttributeL( aField, *aPtrTag ); |
|
207 break; |
|
208 } |
|
209 case ECmProxyPortNumber: |
|
210 { |
|
211 // First set proxy usage to enabled |
|
212 if( !iProxyEnabled ) |
|
213 { |
|
214 iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue ); |
|
215 iProxyEnabled = ETrue; |
|
216 } |
|
217 // TUint32 and should be read as text. |
|
218 TPtrC16 portptr = aPtrTag->Right( aPtrTag->Length() ); |
|
219 TLex16 lex( portptr ); |
|
220 TUint32 portnum( 0 ); |
|
221 if ( lex.Val( portnum, EDecimal ) == KErrNone ) |
|
222 { |
|
223 iPlugin.SetIntAttributeL( aField, portnum ); |
|
224 } |
|
225 else |
|
226 { |
|
227 //no valid data is given - default value is used |
|
228 iPlugin.SetIntAttributeL( aField, KDefaultPortNum ); |
|
229 CLOG_WRITE( "! Error : Invalid port number. Default:80"); |
|
230 } |
|
231 break; |
|
232 } |
|
233 case ELanIfNetworks: |
|
234 case ELanIpNetMask: |
|
235 case ELanIpGateway: |
|
236 case ELanIpAddr: |
|
237 case ELanConfigDaemonManagerName: |
|
238 case ELanConfigDaemonName: |
|
239 { |
|
240 iPlugin.SetStringAttributeL( aField, *aPtrTag ); |
|
241 break; |
|
242 } |
|
243 case ELanIpNameServer1: |
|
244 case ELanIpNameServer2: |
|
245 case ELanIp6NameServer1: |
|
246 case ELanIp6NameServer2: |
|
247 { |
|
248 iPlugin.SetStringAttributeL( aField, *aPtrTag ); |
|
249 SetAddressFromServerL( ELanIpNameServer1, |
|
250 ELanIpNameServer2, |
|
251 ELanIpDNSAddrFromServer, |
|
252 ELanIp6NameServer1, |
|
253 ELanIp6NameServer2, |
|
254 ELanIp6DNSAddrFromServer ); |
|
255 break; |
|
256 } |
|
257 default: |
|
258 { |
|
259 break; |
|
260 } |
|
261 }//switch |
|
262 } |
|
263 |
|
264 // End of File. |