1 /* |
1 /* |
2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
8 * |
9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: SUPL Connection provides the Connection End point |
14 * Description: SUPL Connection provides the Connection End point |
15 * for SUPL Session to send/receive packets from the |
15 * for SUPL Session to send/receive packets from the |
16 * network |
16 * network |
17 * |
17 * |
18 */ |
18 */ |
19 |
|
20 |
|
21 |
19 |
22 // INCLUDE FILES |
20 // INCLUDE FILES |
23 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
21 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
24 #include <ssl_internal.h> |
22 #include <ssl_internal.h> |
25 #endif |
23 #endif |
26 #include <commdbconnpref.h> |
24 #include <commdbconnpref.h> |
27 #include <centralrepository.h> |
25 #include <centralrepository.h> |
28 |
26 #include <extendedconnpref.h> //For OCC |
29 #include "epos_csuplserverprivatecrkeys.h" |
27 #include "epos_csuplserverprivatecrkeys.h" |
30 #include "epos_csuplconnection.h" |
28 #include "epos_csuplconnection.h" |
31 #include "epos_csuplsocketreader.h" |
29 #include "epos_csuplsocketreader.h" |
32 #include "epos_csuplsockettimer.h" |
30 #include "epos_csuplsockettimer.h" |
33 #include "epos_csuplconntrace.h" |
31 #include "epos_csuplconntrace.h" |
34 #include "epos_csuplpacketinfo.h" |
32 #include "epos_csuplpacketinfo.h" |
35 #include "epos_psktlsusageprivatecrkeys.h" |
33 #include "epos_psktlsusageprivatecrkeys.h" |
36 #include "epos_suplpskloger.h" |
34 #include "epos_suplpskloger.h" |
37 |
35 |
38 const TInt KMaxGBAUsageLength = 4; |
36 const TInt KMaxGBAUsageLength = 4; |
39 const TInt KMaxVerLength = 4; |
37 const TInt KMaxVerLength = 4; |
40 //const TInt KMaxNewPasswordLength = 8; |
38 //const TInt KMaxNewPasswordLength = 8; |
41 const TInt KMaxNewPasswordLength = 16; |
39 const TInt KMaxNewPasswordLength = 16; |
42 const TInt KMaxPskKeyLength = 256; |
40 const TInt KMaxPskKeyLength = 256; |
43 |
41 |
44 const TInt KMaxRootKeyLength = 32; |
42 const TInt KMaxRootKeyLength = 32; |
45 const TInt KMaxRootKeyXORLength = 16; |
43 const TInt KMaxRootKeyXORLength = 16; |
46 //const TInt KMaxRootKeyLength = 16; |
44 //const TInt KMaxRootKeyLength = 16; |
47 const TInt KMaxPassKeyLength = 8; |
45 const TInt KMaxPassKeyLength = 8; |
48 //const TInt KMaxPassKeyLength = 8; |
46 //const TInt KMaxPassKeyLength = 8; |
49 const TInt KMaxSaltLength = 128; |
47 const TInt KMaxSaltLength = 128; |
50 //const TInt KMaxSaltLength = 64; |
48 //const TInt KMaxSaltLength = 64; |
51 |
49 |
52 const TInt KMaxPskIdentityHintLength = KMaxGBAUsageLength + KMaxVerLength + KMaxPassKeyLength ; |
50 const TInt KMaxPskIdentityHintLength = KMaxGBAUsageLength + KMaxVerLength |
|
51 + KMaxPassKeyLength; |
53 |
52 |
54 // Constant definition |
53 // Constant definition |
55 |
54 |
56 _LIT8(KWGBA,"WGBA"); |
55 _LIT8(KWGBA,"WGBA"); |
57 |
56 |
58 _LIT(KTraceFileName,"SUPL_PH_API::epos_csuplconnection.cpp"); |
57 _LIT(KTraceFileName,"SUPL_PH_API::epos_csuplconnection.cpp"); |
59 |
58 |
60 _LIT8(KSaltValue,"0x19,0x31,0x45,0x69,0x69,0x45,0x31,0x19"); |
59 _LIT8(KSaltValue,"0x19,0x31,0x45,0x69,0x69,0x45,0x31,0x19"); |
61 |
60 |
62 void DoSelfXOR(TDes8& aDestination,const TDesC8& aSource) |
61 void DoSelfXOR(TDes8& aDestination, const TDesC8& aSource) |
63 { |
62 { |
64 aDestination.Zero(); |
63 aDestination.Zero(); |
65 TInt half = aSource.Length() / 2; |
64 TInt half = aSource.Length() / 2; |
66 for(TInt i = 0; i < half; i++) |
65 for (TInt i = 0; i < half; i++) |
67 { |
66 { |
68 aDestination.Append(aSource[i] ^ aSource[half + i]); |
67 aDestination.Append(aSource[i] ^ aSource[half + i]); |
69 } |
68 } |
70 } |
69 } |
71 |
70 |
72 |
71 void DoXOR(TDes8& aDestination, const TDesC8& aSource1, |
73 void DoXOR(TDes8& aDestination,const TDesC8& aSource1,const TDesC8& aSource2) |
72 const TDesC8& aSource2) |
74 { |
73 { |
75 aDestination.Zero(); |
74 aDestination.Zero(); |
76 TInt srcLen1 = aSource1.Length(); |
75 TInt srcLen1 = aSource1.Length(); |
77 TInt srcLen2 = aSource2.Length(); |
76 TInt srcLen2 = aSource2.Length(); |
78 TInt j = 0; |
77 TInt j = 0; |
79 for(TInt i = 0; i < srcLen1; i++ ) |
78 for (TInt i = 0; i < srcLen1; i++) |
80 { |
79 { |
81 if(j >= srcLen2 ) |
80 if (j >= srcLen2) |
82 { |
81 { |
83 j = 0; |
82 j = 0; |
84 } |
83 } |
85 |
84 |
86 aDestination.Append(aSource1[i] ^ aSource2[j++]); |
85 aDestination.Append(aSource1[i] ^ aSource2[j++]); |
87 } |
86 } |
88 } |
87 } |
89 |
88 |
90 |
|
91 //0x18,0x32,0x34,0x55,0x55,0x34,0x32,0x18 |
89 //0x18,0x32,0x34,0x55,0x55,0x34,0x32,0x18 |
92 void FormSaltKey(TDes8& aDestination,const TDesC8& aSource) |
90 void FormSaltKey(TDes8& aDestination, const TDesC8& aSource) |
93 { |
91 { |
94 TBuf8<2> seachText(_L8("0x")); |
92 TBuf8<2> seachText(_L8("0x")); |
95 aDestination.Zero(); |
93 aDestination.Zero(); |
96 TBuf8<KMaxSaltLength> tempSaltBuffer(aSource); |
94 TBuf8<KMaxSaltLength> tempSaltBuffer(aSource); |
97 TUint32 hexNumber; |
95 TUint32 hexNumber; |
98 TBuf<2> decNumber; |
96 TBuf<2> decNumber; |
99 TInt offSet = tempSaltBuffer.Find(seachText); |
97 TInt offSet = tempSaltBuffer.Find(seachText); |
100 |
98 |
101 while(offSet != KErrNotFound) |
99 while (offSet != KErrNotFound) |
102 { |
100 { |
103 offSet+=2; |
101 offSet += 2; |
104 decNumber.Copy(tempSaltBuffer.Mid(offSet,2)); |
102 decNumber.Copy(tempSaltBuffer.Mid(offSet, 2)); |
105 tempSaltBuffer.Copy(tempSaltBuffer.Mid(offSet+2)); |
103 tempSaltBuffer.Copy(tempSaltBuffer.Mid(offSet + 2)); |
106 TLex lex(decNumber); |
104 TLex lex(decNumber); |
107 lex.Val(hexNumber,EHex); |
105 lex.Val(hexNumber, EHex); |
108 aDestination.Append(hexNumber); |
106 aDestination.Append(hexNumber); |
109 offSet = tempSaltBuffer.Find(seachText); |
107 offSet = tempSaltBuffer.Find(seachText); |
110 } |
108 } |
111 } |
109 } |
112 |
110 |
113 //void get_key(unsigned char key[],unsigned int keylength); |
111 //void get_key(unsigned char key[],unsigned int keylength); |
114 |
112 |
115 void derive_key(const unsigned char pwd[], /* the PASSWORD */ |
113 void derive_key(const unsigned char pwd[], /* the PASSWORD */ |
116 unsigned int pwd_len, /* and its length */ |
114 unsigned int pwd_len, /* and its length */ |
117 const unsigned char salt[], /* the SALT and its */ |
115 const unsigned char salt[], /* the SALT and its */ |
118 unsigned int salt_len, /* length */ |
116 unsigned int salt_len, /* length */ |
119 unsigned int iter, /* the number of iterations */ |
117 unsigned int iter, /* the number of iterations */ |
120 unsigned char key[], /* space for the output key */ |
118 unsigned char key[], /* space for the output key */ |
121 unsigned int key_len);/* and its required length */ |
119 unsigned int key_len);/* and its required length */ |
122 |
|
123 |
|
124 |
|
125 |
120 |
126 // ============================ MEMBER FUNCTIONS =============================== |
121 // ============================ MEMBER FUNCTIONS =============================== |
127 |
122 |
128 CSuplConnection::CSuplConnection(RSocketServ &aSocketServ): |
123 CSuplConnection::CSuplConnection(RSocketServ &aSocketServ) : |
129 CActive(EPriorityStandard), |
124 CActive(EPriorityStandard), iSocketServ(aSocketServ), iRefCount(0), |
130 iSocketServ(aSocketServ), |
125 iState(ENotConnected), iPacket(0, 0), iVariantEnabled(ETrue), |
131 iRefCount(0), |
126 iPskTLSUsage(EFalse), iStartedListen(EFalse), iConnectStarted( |
132 iState(ENotConnected), |
127 EFalse), iSendInProgress(EFalse), iFirstPkt(EFalse), |
133 iPacket(0,0), |
128 iListenCount(0), iPrompt(EFalse), iWlanOnly(EFalse) |
134 iVariantEnabled(ETrue), |
|
135 iPskTLSUsage(EFalse), |
|
136 iStartedListen(EFalse), |
|
137 iConnectStarted(EFalse), |
|
138 iSendInProgress(EFalse), |
|
139 iFirstPkt(EFalse), |
|
140 iListenCount(0) |
|
141 { |
129 { |
142 iHostAddress.Zero(); |
130 iHostAddress.Zero(); |
143 CActiveScheduler::Add(this); |
131 CActiveScheduler::Add(this); |
144 } |
132 } |
145 |
133 |
146 void CSuplConnection::ConstructL(const TDesC &aHostAddress, const TUint aPort, |
134 void CSuplConnection::ConstructL(const TDesC &aHostAddress, |
147 const TInt aIAPId, |
135 const TUint aPort, const TInt aIAPId, MSuplPacketNotifier *aNotifier) |
148 MSuplPacketNotifier *aNotifier) |
136 { |
149 { |
137 |
150 |
|
151 iTrace = CSuplConnTrace::NewL(); |
138 iTrace = CSuplConnTrace::NewL(); |
152 |
139 |
153 iTrace->Trace(_L("CSuplConnection::ConstructL"), KTraceFileName, __LINE__); |
140 iTrace->Trace(_L("CSuplConnection::ConstructL"), KTraceFileName, __LINE__); |
154 SetVariation(); |
141 SetVariation(); |
155 iHostAddress.Append(aHostAddress); |
142 iHostAddress.Append(aHostAddress); |
156 iPort = aPort; |
143 iPort = aPort; |
157 iIAPId = aIAPId; |
144 iIAPId = aIAPId; |
158 |
145 |
159 // Create the Secure Socket |
146 // Create the Secure Socket |
160 if(iVariantEnabled) |
147 if (iVariantEnabled) |
161 { |
148 { |
162 iTrace->Trace(_L("Using CSuplConnection::Secure Construction"), KTraceFileName, __LINE__); |
149 iTrace->Trace(_L("Using CSuplConnection::Secure Construction"), |
163 _LIT(KTLS1,"TLS1.0"); |
150 KTraceFileName, __LINE__); |
164 iTlsSocket = CSecureSocket::NewL( iSocket, KTLS1 ); |
151 _LIT(KTLS1, "TLS1.0"); |
165 |
152 iTlsSocket = CSecureSocket::NewL(iSocket, KTLS1); |
166 TBuf8<KMaxHostAddressLen> dNSName; |
153 |
167 dNSName.Copy(aHostAddress); |
154 TBuf8<KMaxHostAddressLen> dNSName; |
168 iTlsSocket->SetOpt(KSoSSLDomainName,KSolInetSSL,dNSName); |
155 dNSName.Copy(aHostAddress); |
169 |
156 iTlsSocket->SetOpt(KSoSSLDomainName, KSolInetSSL, dNSName); |
170 if(iPskTLSUsage) |
157 |
171 { |
158 if (iPskTLSUsage) |
172 iTrace->Trace(_L("Considering PSK Ciphersuites for Usage..."), KTraceFileName, __LINE__); |
159 { |
173 |
160 iTrace->Trace(_L("Considering PSK Ciphersuites for Usage..."), |
174 // PSK TLS Start |
161 KTraceFileName, __LINE__); |
175 TPckgBuf<MSoPskKeyHandler *> pskConfigPkg; |
162 |
176 pskConfigPkg() = this; |
163 // PSK TLS Start |
177 User::LeaveIfError(iTlsSocket->SetOpt(KSoPskConfig, KSolInetSSL, pskConfigPkg)); |
164 TPckgBuf<MSoPskKeyHandler *> pskConfigPkg; |
178 // PSK TLS End |
165 pskConfigPkg() = this; |
179 } |
166 User::LeaveIfError(iTlsSocket->SetOpt(KSoPskConfig, KSolInetSSL, |
180 |
167 pskConfigPkg)); |
181 iTlsSocket->SetDialogMode(EDialogModeUnattended); |
168 // PSK TLS End |
182 |
169 } |
183 iSocketReader = CSuplSocketReader::NewL(iTlsSocket, aNotifier, iVariantEnabled); |
170 |
184 } |
171 iTlsSocket->SetDialogMode(EDialogModeUnattended); |
185 else |
172 |
186 { |
173 iSocketReader = CSuplSocketReader::NewL(iTlsSocket, aNotifier, |
187 iTrace->Trace(_L("Using CSuplConnection::NonSecure Construction"), KTraceFileName, __LINE__); |
174 iVariantEnabled); |
188 iSocketReader = CSuplSocketReader::NewL(iSocket, aNotifier, iVariantEnabled); |
175 } |
189 } |
176 else |
|
177 { |
|
178 iTrace->Trace(_L("Using CSuplConnection::NonSecure Construction"), |
|
179 KTraceFileName, __LINE__); |
|
180 iSocketReader = CSuplSocketReader::NewL(iSocket, aNotifier, |
|
181 iVariantEnabled); |
|
182 } |
190 iTimer = CSuplSocketTimer::NewL(this); |
183 iTimer = CSuplSocketTimer::NewL(this); |
191 |
184 |
192 |
185 if (iPskTLSUsage) |
193 if(iPskTLSUsage) |
186 { |
194 { |
187 // PSK TLS Start |
195 // PSK TLS Start |
188 #if WITH_GBA_OFFF |
196 #if WITH_GBA_OFFF |
189 iGbaClient = CGbaClientRequestHandler::NewL(); |
197 iGbaClient = CGbaClientRequestHandler::NewL(); |
190 #endif /* WITH_GBA */ |
198 #endif /* WITH_GBA */ |
191 // PSK TLS End |
199 // PSK TLS End |
192 } |
200 } |
193 |
201 |
|
202 iConnArray.Reset(); |
194 iConnArray.Reset(); |
203 |
195 |
204 iPktArray.Reset(); |
196 iPktArray.Reset(); |
205 |
197 |
206 } |
198 } |
207 // ----------------------------------------------------------------------------- |
199 // ----------------------------------------------------------------------------- |
208 // CSuplConnection::ConstructL |
200 // CSuplConnection::ConstructL |
209 // |
201 // |
210 // (other items were commented in a header). |
202 // (other items were commented in a header). |
211 // ----------------------------------------------------------------------------- |
203 // ----------------------------------------------------------------------------- |
212 // |
204 // |
213 //------------------------------------------------------------------------------------------------------------- |
205 //------------------------------------------------------------------------------------------------------------- |
214 void CSuplConnection::ConstructL(const TDesC &aHostAddress, const TUint aPort, |
206 void CSuplConnection::ConstructL(const TDesC &aHostAddress, |
215 const TInt aIAPId, |
207 const TUint aPort, const TInt aIAPId, TBool aTls, TBool aPskTls, |
216 TBool aTls, TBool aPskTls, |
208 MSuplPacketNotifier *aNotifier) |
217 MSuplPacketNotifier *aNotifier) |
209 { |
218 { |
210 |
219 |
|
220 iTrace = CSuplConnTrace::NewL(); |
211 iTrace = CSuplConnTrace::NewL(); |
221 |
212 |
222 iTrace->Trace(_L("CSuplConnection::ConstructL"), KTraceFileName, __LINE__); |
213 iTrace->Trace(_L("CSuplConnection::ConstructL"), KTraceFileName, __LINE__); |
223 //SetVariation(); |
214 //SetVariation(); |
224 iVariantEnabled = aTls; |
215 iVariantEnabled = aTls; |
225 iPskTLSUsage = aPskTls; |
216 iPskTLSUsage = aPskTls; |
226 iHostAddress.Append(aHostAddress); |
217 iHostAddress.Append(aHostAddress); |
227 iPort = aPort; |
218 iPort = aPort; |
228 iIAPId = aIAPId; |
219 iIAPId = aIAPId; |
229 |
220 |
230 // Create the Secure Socket |
221 // Create the Secure Socket |
231 if(iVariantEnabled) |
222 if (iVariantEnabled) |
232 { |
223 { |
233 iTrace->Trace(_L("Using CSuplConnection::Secure Construction"), KTraceFileName, __LINE__); |
224 iTrace->Trace(_L("Using CSuplConnection::Secure Construction"), |
234 _LIT(KTLS1,"TLS1.0"); |
225 KTraceFileName, __LINE__); |
235 iTlsSocket = CSecureSocket::NewL( iSocket, KTLS1 ); |
226 _LIT(KTLS1, "TLS1.0"); |
236 |
227 iTlsSocket = CSecureSocket::NewL(iSocket, KTLS1); |
|
228 |
237 TBuf8<KMaxHostAddressLen> dNSName; |
229 TBuf8<KMaxHostAddressLen> dNSName; |
238 dNSName.Copy(aHostAddress); |
230 dNSName.Copy(aHostAddress); |
239 iTlsSocket->SetOpt(KSoSSLDomainName,KSolInetSSL,dNSName); |
231 iTlsSocket->SetOpt(KSoSSLDomainName, KSolInetSSL, dNSName); |
240 |
232 |
241 if(iPskTLSUsage) |
233 if (iPskTLSUsage) |
242 { |
234 { |
243 iTrace->Trace(_L("Considering PSK Ciphersuites for Usage..."), KTraceFileName, __LINE__); |
235 iTrace->Trace(_L("Considering PSK Ciphersuites for Usage..."), |
244 // PSK TLS Start |
236 KTraceFileName, __LINE__); |
245 TPckgBuf<MSoPskKeyHandler *> pskConfigPkg; |
237 // PSK TLS Start |
246 pskConfigPkg() = this; |
238 TPckgBuf<MSoPskKeyHandler *> pskConfigPkg; |
247 User::LeaveIfError(iTlsSocket->SetOpt(KSoPskConfig, KSolInetSSL, pskConfigPkg)); |
239 pskConfigPkg() = this; |
248 // PSK TLS End |
240 User::LeaveIfError(iTlsSocket->SetOpt(KSoPskConfig, KSolInetSSL, |
249 } |
241 pskConfigPkg)); |
250 |
242 // PSK TLS End |
|
243 } |
|
244 |
251 iTlsSocket->SetDialogMode(EDialogModeUnattended); |
245 iTlsSocket->SetDialogMode(EDialogModeUnattended); |
252 |
246 |
253 iSocketReader = CSuplSocketReader::NewL(iTlsSocket, aNotifier, iVariantEnabled); |
247 iSocketReader = CSuplSocketReader::NewL(iTlsSocket, aNotifier, |
|
248 iVariantEnabled); |
254 } |
249 } |
255 else |
250 else |
256 { |
251 { |
257 iTrace->Trace(_L("Using CSuplConnection::NonSecure Construction"), KTraceFileName, __LINE__); |
252 iTrace->Trace(_L("Using CSuplConnection::NonSecure Construction"), |
258 iSocketReader = CSuplSocketReader::NewL(iSocket, aNotifier, iVariantEnabled); |
253 KTraceFileName, __LINE__); |
|
254 iSocketReader = CSuplSocketReader::NewL(iSocket, aNotifier, |
|
255 iVariantEnabled); |
259 } |
256 } |
260 iTimer = CSuplSocketTimer::NewL(this); |
257 iTimer = CSuplSocketTimer::NewL(this); |
261 |
258 |
262 if(iPskTLSUsage) |
259 if (iPskTLSUsage) |
263 { |
260 { |
264 // PSK TLS Start |
261 // PSK TLS Start |
265 #if WITH_GBA_OFFF |
262 #if WITH_GBA_OFFF |
266 iGbaClient = CGbaClientRequestHandler::NewL(); |
263 iGbaClient = CGbaClientRequestHandler::NewL(); |
267 #endif /* WITH_GBA */ |
264 #endif /* WITH_GBA */ |
268 // PSK TLS End |
265 // PSK TLS End |
269 } |
266 } |
270 |
267 |
271 iConnArray.Reset(); |
268 iConnArray.Reset(); |
272 |
269 |
273 iPktArray.Reset(); |
270 iPktArray.Reset(); |
274 |
271 |
275 } |
272 } |
276 |
273 |
277 CSuplConnection* CSuplConnection::NewL(RSocketServ &aSocketServ, const TDesC &aHostAddress, |
274 CSuplConnection* CSuplConnection::NewL(RSocketServ &aSocketServ, |
278 const TUint aPort,const TInt aIAPId, |
275 const TDesC &aHostAddress, const TUint aPort, const TInt aIAPId, |
279 MSuplPacketNotifier *aNotifier) |
276 MSuplPacketNotifier *aNotifier) |
280 { |
277 { |
281 CSuplConnection* self = new( ELeave ) CSuplConnection(aSocketServ); |
278 CSuplConnection* self = new (ELeave) CSuplConnection(aSocketServ); |
282 |
279 |
283 CleanupStack::PushL( self ); |
280 CleanupStack::PushL(self); |
284 self->ConstructL(aHostAddress, aPort,aIAPId, aNotifier); |
281 self->ConstructL(aHostAddress, aPort, aIAPId, aNotifier); |
285 CleanupStack::Pop(); |
282 CleanupStack::Pop(); |
286 |
283 |
287 return self; |
284 return self; |
288 } |
285 } |
289 |
286 |
290 // --------------------------------------------ADDED NEWL TAKING TLS ALSO------------------------------------- |
287 // --------------------------------------------ADDED NEWL TAKING TLS ALSO------------------------------------- |
291 // ----------------------------------------------------------------------------- |
288 // ----------------------------------------------------------------------------- |
292 // CSuplConnection::NewL |
289 // CSuplConnection::NewL |
293 // |
290 // |
294 // (other items were commented in a header). |
291 // (other items were commented in a header). |
295 // ----------------------------------------------------------------------------- |
292 // ----------------------------------------------------------------------------- |
296 // |
293 // |
297 CSuplConnection* CSuplConnection::NewL(RSocketServ &aSocketServ, const TDesC &aHostAddress, |
294 CSuplConnection* CSuplConnection::NewL(RSocketServ &aSocketServ, |
298 const TUint aPort,const TInt aIAPId, |
295 const TDesC &aHostAddress, const TUint aPort, const TInt aIAPId, |
299 TBool aTls, TBool aPskTls, |
296 TBool aTls, TBool aPskTls, MSuplPacketNotifier *aNotifier) |
300 MSuplPacketNotifier *aNotifier) |
297 { |
301 { |
298 CSuplConnection* self = new (ELeave) CSuplConnection(aSocketServ); |
302 CSuplConnection* self = new( ELeave ) CSuplConnection(aSocketServ); |
299 |
303 |
300 CleanupStack::PushL(self); |
304 CleanupStack::PushL( self ); |
301 self->ConstructL(aHostAddress, aPort, aIAPId, aTls, aPskTls, aNotifier); |
305 self->ConstructL(aHostAddress, aPort,aIAPId, aTls, aPskTls, aNotifier); |
|
306 CleanupStack::Pop(); |
302 CleanupStack::Pop(); |
307 |
303 |
308 return self; |
304 return self; |
309 } |
305 } |
310 //------------------------------------------------------------------------------------------------------------ |
306 //------------------------------------------------------------------------------------------------------------ |
311 CSuplConnection::~CSuplConnection() |
307 CSuplConnection::~CSuplConnection() |
312 { |
308 { |
313 |
309 |
314 // Log |
310 // Log |
315 if(iTrace) |
311 if (iTrace) |
316 { |
312 { |
317 iTrace->Trace(_L("CSuplConnection::Destructor"), KTraceFileName, __LINE__); |
313 iTrace->Trace(_L("CSuplConnection::Destructor"), KTraceFileName, |
318 |
314 __LINE__); |
319 iTrace->Trace(_L("CSuplConnection::Destructor...Cancelling "), KTraceFileName, __LINE__); |
315 |
320 } |
316 iTrace->Trace(_L("CSuplConnection::Destructor...Cancelling "), |
|
317 KTraceFileName, __LINE__); |
|
318 } |
321 // Cancel Any outstanding request |
319 // Cancel Any outstanding request |
322 Cancel(); |
320 Cancel(); |
323 |
321 |
324 iTrace->Trace(_L("CSuplConnection::Destructor...Deleting Socket Reader"), KTraceFileName, __LINE__); |
322 iTrace->Trace(_L("CSuplConnection::Destructor...Deleting Socket Reader"), |
|
323 KTraceFileName, __LINE__); |
325 //Delete the Socket Reader |
324 //Delete the Socket Reader |
326 delete iSocketReader; |
325 delete iSocketReader; |
327 |
326 |
328 // Close the resolver if required |
327 // Close the resolver if required |
329 if(iState == ELookingUp) |
328 if (iState == ELookingUp) |
330 { |
329 { |
331 if(iTrace) |
330 if (iTrace) |
332 iTrace->Trace(_L("CSuplConnection::Destructor...Closing Resolver"), KTraceFileName, __LINE__); |
331 iTrace->Trace( |
333 iResolver.Close(); |
332 _L("CSuplConnection::Destructor...Closing Resolver"), |
334 } |
333 KTraceFileName, __LINE__); |
335 if(iTrace) |
334 iResolver.Close(); |
336 iTrace->Trace(_L("CSuplConnection::Destructor...Deleting Secure Socket"), KTraceFileName, __LINE__); |
335 } |
|
336 if (iTrace) |
|
337 iTrace->Trace(_L( |
|
338 "CSuplConnection::Destructor...Deleting Secure Socket"), |
|
339 KTraceFileName, __LINE__); |
337 // Delete the TLS Socket |
340 // Delete the TLS Socket |
338 delete iTlsSocket; |
341 delete iTlsSocket; |
339 |
342 |
340 // Close the Socket if required |
343 // Close the Socket if required |
341 if(iState == EConnected || iState == EConnecting) |
344 if (iState == EConnected || iState == EConnecting) |
342 { |
345 { |
343 iTrace->Trace(_L("CSuplConnection::Destructor...Closing Socket"), KTraceFileName, __LINE__); |
346 iTrace->Trace(_L("CSuplConnection::Destructor...Closing Socket"), |
344 iSocket.Close(); |
347 KTraceFileName, __LINE__); |
345 } |
348 iSocket.Close(); |
346 |
349 } |
|
350 |
347 #ifndef __WINS__ |
351 #ifndef __WINS__ |
348 // Close the RConnection |
352 // Close the RConnection |
349 if(iTrace) |
353 if(iTrace) |
350 iTrace->Trace(_L("CSuplConnection::Destructor...Closing RConnection"), KTraceFileName, __LINE__); |
354 iTrace->Trace(_L("CSuplConnection::Destructor...Closing RConnection"), KTraceFileName, __LINE__); |
351 iConnection.Close(); |
355 iConnection.Close(); |
352 #endif |
356 #endif |
353 if(iTrace) |
357 if (iTrace) |
354 iTrace->Trace(_L("CSuplConnection::Destructor...Deleting Timer"), KTraceFileName, __LINE__); |
358 iTrace->Trace(_L("CSuplConnection::Destructor...Deleting Timer"), |
|
359 KTraceFileName, __LINE__); |
355 // Delete timer |
360 // Delete timer |
356 delete iTimer; |
361 delete iTimer; |
357 |
362 |
358 // PSK TLS Start |
363 // PSK TLS Start |
359 #if WITH_GBA_OFFF |
364 #if WITH_GBA_OFFF |
360 delete iGbaClient; |
365 delete iGbaClient; |
361 #endif /* WITH_GBA */ |
366 #endif /* WITH_GBA */ |
362 // PSK TLS End |
367 // PSK TLS End |
363 |
368 |
364 iConnArray.Close(); |
369 iConnArray.Close(); |
365 // Delete Trace |
370 // Delete Trace |
366 delete iTrace; |
371 delete iTrace; |
367 |
372 |
368 iPktArray.Close(); |
373 iPktArray.Close(); |
369 } |
374 } |
370 |
375 |
375 // (other items were commented in a header). |
380 // (other items were commented in a header). |
376 // ----------------------------------------------------------------------------- |
381 // ----------------------------------------------------------------------------- |
377 // |
382 // |
378 void CSuplConnection::RunL() |
383 void CSuplConnection::RunL() |
379 { |
384 { |
380 |
385 |
381 // Log |
386 // Log |
382 TBuf<64> msg(_L("CSuplConnection::RunL: State is ")); |
387 TBuf<64> msg(_L("CSuplConnection::RunL: State is ")); |
383 msg.AppendNum(iState); |
388 msg.AppendNum(iState); |
384 msg.Append(_L(" iStatus is ")); |
389 msg.Append(_L(" iStatus is ")); |
385 msg.AppendNum(iStatus.Int()); |
390 msg.AppendNum(iStatus.Int()); |
386 iTrace->Trace(msg, KTraceFileName, __LINE__); |
391 iTrace->Trace(msg, KTraceFileName, __LINE__); |
387 |
392 |
388 switch(iState) |
393 switch (iState) |
389 { |
394 { |
390 case ERetriveIAP: |
395 case ERetriveIAP: |
391 { |
396 { |
392 iTrace->Trace(_L("CSuplConnection::ERetriveIAP"), KTraceFileName, __LINE__); |
397 iTrace->Trace(_L("CSuplConnection::ERetriveIAP"), KTraceFileName, |
393 if(iStatus.Int() == KErrNone) |
398 __LINE__); |
394 { |
399 if (iStatus.Int() == KErrNone) |
395 ConnectIAP(); |
400 { |
396 } |
401 ConnectIAP(); |
397 else |
402 } |
398 { |
403 else |
399 iTrace->Trace(_L("Error in Retriving IAP Id... "), KTraceFileName, __LINE__); |
404 { |
400 iConnection.Close(); |
405 iTrace->Trace(_L("Error in Retriving IAP Id... "), |
401 iTrace->Trace(_L("iConnection.Close();... "), KTraceFileName, __LINE__); |
406 KTraceFileName, __LINE__); |
402 //User::RequestComplete(iReqStatus, iStatus.Int()); |
407 iConnection.Close(); |
|
408 iTrace->Trace(_L("iConnection.Close();... "), KTraceFileName, |
|
409 __LINE__); |
|
410 //User::RequestComplete(iReqStatus, iStatus.Int()); |
|
411 CompleteConnectRequests(iStatus.Int()); |
|
412 } |
|
413 break; |
|
414 } |
|
415 // Socket Connect has completed |
|
416 case EConnecting: |
|
417 iTimer->Cancel(); // Valid SUPL server, Cancel timer started for this purpose |
|
418 if (iStatus == KErrNone) |
|
419 { |
|
420 if (iVariantEnabled) |
|
421 { |
|
422 iTrace->Trace( |
|
423 _L( |
|
424 "CSuplConnection::RunL Making Secure Connection"), |
|
425 KTraceFileName, __LINE__); |
|
426 iState = EMakingSecureConn; |
|
427 |
|
428 MakeSecureConnection(); |
|
429 } |
|
430 else |
|
431 { |
|
432 // Log |
|
433 iTrace->Trace( |
|
434 _L( |
|
435 "CSuplConnection::RunL Non Secure Socket Connection Established"), |
|
436 KTraceFileName, __LINE__); |
|
437 // Change State |
|
438 iState = EConnected; |
|
439 //User::RequestComplete(iReqStatus, iStatus.Int()); |
403 CompleteConnectRequests(iStatus.Int()); |
440 CompleteConnectRequests(iStatus.Int()); |
404 } |
441 } |
405 break; |
442 } |
406 } |
443 else |
407 // Socket Connect has completed |
444 { |
408 case EConnecting: |
445 // Log |
409 iTimer->Cancel(); // Valid SUPL server, Cancel timer started for this purpose |
446 iTrace->Trace(_L( |
410 if(iStatus == KErrNone) |
447 "CSuplConnection::RunL Socket Connection Failed"), |
411 { |
448 KTraceFileName, __LINE__); |
412 if(iVariantEnabled) |
449 |
413 { |
450 iState = EFailure; |
414 iTrace->Trace(_L("CSuplConnection::RunL Making Secure Connection"), KTraceFileName, __LINE__); |
451 iSocket.Close(); |
415 iState = EMakingSecureConn; |
452 #ifndef __WINS__ // Bug Fix for close connection |
416 |
453 // Close the RConnection |
417 MakeSecureConnection(); |
454 iConnection.Close(); |
418 } |
455 #endif |
419 else |
456 //User::RequestComplete(iReqStatus, iStatus.Int()); |
420 { |
|
421 // Log |
|
422 iTrace->Trace(_L("CSuplConnection::RunL Non Secure Socket Connection Established"), KTraceFileName, __LINE__); |
|
423 // Change State |
|
424 iState = EConnected; |
|
425 //User::RequestComplete(iReqStatus, iStatus.Int()); |
|
426 CompleteConnectRequests(iStatus.Int()); |
|
427 } |
|
428 } |
|
429 else |
|
430 { |
|
431 // Log |
|
432 iTrace->Trace(_L("CSuplConnection::RunL Socket Connection Failed"), KTraceFileName, __LINE__); |
|
433 |
|
434 iState = EFailure; |
|
435 iSocket.Close(); |
|
436 #ifndef __WINS__ // Bug Fix for close connection |
|
437 // Close the RConnection |
|
438 iConnection.Close(); |
|
439 #endif |
|
440 //User::RequestComplete(iReqStatus, iStatus.Int()); |
|
441 CompleteConnectRequests(iStatus.Int()); |
457 CompleteConnectRequests(iStatus.Int()); |
442 iTrace->Trace(_L("CSuplConnection::SocketConn Failed Exit"), KTraceFileName, __LINE__); |
458 iTrace->Trace(_L("CSuplConnection::SocketConn Failed Exit"), |
443 } |
459 KTraceFileName, __LINE__); |
444 break; |
460 } |
445 |
461 break; |
446 // Secure Connection |
462 |
447 case ESecureHandShake: |
463 // Secure Connection |
|
464 case ESecureHandShake: |
448 // Stop timer |
465 // Stop timer |
449 iTimer->Cancel(); |
466 iTimer->Cancel(); |
450 if(iStatus != KErrNone) |
467 if (iStatus != KErrNone) |
451 { |
468 { |
452 // Log |
469 // Log |
453 iTrace->Trace(_L("CSuplConnection::RunL Secure Connection Failed"), KTraceFileName, __LINE__); |
470 iTrace->Trace(_L( |
454 |
471 "CSuplConnection::RunL Secure Connection Failed"), |
455 // Connection was not successful |
472 KTraceFileName, __LINE__); |
456 iState = EFailure; |
473 |
457 iSocket.Close(); |
474 // Connection was not successful |
458 #ifndef __WINS__ // Bug Fix for close connection |
475 iState = EFailure; |
459 // Close the RConnection |
476 iSocket.Close(); |
460 iConnection.Close(); |
477 #ifndef __WINS__ // Bug Fix for close connection |
461 #endif |
478 // Close the RConnection |
462 } |
479 iConnection.Close(); |
463 else |
480 #endif |
464 { |
481 } |
465 // Log |
482 else |
466 iTrace->Trace(_L("CSuplConnection::RunL Secure Connection Established"), KTraceFileName, __LINE__); |
483 { |
467 // Change State |
484 // Log |
468 iState = EConnected; |
485 iTrace->Trace( |
469 } |
486 _L( |
470 |
487 "CSuplConnection::RunL Secure Connection Established"), |
471 //User::RequestComplete(iReqStatus, iStatus.Int()); |
488 KTraceFileName, __LINE__); |
|
489 // Change State |
|
490 iState = EConnected; |
|
491 } |
|
492 |
|
493 //User::RequestComplete(iReqStatus, iStatus.Int()); |
472 CompleteConnectRequests(iStatus.Int()); |
494 CompleteConnectRequests(iStatus.Int()); |
473 break; |
495 break; |
474 |
496 |
475 // DNS Lookup has completed |
497 // DNS Lookup has completed |
476 case ELookingUp: |
498 case ELookingUp: |
477 { |
499 { |
478 // Log |
500 // Log |
479 iTrace->Trace(_L("CSuplConnection::RunL DNS Lookup Complete"), KTraceFileName, __LINE__); |
501 iTrace->Trace(_L("CSuplConnection::RunL DNS Lookup Complete"), |
|
502 KTraceFileName, __LINE__); |
480 iTimer->Cancel(); |
503 iTimer->Cancel(); |
481 |
504 |
482 // Close the Resolver |
505 // Close the Resolver |
483 iResolver.Close(); |
506 iResolver.Close(); |
484 |
507 |
485 if(iStatus != KErrNone) |
508 if (iStatus != KErrNone) |
486 { |
509 { |
487 // Log |
510 // Log |
488 iTrace->Trace(_L("CSuplConnection::RunL DNS Lookup Failed"), KTraceFileName, __LINE__); |
511 iTrace->Trace(_L("CSuplConnection::RunL DNS Lookup Failed"), |
489 |
512 KTraceFileName, __LINE__); |
490 iState = EFailure; |
513 |
491 iSocket.Close(); |
514 iState = EFailure; |
492 #ifndef __WINS__ // Bug Fix for close connection |
515 iSocket.Close(); |
493 // Close the RConnection |
516 #ifndef __WINS__ // Bug Fix for close connection |
494 iConnection.Close(); |
517 // Close the RConnection |
495 #endif |
518 iConnection.Close(); |
496 |
519 #endif |
497 //User::RequestComplete(iReqStatus, iStatus.Int()); |
520 |
|
521 //User::RequestComplete(iReqStatus, iStatus.Int()); |
498 CompleteConnectRequests(iStatus.Int()); |
522 CompleteConnectRequests(iStatus.Int()); |
499 break; |
523 break; |
500 } |
524 } |
501 |
525 |
502 // Log |
526 // Log |
503 iTrace->Trace(_L("CSuplConnection::RunL DNS Lookup Successful"), KTraceFileName, __LINE__); |
527 iTrace->Trace(_L("CSuplConnection::RunL DNS Lookup Successful"), |
504 |
528 KTraceFileName, __LINE__); |
505 // Retrieve Address |
529 |
506 TInt addrFamily = iNameEntry().iAddr.Family(); |
530 // Retrieve Address |
507 if(addrFamily == KAfInet) |
531 TInt addrFamily = iNameEntry().iAddr.Family(); |
508 { |
532 if (addrFamily == KAfInet) |
509 //IPv4 Address |
533 { |
510 iAddress.SetAddress(TInetAddr::Cast(iNameEntry().iAddr).Address()); |
534 //IPv4 Address |
511 |
535 iAddress.SetAddress( |
512 } |
536 TInetAddr::Cast(iNameEntry().iAddr).Address()); |
513 if(addrFamily == KAfInet6) |
537 |
514 { |
538 } |
515 //IPv6 Address |
539 if (addrFamily == KAfInet6) |
516 iAddress.SetAddress(TInetAddr::Cast(iNameEntry().iAddr).Ip6Address()); |
540 { |
517 } |
541 //IPv6 Address |
518 |
542 iAddress.SetAddress( |
519 // Set Port |
543 TInetAddr::Cast(iNameEntry().iAddr).Ip6Address()); |
520 iAddress.SetPort(Port()); |
544 } |
521 |
545 |
522 // Connect to Remote Host |
546 // Set Port |
523 Connect(); |
547 iAddress.SetPort(Port()); |
524 |
548 |
525 break; |
549 // Connect to Remote Host |
526 } |
550 Connect(); |
527 default: |
551 |
528 { |
552 break; |
529 if (iSendInProgress) |
553 } |
530 { |
554 default: |
531 if (iPkt) |
555 { |
532 iPkt->CompleteRequest(iStatus.Int()); |
556 if (iSendInProgress) |
533 CheckForOutstandingPackets(); |
557 { |
534 } |
558 if (iPkt) |
535 else |
559 iPkt->CompleteRequest(iStatus.Int()); |
536 { |
560 CheckForOutstandingPackets(); |
537 iState = EFailure; |
561 } |
538 //User::RequestComplete(iReqStatus, KErrGeneral); |
562 else |
539 CompleteConnectRequests(KErrGeneral); |
563 { |
540 } |
564 iState = EFailure; |
541 break; |
565 //User::RequestComplete(iReqStatus, KErrGeneral); |
542 } |
566 CompleteConnectRequests( KErrGeneral); |
543 |
567 } |
544 } |
568 break; |
545 } |
569 } |
546 |
570 |
|
571 } |
|
572 } |
|
573 |
547 // ----------------------------------------------------------------------------- |
574 // ----------------------------------------------------------------------------- |
548 // CSuplConnection::CheckForOutstandingPackets |
575 // CSuplConnection::CheckForOutstandingPackets |
549 // Checks for outstanding packets in the send queue |
576 // Checks for outstanding packets in the send queue |
550 // and sends packets based on FIFO |
577 // and sends packets based on FIFO |
551 // (other items were commented in a header). |
578 // (other items were commented in a header). |
552 // ----------------------------------------------------------------------------- |
579 // ----------------------------------------------------------------------------- |
553 // |
580 // |
554 void CSuplConnection::CheckForOutstandingPackets() |
581 void CSuplConnection::CheckForOutstandingPackets() |
555 { |
582 { |
556 if (iFirstPkt) |
583 if (iFirstPkt) |
557 { |
584 { |
558 iFirstPkt = EFalse; |
585 iFirstPkt = EFalse; |
559 } |
586 } |
560 TInt index = iPktArray.Find(iPkt); |
587 TInt index = iPktArray.Find(iPkt); |
561 if (index != KErrNotFound) |
588 if (index != KErrNotFound) |
562 iPktArray.Remove(index); |
589 iPktArray.Remove(index); |
563 delete iPkt; |
590 delete iPkt; |
564 |
591 |
565 TInt count = iPktArray.Count(); |
592 TInt count = iPktArray.Count(); |
566 if (count == 0) |
593 if (count == 0) |
567 { |
594 { |
568 iSendInProgress = EFalse; |
595 iSendInProgress = EFalse; |
569 } |
596 } |
570 else |
597 else |
571 { |
598 { |
572 iPkt = REINTERPRET_CAST(CSuplPacketInfo*, iPktArray[0]); |
599 iPkt = REINTERPRET_CAST(CSuplPacketInfo*, iPktArray[0]); |
573 iPkt->GetPacketData(iPacket); |
600 iPkt->GetPacketData(iPacket); |
574 |
601 |
575 TBuf<64> msg(_L("Sending data on port ")); |
602 TBuf<64> msg(_L("Sending data on port ")); |
576 msg.AppendNum(iSocket.LocalPort()); |
603 msg.AppendNum(iSocket.LocalPort()); |
577 iTrace->Trace(msg, KTraceFileName, __LINE__); |
604 iTrace->Trace(msg, KTraceFileName, __LINE__); |
578 |
605 |
579 // Log |
606 // Log |
580 if(iVariantEnabled) |
607 if (iVariantEnabled) |
581 { |
608 { |
582 iTrace->Trace(_L("CSuplConnection::CheckForOutstandingPackets sending packet over Secure Connection"), KTraceFileName, __LINE__); |
609 iTrace->Trace( |
583 iTlsSocket->Send(iPacket, iStatus); |
610 _L( |
584 iSendInProgress = ETrue; |
611 "CSuplConnection::CheckForOutstandingPackets sending packet over Secure Connection"), |
585 SetActive(); |
612 KTraceFileName, __LINE__); |
586 } |
613 iTlsSocket->Send(iPacket, iStatus); |
587 else |
614 iSendInProgress = ETrue; |
588 { |
615 SetActive(); |
589 iTrace->Trace(_L("CSuplConnection::CheckForOutstandingPackets sending packet over NonSecure Connection"), KTraceFileName, __LINE__); |
616 } |
590 iSocket.Send(iPacket, 0, iStatus); |
617 else |
591 iSendInProgress = ETrue; |
618 { |
592 SetActive(); |
619 iTrace->Trace( |
593 } |
620 _L( |
594 } |
621 "CSuplConnection::CheckForOutstandingPackets sending packet over NonSecure Connection"), |
|
622 KTraceFileName, __LINE__); |
|
623 iSocket.Send(iPacket, 0, iStatus); |
|
624 iSendInProgress = ETrue; |
|
625 SetActive(); |
|
626 } |
|
627 } |
595 } |
628 } |
596 |
629 |
597 // ----------------------------------------------------------------------------- |
630 // ----------------------------------------------------------------------------- |
598 // CSuplConnection::CancelConnect |
631 // CSuplConnection::CancelConnect |
599 // Cancels connect request. |
632 // Cancels connect request. |
898 TUint CSuplConnection::Port() |
939 TUint CSuplConnection::Port() |
899 { |
940 { |
900 return iPort; |
941 return iPort; |
901 } |
942 } |
902 |
943 |
903 |
|
904 // ----------------------------------------------------------------------------- |
944 // ----------------------------------------------------------------------------- |
905 // CSuplConnection::Connect |
945 // CSuplConnection::Connect |
906 // Makes a secure connection to Network |
946 // Makes a secure connection to Network |
907 // (other items were commented in a header). |
947 // (other items were commented in a header). |
908 // ----------------------------------------------------------------------------- |
948 // ----------------------------------------------------------------------------- |
909 // |
949 // |
910 EXPORT_C void CSuplConnection::Connect(TRequestStatus &aStatus) |
950 EXPORT_C void CSuplConnection::Connect(TRequestStatus &aStatus) |
911 { |
951 { |
912 |
952 |
913 // Log |
953 // Log |
914 iTrace->Trace(_L("CSuplConnection::Connect"), KTraceFileName, __LINE__); |
954 iTrace->Trace(_L("CSuplConnection::Connect"), KTraceFileName, __LINE__); |
915 |
955 |
916 if (iState == EConnected) |
956 if (iState == EConnected) |
917 { |
957 { |
918 aStatus = KRequestPending; |
958 aStatus = KRequestPending; |
919 TRequestStatus *reqStatus = &aStatus; |
959 TRequestStatus *reqStatus = &aStatus; |
920 User::RequestComplete(reqStatus, KErrNone); |
960 User::RequestComplete(reqStatus, KErrNone); |
921 iConnectClients++; |
961 iConnectClients++; |
922 return; |
962 return; |
923 } |
963 } |
924 |
964 |
925 // Check if Connect() is started. If started, add status to Q |
965 // Check if Connect() is started. If started, add status to Q |
926 //if (iConnectStarted) |
966 //if (iConnectStarted) |
927 { |
967 { |
928 aStatus = KRequestPending; |
968 aStatus = KRequestPending; |
929 TRequestStatus *reqStatus = &aStatus; |
969 TRequestStatus *reqStatus = &aStatus; |
930 iConnArray.Append(reqStatus); |
970 iConnArray.Append(reqStatus); |
931 } |
971 } |
932 |
972 |
933 if (!iConnectStarted) |
973 if (!iConnectStarted) |
934 { |
974 { |
935 iTrace->Trace(_L("CSuplConnection::Connect : Connection not started"), KTraceFileName, __LINE__); |
975 iTrace->Trace( |
936 // Connect only if not already connected |
976 _L("CSuplConnection::Connect : Connection not started"), |
937 if(iState == ENotConnected || iState == EFailure) |
977 KTraceFileName, __LINE__); |
938 { |
978 // Connect only if not already connected |
939 iTrace->Trace(_L("CSuplConnection::Connect : ENotConnected"), KTraceFileName, __LINE__); |
979 if (iState == ENotConnected || iState == EFailure) |
|
980 { |
|
981 iTrace->Trace(_L("CSuplConnection::Connect : ENotConnected"), |
|
982 KTraceFileName, __LINE__); |
940 iConnectStarted = ETrue; |
983 iConnectStarted = ETrue; |
941 |
984 |
942 #ifndef __WINS__ |
985 #ifndef __WINS__ |
943 TCommDbConnPref prefs; |
986 TCommDbConnPref prefs; |
944 prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); |
987 prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); |
945 prefs.SetDirection(ECommDbConnectionDirectionOutgoing); |
988 prefs.SetDirection(ECommDbConnectionDirectionOutgoing); |
946 prefs.SetIapId(iIAPId); |
989 prefs.SetIapId(iIAPId); |
947 |
990 |
948 TInt ret = iConnection.Open(iSocketServ); |
991 TInt ret = iConnection.Open(iSocketServ); |
949 // Start an Outgoing Connection with overrides |
992 if( ret != KErrNone ) |
950 iConnection.Start(prefs,iStatus); |
993 { |
951 // Set state to ERetriveIAP |
994 TRequestStatus* statusPtr = &aStatus; |
952 iState = ERetriveIAP; |
995 User::RequestComplete( statusPtr,ret ); |
953 SetActive(); |
996 return; |
|
997 } |
|
998 // Start an Outgoing Connection with overrides |
|
999 iConnection.Start(prefs,iStatus); |
|
1000 // Set state to ERetriveIAP |
|
1001 iState = ERetriveIAP; |
|
1002 SetActive(); |
954 #else |
1003 #else |
955 ConnectIAP(); |
1004 ConnectIAP(); |
956 #endif |
1005 #endif |
957 } |
1006 } |
958 } |
1007 } |
959 else |
1008 else |
960 iTrace->Trace(_L("CSuplConnection::Connect : Conn in progress, request queued"), KTraceFileName, __LINE__); |
1009 iTrace->Trace( |
961 // Log |
1010 _L( |
962 iTrace->Trace(_L("CSuplConnection::Connect:Exit"), KTraceFileName, __LINE__); |
1011 "CSuplConnection::Connect : Conn in progress, request queued"), |
|
1012 KTraceFileName, __LINE__); |
|
1013 // Log |
|
1014 iTrace->Trace(_L("CSuplConnection::Connect:Exit"), KTraceFileName, |
|
1015 __LINE__); |
|
1016 } |
|
1017 |
|
1018 // ----------------------------------------------------------------------------- |
|
1019 // CSuplConnection::Connect |
|
1020 // Makes a secure connection to Network |
|
1021 // (other items were commented in a header). |
|
1022 // ----------------------------------------------------------------------------- |
|
1023 // |
|
1024 |
|
1025 EXPORT_C void CSuplConnection::Connect(TRequestStatus &aStatus, |
|
1026 TBool aPrompt, TBool aWlanOnly) |
|
1027 { |
|
1028 |
|
1029 // Log |
|
1030 iTrace->Trace(_L("CSuplConnection::Connect"), KTraceFileName, __LINE__); |
|
1031 iPrompt = aPrompt; |
|
1032 iWlanOnly = aWlanOnly; |
|
1033 |
|
1034 aStatus = KRequestPending; |
|
1035 TRequestStatus *reqStatus = &aStatus; |
|
1036 |
|
1037 if (iState == EConnected) |
|
1038 { |
|
1039 User::RequestComplete(reqStatus, KErrNone); |
|
1040 iConnectClients++; |
|
1041 return; |
|
1042 } |
|
1043 |
|
1044 TInt error = iConnArray.Append(reqStatus); |
|
1045 if (error != KErrNone) |
|
1046 { |
|
1047 User::RequestComplete(reqStatus, error); |
|
1048 return; |
|
1049 } |
|
1050 |
|
1051 if (!iConnectStarted) |
|
1052 { |
|
1053 iTrace->Trace( |
|
1054 _L("CSuplConnection::Connect : Connection not started"), |
|
1055 KTraceFileName, __LINE__); |
|
1056 // Connect only if not already connected |
|
1057 if (iState == ENotConnected || iState == EFailure) |
|
1058 { |
|
1059 iTrace->Trace(_L("CSuplConnection::Connect : ENotConnected"), |
|
1060 KTraceFileName, __LINE__); |
|
1061 iConnectStarted = ETrue; |
|
1062 |
|
1063 #ifndef __WINS__ |
|
1064 |
|
1065 iTrace->Trace(_L("CSuplConnection::Connect ExtendedConnPref"), KTraceFileName, __LINE__); |
|
1066 |
|
1067 TExtendedConnPref OCCPrefs; |
|
1068 TConnPrefList prefList; |
|
1069 |
|
1070 if(iWlanOnly) |
|
1071 { |
|
1072 iTrace->Trace(_L("CSuplConnection::Connect : iWLANOnly used"), KTraceFileName, __LINE__); |
|
1073 OCCPrefs.SetBearerSet(TExtendedConnPref::EExtendedConnBearerWLAN); |
|
1074 } |
|
1075 else |
|
1076 { |
|
1077 iTrace->Trace(_L("CSuplConnection::Connect OCC GPRS Connection.."), KTraceFileName, __LINE__); |
|
1078 OCCPrefs.SetBearerSet(TExtendedConnPref::EExtendedConnBearerCellular); |
|
1079 } |
|
1080 OCCPrefs.SetSnapPurpose(CMManager::ESnapPurposeInternet); |
|
1081 |
|
1082 if(!iPrompt) |
|
1083 { |
|
1084 iTrace->Trace(_L("CSuplConnection::Connect : silent connection"), KTraceFileName, __LINE__); |
|
1085 OCCPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); |
|
1086 } |
|
1087 else |
|
1088 { |
|
1089 iTrace->Trace(_L("CSuplConnection::Connect : Dialog prompt"), KTraceFileName, __LINE__); |
|
1090 OCCPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourDefault); |
|
1091 } |
|
1092 |
|
1093 TRAP_IGNORE(prefList.AppendL(&OCCPrefs)); |
|
1094 |
|
1095 TInt ret = iConnection.Open(iSocketServ); |
|
1096 if( ret != KErrNone ) |
|
1097 { |
|
1098 TRequestStatus* statusPtr = &iStatus; |
|
1099 User::RequestComplete( statusPtr,ret ); |
|
1100 return; |
|
1101 } |
|
1102 // Start an Outgoing Connection with overrides |
|
1103 iConnection.Start(prefList,iStatus); |
|
1104 // Set state to ERetriveIAP |
|
1105 iState = ERetriveIAP; |
|
1106 SetActive(); |
|
1107 |
|
1108 #else |
|
1109 ConnectIAP(); |
|
1110 #endif |
|
1111 } |
|
1112 } |
|
1113 else |
|
1114 iTrace->Trace( |
|
1115 _L( |
|
1116 "CSuplConnection::Connect : Conn in progress, request queued"), |
|
1117 KTraceFileName, __LINE__); |
|
1118 // Log |
|
1119 iTrace->Trace(_L("CSuplConnection::Connect:Exit"), KTraceFileName, |
|
1120 __LINE__); |
963 } |
1121 } |
964 |
1122 |
965 // ----------------------------------------------------------------------------- |
1123 // ----------------------------------------------------------------------------- |
966 // CSuplConnection::CompleteConnectStatus |
1124 // CSuplConnection::CompleteConnectStatus |
967 // Completes the request to cancel connection |
1125 // Completes the request to cancel connection |
968 // (other items were commented in a header). |
1126 // (other items were commented in a header). |
969 // ----------------------------------------------------------------------------- |
1127 // ----------------------------------------------------------------------------- |
970 void CSuplConnection::CompleteConnectRequests(TInt aErr) |
1128 void CSuplConnection::CompleteConnectRequests(TInt aErr) |
971 { |
1129 { |
972 iTrace->Trace(_L("CSuplConnection::CompleteConnectRequests"), KTraceFileName, __LINE__); |
1130 iTrace->Trace(_L("CSuplConnection::CompleteConnectRequests"), |
|
1131 KTraceFileName, __LINE__); |
973 |
1132 |
974 TInt statusCount = iConnArray.Count(); |
1133 TInt statusCount = iConnArray.Count(); |
975 |
1134 |
976 TBuf<32> msg(_L("Number of conns :")); |
1135 TBuf<32> msg(_L("Number of conns :")); |
977 msg.AppendNum(statusCount); |
1136 msg.AppendNum(statusCount); |
978 iTrace->Trace(msg, KTraceFileName, __LINE__); |
1137 iTrace->Trace(msg, KTraceFileName, __LINE__); |
979 |
1138 |
980 for(TInt loop = 0; loop < statusCount;loop++) |
1139 for (TInt loop = 0; loop < statusCount; loop++) |
981 { |
1140 { |
982 TRequestStatus* newStatus = REINTERPRET_CAST(TRequestStatus*, iConnArray[loop]); |
1141 TRequestStatus* newStatus = REINTERPRET_CAST(TRequestStatus*, iConnArray[loop]); |
983 User::RequestComplete(newStatus, aErr); |
1142 User::RequestComplete(newStatus, aErr); |
984 if (aErr == KErrNone) |
1143 if (aErr == KErrNone) |
985 iConnectClients++; |
1144 iConnectClients++; |
986 iTrace->Trace(_L("CSuplConnection::CompleteConnectRequests, request completed"), KTraceFileName, __LINE__); |
1145 iTrace->Trace( |
987 } |
1146 _L( |
|
1147 "CSuplConnection::CompleteConnectRequests, request completed"), |
|
1148 KTraceFileName, __LINE__); |
|
1149 } |
988 iConnArray.Reset(); |
1150 iConnArray.Reset(); |
989 iConnectStarted = EFalse; |
1151 iConnectStarted = EFalse; |
990 } |
1152 } |
991 |
1153 |
992 // ----------------------------------------------------------------------------- |
1154 // ----------------------------------------------------------------------------- |
993 // CSuplConnection::CompleteConnectStatus |
1155 // CSuplConnection::CompleteConnectStatus |
994 // Completes the request to cancel connection |
1156 // Completes the request to cancel connection |
995 // (other items were commented in a header). |
1157 // (other items were commented in a header). |
999 { |
1161 { |
1000 TInt index = iConnArray.Find(&aStatus); |
1162 TInt index = iConnArray.Find(&aStatus); |
1001 |
1163 |
1002 if (index != KErrNotFound) |
1164 if (index != KErrNotFound) |
1003 { |
1165 { |
1004 TRequestStatus *reqStatus = &aStatus; |
1166 TRequestStatus *reqStatus = &aStatus; |
1005 User::RequestComplete(reqStatus, KErrCancel); |
1167 User::RequestComplete(reqStatus, KErrCancel); |
1006 iConnArray.Remove(index); |
1168 iConnArray.Remove(index); |
1007 } |
1169 } |
1008 } |
1170 } |
1009 |
1171 |
1010 // ----------------------------------------------------------------------------- |
1172 // ----------------------------------------------------------------------------- |
1011 // CSuplConnection::Send |
1173 // CSuplConnection::Send |
1012 // Sends a Packet out of the Secure Connection |
1174 // Sends a Packet out of the Secure Connection |
1013 // (other items were commented in a header). |
1175 // (other items were commented in a header). |
1014 // ----------------------------------------------------------------------------- |
1176 // ----------------------------------------------------------------------------- |
1015 // |
1177 // |
1016 EXPORT_C void CSuplConnection::Send(const TDesC8 &aPacket, TRequestStatus &aStatus) |
1178 EXPORT_C void CSuplConnection::Send(const TDesC8 &aPacket, |
1017 { |
1179 TRequestStatus &aStatus) |
1018 // Log |
1180 { |
1019 iTrace->Trace(_L("CSuplConnection::Send"), KTraceFileName, __LINE__); |
1181 // Log |
1020 |
1182 iTrace->Trace(_L("CSuplConnection::Send"), KTraceFileName, __LINE__); |
1021 if(iState != EConnected || iState == EFailure) |
1183 |
1022 { |
1184 if (iState != EConnected || iState == EFailure) |
1023 // Log |
1185 { |
1024 iTrace->Trace(_L("CSuplConnection::Send...Disconnected"), KTraceFileName, __LINE__); |
1186 // Log |
1025 aStatus = KRequestPending; |
1187 iTrace->Trace(_L("CSuplConnection::Send...Disconnected"), |
1026 TRequestStatus *reqStatus = &aStatus; |
1188 KTraceFileName, __LINE__); |
1027 User::RequestComplete(reqStatus, KErrDisconnected); |
1189 aStatus = KRequestPending; |
1028 return; |
1190 TRequestStatus *reqStatus = &aStatus; |
1029 } |
1191 User::RequestComplete(reqStatus, KErrDisconnected); |
1030 |
1192 return; |
1031 // if send in progress Q it |
1193 } |
1032 if (iSendInProgress) |
1194 |
1033 { |
1195 // if send in progress Q it |
1034 TInt err=KErrNone; |
1196 if (iSendInProgress) |
1035 aStatus = KRequestPending; |
1197 { |
1036 CSuplPacketInfo *packetInfo = NULL; |
1198 TInt err = KErrNone; |
1037 |
1199 aStatus = KRequestPending; |
1038 TRAP(err, packetInfo = CSuplPacketInfo::NewL(aPacket, aStatus)); |
1200 CSuplPacketInfo *packetInfo = NULL; |
1039 if (err != KErrNone) |
1201 |
1040 { |
1202 TRAP(err, packetInfo = CSuplPacketInfo::NewL(aPacket, aStatus)); |
1041 TRequestStatus *reqStatus = &aStatus; |
1203 if (err != KErrNone) |
1042 User::RequestComplete(reqStatus, err); |
1204 { |
1043 return; |
1205 TRequestStatus *reqStatus = &aStatus; |
1044 } |
1206 User::RequestComplete(reqStatus, err); |
1045 iPktArray.Append(packetInfo); |
1207 return; |
1046 } |
1208 } |
1047 |
1209 iPktArray.Append(packetInfo); |
1048 else |
1210 } |
1049 { |
1211 |
1050 TInt err=KErrNone; |
1212 else |
1051 aStatus = KRequestPending; |
1213 { |
1052 TRAP(err, iPkt = CSuplPacketInfo::NewL(aPacket, aStatus)); |
1214 TInt err = KErrNone; |
1053 //iPkt->GetPacketData(iPacket, status); |
1215 aStatus = KRequestPending; |
1054 if (err != KErrNone) |
1216 TRAP(err, iPkt = CSuplPacketInfo::NewL(aPacket, aStatus)); |
1055 { |
1217 //iPkt->GetPacketData(iPacket, status); |
1056 TRequestStatus *reqStatus = &aStatus; |
1218 if (err != KErrNone) |
1057 User::RequestComplete(reqStatus, err); |
1219 { |
1058 return; |
1220 TRequestStatus *reqStatus = &aStatus; |
1059 } |
1221 User::RequestComplete(reqStatus, err); |
1060 iFirstPkt = ETrue; |
1222 return; |
1061 TBuf<64> msg(_L("Sending data on port ")); |
1223 } |
1062 msg.AppendNum(iSocket.LocalPort()); |
1224 iFirstPkt = ETrue; |
1063 iTrace->Trace(msg, KTraceFileName, __LINE__); |
1225 TBuf<64> msg(_L("Sending data on port ")); |
1064 // Log |
1226 msg.AppendNum(iSocket.LocalPort()); |
1065 if(iVariantEnabled) |
1227 iTrace->Trace(msg, KTraceFileName, __LINE__); |
1066 { |
1228 // Log |
1067 iTrace->Trace(_L("CSuplConnection::Send sending packet over Secure Connection"), KTraceFileName, __LINE__); |
1229 if (iVariantEnabled) |
1068 iTlsSocket->Send(aPacket, iStatus); |
1230 { |
1069 iSendInProgress = ETrue; |
1231 iTrace->Trace( |
1070 SetActive(); |
1232 _L( |
1071 } |
1233 "CSuplConnection::Send sending packet over Secure Connection"), |
1072 else |
1234 KTraceFileName, __LINE__); |
1073 { |
1235 iTlsSocket->Send(aPacket, iStatus); |
1074 iTrace->Trace(_L("CSuplConnection::Send sending packet over NonSecure Connection"), KTraceFileName, __LINE__); |
1236 iSendInProgress = ETrue; |
1075 iSocket.Send(aPacket, 0, iStatus); |
1237 SetActive(); |
1076 iSendInProgress = ETrue; |
1238 } |
1077 SetActive(); |
1239 else |
1078 } |
1240 { |
1079 } |
1241 iTrace->Trace( |
1080 } |
1242 _L( |
|
1243 "CSuplConnection::Send sending packet over NonSecure Connection"), |
|
1244 KTraceFileName, __LINE__); |
|
1245 iSocket.Send(aPacket, 0, iStatus); |
|
1246 iSendInProgress = ETrue; |
|
1247 SetActive(); |
|
1248 } |
|
1249 } |
|
1250 } |
1081 |
1251 |
1082 // ----------------------------------------------------------------------------- |
1252 // ----------------------------------------------------------------------------- |
1083 // CSuplConnection::CancelSend |
1253 // CSuplConnection::CancelSend |
1084 // Method to cancel the Socket Send operation |
1254 // Method to cancel the Socket Send operation |
1085 // (other items were commented in a header). |
1255 // (other items were commented in a header). |
1086 // ----------------------------------------------------------------------------- |
1256 // ----------------------------------------------------------------------------- |
1087 // |
1257 // |
1088 EXPORT_C void CSuplConnection::CancelSend(TRequestStatus &aStatus) |
1258 EXPORT_C void CSuplConnection::CancelSend(TRequestStatus &aStatus) |
1089 { |
1259 { |
1090 if (iFirstPkt) |
1260 if (iFirstPkt) |
1091 { |
1261 { |
1092 if(iVariantEnabled) |
1262 if (iVariantEnabled) |
1093 { |
1263 { |
1094 iTrace->Trace(_L("CSuplConnection::Secure Send Cancel"), KTraceFileName, __LINE__); |
1264 iTrace->Trace(_L("CSuplConnection::Secure Send Cancel"), |
1095 iTlsSocket->CancelSend(); |
1265 KTraceFileName, __LINE__); |
1096 } |
1266 iTlsSocket->CancelSend(); |
1097 else |
|
1098 { |
|
1099 iTrace->Trace(_L("CSuplConnection::Non Secure Send Cancel"), KTraceFileName, __LINE__); |
|
1100 iSocket.CancelSend(); |
|
1101 } |
|
1102 delete iPkt; |
|
1103 iPkt = NULL; |
|
1104 TRequestStatus *reqStatus = &aStatus; |
|
1105 User::RequestComplete(reqStatus, KErrCancel); |
|
1106 } |
1267 } |
1107 else |
1268 else |
1108 { |
1269 { |
1109 TInt count = iPktArray.Count(); |
1270 iTrace->Trace(_L("CSuplConnection::Non Secure Send Cancel"), |
1110 if (count == 1) |
1271 KTraceFileName, __LINE__); |
1111 { |
1272 iSocket.CancelSend(); |
1112 TInt index = iPktArray.Find(iPkt); |
1273 } |
1113 if (index != KErrNotFound) |
1274 delete iPkt; |
1114 iPktArray.Remove(index); |
1275 iPkt = NULL; |
1115 delete iPkt; |
1276 TRequestStatus *reqStatus = &aStatus; |
1116 iPkt = NULL; |
1277 User::RequestComplete(reqStatus, KErrCancel); |
1117 TRequestStatus *reqStatus = &aStatus; |
1278 } |
1118 User::RequestComplete(reqStatus, KErrCancel); |
1279 else |
1119 } |
1280 { |
1120 else |
1281 TInt count = iPktArray.Count(); |
1121 { |
1282 if (count == 1) |
1122 for(TInt loop=0;loop<count;loop++) |
1283 { |
|
1284 TInt index = iPktArray.Find(iPkt); |
|
1285 if (index != KErrNotFound) |
|
1286 iPktArray.Remove(index); |
|
1287 delete iPkt; |
|
1288 iPkt = NULL; |
|
1289 TRequestStatus *reqStatus = &aStatus; |
|
1290 User::RequestComplete(reqStatus, KErrCancel); |
|
1291 } |
|
1292 else |
|
1293 { |
|
1294 for (TInt loop = 0; loop < count; loop++) |
|
1295 { |
|
1296 iPkt = REINTERPRET_CAST(CSuplPacketInfo*, iPktArray[0]); |
|
1297 if (iPkt->IsStatusMatches(aStatus)) |
1123 { |
1298 { |
1124 iPkt = REINTERPRET_CAST(CSuplPacketInfo*, iPktArray[0]); |
1299 iTrace->Trace(_L("Found packet, deleting"), |
1125 if (iPkt->IsStatusMatches(aStatus)) |
1300 KTraceFileName, __LINE__); |
|
1301 TInt index = iPktArray.Find(iPkt); |
|
1302 if (index != KErrNotFound) |
1126 { |
1303 { |
1127 iTrace->Trace(_L("Found packet, deleting"), KTraceFileName, __LINE__); |
1304 iTrace->Trace(_L("Found packet, deleted"), |
1128 TInt index = iPktArray.Find(iPkt); |
1305 KTraceFileName, __LINE__); |
1129 if (index != KErrNotFound) |
1306 iPktArray.Remove(index); |
1130 { |
1307 TRequestStatus *reqStatus = &aStatus; |
1131 iTrace->Trace(_L("Found packet, deleted"), KTraceFileName, __LINE__); |
1308 User::RequestComplete(reqStatus, KErrCancel); |
1132 iPktArray.Remove(index); |
1309 } |
1133 TRequestStatus *reqStatus = &aStatus; |
1310 delete iPkt; |
1134 User::RequestComplete(reqStatus, KErrCancel); |
1311 iPkt = NULL; |
1135 } |
1312 break; |
1136 delete iPkt; |
1313 } |
1137 iPkt = NULL; |
1314 } |
1138 break; |
1315 } |
1139 } |
1316 } |
1140 } |
1317 |
1141 } |
1318 } |
1142 } |
|
1143 |
|
1144 } |
|
1145 |
1319 |
1146 // ----------------------------------------------------------------------------- |
1320 // ----------------------------------------------------------------------------- |
1147 // CSuplConnection::Connect |
1321 // CSuplConnection::Connect |
1148 // Makes a socket connection to Network |
1322 // Makes a socket connection to Network |
1149 // (other items were commented in a header). |
1323 // (other items were commented in a header). |
1150 // ----------------------------------------------------------------------------- |
1324 // ----------------------------------------------------------------------------- |
1151 // |
1325 // |
1152 void CSuplConnection::Connect() |
1326 void CSuplConnection::Connect() |
1153 { |
1327 { |
1154 // Log |
1328 // Log |
1155 iTrace->Trace(_L("CSuplConnection::Connect(void)"), KTraceFileName, __LINE__); |
1329 iTrace->Trace(_L("CSuplConnection::Connect(void)"), KTraceFileName, |
1156 |
1330 __LINE__); |
1157 iState = EConnecting; |
1331 |
1158 iTimer->Start(4000000); // For DNS pass case , but not a valid SUPL server |
1332 iState = EConnecting; |
1159 iSocket.Connect(iAddress, iStatus); |
1333 iTimer->Start(4000000); // For DNS pass case , but not a valid SUPL server |
1160 SetActive(); |
1334 iSocket.Connect(iAddress, iStatus); |
1161 } |
1335 if (!IsActive()) |
1162 |
1336 { |
|
1337 SetActive(); |
|
1338 } |
|
1339 } |
1163 // ----------------------------------------------------------------------------- |
1340 // ----------------------------------------------------------------------------- |
1164 // CSuplConnection::ConnectIAP |
1341 // CSuplConnection::ConnectIAP |
1165 // Makes a socket connection to Network |
1342 // Makes a socket connection to Network |
1166 // (other items were commented in a header). |
1343 // (other items were commented in a header). |
1167 // ----------------------------------------------------------------------------- |
1344 // ----------------------------------------------------------------------------- |
1168 // |
1345 // |
1169 |
1346 |
1170 void CSuplConnection::ConnectIAP() |
1347 void CSuplConnection::ConnectIAP() |
1171 { |
1348 { |
1172 iTrace->Trace(_L("CSuplConnection::ConnectIAP(void)"), KTraceFileName, __LINE__); |
1349 iTrace->Trace(_L("CSuplConnection::ConnectIAP(void)"), KTraceFileName, |
1173 // Connect only if not already connected |
1350 __LINE__); |
1174 if(iState == ENotConnected || iState == EFailure || iState == ERetriveIAP) |
1351 // Connect only if not already connected |
1175 { |
1352 if (iState == ENotConnected || iState == EFailure || iState |
1176 // Open the Socket |
1353 == ERetriveIAP) |
|
1354 { |
|
1355 // Open the Socket |
1177 #ifndef __WINS__ |
1356 #ifndef __WINS__ |
1178 // Emulator can't handle RConnections |
1357 // Emulator can't handle RConnections |
1179 TInt err = iSocket.Open( iSocketServ, |
1358 TInt err = iSocket.Open( iSocketServ, |
1180 KAfInet, |
1359 KAfInet, |
1181 KSockStream, |
1360 KSockStream, |
1182 KProtocolInetTcp, |
1361 KProtocolInetTcp, |
1183 iConnection ); |
1362 iConnection ); |
1184 #else |
1363 #else |
1185 TInt err = iSocket.Open( iSocketServ, |
1364 TInt err = iSocket.Open(iSocketServ, KAfInet, KSockStream, |
1186 KAfInet, |
1365 KProtocolInetTcp); |
1187 KSockStream, |
1366 #endif |
1188 KProtocolInetTcp) ; |
1367 |
1189 #endif |
1368 if (KErrNone != err) |
1190 |
1369 { |
1191 if(KErrNone != err) |
1370 // Log |
1192 { |
1371 iTrace->Trace(_L("CSuplConnection::Socket Open Failure"), |
1193 // Log |
1372 KTraceFileName, __LINE__); |
1194 iTrace->Trace(_L("CSuplConnection::Socket Open Failure"), KTraceFileName, __LINE__); |
1373 |
1195 |
1374 //User::RequestComplete(iReqStatus, err); |
1196 //User::RequestComplete(iReqStatus, err); |
1375 CompleteConnectRequests(err); |
|
1376 return; |
|
1377 } |
|
1378 |
|
1379 // Set IP Address and Port |
|
1380 if (iAddress.Input(iHostAddress) == KErrNone) |
|
1381 { |
|
1382 // Log |
|
1383 iTrace->Trace( |
|
1384 _L( |
|
1385 "CSuplConnection::Connect Host Address is an IP Address"), |
|
1386 KTraceFileName, __LINE__); |
|
1387 |
|
1388 iAddress.SetPort(Port()); |
|
1389 Connect(); |
|
1390 } |
|
1391 |
|
1392 else |
|
1393 { |
|
1394 // DNS Lookup |
|
1395 // Log |
|
1396 iTrace->Trace(_L("CSuplConnection::Connect Perform DNS lookup"), |
|
1397 KTraceFileName, __LINE__); |
|
1398 #ifndef __WINS__ |
|
1399 err = iResolver.Open(iSocketServ, KAfInet, KProtocolInetUdp, iConnection); |
|
1400 #else |
|
1401 err = iResolver.Open(iSocketServ, KAfInet, KProtocolInetUdp); |
|
1402 #endif |
|
1403 if (KErrNone != err) |
|
1404 { |
|
1405 //User::RequestComplete(iReqStatus, err); |
1197 CompleteConnectRequests(err); |
1406 CompleteConnectRequests(err); |
1198 return; |
1407 return; |
1199 } |
1408 } |
1200 |
1409 |
1201 // Set IP Address and Port |
1410 iState = ELookingUp; |
1202 if(iAddress.Input(iHostAddress) == KErrNone) |
1411 iResolver.GetByName(iHostAddress, iNameEntry, iStatus); |
1203 { |
1412 iTimer->Start(10000000); |
1204 // Log |
1413 if (!IsActive()) |
1205 iTrace->Trace(_L("CSuplConnection::Connect Host Address is an IP Address"), KTraceFileName, __LINE__); |
1414 { |
1206 |
1415 SetActive(); |
1207 iAddress.SetPort(Port()); |
1416 } |
1208 Connect(); |
1417 } |
1209 } |
1418 |
1210 |
1419 } |
1211 else |
1420 |
1212 { |
1421 else |
1213 // DNS Lookup |
1422 { |
1214 // Log |
1423 // Already Connected. Just return KErrNone |
1215 iTrace->Trace(_L("CSuplConnection::Connect Perform DNS lookup"), KTraceFileName, __LINE__); |
1424 //User::RequestComplete(iReqStatus, KErrNone); |
1216 #ifndef __WINS__ |
1425 CompleteConnectRequests( KErrNone); |
1217 err = iResolver.Open(iSocketServ, KAfInet, KProtocolInetUdp, iConnection); |
1426 } |
1218 #else |
1427 |
1219 err = iResolver.Open(iSocketServ, KAfInet, KProtocolInetUdp); |
1428 } |
1220 #endif |
|
1221 if(KErrNone != err) |
|
1222 { |
|
1223 //User::RequestComplete(iReqStatus, err); |
|
1224 CompleteConnectRequests(err); |
|
1225 return; |
|
1226 } |
|
1227 |
|
1228 iState = ELookingUp; |
|
1229 iResolver.GetByName(iHostAddress, iNameEntry, iStatus); |
|
1230 iTimer->Start(10000000); |
|
1231 SetActive(); |
|
1232 } |
|
1233 |
|
1234 } |
|
1235 |
|
1236 else |
|
1237 { |
|
1238 // Already Connected. Just return KErrNone |
|
1239 //User::RequestComplete(iReqStatus, KErrNone); |
|
1240 CompleteConnectRequests(KErrNone); |
|
1241 } |
|
1242 |
|
1243 } |
|
1244 // ----------------------------------------------------------------------------- |
1429 // ----------------------------------------------------------------------------- |
1245 // CSuplConnection::MakeSecureConnection |
1430 // CSuplConnection::MakeSecureConnection |
1246 // Makes a secure connection to Network |
1431 // Makes a secure connection to Network |
1247 // (other items were commented in a header). |
1432 // (other items were commented in a header). |
1248 // ----------------------------------------------------------------------------- |
1433 // ----------------------------------------------------------------------------- |
1249 // |
1434 // |
1250 void CSuplConnection::MakeSecureConnection() |
1435 void CSuplConnection::MakeSecureConnection() |
1251 { |
1436 { |
1252 // Log |
1437 // Log |
1253 iTrace->Trace(_L("CSuplConnection::MakeSecureConnection"), KTraceFileName, __LINE__); |
1438 iTrace->Trace(_L("CSuplConnection::MakeSecureConnection"), |
1254 |
1439 KTraceFileName, __LINE__); |
1255 // Clear any pervious options |
1440 |
1256 //iTlsSocket->FlushSessionCache(); |
1441 // Clear any pervious options |
1257 |
1442 //iTlsSocket->FlushSessionCache(); |
1258 iTlsSocket->StartClientHandshake( iStatus ); |
1443 |
1259 iTimer->Start(10000000); |
1444 iTlsSocket->StartClientHandshake(iStatus); |
1260 iState = ESecureHandShake; |
1445 iTimer->Start(10000000); |
1261 SetActive(); |
1446 iState = ESecureHandShake; |
1262 |
1447 if (!IsActive()) |
1263 } |
1448 { |
1264 |
1449 SetActive(); |
|
1450 } |
|
1451 } |
1265 |
1452 |
1266 // ----------------------------------------------------------------------------- |
1453 // ----------------------------------------------------------------------------- |
1267 // CSuplConnection::ListenToMessages |
1454 // CSuplConnection::ListenToMessages |
1268 // Start reading from the socket for packets from the network |
1455 // Start reading from the socket for packets from the network |
1269 // (other items were commented in a header). |
1456 // (other items were commented in a header). |
1270 // ----------------------------------------------------------------------------- |
1457 // ----------------------------------------------------------------------------- |
1271 // |
1458 // |
1272 EXPORT_C TInt CSuplConnection::ListenToMessages() |
1459 EXPORT_C TInt CSuplConnection::ListenToMessages() |
1273 { |
1460 { |
1274 // Log |
1461 // Log |
1275 iTrace->Trace(_L("CSuplConnection::ListenToMessages"), KTraceFileName, __LINE__); |
1462 iTrace->Trace(_L("CSuplConnection::ListenToMessages"), KTraceFileName, |
1276 |
1463 __LINE__); |
1277 iListenCount++; |
1464 |
1278 |
1465 iListenCount++; |
1279 if (iStartedListen) |
1466 |
1280 return KErrNone; |
1467 if (iStartedListen) |
1281 |
1468 return KErrNone; |
1282 if(iState != EConnected) |
1469 |
1283 { |
1470 if (iState != EConnected) |
1284 return KErrDisconnected; |
1471 { |
1285 } |
1472 return KErrDisconnected; |
1286 |
1473 } |
1287 if(iSocketReader && (!IsActive())) |
1474 |
1288 { |
1475 if (iSocketReader && (!IsActive())) |
1289 iSocketReader->SetPortNum(GetPortNumberUsed()); |
1476 { |
1290 iSocketReader->IssueRead(); |
1477 iSocketReader->SetPortNum(GetPortNumberUsed()); |
1291 iStartedListen = ETrue; |
1478 iSocketReader->IssueRead(); |
1292 return KErrNone; |
1479 iStartedListen = ETrue; |
1293 } |
1480 return KErrNone; |
1294 |
1481 } |
1295 return KErrGeneral; |
1482 |
1296 } |
1483 return KErrGeneral; |
|
1484 } |
1297 |
1485 |
1298 // ----------------------------------------------------------------------------- |
1486 // ----------------------------------------------------------------------------- |
1299 // CSuplConnection::GetLocalIPAddress |
1487 // CSuplConnection::GetLocalIPAddress |
1300 // Start reading from the socket for packets from the network |
1488 // Start reading from the socket for packets from the network |
1301 // (other items were commented in a header). |
1489 // (other items were commented in a header). |
1302 // ----------------------------------------------------------------------------- |
1490 // ----------------------------------------------------------------------------- |
1303 // |
1491 // |
1304 |
1492 |
1305 EXPORT_C TInt CSuplConnection::GetLocalIPAddress(TInetAddr & aTInetAddress ) |
1493 EXPORT_C TInt CSuplConnection::GetLocalIPAddress(TInetAddr & aTInetAddress) |
1306 { |
1494 { |
1307 if(iState != EConnected) |
1495 if (iState != EConnected) |
1308 return KErrDisconnected; |
1496 return KErrDisconnected; |
1309 |
1497 |
1310 TSockAddr sockAddr; |
1498 TSockAddr sockAddr; |
1311 iSocket.LocalName(sockAddr); |
1499 iSocket.LocalName(sockAddr); |
1312 |
1500 |
1313 TInetAddr inetAddress(sockAddr); |
1501 TInetAddr inetAddress(sockAddr); |
1314 |
1502 |
1315 aTInetAddress = inetAddress; |
1503 aTInetAddress = inetAddress; |
1316 return KErrNone; |
1504 return KErrNone; |
1317 } |
1505 } |
1318 |
1506 |
1319 // ----------------------------------------------------------------------------- |
1507 // ----------------------------------------------------------------------------- |
1320 // CSuplConnection::CancelListenToMessages |
1508 // CSuplConnection::CancelListenToMessages |
1321 // Start reading from the socket for packets from the network |
1509 // Start reading from the socket for packets from the network |
1322 // (other items were commented in a header). |
1510 // (other items were commented in a header). |
1323 // ----------------------------------------------------------------------------- |
1511 // ----------------------------------------------------------------------------- |
1324 // |
1512 // |
1325 EXPORT_C void CSuplConnection::CancelListenToMessages() |
1513 EXPORT_C void CSuplConnection::CancelListenToMessages() |
1326 { |
1514 { |
1327 if (iListenCount > 1) |
1515 if (iListenCount > 1) |
1328 { |
1516 { |
1329 iListenCount--; |
1517 iListenCount--; |
1330 return; |
1518 return; |
1331 } |
1519 } |
1332 if(iSocketReader) |
1520 if (iSocketReader) |
1333 { |
1521 { |
1334 iSocketReader->Cancel(); |
1522 iSocketReader->Cancel(); |
1335 } |
1523 } |
1336 } |
1524 } |
1337 |
1525 |
1338 // ----------------------------------------------------------------------------- |
1526 // ----------------------------------------------------------------------------- |
1339 // COMASuplProvHandler::SetVariation |
1527 // COMASuplProvHandler::SetVariation |
1340 // Initializes the local variation flag |
1528 // Initializes the local variation flag |
1341 // ----------------------------------------------------------------------------- |
1529 // ----------------------------------------------------------------------------- |
1342 // |
1530 // |
1343 void CSuplConnection::SetVariation() |
1531 void CSuplConnection::SetVariation() |
1344 { |
1532 { |
1345 #if 0 |
1533 #if 0 |
1346 CRepository *repository = NULL; |
1534 CRepository *repository = NULL; |
1347 TRAPD( err, repository = CRepository::NewL( KCRUidSuplConfiguration)); |
1535 TRAPD( err, repository = CRepository::NewL( KCRUidSuplConfiguration)); |
1348 if ( KErrNone != err ) |
1536 if ( KErrNone != err ) |
1349 { |
1537 { |
1350 return; |
1538 return; |
1351 } |
1539 } |
1352 |
1540 |
1353 TInt val; |
1541 TInt val; |
1354 TInt rc = repository->Get( KSuplTLSAuthenticationVariant,val ); |
1542 TInt rc = repository->Get( KSuplTLSAuthenticationVariant,val ); |
1355 if ( KErrNone == rc && val == 0 ) |
1543 if ( KErrNone == rc && val == 0 ) |
1356 { |
1544 { |
1357 iVariantEnabled = EFalse; |
1545 iVariantEnabled = EFalse; |
1358 } |
1546 } |
1359 |
1547 |
1360 if ( KErrNone == rc && (val == 1 || val == 2 )) |
1548 if ( KErrNone == rc && (val == 1 || val == 2 )) |
1361 { |
1549 { |
1362 iVariantEnabled = ETrue; |
1550 iVariantEnabled = ETrue; |
1363 if(val == 2 ) |
1551 if(val == 2 ) |
1364 { |
1552 { |
1365 iPskTLSUsage = ETrue; |
1553 iPskTLSUsage = ETrue; |
1366 } |
1554 } |
1367 } |
1555 } |
1368 |
1556 |
1369 delete repository; |
1557 delete repository; |
1370 #endif |
1558 #endif |
1371 } |
1559 } |
1372 |
1560 |
1373 EXPORT_C void CSuplConnection::CloseConnection() |
1561 EXPORT_C void CSuplConnection::CloseConnection() |
1374 { |
1562 { |
1375 if(iTrace) |
1563 if (iTrace) |
1376 iTrace->Trace(_L("CSuplConnection::CloseConnection"), KTraceFileName, __LINE__); |
1564 iTrace->Trace(_L("CSuplConnection::CloseConnection"), KTraceFileName, |
|
1565 __LINE__); |
1377 |
1566 |
1378 // if connection request is from multiple clients and it is not yet |
1567 // if connection request is from multiple clients and it is not yet |
1379 // completed, just return. |
1568 // completed, just return. |
1380 if (iConnArray.Count() > 1) |
1569 if (iConnArray.Count() > 1) |
1381 return; |
1570 return; |
1382 #if 0 |
1571 #if 0 |
1383 TBuf<128> buf; |
1572 TBuf<128> buf; |
1384 buf.Copy(_L("CSuplConnection::CloseConnection, iConnectClients = ")); |
1573 buf.Copy(_L("CSuplConnection::CloseConnection, iConnectClients = ")); |
1385 buf.AppendNum(iConnectClients); |
1574 buf.AppendNum(iConnectClients); |
1386 iTrace->Trace(buf, KTraceFileName, __LINE__); |
1575 iTrace->Trace(buf, KTraceFileName, __LINE__); |
1387 |
1576 |
1388 buf.Copy(_L("CSuplConnection::CloseConnection, iState = ")); |
1577 buf.Copy(_L("CSuplConnection::CloseConnection, iState = ")); |
1389 buf.AppendNum(iState); |
1578 buf.AppendNum(iState); |
1390 iTrace->Trace(buf, KTraceFileName, __LINE__); |
1579 iTrace->Trace(buf, KTraceFileName, __LINE__); |
1391 #endif |
1580 #endif |
1392 |
1581 |
1393 if (iConnArray.Count() == 1) |
1582 if (iConnArray.Count() == 1) |
1394 iConnArray.Reset(); |
1583 iConnArray.Reset(); |
1395 |
1584 |
1396 iConnectClients--; |
1585 iConnectClients--; |
1397 |
1586 |
1398 if (iConnectClients > 0) //earlier > 1 |
1587 if (iConnectClients > 0) //earlier > 1 |
1399 return; |
1588 return; |
1400 |
1589 |
1401 iResolver.Close(); |
1590 iResolver.Close(); |
1402 CancelListenToMessages(); |
1591 CancelListenToMessages(); |
1403 // Close the Socket if required |
1592 // Close the Socket if required |
1404 if(iState == EConnected || iState == EConnecting || iState == ESecureHandShake) |
1593 if (iState == EConnected || iState == EConnecting || iState |
1405 { |
1594 == ESecureHandShake) |
1406 if(iTrace) |
1595 { |
1407 iTrace->Trace(_L("CSuplConnection::...Closing Socket"), KTraceFileName, __LINE__); |
1596 if (iTrace) |
1408 if(iVariantEnabled) |
1597 iTrace->Trace(_L("CSuplConnection::...Closing Socket"), |
1409 iTlsSocket->Close(); |
1598 KTraceFileName, __LINE__); |
1410 iSocket.Close(); |
1599 if (iVariantEnabled) |
1411 } |
1600 iTlsSocket->Close(); |
1412 |
1601 iSocket.Close(); |
|
1602 } |
|
1603 |
1413 #ifndef __WINS__ |
1604 #ifndef __WINS__ |
1414 // Close the RConnection |
1605 // Close the RConnection |
1415 if(iTrace) |
1606 if(iTrace) |
1416 iTrace->Trace(_L("CSuplConnection::...Closing RConnection"), KTraceFileName, __LINE__); |
1607 iTrace->Trace(_L("CSuplConnection::...Closing RConnection"), KTraceFileName, __LINE__); |
1417 iConnection.Close(); |
1608 iConnection.Close(); |
1418 #endif |
1609 #endif |
1419 iState = ENotConnected; |
1610 iState = ENotConnected; |
1420 } |
1611 } |
1421 |
1612 |
1422 // ----------------------------------------------------------------------------- |
1613 // ----------------------------------------------------------------------------- |
1423 // CSuplConnection::GetPskL |
1614 // CSuplConnection::GetPskL |
1424 // |
1615 // |
1425 // (other items were commented in a header). |
1616 // (other items were commented in a header). |
1426 // ----------------------------------------------------------------------------- |
1617 // ----------------------------------------------------------------------------- |
1427 // |
1618 // |
1428 |
1619 |
1429 // PSK TLS Start |
1620 // PSK TLS Start |
1430 void CSuplConnection::GetPskL(const HBufC8 * aPskIdentityHint, HBufC8 *& aPskIdentity, HBufC8 *& aPskKey) |
1621 void CSuplConnection::GetPskL(const HBufC8 * aPskIdentityHint, |
1431 { |
1622 HBufC8 *& aPskIdentity, HBufC8 *& aPskKey) |
1432 |
1623 { |
1433 iTrace->Trace(_L("CSuplConnection::GetPskL Start"), KTraceFileName, __LINE__); |
1624 |
1434 if (aPskIdentityHint != NULL && aPskIdentityHint->Length() >= KMaxPskIdentityHintLength ) |
1625 iTrace->Trace(_L("CSuplConnection::GetPskL Start"), KTraceFileName, |
1435 { |
1626 __LINE__); |
1436 iTrace->Trace(_L("aPskIdentityHint is not null..."), KTraceFileName, __LINE__); |
1627 if (aPskIdentityHint != NULL && aPskIdentityHint->Length() |
1437 TBuf8<KMaxGBAUsageLength> gbaUsage; |
1628 >= KMaxPskIdentityHintLength) |
1438 TBuf8<KMaxVerLength> ver; |
1629 { |
1439 TBuf8<KMaxNewPasswordLength> newPassword; |
1630 iTrace->Trace(_L("aPskIdentityHint is not null..."), KTraceFileName, |
1440 |
1631 __LINE__); |
1441 gbaUsage.Copy(aPskIdentityHint->Left(KMaxGBAUsageLength)); |
1632 TBuf8<KMaxGBAUsageLength> gbaUsage; |
1442 ver.Copy(aPskIdentityHint->Mid(KMaxGBAUsageLength,KMaxVerLength)); |
1633 TBuf8<KMaxVerLength> ver; |
1443 newPassword.Copy(aPskIdentityHint->Mid(KMaxGBAUsageLength + KMaxVerLength)); |
1634 TBuf8<KMaxNewPasswordLength> newPassword; |
1444 |
1635 |
1445 gbaUsage.UpperCase(); |
1636 gbaUsage.Copy(aPskIdentityHint->Left(KMaxGBAUsageLength)); |
1446 ver.UpperCase(); |
1637 ver.Copy(aPskIdentityHint->Mid(KMaxGBAUsageLength, KMaxVerLength)); |
1447 |
1638 newPassword.Copy(aPskIdentityHint->Mid(KMaxGBAUsageLength |
1448 if(gbaUsage.Compare(KWGBA) == 0) //We will proceed with key generation if its WGBA |
1639 + KMaxVerLength)); |
1449 { |
1640 |
1450 iTrace->Trace(_L("Its WGBA..."), KTraceFileName, __LINE__); |
1641 gbaUsage.UpperCase(); |
1451 GeneratePsk_Identity_KeyL(ver,newPassword,aPskIdentity,aPskKey); |
1642 ver.UpperCase(); |
1452 } |
1643 |
1453 else |
1644 if (gbaUsage.Compare(KWGBA) == 0) //We will proceed with key generation if its WGBA |
1454 { |
1645 { |
1455 TBuf<32> buf; |
1646 iTrace->Trace(_L("Its WGBA..."), KTraceFileName, __LINE__); |
1456 buf.Copy(gbaUsage); |
1647 GeneratePsk_Identity_KeyL(ver, newPassword, aPskIdentity, aPskKey); |
1457 iTrace->Trace(_L("Received GBA field is ..."), KTraceFileName, __LINE__); |
1648 } |
1458 iTrace->Trace(buf,KTraceFileName, __LINE__); |
1649 else |
1459 iTrace->Trace(_L("Leaving as of now,till GBA supports comes..."), KTraceFileName, __LINE__); |
1650 { |
1460 User::LeaveIfError(KErrNotSupported); |
1651 TBuf<32> buf; |
1461 } |
1652 buf.Copy(gbaUsage); |
1462 } |
1653 iTrace->Trace(_L("Received GBA field is ..."), KTraceFileName, |
|
1654 __LINE__); |
|
1655 iTrace->Trace(buf, KTraceFileName, __LINE__); |
|
1656 iTrace->Trace(_L("Leaving as of now,till GBA supports comes..."), |
|
1657 KTraceFileName, __LINE__); |
|
1658 User::LeaveIfError( KErrNotSupported); |
|
1659 } |
|
1660 } |
1463 else |
1661 else |
1464 { |
1662 { |
1465 iTrace->Trace(_L("Either Hint is Null OR Hint Length is exceeded."), KTraceFileName, __LINE__); |
1663 iTrace->Trace(_L("Either Hint is Null OR Hint Length is exceeded."), |
1466 User::LeaveIfError(KErrArgument); |
1664 KTraceFileName, __LINE__); |
1467 } |
1665 User::LeaveIfError( KErrArgument); |
1468 |
1666 } |
1469 #ifdef _DEBUG |
1667 |
1470 LogPskKeyInfoL(aPskIdentityHint,aPskIdentity,aPskKey); |
1668 #ifdef _DEBUG |
1471 #endif |
1669 LogPskKeyInfoL(aPskIdentityHint, aPskIdentity, aPskKey); |
1472 iTrace->Trace(_L("CSuplConnection::GetPskL End"), KTraceFileName, __LINE__); |
1670 #endif |
1473 |
1671 iTrace->Trace(_L("CSuplConnection::GetPskL End"), KTraceFileName, |
1474 } |
1672 __LINE__); |
1475 |
1673 |
|
1674 } |
|
1675 |
1476 // ----------------------------------------------------------------------------- |
1676 // ----------------------------------------------------------------------------- |
1477 // CSuplConnection::GeneratePsk_Identity_KeyL |
1677 // CSuplConnection::GeneratePsk_Identity_KeyL |
1478 // |
1678 // |
1479 // (other items were commented in a header). |
1679 // (other items were commented in a header). |
1480 // ----------------------------------------------------------------------------- |
1680 // ----------------------------------------------------------------------------- |
1481 // |
1681 // |
1482 void CSuplConnection::GeneratePsk_Identity_KeyL(const TDesC8& aSLPKeyVer,const TDesC8& aPassKey, |
1682 void CSuplConnection::GeneratePsk_Identity_KeyL(const TDesC8& aSLPKeyVer, |
1483 HBufC8 *& aPskIdentity, HBufC8 *& aPskKey) |
1683 const TDesC8& aPassKey, HBufC8 *& aPskIdentity, HBufC8 *& aPskKey) |
1484 { |
1684 { |
1485 |
1685 |
1486 iTrace->Trace(_L("Before CR..."), KTraceFileName, __LINE__); |
1686 iTrace->Trace(_L("Before CR..."), KTraceFileName, __LINE__); |
1487 CRepository* repository = CRepository::NewL( KCRUidPskTLSUsageConfiguration); |
1687 CRepository* repository = CRepository::NewL( |
1488 iTrace->Trace(_L("After CR..."), KTraceFileName, __LINE__); |
1688 KCRUidPskTLSUsageConfiguration); |
1489 CleanupStack::PushL(repository); |
1689 iTrace->Trace(_L("After CR..."), KTraceFileName, __LINE__); |
1490 |
1690 CleanupStack::PushL(repository); |
1491 TInt keyVersion; |
1691 |
1492 |
1692 TInt keyVersion; |
1493 TLex8 verStr(aSLPKeyVer); |
1693 |
1494 TInt SLPKeyVer; |
1694 TLex8 verStr(aSLPKeyVer); |
1495 verStr.Val(SLPKeyVer); |
1695 TInt SLPKeyVer; |
1496 |
1696 verStr.Val(SLPKeyVer); |
1497 TBuf8<KMaxPskKeyLength> pskKey; |
1697 |
1498 |
1698 TBuf8<KMaxPskKeyLength> pskKey; |
1499 TInt rc = repository->Get(KSuplPskTLSKeyVersion,keyVersion); |
1699 |
1500 if(rc == KErrNone && keyVersion == SLPKeyVer) |
1700 TInt rc = repository->Get(KSuplPskTLSKeyVersion, keyVersion); |
1501 { |
1701 if (rc == KErrNone && keyVersion == SLPKeyVer) |
1502 iTrace->Trace(_L("Version is matching with stored one..."), KTraceFileName, __LINE__); |
1702 { |
1503 rc = repository->Get(KSuplPskTLSNewPassword,pskKey); |
1703 iTrace->Trace(_L("Version is matching with stored one..."), |
1504 if(rc == KErrNone) |
1704 KTraceFileName, __LINE__); |
1505 { |
1705 rc = repository->Get(KSuplPskTLSNewPassword, pskKey); |
1506 aPskKey = HBufC8::NewL(KMaxPskKeyLength); |
1706 if (rc == KErrNone) |
1507 aPskKey->Des().Copy(pskKey); |
1707 { |
1508 iTrace->Trace(_L("Copied Psk Key"), KTraceFileName, __LINE__); |
1708 aPskKey = HBufC8::NewL(KMaxPskKeyLength); |
1509 PrintHex(pskKey,__LINE__); |
1709 aPskKey->Des().Copy(pskKey); |
1510 } |
1710 iTrace->Trace(_L("Copied Psk Key"), KTraceFileName, __LINE__); |
1511 else |
1711 PrintHex(pskKey, __LINE__); |
1512 { |
1712 } |
1513 iTrace->Trace(_L("KSuplPskTLSNewPassword Not Found"), KTraceFileName, __LINE__); |
1713 else |
1514 User::LeaveIfError(rc); |
1714 { |
1515 } |
1715 iTrace->Trace(_L("KSuplPskTLSNewPassword Not Found"), |
1516 } |
1716 KTraceFileName, __LINE__); |
1517 else |
1717 User::LeaveIfError(rc); |
1518 { |
1718 } |
1519 iTrace->Trace(_L("Version is NOT matching with stored one..."), KTraceFileName, __LINE__); |
1719 } |
1520 iTrace->Trace(_L("Generating new Key..."), KTraceFileName, __LINE__); |
1720 else |
1521 GeneratePskKeyL(repository,aPassKey,aPskKey,SLPKeyVer); |
1721 { |
1522 PrintHex(*aPskKey,__LINE__); |
1722 iTrace->Trace(_L("Version is NOT matching with stored one..."), |
1523 } |
1723 KTraceFileName, __LINE__); |
1524 |
1724 iTrace->Trace(_L("Generating new Key..."), KTraceFileName, __LINE__); |
1525 GeneratePskIdentityL(repository,SLPKeyVer,aPskIdentity); |
1725 GeneratePskKeyL(repository, aPassKey, aPskKey, SLPKeyVer); |
1526 CleanupStack::PopAndDestroy(repository); |
1726 PrintHex(*aPskKey, __LINE__); |
1527 |
1727 } |
1528 } |
1728 |
|
1729 GeneratePskIdentityL(repository, SLPKeyVer, aPskIdentity); |
|
1730 CleanupStack::PopAndDestroy(repository); |
|
1731 |
|
1732 } |
1529 |
1733 |
1530 // ----------------------------------------------------------------------------- |
1734 // ----------------------------------------------------------------------------- |
1531 // CSuplConnection::GeneratePskIdentity |
1735 // CSuplConnection::GeneratePskIdentity |
1532 // |
1736 // |
1533 // (other items were commented in a header). |
1737 // (other items were commented in a header). |
1534 // ----------------------------------------------------------------------------- |
1738 // ----------------------------------------------------------------------------- |
1535 // |
1739 // |
1536 void CSuplConnection::GeneratePskIdentityL(CRepository* aRepository,TInt /*aKeyVer*/,HBufC8 *& aPskIdentity) |
1740 void CSuplConnection::GeneratePskIdentityL(CRepository* aRepository, |
1537 { |
1741 TInt /*aKeyVer*/, HBufC8 *& aPskIdentity) |
1538 iTrace->Trace(_L("Start of GeneratePskIdentityL"), KTraceFileName, __LINE__); |
1742 { |
1539 |
1743 iTrace->Trace(_L("Start of GeneratePskIdentityL"), KTraceFileName, |
1540 TInt crKeyId; |
1744 __LINE__); |
1541 TInt rc = aRepository->Get(KSuplPskTLSKeyId,crKeyId); |
1745 |
1542 |
1746 TInt crKeyId; |
1543 if(rc == KErrNone) |
1747 TInt rc = aRepository->Get(KSuplPskTLSKeyId, crKeyId); |
1544 { |
1748 |
1545 aPskIdentity = HBufC8::NewL(KMaxPskKeyLength); |
1749 if (rc == KErrNone) |
1546 aPskIdentity->Des().Append(crKeyId); |
1750 { |
1547 aPskIdentity->Des().Append(13);//newline |
1751 aPskIdentity = HBufC8::NewL(KMaxPskKeyLength); |
1548 iTrace->Trace(_L("Copied PskIdentityL"), KTraceFileName, __LINE__); |
1752 aPskIdentity->Des().Append(crKeyId); |
1549 TRACESTRING("PskIdentity : ") |
1753 aPskIdentity->Des().Append(13);//newline |
1550 PrintHex(aPskIdentity->Des(),__LINE__); |
1754 iTrace->Trace(_L("Copied PskIdentityL"), KTraceFileName, __LINE__); |
1551 } |
1755 TRACESTRING ("PskIdentity : ") |
1552 else |
1756 PrintHex(aPskIdentity->Des(),__LINE__); |
1553 { |
1757 } |
1554 iTrace->Trace(_L("KSuplPskTLSKeyId Not Found"), KTraceFileName, __LINE__); |
1758 else |
1555 User::LeaveIfError(rc); |
1759 { |
1556 } |
1760 iTrace->Trace(_L("KSuplPskTLSKeyId Not Found"), KTraceFileName, __LINE__); |
1557 iTrace->Trace(_L("End of GeneratePskIdentityL"), KTraceFileName, __LINE__); |
1761 User::LeaveIfError(rc); |
1558 } |
1762 } |
1559 |
1763 iTrace->Trace(_L("End of GeneratePskIdentityL"), KTraceFileName, __LINE__); |
|
1764 } |
1560 |
1765 |
1561 // ----------------------------------------------------------------------------- |
1766 // ----------------------------------------------------------------------------- |
1562 // CSuplConnection::GeneratePskKeyL |
1767 // CSuplConnection::GeneratePskKeyL |
1563 // |
1768 // |
1564 // (other items were commented in a header). |
1769 // (other items were commented in a header). |
1565 // ----------------------------------------------------------------------------- |
1770 // ----------------------------------------------------------------------------- |
1566 // |
1771 // |
1567 void CSuplConnection::GeneratePskKeyL(CRepository* aRepository,const TDesC8& aPassKey,HBufC8 *& aPskKey,TInt aSLPKeyVersion) |
1772 void CSuplConnection::GeneratePskKeyL(CRepository* aRepository, |
1568 { |
1773 const TDesC8& aPassKey, HBufC8 *& aPskKey, TInt aSLPKeyVersion) |
1569 unsigned char newpassword[32]; |
1774 { |
1570 TBuf8<KMaxRootKeyLength> rootKey; |
1775 unsigned char newpassword[32]; |
1571 TBuf8<KMaxRootKeyXORLength> rootXORedPassKey; |
1776 TBuf8<KMaxRootKeyLength> rootKey; |
1572 TBuf8<KMaxSaltLength> finalSalt; |
1777 TBuf8<KMaxRootKeyXORLength> rootXORedPassKey; |
1573 |
1778 TBuf8<KMaxSaltLength> finalSalt; |
1574 iTrace->Trace(_L("Get rootKey from CR"), KTraceFileName, __LINE__); |
1779 |
1575 |
1780 iTrace->Trace(_L("Get rootKey from CR"), KTraceFileName, __LINE__); |
1576 TBuf<KMaxRootKeyLength> rootKey16; |
1781 |
1577 TInt rc = aRepository->Get(KSuplPskTLSRootPassword,rootKey16); |
1782 TBuf<KMaxRootKeyLength> rootKey16; |
1578 rootKey.Copy(rootKey16); |
1783 TInt rc = aRepository->Get(KSuplPskTLSRootPassword, rootKey16); |
1579 |
1784 rootKey.Copy(rootKey16); |
1580 TBuf<64> buf; |
1785 |
1581 TRACESTRING("Root Key from CenRep") |
1786 TBuf<64> buf; |
1582 TRACETEXT(rootKey) |
1787 TRACESTRING("Root Key from CenRep") |
1583 |
1788 TRACETEXT(rootKey) |
1584 buf.Copy(_L("Get(KSuplPskTLSRootPassword,rootKey16) ")); |
1789 |
1585 buf.AppendNum(rc); |
1790 buf.Copy(_L("Get(KSuplPskTLSRootPassword,rootKey16) ")); |
1586 buf.Append(_L(" Len of rootkey ")); |
1791 buf.AppendNum(rc); |
1587 buf.AppendNum(rootKey.Length()); |
1792 buf.Append(_L(" Len of rootkey ")); |
1588 iTrace->Trace(buf,KTraceFileName, __LINE__); |
1793 buf.AppendNum(rootKey.Length()); |
1589 User::LeaveIfError(rc); |
1794 iTrace->Trace(buf, KTraceFileName, __LINE__); |
1590 |
1795 User::LeaveIfError(rc); |
1591 TRACESTRING("Pass Key from SLP") |
1796 |
1592 TRACETEXT(aPassKey) |
1797 TRACESTRING("Pass Key from SLP") |
1593 |
1798 TRACETEXT(aPassKey) |
1594 if(rc == KErrNone && rootKey.Length() != 0) |
1799 |
1595 { |
1800 if(rc == KErrNone && rootKey.Length() != 0) |
1596 TBuf8<KMaxRootKeyLength> rootXORedKey; |
1801 { |
1597 |
1802 TBuf8<KMaxRootKeyLength> rootXORedKey; |
1598 iTrace->Trace(_L("DoSelfXOR"), KTraceFileName, __LINE__); |
1803 |
1599 DoSelfXOR(rootXORedKey,rootKey); |
1804 iTrace->Trace(_L("DoSelfXOR"), KTraceFileName, __LINE__); |
1600 TRACESTRING("Self XOR") |
1805 DoSelfXOR(rootXORedKey,rootKey); |
1601 PrintHex(rootXORedKey,__LINE__); |
1806 TRACESTRING("Self XOR") |
1602 |
1807 PrintHex(rootXORedKey,__LINE__); |
1603 iTrace->Trace(_L("DoXOR"), KTraceFileName, __LINE__); |
1808 |
1604 DoXOR(rootXORedPassKey,aPassKey,rootXORedKey); |
1809 iTrace->Trace(_L("DoXOR"), KTraceFileName, __LINE__); |
1605 TRACESTRING("DoXOR") |
1810 DoXOR(rootXORedPassKey,aPassKey,rootXORedKey); |
1606 PrintHex(rootXORedPassKey,__LINE__); |
1811 TRACESTRING("DoXOR") |
1607 |
1812 PrintHex(rootXORedPassKey,__LINE__); |
1608 iTrace->Trace(_L("FormSalt"), KTraceFileName, __LINE__); |
1813 |
1609 TRACETEXT(KSaltValue) |
1814 iTrace->Trace(_L("FormSalt"), KTraceFileName, __LINE__); |
1610 FormSaltKey(finalSalt,KSaltValue); |
1815 TRACETEXT(KSaltValue) |
1611 TRACESTRING("Salt Value in hex...") |
1816 FormSaltKey(finalSalt,KSaltValue); |
1612 PrintHex(finalSalt,__LINE__); |
1817 TRACESTRING("Salt Value in hex...") |
1613 |
1818 PrintHex(finalSalt,__LINE__); |
1614 iTrace->Trace(_L("Call derive key"), KTraceFileName, __LINE__); |
1819 |
1615 |
1820 iTrace->Trace(_L("Call derive key"), KTraceFileName, __LINE__); |
1616 buf.Copy(_L("Length of RootXORedPassKey ")); |
1821 |
1617 buf.AppendNum(rootXORedPassKey.Length()); |
1822 buf.Copy(_L("Length of RootXORedPassKey ")); |
1618 TRACETEXT(buf) |
1823 buf.AppendNum(rootXORedPassKey.Length()); |
1619 |
1824 TRACETEXT(buf) |
1620 buf.Copy(_L("Length of Salt Key ")); |
1825 |
1621 buf.AppendNum(finalSalt.Length()); |
1826 buf.Copy(_L("Length of Salt Key ")); |
1622 TRACETEXT(buf) |
1827 buf.AppendNum(finalSalt.Length()); |
1623 |
1828 TRACETEXT(buf) |
1624 derive_key(rootXORedPassKey.Ptr(),rootXORedPassKey.Length(),finalSalt.Ptr(), |
1829 |
1625 finalSalt.Length(),8,newpassword,32); |
1830 derive_key(rootXORedPassKey.Ptr(),rootXORedPassKey.Length(),finalSalt.Ptr(), |
1626 |
1831 finalSalt.Length(),8,newpassword,32); |
1627 iTrace->Trace(_L("Copy key into PskKey"), KTraceFileName, __LINE__); |
1832 |
1628 |
1833 iTrace->Trace(_L("Copy key into PskKey"), KTraceFileName, __LINE__); |
1629 aPskKey = HBufC8::NewL(32); |
1834 |
1630 aPskKey->Des().Copy(newpassword,32); |
1835 aPskKey = HBufC8::NewL(32); |
1631 |
1836 aPskKey->Des().Copy(newpassword,32); |
1632 buf.Copy(_L("Length of Key ")); |
1837 |
1633 buf.AppendNum(aPskKey->Des().Length()); |
1838 buf.Copy(_L("Length of Key ")); |
1634 TRACETEXT(buf) |
1839 buf.AppendNum(aPskKey->Des().Length()); |
1635 |
1840 TRACETEXT(buf) |
1636 TRACESTRING("Key...") |
1841 |
1637 PrintHex(aPskKey->Des(),__LINE__); |
1842 TRACESTRING("Key...") |
1638 |
1843 PrintHex(aPskKey->Des(),__LINE__); |
1639 aRepository->Set(KSuplPskTLSNewPassword,aPskKey->Des()); |
1844 |
1640 aRepository->Set(KSuplPskTLSKeyVersion,aSLPKeyVersion); |
1845 aRepository->Set(KSuplPskTLSNewPassword,aPskKey->Des()); |
1641 iTrace->Trace(_L("Copied PskKey"), KTraceFileName, __LINE__); |
1846 aRepository->Set(KSuplPskTLSKeyVersion,aSLPKeyVersion); |
1642 } |
1847 iTrace->Trace(_L("Copied PskKey"), KTraceFileName, __LINE__); |
1643 |
1848 } |
1644 else |
1849 |
1645 { |
1850 else |
1646 iTrace->Trace(_L("KSuplPskTLSRootPassword Not Found"), KTraceFileName, __LINE__); |
1851 { |
1647 User::LeaveIfError(rc); |
1852 iTrace->Trace(_L("KSuplPskTLSRootPassword Not Found"), KTraceFileName, __LINE__); |
1648 } |
1853 User::LeaveIfError(rc); |
1649 |
1854 } |
1650 iTrace->Trace(_L("End GeneratePskKeyL"), KTraceFileName, __LINE__); |
1855 |
1651 } |
1856 iTrace->Trace(_L("End GeneratePskKeyL"), KTraceFileName, __LINE__); |
|
1857 } |
1652 // ----------------------------------------------------------------------------- |
1858 // ----------------------------------------------------------------------------- |
1653 // CSuplConnection::LogPskKeyInfoL |
1859 // CSuplConnection::LogPskKeyInfoL |
1654 // |
1860 // |
1655 // (other items were commented in a header). |
1861 // (other items were commented in a header). |
1656 // ----------------------------------------------------------------------------- |
1862 // ----------------------------------------------------------------------------- |
1657 // |
1863 // |
1658 void CSuplConnection::LogPskKeyInfoL(const HBufC8* /*aPskIdentityHint*/,HBufC8* /*aPskIdentity*/,HBufC8* /*aPskKey*/) |
1864 void CSuplConnection::LogPskKeyInfoL(const HBufC8* /*aPskIdentityHint*/, |
1659 { |
1865 HBufC8* /*aPskIdentity*/, HBufC8* /*aPskKey*/) |
1660 #if 0 |
1866 { |
1661 TBuf<128> buf; |
1867 #if 0 |
1662 buf.Copy(_L("PSK Key :")); |
1868 TBuf<128> buf; |
|
1869 buf.Copy(_L("PSK Key :")); |
1663 iTrace->Trace(buf, KTraceFileName, __LINE__); |
1870 iTrace->Trace(buf, KTraceFileName, __LINE__); |
1664 HBufC* hintbuf = NULL; |
1871 HBufC* hintbuf = NULL; |
1665 TInt err; |
1872 TInt err; |
1666 TRAP(err, hintbuf = HBufC::NewL(aPskKey->Length())); |
1873 TRAP(err, hintbuf = HBufC::NewL(aPskKey->Length())); |
1667 err = 0; |
1874 err = 0; |
1668 hintbuf->Des().Copy(aPskKey->Des()); |
1875 hintbuf->Des().Copy(aPskKey->Des()); |
1669 iTrace->Trace( hintbuf->Des(),KTraceFileName, __LINE__); |
1876 iTrace->Trace( hintbuf->Des(),KTraceFileName, __LINE__); |
1670 delete hintbuf; |
1877 delete hintbuf; |
1671 hintbuf = NULL; |
1878 hintbuf = NULL; |
1672 |
1879 |
1673 buf.Copy(_L("PSK Identity :")); |
1880 buf.Copy(_L("PSK Identity :")); |
1674 iTrace->Trace(buf, KTraceFileName, __LINE__); |
1881 iTrace->Trace(buf, KTraceFileName, __LINE__); |
1675 TRAP(err, hintbuf = HBufC::NewL(aPskIdentity->Length())); |
1882 TRAP(err, hintbuf = HBufC::NewL(aPskIdentity->Length())); |
1676 err = 0; |
1883 err = 0; |
1677 hintbuf->Des().Copy(aPskIdentity->Des()); |
1884 hintbuf->Des().Copy(aPskIdentity->Des()); |
1678 iTrace->Trace( hintbuf->Des(),KTraceFileName, __LINE__); |
1885 iTrace->Trace( hintbuf->Des(),KTraceFileName, __LINE__); |
1679 delete hintbuf; |
1886 delete hintbuf; |
1680 hintbuf = NULL; |
1887 hintbuf = NULL; |
1681 |
1888 |
1682 if (aPskIdentityHint != NULL) |
1889 if (aPskIdentityHint != NULL) |
1683 { |
1890 { |
1684 buf.Copy(_L("Rcvd Identity Hint :")); |
1891 buf.Copy(_L("Rcvd Identity Hint :")); |
1685 iTrace->Trace(buf, KTraceFileName, __LINE__); |
1892 iTrace->Trace(buf, KTraceFileName, __LINE__); |
1686 TRAP(err, hintbuf = HBufC::NewL(aPskIdentityHint->Length())); |
1893 TRAP(err, hintbuf = HBufC::NewL(aPskIdentityHint->Length())); |
1687 err = 0; |
1894 err = 0; |
1688 hintbuf->Des().Copy(*aPskIdentityHint); |
1895 hintbuf->Des().Copy(*aPskIdentityHint); |
1689 iTrace->Trace( hintbuf->Des(),KTraceFileName, __LINE__); |
1896 iTrace->Trace( hintbuf->Des(),KTraceFileName, __LINE__); |
1690 delete hintbuf; |
1897 delete hintbuf; |
1691 hintbuf = NULL; |
1898 hintbuf = NULL; |
1692 } |
1899 } |
1693 else |
1900 else |
1694 { |
1901 { |
1695 iTrace->Trace(_L("Rcvd Null Identity Hint"), KTraceFileName, __LINE__); |
1902 iTrace->Trace(_L("Rcvd Null Identity Hint"), KTraceFileName, __LINE__); |
1696 } |
1903 } |
1697 #endif |
1904 #endif |
1698 } |
1905 } |
1699 |
1906 |
1700 |
1907 void CSuplConnection::PrintHex(const TDesC8& |
1701 void CSuplConnection::PrintHex(const TDesC8& |
|
1702 #ifdef _DEBUG |
1908 #ifdef _DEBUG |
1703 aBuffer |
1909 aBuffer |
1704 #endif |
1910 #endif |
1705 , |
1911 , TInt |
1706 TInt |
|
1707 #ifdef _DEBUG |
1912 #ifdef _DEBUG |
1708 aLine |
1913 aLine |
1709 #endif |
1914 #endif |
1710 |
1915 |
1711 ) |
1916 ) |
1712 { |
1917 { |
1713 #ifdef _DEBUG |
1918 #ifdef _DEBUG |
1714 TBuf<128> buffer; |
1919 TBuf<128> buffer; |
1715 TBuf<8> buff; |
1920 TBuf<8> buff; |
1716 _LIT16(KFormat1,"%02x"); |
1921 _LIT16(KFormat1, "%02x"); |
1717 TInt len = aBuffer.Length(); |
1922 TInt len = aBuffer.Length(); |
1718 for(TInt i = 0 ; i <len; i++) |
1923 for (TInt i = 0; i < len; i++) |
1719 { |
1924 { |
1720 buff.Zero(); |
1925 buff.Zero(); |
1721 buff.Format(KFormat1,aBuffer[i]); |
1926 buff.Format(KFormat1, aBuffer[i]); |
1722 TRACETEXT(buff) |
1927 TRACETEXT (buff) |
1723 iTrace->Trace(buff, KTraceFileName, aLine); |
1928 iTrace->Trace(buff, KTraceFileName, aLine); |
1724 } |
1929 } |
1725 #endif |
1930 #endif |
1726 } |
1931 } |
1727 |
1932 |
1728 EXPORT_C TInt CSuplConnection::GetPortNumberUsed() |
1933 EXPORT_C TInt CSuplConnection::GetPortNumberUsed() |
1729 { |
1934 { |
1730 iTrace->Trace(_L("CSuplConnection::GetPortNumberUsed"), KTraceFileName, __LINE__); |
1935 iTrace->Trace(_L("CSuplConnection::GetPortNumberUsed"), KTraceFileName, |
|
1936 __LINE__); |
1731 if (iState == EConnected) |
1937 if (iState == EConnected) |
1732 { |
1938 { |
1733 TBuf<64> msg(_L("Port Number used is ")); |
1939 TBuf<64> msg(_L("Port Number used is ")); |
1734 msg.AppendNum(iSocket.LocalPort()); |
1940 msg.AppendNum(iSocket.LocalPort()); |
1735 iTrace->Trace(msg, KTraceFileName, __LINE__); |
1941 iTrace->Trace(msg, KTraceFileName, __LINE__); |
1736 return iSocket.LocalPort(); |
1942 return iSocket.LocalPort(); |
1737 } |
1943 } |
1738 else |
1944 else |
1739 return KErrGeneral; |
1945 return KErrGeneral; |
1740 } |
1946 } |
1741 |
1947 |
1742 // PSK TLS End |
1948 // PSK TLS End |
1743 // End of File |
1949 // End of File |