|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Name : sipconcreteprofile.cpp |
|
15 // Part of : SIP / SIP Profile Agent / SIP Concrete Profile |
|
16 // Implementation |
|
17 // Version : %version: 3.1.1 % |
|
18 // |
|
19 |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include "sipconcreteprofile.h" |
|
24 #include "sipprofileparameter.h" |
|
25 #include "sipprofile.h" |
|
26 #include "sipmanagedprofile.h" |
|
27 #include "extensionintparam.h" |
|
28 #include "extensionboolparam.h" |
|
29 #include "extensiondescrparam.h" |
|
30 #include "extensiondescrarrayparam.h" |
|
31 #include <random.h> |
|
32 #include <utf.h> |
|
33 #include <commsdattypesv1_1.h> |
|
34 #include <commsdat.h> |
|
35 #include <e32const.h> |
|
36 #include "SipProfileLog.h" |
|
37 |
|
38 const TInt KBitsInByte = 8; |
|
39 const TInt KContactUserNameLength = 20; |
|
40 const TUint KParameterLength = 25; |
|
41 const TUint32 KDefaultSNAPIdentifier = KMaxTUint32; |
|
42 _LIT8(KSIPProfileParameter, "%u"); |
|
43 |
|
44 using namespace CommsDat; |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CSIPConcreteProfile::NewL |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 EXPORT_C CSIPConcreteProfile* CSIPConcreteProfile::NewL() |
|
50 { |
|
51 CSIPConcreteProfile* self = CSIPConcreteProfile::NewLC(); |
|
52 CleanupStack::Pop(self); |
|
53 return self; |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // CSIPConcreteProfile::NewLC |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 EXPORT_C CSIPConcreteProfile* CSIPConcreteProfile::NewLC() |
|
61 { |
|
62 CSIPConcreteProfile* self = new (ELeave) CSIPConcreteProfile(); |
|
63 CleanupStack::PushL(self); |
|
64 self->ConstructL(); |
|
65 return self; |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // CSIPConcreteProfile::CSIPConcreteProfile |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 CSIPConcreteProfile::CSIPConcreteProfile() |
|
73 { |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CSIPConcreteProfile::ConstructL |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 void CSIPConcreteProfile::ConstructL() |
|
81 { |
|
82 iSIPAORUri8 = CUri8::NewL(); |
|
83 iSIPRegistrar = HBufC8::NewL(0); |
|
84 iSIPProviderName = HBufC8::NewL(0); |
|
85 iSIPPrivateIdentity = HBufC8::NewL(0); |
|
86 iSIPOutboundProxy = HBufC8::NewL(0); |
|
87 |
|
88 iSIPSigComp = EFalse; |
|
89 iSecurityNegotiation = EFalse; |
|
90 iSIPAutoRegistered = EFalse; |
|
91 |
|
92 iStatus = EUnregistered; |
|
93 iDefaultProfile = EFalse; |
|
94 |
|
95 iDynamicProxyResolving = EFalse; |
|
96 iDynamicProxy = HBufC8::NewL(0); |
|
97 |
|
98 iSIPContactHeaderParams = new (ELeave) CDesC8ArrayFlat(1); |
|
99 |
|
100 iSIPRegisteredAORs = new (ELeave) CDesC8ArrayFlat(1); |
|
101 iSIPNegotiatedSecurityMechanism = HBufC8::NewL(0); |
|
102 |
|
103 iSIPHeaders = new (ELeave) CDesC8ArrayFlat(1); |
|
104 |
|
105 HBufC8* username = CreateContactUserNameLC(); |
|
106 SetExtensionParameterL(KSIPContactHeaderUser,*username); |
|
107 CleanupStack::PopAndDestroy(username); |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CSIPConcreteProfile::CloneL |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 EXPORT_C CSIPConcreteProfile* CSIPConcreteProfile::CloneL() const |
|
115 { |
|
116 return CloneL(EFalse); |
|
117 } |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // CSIPConcreteProfile::CloneWithDynamicValuesL |
|
121 // ----------------------------------------------------------------------------- |
|
122 // |
|
123 EXPORT_C CSIPConcreteProfile* CSIPConcreteProfile::CloneWithDynamicValuesL() const |
|
124 { |
|
125 return CloneL(ETrue); |
|
126 } |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CSIPConcreteProfile::CloneL(TBool) |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 CSIPConcreteProfile* CSIPConcreteProfile::CloneL(TBool aWithDynamicValues) const |
|
133 { |
|
134 CSIPConcreteProfile* newCopy = CSIPConcreteProfile::NewLC(); |
|
135 |
|
136 newCopy->SetIapId(IapId()); |
|
137 newCopy->SetProfileType(ProfileType()); |
|
138 newCopy->SetRegistrarL(*iSIPRegistrar); |
|
139 newCopy->SetOutboundProxyL(*iSIPOutboundProxy); |
|
140 newCopy->SetPrivateIdentityL(PrivateIdentity()); |
|
141 newCopy->SetProviderNameL(ProviderName()); |
|
142 |
|
143 |
|
144 newCopy->SetServerParameterL(KSIPRegistrar, KSIPDigestRealm, |
|
145 ServerParameter(KSIPRegistrar, KSIPDigestRealm)); |
|
146 |
|
147 newCopy->SetServerParameterL(KSIPRegistrar, KSIPDigestUserName, |
|
148 ServerParameter(KSIPRegistrar, KSIPDigestUserName)); |
|
149 |
|
150 newCopy->SetServerParameterL(KSIPRegistrar, KSIPDigestPassword, |
|
151 ServerParameter(KSIPRegistrar, KSIPDigestPassword)); |
|
152 |
|
153 TInt i = 0; |
|
154 for (i = 0; i < iSIPRegistrarExtParameter.Count(); i++) |
|
155 { |
|
156 CSIPProfileParameter* param = iSIPRegistrarExtParameter[i]; |
|
157 newCopy->SetServerExtensionParameterL(KSIPRegistrar, param->Key(), param->ValueL()); |
|
158 } |
|
159 |
|
160 newCopy->SetServerParameterL(KSIPOutboundProxy, KSIPDigestRealm, |
|
161 ServerParameter(KSIPOutboundProxy, KSIPDigestRealm)); |
|
162 |
|
163 newCopy->SetServerParameterL(KSIPOutboundProxy, KSIPDigestUserName, |
|
164 ServerParameter(KSIPOutboundProxy, KSIPDigestUserName)); |
|
165 |
|
166 newCopy->SetServerParameterL(KSIPOutboundProxy, KSIPDigestPassword, |
|
167 ServerParameter(KSIPOutboundProxy, KSIPDigestPassword)); |
|
168 |
|
169 for (i = 0; i < iSIPOutboundProxyExtParameter.Count(); i++) |
|
170 { |
|
171 CSIPProfileParameter* param = iSIPOutboundProxyExtParameter[i]; |
|
172 newCopy->SetServerExtensionParameterL(KSIPOutboundProxy, param->Key(), param->ValueL()); |
|
173 } |
|
174 |
|
175 newCopy->SetAORL(AOR()); |
|
176 |
|
177 newCopy->EnableSigComp(IsSigCompEnabled()); |
|
178 newCopy->EnableSecurityNegotiation(IsSecurityNegotiationEnabled()); |
|
179 newCopy->SetAutoRegistrationEnabled(IsAutoRegistrationEnabled()); |
|
180 newCopy->SetDynamicProxyL(DynamicProxy()); |
|
181 |
|
182 newCopy->SetContactHeaderParamsL(ContactHeaderParams()); |
|
183 |
|
184 newCopy->SetSIPHeadersL(SIPHeaders()); |
|
185 |
|
186 newCopy->SetStatus(EUnregistered); |
|
187 newCopy->SetContextId(0); |
|
188 newCopy->SetDefault(EFalse); |
|
189 newCopy->SetLastRegistrationError(KErrNone); |
|
190 |
|
191 CloneExtensionParamsL(*newCopy); |
|
192 |
|
193 if (aWithDynamicValues) // All vales are copied |
|
194 { |
|
195 newCopy->SetId(Id()); |
|
196 newCopy->SetStatus(Status()); |
|
197 newCopy->SetContextId(ContextId()); |
|
198 newCopy->SetDefault(IsDefault()); |
|
199 newCopy->SetLastRegistrationError(LastRegistrationError()); |
|
200 } |
|
201 else |
|
202 { |
|
203 newCopy->SetStatus(EUnregistered); |
|
204 newCopy->SetContextId(0); |
|
205 newCopy->SetDefault(EFalse); |
|
206 newCopy->SetLastRegistrationError(KErrNone); |
|
207 |
|
208 // The Contact-header's user-part must be unique. |
|
209 // It is stored in the extension parameters to preserve data compatibility. |
|
210 HBufC8* username = CreateContactUserNameLC(); |
|
211 newCopy->SetExtensionParameterL(KSIPContactHeaderUser,*username); |
|
212 CleanupStack::PopAndDestroy(username); |
|
213 } |
|
214 |
|
215 CleanupStack::Pop(newCopy); |
|
216 return newCopy; |
|
217 } |
|
218 |
|
219 |
|
220 // ----------------------------------------------------------------------------- |
|
221 // CSIPConcreteProfile::~CSIPConcreteProfile |
|
222 // Destructor. |
|
223 // ----------------------------------------------------------------------------- |
|
224 // |
|
225 EXPORT_C CSIPConcreteProfile::~CSIPConcreteProfile() |
|
226 { |
|
227 if (iSIPHeaders) |
|
228 { |
|
229 iSIPHeaders->Reset(); |
|
230 } |
|
231 delete iSIPHeaders; |
|
232 |
|
233 delete iSIPNegotiatedSecurityMechanism; |
|
234 |
|
235 if (iSIPRegisteredAORs) |
|
236 { |
|
237 iSIPRegisteredAORs->Reset(); |
|
238 } |
|
239 delete iSIPRegisteredAORs; |
|
240 |
|
241 if (iSIPContactHeaderParams) |
|
242 { |
|
243 iSIPContactHeaderParams->Reset(); |
|
244 } |
|
245 delete iSIPContactHeaderParams; |
|
246 |
|
247 iSIPOutboundProxyParameter.ResetAndDestroy(); |
|
248 iSIPOutboundProxyExtParameter.ResetAndDestroy(); |
|
249 iSIPRegistrarParameter.ResetAndDestroy(); |
|
250 iSIPRegistrarExtParameter.ResetAndDestroy(); |
|
251 |
|
252 delete iDynamicProxy; |
|
253 delete iSIPAORUri8; |
|
254 delete iSIPRegistrar; |
|
255 delete iSIPProviderName; |
|
256 delete iSIPPrivateIdentity; |
|
257 delete iSIPOutboundProxy; |
|
258 |
|
259 iExtensionIntParams.Close(); |
|
260 iExtensionBoolParams.Close(); |
|
261 iExtensionDescrParams.ResetAndDestroy(); |
|
262 iExtensionDescrArrayParams.ResetAndDestroy(); |
|
263 } |
|
264 |
|
265 // ----------------------------------------------------------------------------- |
|
266 // CSIPConcreteProfile::Id |
|
267 // ----------------------------------------------------------------------------- |
|
268 // |
|
269 EXPORT_C TUint32 CSIPConcreteProfile::Id() const |
|
270 { |
|
271 return iSIPProfileId; |
|
272 } |
|
273 |
|
274 // ----------------------------------------------------------------------------- |
|
275 // CSIPConcreteProfile::SetId |
|
276 // ----------------------------------------------------------------------------- |
|
277 // |
|
278 EXPORT_C void CSIPConcreteProfile::SetId(TUint32 aId) |
|
279 { |
|
280 iSIPProfileId = aId; |
|
281 } |
|
282 |
|
283 // ----------------------------------------------------------------------------- |
|
284 // CSIPConcreteProfile::SetIapId |
|
285 // ----------------------------------------------------------------------------- |
|
286 // |
|
287 EXPORT_C void CSIPConcreteProfile::SetIapId(TUint32 aIapId) |
|
288 { |
|
289 iSIPIAPId = aIapId; |
|
290 } |
|
291 |
|
292 // ----------------------------------------------------------------------------- |
|
293 // CSIPConcreteProfile::IapId |
|
294 // ----------------------------------------------------------------------------- |
|
295 // |
|
296 EXPORT_C TUint32 CSIPConcreteProfile::IapId() const |
|
297 { |
|
298 return iSIPIAPId; |
|
299 } |
|
300 |
|
301 // ----------------------------------------------------------------------------- |
|
302 // CSIPConcreteProfile::SetProfileTypeL |
|
303 // ----------------------------------------------------------------------------- |
|
304 // |
|
305 EXPORT_C void CSIPConcreteProfile::SetProfileType( |
|
306 const TSIPProfileTypeInfo& aProfileType) |
|
307 { |
|
308 iSIPProfileType.iSIPProfileClass = aProfileType.iSIPProfileClass; |
|
309 iSIPProfileType.iSIPProfileName = aProfileType.iSIPProfileName; |
|
310 } |
|
311 |
|
312 // ----------------------------------------------------------------------------- |
|
313 // CSIPConcreteProfile::ProfileType |
|
314 // ----------------------------------------------------------------------------- |
|
315 // |
|
316 EXPORT_C const TSIPProfileTypeInfo& CSIPConcreteProfile::ProfileType() const |
|
317 { |
|
318 return iSIPProfileType; |
|
319 } |
|
320 |
|
321 // ----------------------------------------------------------------------------- |
|
322 // CSIPConcreteProfile::Server |
|
323 // ----------------------------------------------------------------------------- |
|
324 // |
|
325 EXPORT_C const TDesC8& CSIPConcreteProfile::Server(TUint32 aServer) const |
|
326 { |
|
327 switch(aServer) |
|
328 { |
|
329 case KSIPOutboundProxy: |
|
330 return *iSIPOutboundProxy; |
|
331 case KSIPRegistrar: |
|
332 return *iSIPRegistrar; |
|
333 default: |
|
334 return KNullDesC8; |
|
335 } |
|
336 } |
|
337 |
|
338 // ----------------------------------------------------------------------------- |
|
339 // CSIPConcreteProfile::ServerParameter |
|
340 // ----------------------------------------------------------------------------- |
|
341 // |
|
342 EXPORT_C const TDesC8& CSIPConcreteProfile::ServerParameter( |
|
343 TUint32 aServer, |
|
344 TUint32 aServerParam) const |
|
345 { |
|
346 if (aServerParam == KSIPDigestUserName || |
|
347 aServerParam == KSIPDigestRealm || |
|
348 aServerParam == KSIPDigestPassword) |
|
349 { |
|
350 TBuf8<KParameterLength> parameter; |
|
351 parameter.Format(KSIPProfileParameter, aServerParam); |
|
352 |
|
353 switch(aServer) |
|
354 { |
|
355 case KSIPOutboundProxy: |
|
356 return Parameter(&iSIPOutboundProxyParameter, parameter); |
|
357 case KSIPRegistrar: |
|
358 return Parameter(&iSIPRegistrarParameter, parameter); |
|
359 default: |
|
360 return KNullDesC8; |
|
361 } |
|
362 } |
|
363 else |
|
364 { |
|
365 return KNullDesC8; |
|
366 } |
|
367 } |
|
368 |
|
369 // ----------------------------------------------------------------------------- |
|
370 // CSIPConcreteProfile::ServerExtensionParameter |
|
371 // ----------------------------------------------------------------------------- |
|
372 // |
|
373 EXPORT_C const TDesC8& CSIPConcreteProfile::ServerExtensionParameter( |
|
374 TUint32 aServer, |
|
375 const TDesC8& aName) const |
|
376 { |
|
377 switch(aServer) |
|
378 { |
|
379 case KSIPOutboundProxy: |
|
380 return Parameter(&iSIPOutboundProxyExtParameter, aName); |
|
381 case KSIPRegistrar: |
|
382 return Parameter(&iSIPRegistrarExtParameter, aName); |
|
383 default: |
|
384 return KNullDesC8; |
|
385 } |
|
386 } |
|
387 |
|
388 // ----------------------------------------------------------------------------- |
|
389 // CSIPConcreteProfile::SetServerL |
|
390 // ----------------------------------------------------------------------------- |
|
391 // |
|
392 EXPORT_C void CSIPConcreteProfile::SetServerL( |
|
393 TUint32 aServer, |
|
394 const TDesC8& aSipUri) |
|
395 { |
|
396 switch(aServer) |
|
397 { |
|
398 case KSIPOutboundProxy: |
|
399 SetOutboundProxyL(aSipUri); |
|
400 break; |
|
401 case KSIPRegistrar: |
|
402 SetRegistrarL(aSipUri); |
|
403 break; |
|
404 default: |
|
405 User::Leave (KErrArgument); |
|
406 } |
|
407 } |
|
408 |
|
409 // ----------------------------------------------------------------------------- |
|
410 // CSIPConcreteProfile::SetServerParameterL |
|
411 // ----------------------------------------------------------------------------- |
|
412 // |
|
413 EXPORT_C void CSIPConcreteProfile::SetServerParameterL( |
|
414 TUint32 aServer, |
|
415 TUint32 aServerParam, |
|
416 const TDesC8& aValue) |
|
417 { |
|
418 __ASSERT_ALWAYS(aServerParam == KSIPDigestUserName || |
|
419 aServerParam == KSIPDigestRealm || |
|
420 aServerParam == KSIPDigestPassword , User::Leave(KErrArgument)); |
|
421 |
|
422 TBuf8<KParameterLength> parameter; |
|
423 parameter.Format(KSIPProfileParameter, aServerParam); |
|
424 |
|
425 switch(aServer) |
|
426 { |
|
427 case KSIPOutboundProxy: |
|
428 SetParameterL(&iSIPOutboundProxyParameter, parameter, aValue); |
|
429 break; |
|
430 case KSIPRegistrar: |
|
431 SetParameterL(&iSIPRegistrarParameter, parameter, aValue); |
|
432 break; |
|
433 default: |
|
434 User::Leave (KErrArgument); |
|
435 } |
|
436 } |
|
437 |
|
438 // ----------------------------------------------------------------------------- |
|
439 // CSIPConcreteProfile::SetServerExtensionParameterL |
|
440 // ----------------------------------------------------------------------------- |
|
441 // |
|
442 EXPORT_C void CSIPConcreteProfile::SetServerExtensionParameterL( |
|
443 TUint32 aServer, |
|
444 const TDesC8& aName, |
|
445 const TDesC8& aValue) |
|
446 { |
|
447 switch(aServer) |
|
448 { |
|
449 case KSIPOutboundProxy: |
|
450 SetParameterL(&iSIPOutboundProxyExtParameter, aName, aValue); |
|
451 break; |
|
452 case KSIPRegistrar: |
|
453 SetParameterL(&iSIPRegistrarExtParameter, aName, aValue); |
|
454 break; |
|
455 default: |
|
456 User::Leave (KErrArgument); |
|
457 } |
|
458 } |
|
459 |
|
460 // ----------------------------------------------------------------------------- |
|
461 // CSIPConcreteProfile::SetAORL |
|
462 // ----------------------------------------------------------------------------- |
|
463 // |
|
464 EXPORT_C void CSIPConcreteProfile::SetAORL(const TDesC8& aAOR) |
|
465 { |
|
466 TUriParser8 parser; |
|
467 User::LeaveIfError(parser.Parse(aAOR)); |
|
468 CUri8* tmp = CUri8::NewL(parser); |
|
469 delete iSIPAORUri8; |
|
470 iSIPAORUri8 = tmp; |
|
471 } |
|
472 |
|
473 // ----------------------------------------------------------------------------- |
|
474 // CSIPConcreteProfile::AOR |
|
475 // ----------------------------------------------------------------------------- |
|
476 // |
|
477 EXPORT_C const TDesC8& CSIPConcreteProfile::AOR() const |
|
478 { |
|
479 return iSIPAORUri8->Uri().UriDes(); |
|
480 } |
|
481 |
|
482 // ----------------------------------------------------------------------------- |
|
483 // CSIPConcreteProfile::AORUri8 |
|
484 // ----------------------------------------------------------------------------- |
|
485 // |
|
486 EXPORT_C const TUriC8& CSIPConcreteProfile::AORUri8() const |
|
487 { |
|
488 return iSIPAORUri8->Uri(); |
|
489 } |
|
490 |
|
491 // ----------------------------------------------------------------------------- |
|
492 // CSIPConcreteProfile::PrivateIdentity |
|
493 // ----------------------------------------------------------------------------- |
|
494 // |
|
495 EXPORT_C const TDesC8& CSIPConcreteProfile::PrivateIdentity() const |
|
496 { |
|
497 return *iSIPPrivateIdentity; |
|
498 } |
|
499 |
|
500 // ----------------------------------------------------------------------------- |
|
501 // CSIPConcreteProfile::SetPrivateIdentityL |
|
502 // ----------------------------------------------------------------------------- |
|
503 // |
|
504 EXPORT_C void CSIPConcreteProfile::SetPrivateIdentityL( |
|
505 const TDesC8& aPrivateIdentity) |
|
506 { |
|
507 HBufC8* tmp = aPrivateIdentity.AllocL(); |
|
508 delete iSIPPrivateIdentity; |
|
509 iSIPPrivateIdentity = tmp; |
|
510 } |
|
511 |
|
512 // ----------------------------------------------------------------------------- |
|
513 // CSIPConcreteProfile::SetProviderNameL |
|
514 // ----------------------------------------------------------------------------- |
|
515 // |
|
516 EXPORT_C void CSIPConcreteProfile::SetProviderNameL( |
|
517 const TDesC8& aProviderName) |
|
518 { |
|
519 HBufC8* tmp = aProviderName.AllocL(); |
|
520 delete iSIPProviderName; |
|
521 iSIPProviderName = tmp; |
|
522 } |
|
523 |
|
524 // ----------------------------------------------------------------------------- |
|
525 // CSIPConcreteProfile::ProviderName |
|
526 // ----------------------------------------------------------------------------- |
|
527 // |
|
528 EXPORT_C const TDesC8& CSIPConcreteProfile::ProviderName() const |
|
529 { |
|
530 return *iSIPProviderName; |
|
531 } |
|
532 |
|
533 // ----------------------------------------------------------------------------- |
|
534 // CSIPConcreteProfile::ExtensionParameter |
|
535 // ----------------------------------------------------------------------------- |
|
536 // |
|
537 EXPORT_C TInt |
|
538 CSIPConcreteProfile::ExtensionParameter(TUint aID, TUint32& aValue) const |
|
539 { |
|
540 TInt index = ExtensionIntParamIndex(aID); |
|
541 if (index != KErrNotFound) |
|
542 { |
|
543 aValue = iExtensionIntParams[index].Value(); |
|
544 return KErrNone; |
|
545 } |
|
546 |
|
547 return KErrNotFound; |
|
548 } |
|
549 |
|
550 // ----------------------------------------------------------------------------- |
|
551 // CSIPConcreteProfile::ExtensionParameter |
|
552 // ----------------------------------------------------------------------------- |
|
553 // |
|
554 EXPORT_C TInt CSIPConcreteProfile::ExtensionParameter( |
|
555 TUint aID, |
|
556 TBool& aValue) const |
|
557 { |
|
558 TInt index = ExtensionBoolParamIndex(aID); |
|
559 if (index != KErrNotFound) |
|
560 { |
|
561 aValue = iExtensionBoolParams[index].Value(); |
|
562 return KErrNone; |
|
563 } |
|
564 |
|
565 return KErrNotFound; |
|
566 } |
|
567 |
|
568 // ----------------------------------------------------------------------------- |
|
569 // CSIPConcreteProfile::ExtensionParameter |
|
570 // ----------------------------------------------------------------------------- |
|
571 // |
|
572 EXPORT_C TInt CSIPConcreteProfile::ExtensionParameter( |
|
573 TUint aID, |
|
574 TDesC8 const *& aValue) const |
|
575 { |
|
576 TInt index = ExtensionDescrParamIndex(aID); |
|
577 if (index != KErrNotFound) |
|
578 { |
|
579 aValue = &iExtensionDescrParams[index]->Value(); |
|
580 return KErrNone; |
|
581 } |
|
582 |
|
583 return KErrNotFound; |
|
584 } |
|
585 |
|
586 // ----------------------------------------------------------------------------- |
|
587 // CSIPConcreteProfile::ExtensionParameter |
|
588 // ----------------------------------------------------------------------------- |
|
589 // |
|
590 EXPORT_C TInt CSIPConcreteProfile::ExtensionParameter( |
|
591 TUint aID, |
|
592 MDesC8Array const *& aValue) const |
|
593 { |
|
594 TInt index = ExtensionDescrArrayParamIndex(aID); |
|
595 if (index != KErrNotFound) |
|
596 { |
|
597 aValue = &iExtensionDescrArrayParams[index]->Value(); |
|
598 return KErrNone; |
|
599 } |
|
600 |
|
601 return KErrNotFound; |
|
602 } |
|
603 |
|
604 // ----------------------------------------------------------------------------- |
|
605 // CSIPConcreteProfile::SetExtensionParameterL |
|
606 // If parameter with the same ID already exists, remove the old parameter. |
|
607 // ----------------------------------------------------------------------------- |
|
608 // |
|
609 EXPORT_C void CSIPConcreteProfile::SetExtensionParameterL( |
|
610 TUint32 aID, |
|
611 TUint32 aValue) |
|
612 { |
|
613 TInt index = ExtensionIntParamIndex(aID); |
|
614 if (index != KErrNotFound) |
|
615 { |
|
616 iExtensionIntParams.Remove(index); |
|
617 } |
|
618 |
|
619 TExtensionIntParam param(aID, aValue); |
|
620 iExtensionIntParams.AppendL(param); |
|
621 } |
|
622 |
|
623 // ----------------------------------------------------------------------------- |
|
624 // CSIPConcreteProfile::SetExtensionParameterL |
|
625 // If parameter with the same ID already exists, remove the old parameter. |
|
626 // ----------------------------------------------------------------------------- |
|
627 // |
|
628 EXPORT_C void CSIPConcreteProfile::SetExtensionParameterL( |
|
629 TUint32 aID, |
|
630 TBool aValue) |
|
631 { |
|
632 TInt index = ExtensionBoolParamIndex(aID); |
|
633 if (index != KErrNotFound) |
|
634 { |
|
635 iExtensionBoolParams.Remove(index); |
|
636 } |
|
637 |
|
638 TExtensionBoolParam param(aID, aValue); |
|
639 iExtensionBoolParams.AppendL(param); |
|
640 } |
|
641 |
|
642 // ----------------------------------------------------------------------------- |
|
643 // CSIPConcreteProfile::SetExtensionParameterL |
|
644 // If parameter with the same ID already exists, remove the old parameter. |
|
645 // ----------------------------------------------------------------------------- |
|
646 // |
|
647 EXPORT_C void CSIPConcreteProfile::SetExtensionParameterL( |
|
648 TUint32 aID, |
|
649 const TDesC8& aValue) |
|
650 { |
|
651 TInt index = ExtensionDescrParamIndex(aID); |
|
652 if (index != KErrNotFound) |
|
653 { |
|
654 CExtensionDescrParam* param = iExtensionDescrParams[index]; |
|
655 iExtensionDescrParams.Remove(index); |
|
656 delete param; |
|
657 } |
|
658 |
|
659 if (aValue.Length() > 0) |
|
660 { |
|
661 CExtensionDescrParam* param = CExtensionDescrParam::NewLC(aID, aValue); |
|
662 iExtensionDescrParams.AppendL(param); |
|
663 CleanupStack::Pop(param); |
|
664 } |
|
665 |
|
666 TUint32 iVal; |
|
667 if(aID == KSIPAccessPointName && !IapId()) |
|
668 { |
|
669 iVal = FetchIAPIDL(aValue); |
|
670 SetIapId(iVal); |
|
671 } |
|
672 |
|
673 |
|
674 if(aID == KSIPSnapName && ExtensionParameter(KSIPSnapId, iVal) != KErrNone ) |
|
675 { |
|
676 iVal = FetchSNAPIDL(aValue); |
|
677 SetExtensionParameterL(KSIPSnapId,iVal); |
|
678 } |
|
679 |
|
680 } |
|
681 |
|
682 // ----------------------------------------------------------------------------- |
|
683 // CSIPConcreteProfile::SetExtensionParameterL |
|
684 // If parameter with the same ID already exists, remove the old parameter. |
|
685 // ----------------------------------------------------------------------------- |
|
686 // |
|
687 EXPORT_C void CSIPConcreteProfile::SetExtensionParameterL( |
|
688 TUint32 aID, |
|
689 const MDesC8Array& aValue) |
|
690 { |
|
691 TInt index = ExtensionDescrArrayParamIndex(aID); |
|
692 if (index != KErrNotFound) |
|
693 { |
|
694 CExtensionDescrArrayParam* param = iExtensionDescrArrayParams[index]; |
|
695 iExtensionDescrArrayParams.Remove(index); |
|
696 delete param; |
|
697 } |
|
698 |
|
699 if (aValue.MdcaCount() > 0) |
|
700 { |
|
701 CExtensionDescrArrayParam* param = |
|
702 CExtensionDescrArrayParam::NewLC(aID, aValue); |
|
703 iExtensionDescrArrayParams.AppendL(param); |
|
704 CleanupStack::Pop(param); |
|
705 } |
|
706 } |
|
707 |
|
708 // ----------------------------------------------------------------------------- |
|
709 // CSIPConcreteProfile::ExtensionIntParamIndex |
|
710 // ----------------------------------------------------------------------------- |
|
711 // |
|
712 TInt CSIPConcreteProfile::ExtensionIntParamIndex(TUint32 aID) const |
|
713 { |
|
714 for (TInt i = 0; i < iExtensionIntParams.Count(); ++i) |
|
715 { |
|
716 if (iExtensionIntParams[i].ID() == aID) |
|
717 { |
|
718 return i; |
|
719 } |
|
720 } |
|
721 return KErrNotFound; |
|
722 } |
|
723 |
|
724 // ----------------------------------------------------------------------------- |
|
725 // CSIPConcreteProfile::ExtensionBoolParamIndex |
|
726 // ----------------------------------------------------------------------------- |
|
727 // |
|
728 TInt CSIPConcreteProfile::ExtensionBoolParamIndex(TUint32 aID) const |
|
729 { |
|
730 for (TInt i = 0; i < iExtensionBoolParams.Count(); ++i) |
|
731 { |
|
732 if (iExtensionBoolParams[i].ID() == aID) |
|
733 { |
|
734 return i; |
|
735 } |
|
736 } |
|
737 return KErrNotFound; |
|
738 } |
|
739 |
|
740 // ----------------------------------------------------------------------------- |
|
741 // CSIPConcreteProfile::ExtensionDescrParamIndex |
|
742 // ----------------------------------------------------------------------------- |
|
743 // |
|
744 TInt CSIPConcreteProfile::ExtensionDescrParamIndex(TUint32 aID) const |
|
745 { |
|
746 for (TInt i = 0; i < iExtensionDescrParams.Count(); ++i) |
|
747 { |
|
748 if (iExtensionDescrParams[i]->ID() == aID) |
|
749 { |
|
750 return i; |
|
751 } |
|
752 } |
|
753 return KErrNotFound; |
|
754 } |
|
755 |
|
756 // ----------------------------------------------------------------------------- |
|
757 // CSIPConcreteProfile::ExtensionDescrArrayParamIndex |
|
758 // ----------------------------------------------------------------------------- |
|
759 // |
|
760 TInt CSIPConcreteProfile::ExtensionDescrArrayParamIndex(TUint32 aID) const |
|
761 { |
|
762 for (TInt i = 0; i < iExtensionDescrArrayParams.Count(); ++i) |
|
763 { |
|
764 if (iExtensionDescrArrayParams[i]->ID() == aID) |
|
765 { |
|
766 return i; |
|
767 } |
|
768 } |
|
769 return KErrNotFound; |
|
770 } |
|
771 |
|
772 // ----------------------------------------------------------------------------- |
|
773 // CSIPConcreteProfile::SetDefault |
|
774 // ----------------------------------------------------------------------------- |
|
775 // |
|
776 EXPORT_C void CSIPConcreteProfile::SetDefault(TBool aOn) |
|
777 { |
|
778 iDefaultProfile = aOn; |
|
779 } |
|
780 |
|
781 // ----------------------------------------------------------------------------- |
|
782 // CSIPConcreteProfile::IsDefault |
|
783 // ----------------------------------------------------------------------------- |
|
784 // |
|
785 EXPORT_C TBool CSIPConcreteProfile::IsDefault() const |
|
786 { |
|
787 //This parameter is set as ETrue, only temporarily. |
|
788 //The value of iDefaultProfile is normally EFalse. |
|
789 return iDefaultProfile; |
|
790 } |
|
791 |
|
792 // ----------------------------------------------------------------------------- |
|
793 // CSIPConcreteProfile::EnableSigComp |
|
794 // ----------------------------------------------------------------------------- |
|
795 // |
|
796 EXPORT_C void CSIPConcreteProfile::EnableSigComp(TBool aOn) |
|
797 { |
|
798 iSIPSigComp = aOn; |
|
799 } |
|
800 |
|
801 // ----------------------------------------------------------------------------- |
|
802 // CSIPConcreteProfile::IsSigCompEnabled |
|
803 // ----------------------------------------------------------------------------- |
|
804 // |
|
805 EXPORT_C TBool CSIPConcreteProfile::IsSigCompEnabled() const |
|
806 { |
|
807 return iSIPSigComp; |
|
808 } |
|
809 |
|
810 // ----------------------------------------------------------------------------- |
|
811 // CSIPConcreteProfile::EnableSecurityNegotiation |
|
812 // ----------------------------------------------------------------------------- |
|
813 // |
|
814 EXPORT_C void CSIPConcreteProfile::EnableSecurityNegotiation(TBool aOn) |
|
815 { |
|
816 iSecurityNegotiation = aOn; |
|
817 } |
|
818 |
|
819 // ----------------------------------------------------------------------------- |
|
820 // CSIPConcreteProfile::IsSecurityNegotiationEnabled |
|
821 // ----------------------------------------------------------------------------- |
|
822 // |
|
823 EXPORT_C TBool CSIPConcreteProfile::IsSecurityNegotiationEnabled() const |
|
824 { |
|
825 return iSecurityNegotiation; |
|
826 } |
|
827 |
|
828 // ----------------------------------------------------------------------------- |
|
829 // CSIPConcreteProfile::SetAutoRegistrationEnabled |
|
830 // ----------------------------------------------------------------------------- |
|
831 // |
|
832 EXPORT_C void CSIPConcreteProfile::SetAutoRegistrationEnabled(TBool aOn) |
|
833 { |
|
834 iSIPAutoRegistered = aOn; |
|
835 } |
|
836 |
|
837 // ----------------------------------------------------------------------------- |
|
838 // CSIPConcreteProfile::IsAutoRegistrationEnabled |
|
839 // ----------------------------------------------------------------------------- |
|
840 // |
|
841 EXPORT_C TBool CSIPConcreteProfile::IsAutoRegistrationEnabled() const |
|
842 { |
|
843 return iSIPAutoRegistered; |
|
844 } |
|
845 |
|
846 // ----------------------------------------------------------------------------- |
|
847 // CSIPConcreteProfile::TStatus |
|
848 // ----------------------------------------------------------------------------- |
|
849 // |
|
850 EXPORT_C CSIPConcreteProfile::TStatus CSIPConcreteProfile::Status() const |
|
851 { |
|
852 return iStatus; |
|
853 } |
|
854 |
|
855 // ----------------------------------------------------------------------------- |
|
856 // CSIPConcreteProfile::SetStatus |
|
857 // ----------------------------------------------------------------------------- |
|
858 // |
|
859 EXPORT_C void CSIPConcreteProfile::SetStatus( |
|
860 CSIPConcreteProfile::TStatus aStatus) |
|
861 { |
|
862 iStatus = aStatus; |
|
863 } |
|
864 |
|
865 // ----------------------------------------------------------------------------- |
|
866 // CSIPConcreteProfile::ContextId |
|
867 // ----------------------------------------------------------------------------- |
|
868 // |
|
869 EXPORT_C TUint32 CSIPConcreteProfile::ContextId() const |
|
870 { |
|
871 return iContextId; |
|
872 } |
|
873 |
|
874 // ----------------------------------------------------------------------------- |
|
875 // CSIPConcreteProfile::SetContextId |
|
876 // ----------------------------------------------------------------------------- |
|
877 // |
|
878 EXPORT_C void CSIPConcreteProfile::SetContextId(TUint32 id) |
|
879 { |
|
880 iContextId = id; |
|
881 } |
|
882 |
|
883 // ----------------------------------------------------------------------------- |
|
884 // CSIPConcreteProfile::SetLastRegistrationError |
|
885 // ----------------------------------------------------------------------------- |
|
886 // |
|
887 EXPORT_C void CSIPConcreteProfile::SetLastRegistrationError(TInt aError) |
|
888 { |
|
889 iLastRegistrationError = aError; |
|
890 } |
|
891 |
|
892 // ----------------------------------------------------------------------------- |
|
893 // CSIPConcreteProfile::LastRegistrationError |
|
894 // ----------------------------------------------------------------------------- |
|
895 // |
|
896 EXPORT_C TInt CSIPConcreteProfile::LastRegistrationError() const |
|
897 { |
|
898 return iLastRegistrationError; |
|
899 } |
|
900 |
|
901 // ----------------------------------------------------------------------------- |
|
902 // CSIPConcreteProfile::InternalizeL |
|
903 // ----------------------------------------------------------------------------- |
|
904 // |
|
905 EXPORT_C CSIPConcreteProfile* CSIPConcreteProfile::InternalizeL( |
|
906 RReadStream& aReadStream, |
|
907 TBool aAll) |
|
908 { |
|
909 CSIPConcreteProfile* self = new(ELeave)CSIPConcreteProfile(); |
|
910 CleanupStack::PushL(self); |
|
911 self->DoInternalizeL(aReadStream, aAll); |
|
912 CleanupStack::Pop(self); |
|
913 return self; |
|
914 } |
|
915 |
|
916 // ----------------------------------------------------------------------------- |
|
917 // CSIPConcreteProfile::ExternalizeL |
|
918 // ----------------------------------------------------------------------------- |
|
919 // |
|
920 EXPORT_C void CSIPConcreteProfile::ExternalizeL( |
|
921 RWriteStream& aWriteStream, |
|
922 TBool aAll) const |
|
923 { |
|
924 TInt i = 0; |
|
925 |
|
926 aWriteStream.WriteUint32L(iSIPProfileId); |
|
927 |
|
928 aWriteStream.WriteUint32L(iSIPIAPId); |
|
929 |
|
930 aWriteStream.WriteInt32L(iSIPProfileType.iSIPProfileName.Length()); |
|
931 aWriteStream.WriteL(iSIPProfileType.iSIPProfileName); |
|
932 aWriteStream.WriteUint8L(iSIPProfileType.iSIPProfileClass); |
|
933 |
|
934 aWriteStream.WriteInt32L(iSIPRegistrar->Length()); |
|
935 aWriteStream.WriteL(*iSIPRegistrar); |
|
936 |
|
937 aWriteStream.WriteUint32L(iSIPRegistrarParameter.Count()); |
|
938 for (i = 0; i < iSIPRegistrarParameter.Count(); i++) |
|
939 { |
|
940 CSIPProfileParameter* param = iSIPRegistrarParameter[i]; |
|
941 param->ExternalizeL(aWriteStream); |
|
942 } |
|
943 |
|
944 aWriteStream.WriteUint32L(iSIPRegistrarExtParameter.Count()); |
|
945 for (i = 0; i < iSIPRegistrarExtParameter.Count(); i++) |
|
946 { |
|
947 CSIPProfileParameter* param = iSIPRegistrarExtParameter[i]; |
|
948 param->ExternalizeL(aWriteStream); |
|
949 } |
|
950 |
|
951 aWriteStream.WriteInt32L(iSIPOutboundProxy->Length()); |
|
952 aWriteStream.WriteL(*iSIPOutboundProxy); |
|
953 |
|
954 aWriteStream.WriteUint32L(iSIPOutboundProxyParameter.Count()); |
|
955 for (i = 0; i < iSIPOutboundProxyParameter.Count(); i++) |
|
956 { |
|
957 CSIPProfileParameter* param = iSIPOutboundProxyParameter[i]; |
|
958 param->ExternalizeL(aWriteStream); |
|
959 } |
|
960 |
|
961 aWriteStream.WriteUint32L(iSIPOutboundProxyExtParameter.Count()); |
|
962 for (i = 0; i < iSIPOutboundProxyExtParameter.Count(); i++) |
|
963 { |
|
964 CSIPProfileParameter* param = iSIPOutboundProxyExtParameter[i]; |
|
965 param->ExternalizeL(aWriteStream); |
|
966 } |
|
967 |
|
968 aWriteStream.WriteInt32L(iSIPProviderName->Length()); |
|
969 aWriteStream.WriteL(*iSIPProviderName); |
|
970 |
|
971 aWriteStream.WriteInt32L(iSIPPrivateIdentity->Length()); |
|
972 aWriteStream.WriteL(*iSIPPrivateIdentity); |
|
973 |
|
974 aWriteStream.WriteInt32L(AOR().Length()); |
|
975 aWriteStream.WriteL(AOR()); |
|
976 |
|
977 aWriteStream.WriteInt8L(iSIPSigComp); |
|
978 aWriteStream.WriteInt8L(iSecurityNegotiation); |
|
979 aWriteStream.WriteInt8L(iSIPAutoRegistered); |
|
980 aWriteStream.WriteInt8L(iDynamicProxyResolving); |
|
981 |
|
982 ExternalizeDesArrayL(*iSIPContactHeaderParams,aWriteStream); |
|
983 ExternalizeDesArrayL(*iSIPHeaders,aWriteStream); |
|
984 |
|
985 if (aAll) |
|
986 { |
|
987 aWriteStream.WriteInt8L(iStatus); |
|
988 aWriteStream.WriteUint32L(iContextId); |
|
989 aWriteStream.WriteInt8L(iDefaultProfile); |
|
990 aWriteStream.WriteUint32L(iLastRegistrationError); |
|
991 } |
|
992 |
|
993 //Extension parameters |
|
994 aWriteStream.WriteUint32L(iExtensionIntParams.Count()); |
|
995 for (i = 0; i < iExtensionIntParams.Count(); ++i) |
|
996 { |
|
997 iExtensionIntParams[i].ExternalizeL(aWriteStream); |
|
998 } |
|
999 |
|
1000 aWriteStream.WriteUint32L(iExtensionBoolParams.Count()); |
|
1001 for (i = 0; i < iExtensionBoolParams.Count(); ++i) |
|
1002 { |
|
1003 iExtensionBoolParams[i].ExternalizeL(aWriteStream); |
|
1004 } |
|
1005 |
|
1006 aWriteStream.WriteUint32L(iExtensionDescrParams.Count()); |
|
1007 for (i = 0; i < iExtensionDescrParams.Count(); ++i) |
|
1008 { |
|
1009 iExtensionDescrParams[i]->ExternalizeL(aWriteStream); |
|
1010 } |
|
1011 |
|
1012 aWriteStream.WriteUint32L(iExtensionDescrArrayParams.Count()); |
|
1013 for (i = 0; i < iExtensionDescrArrayParams.Count(); ++i) |
|
1014 { |
|
1015 iExtensionDescrArrayParams[i]->ExternalizeL(aWriteStream); |
|
1016 } |
|
1017 } |
|
1018 |
|
1019 // ----------------------------------------------------------------------------- |
|
1020 // CSIPConcreteProfile::ExternalizedSizeL |
|
1021 // ----------------------------------------------------------------------------- |
|
1022 // |
|
1023 EXPORT_C TUint CSIPConcreteProfile::ExternalizedSizeL(TBool aAll) const |
|
1024 { |
|
1025 TUint size = 14 * sizeof(TUint32) + |
|
1026 5 * sizeof(TInt8) + |
|
1027 iSIPProfileType.iSIPProfileName.Length() + |
|
1028 iSIPRegistrar->Length() + |
|
1029 iSIPOutboundProxy->Length() + |
|
1030 iSIPProviderName->Length() + |
|
1031 iSIPPrivateIdentity->Length() + |
|
1032 AOR().Length(); |
|
1033 TInt i(0); |
|
1034 for (i = 0; i < iSIPRegistrarParameter.Count(); i++) |
|
1035 { |
|
1036 CSIPProfileParameter* param = iSIPRegistrarParameter[i]; |
|
1037 size = size + param->ExternalizedSizeL(); |
|
1038 } |
|
1039 |
|
1040 for (i = 0; i < iSIPRegistrarExtParameter.Count(); i++) |
|
1041 { |
|
1042 CSIPProfileParameter* param = iSIPRegistrarExtParameter[i]; |
|
1043 size = size + param->ExternalizedSizeL(); |
|
1044 } |
|
1045 |
|
1046 for (i = 0; i < iSIPOutboundProxyParameter.Count(); i++) |
|
1047 { |
|
1048 CSIPProfileParameter* param = iSIPOutboundProxyParameter[i]; |
|
1049 size = size + param->ExternalizedSizeL(); |
|
1050 } |
|
1051 |
|
1052 for (i = 0; i < iSIPOutboundProxyExtParameter.Count(); i++) |
|
1053 { |
|
1054 CSIPProfileParameter* param = iSIPOutboundProxyExtParameter[i]; |
|
1055 size = size + param->ExternalizedSizeL(); |
|
1056 } |
|
1057 |
|
1058 for (i = 0; i < iSIPContactHeaderParams->Count(); i++) |
|
1059 { |
|
1060 const TPtrC8& value = (*iSIPContactHeaderParams)[i]; |
|
1061 size = size + sizeof(TInt32) + value.Length(); |
|
1062 } |
|
1063 |
|
1064 for (i = 0; i < iSIPHeaders->Count(); i++) |
|
1065 { |
|
1066 const TPtrC8& value = (*iSIPHeaders)[i]; |
|
1067 size = size + sizeof(TInt32) + value.Length(); |
|
1068 } |
|
1069 |
|
1070 if (aAll) |
|
1071 { |
|
1072 size = size + 10; // 2 + 8 |
|
1073 } |
|
1074 |
|
1075 //Every extension parameter array writes a Uint32 that tells how many |
|
1076 //elements that array has. |
|
1077 const TInt KAmountOfExtensionArrays = 4; |
|
1078 size = size + KAmountOfExtensionArrays * sizeof(TUint32); |
|
1079 |
|
1080 for (i = 0; i < iExtensionIntParams.Count(); ++i) |
|
1081 { |
|
1082 size = size + iExtensionIntParams[i].ExternalizedSizeL(); |
|
1083 } |
|
1084 |
|
1085 for (i = 0; i < iExtensionBoolParams.Count(); ++i) |
|
1086 { |
|
1087 size = size + iExtensionBoolParams[i].ExternalizedSizeL(); |
|
1088 } |
|
1089 |
|
1090 for (i = 0; i < iExtensionDescrParams.Count(); ++i) |
|
1091 { |
|
1092 size = size + iExtensionDescrParams[i]->ExternalizedSizeL(); |
|
1093 } |
|
1094 |
|
1095 for (i = 0; i < iExtensionDescrArrayParams.Count(); ++i) |
|
1096 { |
|
1097 size = size + iExtensionDescrArrayParams[i]->ExternalizedSizeL(); |
|
1098 } |
|
1099 |
|
1100 return size; |
|
1101 } |
|
1102 |
|
1103 // ----------------------------------------------------------------------------- |
|
1104 // CSIPConcreteProfile::operator== |
|
1105 // ----------------------------------------------------------------------------- |
|
1106 // |
|
1107 TBool CSIPConcreteProfile::operator==( |
|
1108 const CSIPConcreteProfile& aProfile) |
|
1109 { |
|
1110 iLastComparisonResult = 0; |
|
1111 |
|
1112 if (iSIPProfileId != aProfile.Id()) |
|
1113 { |
|
1114 iLastComparisonResult = iLastComparisonResult | EId; |
|
1115 } |
|
1116 |
|
1117 if (iSIPIAPId != aProfile.IapId()) |
|
1118 { |
|
1119 iLastComparisonResult = iLastComparisonResult | EIAPId; |
|
1120 } |
|
1121 |
|
1122 if ( |
|
1123 (iSIPProfileType.iSIPProfileName.Compare(aProfile.ProfileType().iSIPProfileName) != 0)|| |
|
1124 (iSIPProfileType.iSIPProfileClass != aProfile.ProfileType().iSIPProfileClass) |
|
1125 ) |
|
1126 { |
|
1127 iLastComparisonResult = iLastComparisonResult | ETypeInfo; |
|
1128 } |
|
1129 |
|
1130 if (iSIPRegistrar->Compare(aProfile.Server(KSIPRegistrar)) != 0) |
|
1131 { |
|
1132 iLastComparisonResult = iLastComparisonResult | ERegistrar; |
|
1133 } |
|
1134 |
|
1135 if (iSIPOutboundProxy->Compare(aProfile.Server(KSIPOutboundProxy)) != 0) |
|
1136 { |
|
1137 iLastComparisonResult = iLastComparisonResult | EOutboundProxy; |
|
1138 } |
|
1139 |
|
1140 if (iSIPPrivateIdentity->Compare(aProfile.PrivateIdentity()) != 0) |
|
1141 { |
|
1142 iLastComparisonResult = iLastComparisonResult | EPrivateIdentity; |
|
1143 } |
|
1144 |
|
1145 if (iSIPProviderName->Compare(aProfile.ProviderName()) != 0) |
|
1146 { |
|
1147 iLastComparisonResult = iLastComparisonResult | EName; |
|
1148 } |
|
1149 |
|
1150 |
|
1151 if ((iSIPRegistrarParameter.Count() != aProfile.iSIPRegistrarParameter.Count())|| |
|
1152 (ServerParameter(KSIPRegistrar, KSIPDigestRealm). |
|
1153 Compare(aProfile.ServerParameter(KSIPRegistrar, KSIPDigestRealm)) != 0)|| |
|
1154 (ServerParameter(KSIPRegistrar, KSIPDigestUserName). |
|
1155 Compare(aProfile.ServerParameter(KSIPRegistrar, KSIPDigestUserName)) != 0)|| |
|
1156 (ServerParameter(KSIPRegistrar, KSIPDigestPassword). |
|
1157 Compare(aProfile.ServerParameter(KSIPRegistrar, KSIPDigestPassword)) != 0) |
|
1158 ) |
|
1159 { |
|
1160 iLastComparisonResult = iLastComparisonResult | ERegistrarParameters; |
|
1161 } |
|
1162 |
|
1163 |
|
1164 if (iSIPRegistrarExtParameter.Count() != iSIPRegistrarExtParameter.Count()) |
|
1165 { |
|
1166 iLastComparisonResult = iLastComparisonResult | ERegistrarExtensionParameters; |
|
1167 } |
|
1168 |
|
1169 TInt i = 0; |
|
1170 if (iLastComparisonResult != ERegistrarExtensionParameters) |
|
1171 { |
|
1172 for (i = 0; i < iSIPRegistrarExtParameter.Count(); i++) |
|
1173 { |
|
1174 CSIPProfileParameter* param = iSIPRegistrarExtParameter[i]; |
|
1175 if (param->Value().Compare(aProfile.ServerExtensionParameter(KSIPRegistrar, |
|
1176 param->Key())) != 0) |
|
1177 { |
|
1178 iLastComparisonResult = iLastComparisonResult | ERegistrarExtensionParameters; |
|
1179 } |
|
1180 } |
|
1181 } |
|
1182 |
|
1183 if ( |
|
1184 (iSIPOutboundProxyParameter.Count() != aProfile.iSIPOutboundProxyParameter.Count())|| |
|
1185 (ServerParameter(KSIPOutboundProxy, KSIPDigestRealm). |
|
1186 Compare(aProfile.ServerParameter(KSIPOutboundProxy, KSIPDigestRealm)) != 0)|| |
|
1187 (ServerParameter(KSIPOutboundProxy, KSIPDigestUserName). |
|
1188 Compare(aProfile.ServerParameter(KSIPOutboundProxy, KSIPDigestUserName)) != 0)|| |
|
1189 (ServerParameter(KSIPOutboundProxy, KSIPDigestPassword). |
|
1190 Compare(aProfile.ServerParameter(KSIPOutboundProxy, KSIPDigestPassword)) != 0) |
|
1191 ) |
|
1192 { |
|
1193 iLastComparisonResult = iLastComparisonResult | EOutboundProxyParameters; |
|
1194 } |
|
1195 |
|
1196 if (iSIPOutboundProxyExtParameter.Count() != |
|
1197 aProfile.iSIPOutboundProxyExtParameter.Count()) |
|
1198 { |
|
1199 iLastComparisonResult = iLastComparisonResult | EOutboundProxyExtensionParameters; |
|
1200 } |
|
1201 |
|
1202 if (iLastComparisonResult != EOutboundProxyExtensionParameters) |
|
1203 { |
|
1204 for (i = 0; i < iSIPOutboundProxyExtParameter.Count(); i++) |
|
1205 { |
|
1206 CSIPProfileParameter* param = iSIPOutboundProxyExtParameter[i]; |
|
1207 if (param->Value().Compare( |
|
1208 aProfile.ServerExtensionParameter(KSIPOutboundProxy,param->Key())) != 0) |
|
1209 { |
|
1210 iLastComparisonResult = |
|
1211 iLastComparisonResult | EOutboundProxyExtensionParameters; |
|
1212 } |
|
1213 } |
|
1214 } |
|
1215 |
|
1216 TInt aorComparisonErr = iSIPAORUri8->Uri().Equivalent(aProfile.AORUri8()); |
|
1217 if (aorComparisonErr != KErrNone && |
|
1218 aorComparisonErr != KErrNoMemory) |
|
1219 { |
|
1220 iLastComparisonResult = iLastComparisonResult | EAOR; |
|
1221 } |
|
1222 |
|
1223 if (iSIPSigComp != aProfile.IsSigCompEnabled()) |
|
1224 { |
|
1225 iLastComparisonResult = iLastComparisonResult | ESigComp; |
|
1226 } |
|
1227 |
|
1228 if (iSecurityNegotiation != aProfile.IsSecurityNegotiationEnabled()) |
|
1229 { |
|
1230 iLastComparisonResult = iLastComparisonResult | ESecurityNegotiation; |
|
1231 } |
|
1232 |
|
1233 if (iSIPAutoRegistered != aProfile.IsAutoRegistrationEnabled()) |
|
1234 { |
|
1235 iLastComparisonResult = iLastComparisonResult | EAutoRegistration; |
|
1236 } |
|
1237 |
|
1238 if (iDynamicProxy->Compare(aProfile.DynamicProxy()) != 0) |
|
1239 { |
|
1240 iLastComparisonResult = iLastComparisonResult | EProxyResolving; |
|
1241 } |
|
1242 |
|
1243 TBool done = EFalse; |
|
1244 const MDesC8Array& params = aProfile.ContactHeaderParams(); |
|
1245 if (iSIPContactHeaderParams->Count() != params.MdcaCount()) |
|
1246 { |
|
1247 iLastComparisonResult = iLastComparisonResult | EContactHeaderParams; |
|
1248 done = ETrue; |
|
1249 } |
|
1250 |
|
1251 |
|
1252 for (i = 0; i < params.MdcaCount() && !done; i++) |
|
1253 { |
|
1254 TInt pos = 0; |
|
1255 |
|
1256 if (iSIPContactHeaderParams->Find(params.MdcaPoint(i), pos) != 0) |
|
1257 { |
|
1258 iLastComparisonResult = iLastComparisonResult | EContactHeaderParams; |
|
1259 done = ETrue; |
|
1260 } |
|
1261 } |
|
1262 |
|
1263 const MDesC8Array& headers = aProfile.SIPHeaders(); |
|
1264 if (iSIPHeaders->Count() != headers.MdcaCount()) |
|
1265 { |
|
1266 iLastComparisonResult = iLastComparisonResult | ESIPHeaders; |
|
1267 } |
|
1268 for (i = 0; i < headers.MdcaCount(); i++) |
|
1269 { |
|
1270 TInt pos = 0; |
|
1271 |
|
1272 if (iSIPHeaders->Find(headers.MdcaPoint(i), pos) != 0) |
|
1273 { |
|
1274 iLastComparisonResult = iLastComparisonResult | ESIPHeaders; |
|
1275 } |
|
1276 } |
|
1277 |
|
1278 return iLastComparisonResult == 0; |
|
1279 } |
|
1280 |
|
1281 // ----------------------------------------------------------------------------- |
|
1282 // CSIPConcreteProfile::LastCompareResult |
|
1283 // ----------------------------------------------------------------------------- |
|
1284 // |
|
1285 TInt32 CSIPConcreteProfile::LastCompareResult() const |
|
1286 { |
|
1287 return iLastComparisonResult; |
|
1288 } |
|
1289 |
|
1290 // ----------------------------------------------------------------------------- |
|
1291 // CSIPConcreteProfile::CloneExtensionParamsL |
|
1292 // ----------------------------------------------------------------------------- |
|
1293 // |
|
1294 void CSIPConcreteProfile::CloneExtensionParamsL( |
|
1295 CSIPConcreteProfile& aNewCopy) const |
|
1296 { |
|
1297 TInt i(0); |
|
1298 for (i = 0; i < iExtensionIntParams.Count(); ++i) |
|
1299 { |
|
1300 TExtensionIntParam param = iExtensionIntParams[i]; |
|
1301 aNewCopy.SetExtensionParameterL(param.ID(), param.Value()); |
|
1302 } |
|
1303 |
|
1304 for (i = 0; i < iExtensionBoolParams.Count(); ++i) |
|
1305 { |
|
1306 TExtensionBoolParam param = iExtensionBoolParams[i]; |
|
1307 aNewCopy.SetExtensionParameterL(param.ID(), param.Value()); |
|
1308 } |
|
1309 |
|
1310 for (i = 0; i < iExtensionDescrParams.Count(); ++i) |
|
1311 { |
|
1312 CExtensionDescrParam* param = iExtensionDescrParams[i]; |
|
1313 aNewCopy.SetExtensionParameterL(param->ID(), param->Value()); |
|
1314 } |
|
1315 |
|
1316 for (i = 0; i < iExtensionDescrArrayParams.Count(); ++i) |
|
1317 { |
|
1318 CExtensionDescrArrayParam* param = iExtensionDescrArrayParams[i]; |
|
1319 aNewCopy.SetExtensionParameterL(param->ID(), param->Value()); |
|
1320 } |
|
1321 } |
|
1322 |
|
1323 // ----------------------------------------------------------------------------- |
|
1324 // CSIPConcreteProfile::SetDynamicProxyL |
|
1325 // ----------------------------------------------------------------------------- |
|
1326 // |
|
1327 EXPORT_C const TDesC8& CSIPConcreteProfile::DynamicProxy() const |
|
1328 { |
|
1329 return *iDynamicProxy; |
|
1330 } |
|
1331 |
|
1332 // ----------------------------------------------------------------------------- |
|
1333 // CSIPConcreteProfile::SetDynamicProxyL |
|
1334 // ----------------------------------------------------------------------------- |
|
1335 // |
|
1336 EXPORT_C void CSIPConcreteProfile::SetDynamicProxyL(const TDesC8& aDynamicProxy) |
|
1337 { |
|
1338 HBufC8* tmp = aDynamicProxy.AllocL(); |
|
1339 delete iDynamicProxy; |
|
1340 iDynamicProxy = tmp; |
|
1341 } |
|
1342 |
|
1343 // ----------------------------------------------------------------------------- |
|
1344 // CSIPConcreteProfile::ContactHeaderParams |
|
1345 // ----------------------------------------------------------------------------- |
|
1346 // |
|
1347 EXPORT_C const MDesC8Array& CSIPConcreteProfile::ContactHeaderParams() const |
|
1348 { |
|
1349 return *iSIPContactHeaderParams; |
|
1350 } |
|
1351 |
|
1352 // ----------------------------------------------------------------------------- |
|
1353 // CSIPConcreteProfile::SetContactHeaderParamsL |
|
1354 // ----------------------------------------------------------------------------- |
|
1355 // |
|
1356 EXPORT_C void CSIPConcreteProfile::SetContactHeaderParamsL( |
|
1357 const MDesC8Array& aParams) |
|
1358 { |
|
1359 CDesC8ArrayFlat* tmp = CopyDesArrayL(aParams); |
|
1360 iSIPContactHeaderParams->Reset(); |
|
1361 delete iSIPContactHeaderParams; |
|
1362 iSIPContactHeaderParams = tmp; |
|
1363 } |
|
1364 |
|
1365 // ----------------------------------------------------------------------------- |
|
1366 // CSIPConcreteProfile::RegisteredAORs |
|
1367 // ----------------------------------------------------------------------------- |
|
1368 // |
|
1369 EXPORT_C const MDesC8Array& CSIPConcreteProfile::RegisteredAORs() const |
|
1370 { |
|
1371 return *iSIPRegisteredAORs; |
|
1372 } |
|
1373 |
|
1374 // ----------------------------------------------------------------------------- |
|
1375 // CSIPConcreteProfile::SetRegisteredAORsL |
|
1376 // ----------------------------------------------------------------------------- |
|
1377 // |
|
1378 EXPORT_C void CSIPConcreteProfile::SetRegisteredAORsL( |
|
1379 const MDesC8Array& aParams) |
|
1380 { |
|
1381 CDesC8ArrayFlat* tmp = CopyDesArrayL(aParams); |
|
1382 iSIPRegisteredAORs->Reset(); |
|
1383 delete iSIPRegisteredAORs; |
|
1384 iSIPRegisteredAORs = tmp; |
|
1385 } |
|
1386 |
|
1387 // ----------------------------------------------------------------------------- |
|
1388 // CSIPConcreteProfile::NegotiatedSecurityMechanism |
|
1389 // ----------------------------------------------------------------------------- |
|
1390 // |
|
1391 EXPORT_C const TDesC8& CSIPConcreteProfile::NegotiatedSecurityMechanism() const |
|
1392 { |
|
1393 return *iSIPNegotiatedSecurityMechanism; |
|
1394 } |
|
1395 |
|
1396 // ----------------------------------------------------------------------------- |
|
1397 // CSIPConcreteProfile::SetNegotiatedSecurityMechanismL |
|
1398 // ----------------------------------------------------------------------------- |
|
1399 // |
|
1400 EXPORT_C void CSIPConcreteProfile::SetNegotiatedSecurityMechanismL( |
|
1401 const TDesC8& aMechanism) |
|
1402 { |
|
1403 HBufC8* tmp = aMechanism.AllocL(); |
|
1404 delete iSIPNegotiatedSecurityMechanism; |
|
1405 iSIPNegotiatedSecurityMechanism = tmp; |
|
1406 } |
|
1407 |
|
1408 // ----------------------------------------------------------------------------- |
|
1409 // CSIPConcreteProfile::SIPHeaders |
|
1410 // ----------------------------------------------------------------------------- |
|
1411 // |
|
1412 EXPORT_C const MDesC8Array& CSIPConcreteProfile::SIPHeaders() const |
|
1413 { |
|
1414 return *iSIPHeaders; |
|
1415 } |
|
1416 |
|
1417 // ----------------------------------------------------------------------------- |
|
1418 // CSIPConcreteProfile::SetSIPHeadersL |
|
1419 // ----------------------------------------------------------------------------- |
|
1420 // |
|
1421 EXPORT_C void CSIPConcreteProfile::SetSIPHeadersL(const MDesC8Array& aHeaders) |
|
1422 { |
|
1423 CDesC8ArrayFlat* tmp = CopyDesArrayL(aHeaders); |
|
1424 iSIPHeaders->Reset(); |
|
1425 delete iSIPHeaders; |
|
1426 iSIPHeaders = tmp; |
|
1427 } |
|
1428 |
|
1429 // ----------------------------------------------------------------------------- |
|
1430 // CSIPConcreteProfile::SetEnabled |
|
1431 // ----------------------------------------------------------------------------- |
|
1432 // |
|
1433 EXPORT_C void CSIPConcreteProfile::SetEnabled(TBool aIsEnabled) |
|
1434 { |
|
1435 iIsEnabled = aIsEnabled; |
|
1436 } |
|
1437 |
|
1438 // ----------------------------------------------------------------------------- |
|
1439 // CSIPConcreteProfile::IsEnabled |
|
1440 // ----------------------------------------------------------------------------- |
|
1441 // |
|
1442 EXPORT_C TBool CSIPConcreteProfile::IsEnabled() const |
|
1443 { |
|
1444 return iIsEnabled; |
|
1445 } |
|
1446 |
|
1447 // ----------------------------------------------------------------------------- |
|
1448 // CSIPConcreteProfile::SetStorageId |
|
1449 // ----------------------------------------------------------------------------- |
|
1450 // |
|
1451 EXPORT_C void CSIPConcreteProfile::SetStorageId(TUint32 aId) |
|
1452 { |
|
1453 iStorageId = aId; |
|
1454 } |
|
1455 |
|
1456 // ----------------------------------------------------------------------------- |
|
1457 // CSIPConcreteProfile::StorageId |
|
1458 // ----------------------------------------------------------------------------- |
|
1459 // |
|
1460 EXPORT_C TUint32 CSIPConcreteProfile::StorageId() const |
|
1461 { |
|
1462 return iStorageId; |
|
1463 } |
|
1464 |
|
1465 // ----------------------------------------------------------------------------- |
|
1466 // CSIPConcreteProfile::InternalizeRegisteredAORsL |
|
1467 // ----------------------------------------------------------------------------- |
|
1468 // |
|
1469 EXPORT_C void CSIPConcreteProfile::InternalizeRegisteredAORsL( |
|
1470 RReadStream& aReadStream) |
|
1471 { |
|
1472 CDesC8ArrayFlat* tmp = InternalizeDesArrayL(aReadStream); |
|
1473 iSIPRegisteredAORs->Reset(); |
|
1474 delete iSIPRegisteredAORs; |
|
1475 iSIPRegisteredAORs = tmp; |
|
1476 } |
|
1477 |
|
1478 // ----------------------------------------------------------------------------- |
|
1479 // CSIPConcreteProfile::ExternalizeRegisteredAORsL |
|
1480 // ----------------------------------------------------------------------------- |
|
1481 // |
|
1482 EXPORT_C void CSIPConcreteProfile::ExternalizeRegisteredAORsL( |
|
1483 RWriteStream& aWriteStream) const |
|
1484 { |
|
1485 ExternalizeDesArrayL(*iSIPRegisteredAORs,aWriteStream); |
|
1486 } |
|
1487 |
|
1488 // ----------------------------------------------------------------------------- |
|
1489 // CSIPConcreteProfile::ExternalizedRegisteredAORsSizeL |
|
1490 // ----------------------------------------------------------------------------- |
|
1491 // |
|
1492 EXPORT_C TUint CSIPConcreteProfile::ExternalizedRegisteredAORsSizeL() const |
|
1493 { |
|
1494 TUint size = sizeof(TUint32); |
|
1495 for (TInt i = 0; i < iSIPRegisteredAORs->Count(); i++) |
|
1496 { |
|
1497 const TPtrC8& value = (*iSIPRegisteredAORs)[i]; |
|
1498 size = size + sizeof(TInt32); |
|
1499 size = size + value.Length(); |
|
1500 } |
|
1501 return size; |
|
1502 } |
|
1503 |
|
1504 // ----------------------------------------------------------------------------- |
|
1505 // CSIPConcreteProfile::ExtensionBoolParameterCount |
|
1506 // ----------------------------------------------------------------------------- |
|
1507 // |
|
1508 EXPORT_C TInt CSIPConcreteProfile::ExtensionBoolParameterCount() const |
|
1509 { |
|
1510 return iExtensionBoolParams.Count(); |
|
1511 } |
|
1512 |
|
1513 // ----------------------------------------------------------------------------- |
|
1514 // CSIPConcreteProfile::ExtensionDesArrayParameterCount |
|
1515 // ----------------------------------------------------------------------------- |
|
1516 // |
|
1517 EXPORT_C TInt CSIPConcreteProfile::ExtensionDesArrayParameterCount() const |
|
1518 { |
|
1519 return iExtensionDescrArrayParams.Count(); |
|
1520 } |
|
1521 |
|
1522 // ----------------------------------------------------------------------------- |
|
1523 // CSIPConcreteProfile::ExtensionDesParameterCount |
|
1524 // ----------------------------------------------------------------------------- |
|
1525 // |
|
1526 EXPORT_C TInt CSIPConcreteProfile::ExtensionDesParameterCount() const |
|
1527 { |
|
1528 return iExtensionDescrParams.Count(); |
|
1529 } |
|
1530 |
|
1531 // ----------------------------------------------------------------------------- |
|
1532 // CSIPConcreteProfile::ExtensionIntParameterCount |
|
1533 // ----------------------------------------------------------------------------- |
|
1534 // |
|
1535 EXPORT_C TInt CSIPConcreteProfile::ExtensionIntParameterCount() const |
|
1536 { |
|
1537 return iExtensionIntParams.Count(); |
|
1538 } |
|
1539 |
|
1540 // ----------------------------------------------------------------------------- |
|
1541 // CSIPConcreteProfile::ExtensionParameter |
|
1542 // ----------------------------------------------------------------------------- |
|
1543 // |
|
1544 EXPORT_C TInt CSIPConcreteProfile::ExtensionParameter( |
|
1545 TInt aIndex, |
|
1546 TUint& aID, |
|
1547 TUint32& aValue) const |
|
1548 { |
|
1549 TInt retVal(KErrNotFound); |
|
1550 if (aIndex < iExtensionIntParams.Count()) |
|
1551 { |
|
1552 aID = iExtensionIntParams[aIndex].ID(); |
|
1553 aValue = iExtensionIntParams[aIndex].Value(); |
|
1554 retVal = KErrNone; |
|
1555 } |
|
1556 return retVal; |
|
1557 } |
|
1558 |
|
1559 // ----------------------------------------------------------------------------- |
|
1560 // CSIPConcreteProfile::ExtensionParameter |
|
1561 // ----------------------------------------------------------------------------- |
|
1562 // |
|
1563 EXPORT_C TInt CSIPConcreteProfile::ExtensionParameter( |
|
1564 TInt aIndex, |
|
1565 TUint& aID, |
|
1566 TBool& aValue ) const |
|
1567 { |
|
1568 TInt retVal(KErrNotFound); |
|
1569 if (aIndex < iExtensionBoolParams.Count()) |
|
1570 { |
|
1571 aID = iExtensionBoolParams[aIndex].ID(); |
|
1572 aValue = iExtensionBoolParams[aIndex].Value(); |
|
1573 retVal = KErrNone; |
|
1574 } |
|
1575 return retVal; |
|
1576 } |
|
1577 |
|
1578 // ----------------------------------------------------------------------------- |
|
1579 // CSIPConcreteProfile::ExtensionParameter |
|
1580 // ----------------------------------------------------------------------------- |
|
1581 // |
|
1582 EXPORT_C TInt CSIPConcreteProfile::ExtensionParameter( |
|
1583 TInt aIndex, |
|
1584 TUint& aID, |
|
1585 MDesC8Array const *& aValue ) const |
|
1586 { |
|
1587 TInt retVal(KErrNotFound); |
|
1588 if (aIndex < iExtensionDescrArrayParams.Count()) |
|
1589 { |
|
1590 aID = iExtensionDescrArrayParams[aIndex]->ID(); |
|
1591 aValue = &iExtensionDescrArrayParams[aIndex]->Value(); |
|
1592 retVal = KErrNone; |
|
1593 } |
|
1594 return retVal; |
|
1595 } |
|
1596 |
|
1597 // ----------------------------------------------------------------------------- |
|
1598 // CSIPConcreteProfile::ExtensionParameter |
|
1599 // ----------------------------------------------------------------------------- |
|
1600 // |
|
1601 EXPORT_C TInt CSIPConcreteProfile::ExtensionParameter( |
|
1602 TInt aIndex, |
|
1603 TUint& aID, |
|
1604 TDesC8 const *& aValue ) const |
|
1605 { |
|
1606 TInt retVal(KErrNotFound); |
|
1607 if (aIndex < iExtensionDescrParams.Count()) |
|
1608 { |
|
1609 aID = iExtensionDescrParams[aIndex]->ID(); |
|
1610 aValue = &iExtensionDescrParams[aIndex]->Value(); |
|
1611 retVal = KErrNone; |
|
1612 } |
|
1613 return retVal; |
|
1614 } |
|
1615 |
|
1616 // ----------------------------------------------------------------------------- |
|
1617 // CSIPConcreteProfile::ServerExtensionParameter |
|
1618 // ----------------------------------------------------------------------------- |
|
1619 // |
|
1620 EXPORT_C TInt CSIPConcreteProfile::ServerExtensionParameter( |
|
1621 TUint32 aServer, |
|
1622 TInt aIndex, |
|
1623 TDesC8 const *& aKey, |
|
1624 TDesC8 const *& aValue) const |
|
1625 { |
|
1626 TInt retVal(KErrNotFound); |
|
1627 switch(aServer) |
|
1628 { |
|
1629 case KSIPOutboundProxy: |
|
1630 { |
|
1631 if (aIndex < iSIPOutboundProxyExtParameter.Count()) |
|
1632 { |
|
1633 aKey = &iSIPOutboundProxyExtParameter[aIndex]->Key(); |
|
1634 aValue = &iSIPOutboundProxyExtParameter[aIndex]->Value(); |
|
1635 retVal = KErrNone; |
|
1636 } |
|
1637 break; |
|
1638 } |
|
1639 case KSIPRegistrar: |
|
1640 { |
|
1641 if (aIndex < iSIPRegistrarExtParameter.Count()) |
|
1642 { |
|
1643 aKey = &iSIPRegistrarExtParameter[aIndex]->Key(); |
|
1644 aValue = &iSIPRegistrarExtParameter[aIndex]->Value(); |
|
1645 retVal = KErrNone; |
|
1646 } |
|
1647 break; |
|
1648 } |
|
1649 default: |
|
1650 break; |
|
1651 } |
|
1652 return retVal; |
|
1653 } |
|
1654 // ----------------------------------------------------------------------------- |
|
1655 // CSIPConcreteProfile::ServerExtensionParameterCount |
|
1656 // ----------------------------------------------------------------------------- |
|
1657 // |
|
1658 EXPORT_C TInt CSIPConcreteProfile::ServerExtensionParameterCount( |
|
1659 TUint32 aServer) const |
|
1660 { |
|
1661 switch(aServer) |
|
1662 { |
|
1663 case KSIPOutboundProxy: |
|
1664 return iSIPOutboundProxyExtParameter.Count(); |
|
1665 case KSIPRegistrar: |
|
1666 return iSIPRegistrarExtParameter.Count(); |
|
1667 default: |
|
1668 return KErrNotFound; |
|
1669 } |
|
1670 } |
|
1671 |
|
1672 // ----------------------------------------------------------------------------- |
|
1673 // CSIPConcreteProfile::ServerParameter |
|
1674 // ----------------------------------------------------------------------------- |
|
1675 // |
|
1676 EXPORT_C TInt CSIPConcreteProfile::ServerParameter( |
|
1677 TUint32 aServer, |
|
1678 TInt aIndex, |
|
1679 TUint& aID, |
|
1680 TDesC8 const *& aValue) const |
|
1681 { |
|
1682 TInt retVal(KErrNotFound); |
|
1683 TLex8 lex; |
|
1684 switch(aServer) |
|
1685 { |
|
1686 case KSIPOutboundProxy: |
|
1687 { |
|
1688 if (aIndex < iSIPOutboundProxyParameter.Count()) |
|
1689 { |
|
1690 lex.Assign(iSIPOutboundProxyParameter[aIndex]->Key()); |
|
1691 lex.Val(aID); |
|
1692 aValue = &iSIPOutboundProxyParameter[aIndex]->Value(); |
|
1693 retVal = KErrNone; |
|
1694 } |
|
1695 break; |
|
1696 } |
|
1697 case KSIPRegistrar: |
|
1698 { |
|
1699 if (aIndex < iSIPRegistrarParameter.Count()) |
|
1700 { |
|
1701 lex.Assign(iSIPRegistrarParameter[aIndex]->Key()); |
|
1702 lex.Val(aID); |
|
1703 aValue = &iSIPRegistrarParameter[aIndex]->Value(); |
|
1704 retVal = KErrNone; |
|
1705 } |
|
1706 break; |
|
1707 } |
|
1708 default: |
|
1709 break; |
|
1710 } |
|
1711 return retVal; |
|
1712 } |
|
1713 // ----------------------------------------------------------------------------- |
|
1714 // CSIPConcreteProfile::ServerParameterCount |
|
1715 // ----------------------------------------------------------------------------- |
|
1716 // |
|
1717 EXPORT_C TInt CSIPConcreteProfile::ServerParameterCount( |
|
1718 TUint32 aServer) const |
|
1719 { |
|
1720 switch(aServer) |
|
1721 { |
|
1722 case KSIPOutboundProxy: |
|
1723 return iSIPOutboundProxyParameter.Count(); |
|
1724 case KSIPRegistrar: |
|
1725 return iSIPRegistrarParameter.Count(); |
|
1726 default: |
|
1727 return KErrNotFound; |
|
1728 } |
|
1729 } |
|
1730 // CSIPConcreteProfile::DoInternalizeL |
|
1731 // ----------------------------------------------------------------------------- |
|
1732 // |
|
1733 void CSIPConcreteProfile::DoInternalizeL(RReadStream& aReadStream, TBool aAll) |
|
1734 { |
|
1735 iDynamicProxy = HBufC8::NewL(0); |
|
1736 iSIPRegisteredAORs = new (ELeave) CDesC8ArrayFlat(1); |
|
1737 iSIPNegotiatedSecurityMechanism = HBufC8::NewL(0); |
|
1738 |
|
1739 iSIPProfileId = aReadStream.ReadUint32L(); |
|
1740 iSIPIAPId = aReadStream.ReadUint32L(); |
|
1741 |
|
1742 TInt32 typeLength = aReadStream.ReadInt32L(); |
|
1743 __ASSERT_ALWAYS(typeLength >= 0, User::Leave(KErrCorrupt)); |
|
1744 __ASSERT_ALWAYS(typeLength < KMaxTInt/2, User::Leave (KErrCorrupt)); |
|
1745 HBufC8* typeBuf = HBufC8::NewL (typeLength); |
|
1746 CleanupStack::PushL(typeBuf); |
|
1747 TPtr8 type(typeBuf->Des()); |
|
1748 aReadStream.ReadL (type, typeLength); |
|
1749 iSIPProfileType.iSIPProfileName = *typeBuf; |
|
1750 CleanupStack::PopAndDestroy(typeBuf); |
|
1751 iSIPProfileType.iSIPProfileClass = |
|
1752 (enum TSIPProfileTypeInfo::TSIPProfileClass) aReadStream.ReadUint8L(); |
|
1753 |
|
1754 InternalizeRegistrarL(aReadStream); |
|
1755 InternalizeProxyL(aReadStream); |
|
1756 |
|
1757 TInt32 providerLength = aReadStream.ReadInt32L(); |
|
1758 __ASSERT_ALWAYS(providerLength >= 0, User::Leave(KErrCorrupt)); |
|
1759 __ASSERT_ALWAYS(providerLength < KMaxTInt/2, User::Leave (KErrCorrupt)); |
|
1760 iSIPProviderName = HBufC8::NewL (providerLength); |
|
1761 TPtr8 provider(iSIPProviderName->Des()); |
|
1762 aReadStream.ReadL (provider, providerLength); |
|
1763 |
|
1764 TInt32 privateLength = aReadStream.ReadInt32L(); |
|
1765 __ASSERT_ALWAYS(privateLength >= 0, User::Leave(KErrCorrupt)); |
|
1766 __ASSERT_ALWAYS(privateLength < KMaxTInt/2, User::Leave (KErrCorrupt)); |
|
1767 iSIPPrivateIdentity = HBufC8::NewL (privateLength); |
|
1768 TPtr8 priv(iSIPPrivateIdentity->Des()); |
|
1769 aReadStream.ReadL (priv, privateLength); |
|
1770 |
|
1771 TInt32 aorLength = aReadStream.ReadInt32L(); |
|
1772 __ASSERT_ALWAYS(aorLength >= 0, User::Leave(KErrCorrupt)); |
|
1773 __ASSERT_ALWAYS(aorLength < KMaxTInt/2, User::Leave (KErrCorrupt)); |
|
1774 HBufC8* tmpAorBuf = HBufC8::NewLC(aorLength); |
|
1775 TPtr8 aorPtr(tmpAorBuf->Des()); |
|
1776 aReadStream.ReadL(aorPtr, aorLength); |
|
1777 SetAORL(aorPtr); |
|
1778 CleanupStack::PopAndDestroy(tmpAorBuf); |
|
1779 |
|
1780 iSIPSigComp = aReadStream.ReadInt8L(); |
|
1781 iSecurityNegotiation = aReadStream.ReadInt8L(); |
|
1782 iSIPAutoRegistered = aReadStream.ReadInt8L(); |
|
1783 iDynamicProxyResolving = aReadStream.ReadInt8L(); |
|
1784 |
|
1785 iSIPContactHeaderParams = InternalizeDesArrayL(aReadStream); |
|
1786 iSIPHeaders = InternalizeDesArrayL(aReadStream); |
|
1787 |
|
1788 if (aAll) |
|
1789 { |
|
1790 iStatus = (enum TStatus) aReadStream.ReadUint8L(); |
|
1791 iContextId = aReadStream.ReadUint32L(); |
|
1792 iDefaultProfile = aReadStream.ReadInt8L(); |
|
1793 iLastRegistrationError = aReadStream.ReadUint32L(); |
|
1794 } |
|
1795 else |
|
1796 { |
|
1797 iStatus = EUnregistered; |
|
1798 iContextId = 0; |
|
1799 iDefaultProfile = EFalse; |
|
1800 iLastRegistrationError = KErrNone; |
|
1801 } |
|
1802 |
|
1803 InternalizeExtensionParamsL(aReadStream); |
|
1804 |
|
1805 // The Contact-header's user-part must be unique present in all profiles. |
|
1806 // If the profile is imported from an older platform |
|
1807 // that does not have SIP 6.0, generate KSIPContactHeaderUser-parameter |
|
1808 // to preserve data compatibility. |
|
1809 // This profile can also be returned to the older platform |
|
1810 // as KSIPContactHeaderUser is an extension parameter. |
|
1811 if (ExtensionDescrParamIndex(KSIPContactHeaderUser) < 0) |
|
1812 { |
|
1813 HBufC8* username = CreateContactUserNameLC(); |
|
1814 SetExtensionParameterL(KSIPContactHeaderUser,*username); |
|
1815 CleanupStack::PopAndDestroy(username); |
|
1816 } |
|
1817 } |
|
1818 |
|
1819 // ----------------------------------------------------------------------------- |
|
1820 // CSIPConcreteProfile::InternalizeRegistrarL |
|
1821 // ----------------------------------------------------------------------------- |
|
1822 // |
|
1823 void CSIPConcreteProfile::InternalizeRegistrarL(RReadStream& aReadStream) |
|
1824 { |
|
1825 TUint i = 0; |
|
1826 TInt32 registrarLength = aReadStream.ReadInt32L(); |
|
1827 __ASSERT_ALWAYS(registrarLength >= 0, User::Leave(KErrCorrupt)); |
|
1828 __ASSERT_ALWAYS(registrarLength < KMaxTInt/2, User::Leave (KErrCorrupt)); |
|
1829 iSIPRegistrar = HBufC8::NewL (registrarLength); |
|
1830 TPtr8 registrar(iSIPRegistrar->Des()); |
|
1831 aReadStream.ReadL (registrar, registrarLength); |
|
1832 |
|
1833 TUint count = aReadStream.ReadUint32L(); |
|
1834 for (i = 0; i < count; i++) |
|
1835 { |
|
1836 CSIPProfileParameter* param = |
|
1837 CSIPProfileParameter::InternalizeL(aReadStream); |
|
1838 CleanupStack::PushL(param); |
|
1839 iSIPRegistrarParameter.AppendL(param); |
|
1840 CleanupStack::Pop(param); |
|
1841 } |
|
1842 |
|
1843 count = aReadStream.ReadUint32L(); |
|
1844 for (i = 0; i < count; i++) |
|
1845 { |
|
1846 CSIPProfileParameter* param = |
|
1847 CSIPProfileParameter::InternalizeL(aReadStream); |
|
1848 CleanupStack::PushL(param); |
|
1849 iSIPRegistrarExtParameter.AppendL(param); |
|
1850 CleanupStack::Pop(param); |
|
1851 } |
|
1852 } |
|
1853 |
|
1854 // ----------------------------------------------------------------------------- |
|
1855 // CSIPConcreteProfile::InternalizeProxyL |
|
1856 // ----------------------------------------------------------------------------- |
|
1857 // |
|
1858 void CSIPConcreteProfile::InternalizeProxyL(RReadStream& aReadStream) |
|
1859 { |
|
1860 TUint i = 0; |
|
1861 TInt32 proxyLength = aReadStream.ReadInt32L(); |
|
1862 __ASSERT_ALWAYS(proxyLength >= 0, User::Leave(KErrCorrupt)); |
|
1863 __ASSERT_ALWAYS(proxyLength < KMaxTInt/2, User::Leave (KErrCorrupt)); |
|
1864 iSIPOutboundProxy = HBufC8::NewL (proxyLength); |
|
1865 TPtr8 proxy(iSIPOutboundProxy->Des()); |
|
1866 aReadStream.ReadL (proxy, proxyLength); |
|
1867 |
|
1868 TUint count = aReadStream.ReadUint32L(); |
|
1869 for (i = 0; i < count; i++) |
|
1870 { |
|
1871 CSIPProfileParameter* param = |
|
1872 CSIPProfileParameter::InternalizeL(aReadStream); |
|
1873 CleanupStack::PushL(param); |
|
1874 iSIPOutboundProxyParameter.AppendL(param); |
|
1875 CleanupStack::Pop(param); |
|
1876 } |
|
1877 |
|
1878 count = aReadStream.ReadUint32L(); |
|
1879 for (i = 0; i < count; i++) |
|
1880 { |
|
1881 CSIPProfileParameter* param = |
|
1882 CSIPProfileParameter::InternalizeL(aReadStream); |
|
1883 CleanupStack::PushL(param); |
|
1884 iSIPOutboundProxyExtParameter.AppendL(param); |
|
1885 CleanupStack::Pop(param); |
|
1886 } |
|
1887 } |
|
1888 |
|
1889 // ----------------------------------------------------------------------------- |
|
1890 // CSIPConcreteProfile::InternalizeExtensionParamsL |
|
1891 // ----------------------------------------------------------------------------- |
|
1892 // |
|
1893 void CSIPConcreteProfile::InternalizeExtensionParamsL(RReadStream& aReadStream) |
|
1894 { |
|
1895 TUint count = aReadStream.ReadUint32L(); |
|
1896 TUint i(0); |
|
1897 for (i = 0; i < count; ++i) |
|
1898 { |
|
1899 TExtensionIntParam param = |
|
1900 TExtensionIntParam::InternalizeL(aReadStream); |
|
1901 iExtensionIntParams.AppendL(param); |
|
1902 } |
|
1903 |
|
1904 count = aReadStream.ReadUint32L(); |
|
1905 for (i = 0; i < count; ++i) |
|
1906 { |
|
1907 TExtensionBoolParam param = |
|
1908 TExtensionBoolParam::InternalizeL(aReadStream); |
|
1909 iExtensionBoolParams.AppendL(param); |
|
1910 } |
|
1911 |
|
1912 count = aReadStream.ReadUint32L(); |
|
1913 for (i = 0; i < count; ++i) |
|
1914 { |
|
1915 CExtensionDescrParam* param = |
|
1916 CExtensionDescrParam::InternalizeL(aReadStream); |
|
1917 CleanupStack::PushL(param); |
|
1918 iExtensionDescrParams.AppendL(param); |
|
1919 CleanupStack::Pop(param); |
|
1920 } |
|
1921 |
|
1922 count = aReadStream.ReadUint32L(); |
|
1923 for (i = 0; i < count; ++i) |
|
1924 { |
|
1925 CExtensionDescrArrayParam* param = |
|
1926 CExtensionDescrArrayParam::InternalizeL(aReadStream); |
|
1927 CleanupStack::PushL(param); |
|
1928 iExtensionDescrArrayParams.AppendL(param); |
|
1929 CleanupStack::Pop(param); |
|
1930 } |
|
1931 } |
|
1932 |
|
1933 // ----------------------------------------------------------------------------- |
|
1934 // CSIPConcreteProfile::IndexOf |
|
1935 // ----------------------------------------------------------------------------- |
|
1936 // |
|
1937 TInt CSIPConcreteProfile::IndexOf(const TDesC8& aKey, |
|
1938 const RPointerArray<CSIPProfileParameter>* aArray) const |
|
1939 { |
|
1940 TInt index = KErrNotFound; |
|
1941 TBool found = EFalse; |
|
1942 |
|
1943 for (TInt i = 0; i < aArray->Count() && !found; i ++) |
|
1944 { |
|
1945 if ((*aArray)[i]->Key().Compare(aKey) == 0) |
|
1946 { |
|
1947 index = i; |
|
1948 found = ETrue; |
|
1949 } |
|
1950 } |
|
1951 return index; |
|
1952 } |
|
1953 |
|
1954 // ----------------------------------------------------------------------------- |
|
1955 // CSIPConcreteProfile::SetOutboundProxyL |
|
1956 // ----------------------------------------------------------------------------- |
|
1957 // |
|
1958 void CSIPConcreteProfile::SetOutboundProxyL(const TDesC8& aOutboundProxy) |
|
1959 { |
|
1960 HBufC8* tmp = aOutboundProxy.AllocL(); |
|
1961 delete iSIPOutboundProxy; |
|
1962 iSIPOutboundProxy = tmp; |
|
1963 } |
|
1964 |
|
1965 // ----------------------------------------------------------------------------- |
|
1966 // CSIPConcreteProfile::SetRegistrarL |
|
1967 // ----------------------------------------------------------------------------- |
|
1968 // |
|
1969 void CSIPConcreteProfile::SetRegistrarL(const TDesC8& aRegistrar) |
|
1970 { |
|
1971 HBufC8* tmp = aRegistrar.AllocL(); |
|
1972 delete iSIPRegistrar; |
|
1973 iSIPRegistrar = tmp; |
|
1974 } |
|
1975 |
|
1976 // ----------------------------------------------------------------------------- |
|
1977 // CSIPConcreteProfile::SetParameterL |
|
1978 // ----------------------------------------------------------------------------- |
|
1979 // |
|
1980 void CSIPConcreteProfile::SetParameterL( |
|
1981 RPointerArray<CSIPProfileParameter>* aArray, |
|
1982 const TDesC8& aName, |
|
1983 const TDesC8& aValue) |
|
1984 { |
|
1985 TInt index = IndexOf(aName, aArray); |
|
1986 if (index != KErrNotFound) |
|
1987 { |
|
1988 CSIPProfileParameter* parameter = (*aArray)[index]; |
|
1989 aArray->Remove(index); |
|
1990 delete parameter; |
|
1991 |
|
1992 if(aValue.Length() > 0) |
|
1993 { |
|
1994 parameter = CSIPProfileParameter::NewLC(aName, aValue); |
|
1995 aArray->AppendL(parameter); |
|
1996 CleanupStack::Pop(parameter); |
|
1997 } |
|
1998 } |
|
1999 else |
|
2000 { |
|
2001 if(aValue.Length() > 0) |
|
2002 { |
|
2003 CSIPProfileParameter* parameter = |
|
2004 CSIPProfileParameter::NewLC(aName, aValue); |
|
2005 aArray->AppendL(parameter); |
|
2006 CleanupStack::Pop(parameter); |
|
2007 } |
|
2008 } |
|
2009 } |
|
2010 |
|
2011 // ----------------------------------------------------------------------------- |
|
2012 // CSIPConcreteProfile::Parameter |
|
2013 // ----------------------------------------------------------------------------- |
|
2014 // |
|
2015 const TDesC8& CSIPConcreteProfile::Parameter( |
|
2016 const RPointerArray<CSIPProfileParameter>* aArray, |
|
2017 const TDesC8& aName) const |
|
2018 { |
|
2019 TInt index = IndexOf(aName, aArray); |
|
2020 |
|
2021 if (index != KErrNotFound) |
|
2022 return (*aArray)[index]->Value(); |
|
2023 |
|
2024 return KNullDesC8; |
|
2025 } |
|
2026 |
|
2027 // ----------------------------------------------------------------------------- |
|
2028 // CSIPConcreteProfile::ExternalizeDesArrayL |
|
2029 // ----------------------------------------------------------------------------- |
|
2030 // |
|
2031 void CSIPConcreteProfile::ExternalizeDesArrayL(const MDesC8Array& aArray, |
|
2032 RWriteStream& aWriteStream) |
|
2033 { |
|
2034 aWriteStream.WriteUint32L(aArray.MdcaCount()); |
|
2035 for (TInt i = 0; i < aArray.MdcaCount(); i++) |
|
2036 { |
|
2037 const TPtrC8& value = aArray.MdcaPoint(i); |
|
2038 aWriteStream.WriteInt32L(value.Length()); |
|
2039 aWriteStream.WriteL(value); |
|
2040 } |
|
2041 } |
|
2042 |
|
2043 // ----------------------------------------------------------------------------- |
|
2044 // CSIPConcreteProfile::InternalizeDesArrayL |
|
2045 // ----------------------------------------------------------------------------- |
|
2046 // |
|
2047 CDesC8ArrayFlat* |
|
2048 CSIPConcreteProfile::InternalizeDesArrayL(RReadStream& aReadStream) |
|
2049 { |
|
2050 CDesC8ArrayFlat* array = new (ELeave) CDesC8ArrayFlat(1); |
|
2051 CleanupStack::PushL(array); |
|
2052 TInt count = aReadStream.ReadUint32L(); |
|
2053 for (TInt i = 0; i < count; i++) |
|
2054 { |
|
2055 TInt32 valueLen = aReadStream.ReadInt32L(); |
|
2056 __ASSERT_ALWAYS(valueLen >= 0, User::Leave(KErrCorrupt)); |
|
2057 __ASSERT_ALWAYS(valueLen < KMaxTInt/2, User::Leave (KErrCorrupt)); |
|
2058 HBufC8* valueBuf = HBufC8::NewLC(valueLen); |
|
2059 TPtr8 value = valueBuf->Des(); |
|
2060 aReadStream.ReadL (value, valueLen); |
|
2061 array->AppendL(*valueBuf); |
|
2062 CleanupStack::PopAndDestroy(valueBuf); |
|
2063 } |
|
2064 CleanupStack::Pop(array); |
|
2065 return array; |
|
2066 } |
|
2067 |
|
2068 // ----------------------------------------------------------------------------- |
|
2069 // CSIPConcreteProfile::CopyDesArrayL |
|
2070 // ----------------------------------------------------------------------------- |
|
2071 // |
|
2072 CDesC8ArrayFlat* CSIPConcreteProfile::CopyDesArrayL(const MDesC8Array& aArray) |
|
2073 { |
|
2074 CDesC8ArrayFlat* tmp = new (ELeave) CDesC8ArrayFlat(1); |
|
2075 CleanupStack::PushL(tmp); |
|
2076 for (TInt i = 0; i < aArray.MdcaCount(); i++) |
|
2077 { |
|
2078 tmp->AppendL(aArray.MdcaPoint(i)); |
|
2079 } |
|
2080 CleanupStack::Pop(tmp); |
|
2081 return tmp; |
|
2082 } |
|
2083 |
|
2084 // ----------------------------------------------------------------------------- |
|
2085 // CSIPConcreteProfile::CreateContactUserNameLC |
|
2086 // ----------------------------------------------------------------------------- |
|
2087 // |
|
2088 HBufC8* CSIPConcreteProfile::CreateContactUserNameLC() const |
|
2089 { |
|
2090 CSystemRandom* random = CSystemRandom::NewLC(); |
|
2091 HBufC8* data = HBufC8::NewLC(KContactUserNameLength); |
|
2092 TPtr8 dataPtr(data->Des()); |
|
2093 dataPtr.FillZ(dataPtr.MaxLength()); |
|
2094 random->GenerateBytesL(dataPtr); |
|
2095 |
|
2096 HBufC8* result = HBufC8::NewLC(KContactUserNameLength); |
|
2097 TPtr8 resultPtr(result->Des()); |
|
2098 |
|
2099 //2^6 = 64 valid chars that can be put to descriptor |
|
2100 const TInt KMaxBitsReturned = 6; |
|
2101 _LIT8(KValidChars, |
|
2102 "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_"); |
|
2103 TUint counter = 0; |
|
2104 for (TInt i = 0; i < KContactUserNameLength; i++) |
|
2105 { |
|
2106 TInt index = |
|
2107 GetNextBits(*data,KMaxBitsReturned,counter)%KValidChars().Length(); |
|
2108 resultPtr.Append(KValidChars()[index]); |
|
2109 } |
|
2110 |
|
2111 CleanupStack::Pop(result); |
|
2112 CleanupStack::PopAndDestroy(data); |
|
2113 CleanupStack::PopAndDestroy(random); |
|
2114 CleanupStack::PushL(result); |
|
2115 return result; |
|
2116 } |
|
2117 |
|
2118 // ----------------------------------------------------------------------------- |
|
2119 // CSIPConcreteProfile::GetNextBits |
|
2120 // ----------------------------------------------------------------------------- |
|
2121 // |
|
2122 TUint8 CSIPConcreteProfile::GetNextBits( |
|
2123 const TDesC8& aBuf, |
|
2124 TInt aBits, |
|
2125 TUint& aCounter) const |
|
2126 { |
|
2127 if (aBuf.Length() == 0) |
|
2128 { |
|
2129 return 0; |
|
2130 } |
|
2131 |
|
2132 //Amount of aBits long bit sequences in aBuf |
|
2133 TUint sixBitItems = aBuf.Length() * KBitsInByte / aBits; |
|
2134 |
|
2135 if (aCounter >= sixBitItems) |
|
2136 { |
|
2137 aCounter = 0; |
|
2138 } |
|
2139 |
|
2140 //The position in aBuf, of the byte containing the first bit of the aBits |
|
2141 //long bit sequence. Zero means the first byte. |
|
2142 TInt startByte = aCounter * aBits / KBitsInByte; |
|
2143 TUint16 result = static_cast<TUint16>(aBuf[startByte] << KBitsInByte); |
|
2144 |
|
2145 if (++startByte >= aBuf.Length()) |
|
2146 { |
|
2147 startByte = 0; |
|
2148 } |
|
2149 |
|
2150 result = static_cast<TUint16>(result | aBuf[startByte]); |
|
2151 |
|
2152 |
|
2153 //The position of the first bit of the aBits long bit sequence, within the |
|
2154 //byte. Zero means the first bit. |
|
2155 TUint offsetInsideByte = (aCounter * aBits) % KBitsInByte; |
|
2156 |
|
2157 //Remove excess bits from the result |
|
2158 result = static_cast<TUint16>(result << offsetInsideByte); |
|
2159 result >>= ((2 * KBitsInByte) - aBits); |
|
2160 |
|
2161 aCounter++; |
|
2162 return static_cast<TUint8>(result); |
|
2163 } |
|
2164 |
|
2165 // ----------------------------------------------------------------------------- |
|
2166 // CSIPConcreteProfile::FetchIAPIDL |
|
2167 // ----------------------------------------------------------------------------- |
|
2168 // |
|
2169 TUint32 CSIPConcreteProfile::FetchIAPIDL(const TDesC8& aValue) |
|
2170 { |
|
2171 TUint32 iVal(0); |
|
2172 TBuf16<1024> recordname; |
|
2173 recordname.SetLength(aValue.Length()); |
|
2174 CnvUtfConverter::ConvertToUnicodeFromUtf8(recordname,aValue); |
|
2175 CMDBSession* db = CMDBSession::NewLC( KCDVersion1_1); |
|
2176 db->SetAttributeMask( ECDHidden ); |
|
2177 CCDIAPRecord* ptrIAPRecord = static_cast<CCDIAPRecord *>(CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord)); |
|
2178 CleanupStack::PushL( ptrIAPRecord ); |
|
2179 ptrIAPRecord->iRecordName.SetMaxLengthL(recordname.Length()); |
|
2180 ptrIAPRecord->iRecordName = recordname; |
|
2181 if(ptrIAPRecord->FindL(*db)) |
|
2182 { |
|
2183 ptrIAPRecord->LoadL( *db ); |
|
2184 iVal = ptrIAPRecord->RecordId(); |
|
2185 } |
|
2186 else |
|
2187 { |
|
2188 User::Leave(KErrNotFound); |
|
2189 } |
|
2190 CleanupStack::PopAndDestroy( ptrIAPRecord ); |
|
2191 CleanupStack::PopAndDestroy( db ); |
|
2192 return iVal; |
|
2193 } |
|
2194 |
|
2195 // ----------------------------------------------------------------------------- |
|
2196 // CSIPConcreteProfile::FetchSNAPIDL |
|
2197 // ----------------------------------------------------------------------------- |
|
2198 // |
|
2199 TUint32 CSIPConcreteProfile::FetchSNAPIDL(const TDesC8& aValue) |
|
2200 { |
|
2201 TUint32 iVal(0); |
|
2202 TBuf16<1024> recordname; |
|
2203 recordname.SetLength(aValue.Length()); |
|
2204 CnvUtfConverter::ConvertToUnicodeFromUtf8(recordname,aValue); |
|
2205 CMDBSession* db = CMDBSession::NewLC( KCDVersion1_1); |
|
2206 db->SetAttributeMask( ECDHidden ); |
|
2207 CCDAccessPointRecord* ptrAPRecord = static_cast<CCDAccessPointRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdAccessPointRecord)); |
|
2208 CleanupStack::PushL(ptrAPRecord); |
|
2209 ptrAPRecord->iRecordName.SetMaxLengthL(recordname.Length()); |
|
2210 ptrAPRecord->iRecordName = recordname; |
|
2211 if(ptrAPRecord->FindL(*db)) |
|
2212 { |
|
2213 ptrAPRecord->LoadL( *db ); |
|
2214 iVal = ptrAPRecord->RecordId(); |
|
2215 } |
|
2216 else |
|
2217 { |
|
2218 User::Leave(KErrNotFound); |
|
2219 } |
|
2220 CleanupStack::PopAndDestroy( ptrAPRecord ); |
|
2221 CleanupStack::PopAndDestroy( db ); |
|
2222 return iVal; |
|
2223 } |
|
2224 |
|
2225 // ----------------------------------------------------------------------------- |
|
2226 // CSIPConcreteProfile::ValidateProfileParamsL |
|
2227 // ----------------------------------------------------------------------------- |
|
2228 // |
|
2229 EXPORT_C TBool CSIPConcreteProfile::ValidateProfileParamsL() |
|
2230 { |
|
2231 TBool res(ETrue); |
|
2232 TUint32 iVal(0); |
|
2233 const TDesC8* aSnapName(NULL); |
|
2234 const TDesC8* aIAPName(NULL); |
|
2235 |
|
2236 if ( ExtensionParameter(KSIPSnapName,aSnapName) == KErrNone) |
|
2237 { |
|
2238 if(ExtensionParameter(KSIPSnapId,iVal) == KErrNone) |
|
2239 { |
|
2240 if (iVal != FetchSNAPIDL(*aSnapName)) |
|
2241 res=EFalse; |
|
2242 } |
|
2243 else |
|
2244 res = ETrue; |
|
2245 } |
|
2246 |
|
2247 if ( ExtensionParameter(KSIPAccessPointName,aIAPName) == KErrNone) |
|
2248 { |
|
2249 if (IapId() != FetchIAPIDL(*aIAPName)) |
|
2250 res=EFalse; |
|
2251 } |
|
2252 // Checking for the case of a Profile created without any Connection related Parameters. |
|
2253 //In such cases the SNAP Id will be set to a Unique value which will be later used to retrieve the Default SNAP. |
|
2254 if((ExtensionParameter(KSIPSnapId,iVal)!=KErrNone) && IapId() == 0) |
|
2255 { |
|
2256 PROFILE_DEBUG3("CSIPConcreteProfile::ValidateProfileParamsL.. Setting SNAP ID with 25000 as IAP is: ", 0) |
|
2257 PROFILE_DEBUG3("Exceptional SNAP Entry verifier :", KDefaultSNAPIdentifier) |
|
2258 SetExtensionParameterL(KSIPSnapId,KDefaultSNAPIdentifier); |
|
2259 } |
|
2260 return res; |
|
2261 } |