|
1 // Copyright (c) 2002-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 : sipmanagedprofile |
|
15 // Part of : SIP Profile Client |
|
16 // implementation |
|
17 // Version : 1.0 |
|
18 // INCLUDE FILES |
|
19 // |
|
20 |
|
21 |
|
22 |
|
23 #include "sipmanagedprofile.h" |
|
24 #include "sipconcreteprofile.h" |
|
25 #include "sipprofileregistry.h" |
|
26 #include "sipmanagedprofileregistry.h" |
|
27 |
|
28 _LIT8(KSIPProfileExtenstionParameter, "%u"); |
|
29 const TUint KParameterbufLength = 25; |
|
30 |
|
31 // ============================ MEMBER FUNCTIONS =============================== |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CSIPManagedProfile::NewL |
|
35 // Two-phased constructor. |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 CSIPManagedProfile* CSIPManagedProfile::NewL(CSIPManagedProfileRegistry* aSIPRegistry) |
|
39 { |
|
40 CSIPManagedProfile* self = CSIPManagedProfile::NewLC (aSIPRegistry); |
|
41 CleanupStack::Pop (self); |
|
42 return self; |
|
43 } |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CSIPManagedProfile::NewLC |
|
47 // Two-phased constructor. |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 CSIPManagedProfile* CSIPManagedProfile::NewLC(CSIPManagedProfileRegistry* aSIPRegistry) |
|
51 { |
|
52 CSIPManagedProfile* self = new(ELeave)CSIPManagedProfile(aSIPRegistry); |
|
53 CleanupStack::PushL (self); |
|
54 self->ConstructL (); |
|
55 return self; |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CSIPManagedProfile::~CSIPManagedProfile |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 EXPORT_C CSIPManagedProfile::~CSIPManagedProfile() |
|
63 { |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CSIPManagedProfile::SetType |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 EXPORT_C void CSIPManagedProfile::SetType( |
|
71 const TSIPProfileTypeInfo& aSIPProfileTypeInfo) |
|
72 { |
|
73 iSIPProfile->SetProfileType(aSIPProfileTypeInfo); |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CSIPManagedProfile::SetParameter |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 EXPORT_C TInt CSIPManagedProfile::SetParameter(TUint32 aParam, const TDesC8& aVal) |
|
81 { |
|
82 TRAPD(err, SetParameterL(aParam,aVal)); |
|
83 return err; |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CSIPManagedProfile::SetParameter |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 EXPORT_C TInt CSIPManagedProfile::SetParameter(TUint32 aParam, TUint32 aVal) |
|
91 { |
|
92 TRAPD(err, SetParameterL(aParam,aVal)); |
|
93 return err; |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CSIPManagedProfile::SetParameter |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 EXPORT_C TInt CSIPManagedProfile::SetParameter(TUint32 aParam, TBool aVal) |
|
101 { |
|
102 TRAPD(err, SetParameterL(aParam,aVal)); |
|
103 return err; |
|
104 } |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CSIPManagedProfile::SetParameter |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 EXPORT_C TInt CSIPManagedProfile::SetParameter(TUint32 aServerType, |
|
111 TUint32 aParam, const TDesC8& aVal) |
|
112 { |
|
113 TRAPD(err, SetParameterL(aServerType,aParam,aVal)); |
|
114 return err; |
|
115 } |
|
116 |
|
117 // ----------------------------------------------------------------------------- |
|
118 // CSIPManagedProfile::SetParameter |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 EXPORT_C TInt CSIPManagedProfile::SetParameter(TUint32 aParam, |
|
122 const MDesC8Array& aVal) |
|
123 { |
|
124 TRAPD(err, SetParameterL(aParam,aVal)); |
|
125 return err; |
|
126 } |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CSIPManagedProfile::CloneL |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 EXPORT_C CSIPManagedProfile* CSIPManagedProfile::CloneL() const |
|
133 { |
|
134 __ASSERT_ALWAYS(iSIPProfileRegistry, User::Leave(KErrBadHandle)); |
|
135 CSIPManagedProfile* newCopy = CSIPManagedProfile::NewLC( |
|
136 static_cast<CSIPManagedProfileRegistry*>(iSIPProfileRegistry)); |
|
137 |
|
138 newCopy->SetConcreteProfile(iSIPProfile->CloneL()); |
|
139 |
|
140 CleanupStack::Pop(newCopy); |
|
141 return newCopy; |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // CSIPManagedProfile::CSIPManagedProfile |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 CSIPManagedProfile::CSIPManagedProfile(CSIPManagedProfileRegistry* aSIPRegistry): |
|
149 CSIPProfile(aSIPRegistry) |
|
150 { |
|
151 } |
|
152 |
|
153 // ----------------------------------------------------------------------------- |
|
154 // CSIPManagedProfile::SetParameterL |
|
155 // ----------------------------------------------------------------------------- |
|
156 // |
|
157 void CSIPManagedProfile::SetParameterL(TUint32 aParam, const TDesC8& aVal) |
|
158 { |
|
159 switch (aParam) |
|
160 { |
|
161 case KSIPProviderName: |
|
162 iSIPProfile->SetProviderNameL(aVal); |
|
163 break; |
|
164 case KSIPUserAor: |
|
165 iSIPProfile->SetAORL(aVal); |
|
166 break; |
|
167 case KSIPPrivateIdentity: |
|
168 iSIPProfile->SetPrivateIdentityL(aVal); |
|
169 break; |
|
170 case KSIPProfileId: |
|
171 case KSIPAccessPointId: |
|
172 case KSIPSigComp: |
|
173 case KSIPSecurityNegotiation: |
|
174 case KSIPAutoRegistration: |
|
175 case KSIPProfileRegistered: |
|
176 case KSIPRegisteredAors: |
|
177 case KSIPNegotiatedSecurityMechanism: |
|
178 case KSIPDefaultProfile: |
|
179 case KSIPContactHeaderParams: |
|
180 case KSIPRegistrar: |
|
181 case KSIPOutboundProxy: |
|
182 case KSIPDigestUserName: |
|
183 case KSIPDigestRealm: |
|
184 case KSIPServerAddress: |
|
185 case KSIPDigestPassword: |
|
186 case KSIPHeaders: |
|
187 case KSIPSoIpTOS: |
|
188 User::Leave(KErrNotFound); |
|
189 case KSIPContactHeaderUser: |
|
190 User::Leave(KErrAccessDenied); |
|
191 default: |
|
192 iSIPProfile->SetExtensionParameterL(aParam, aVal); |
|
193 } |
|
194 } |
|
195 |
|
196 // ----------------------------------------------------------------------------- |
|
197 // CSIPManagedProfile::SetParameterL |
|
198 // ----------------------------------------------------------------------------- |
|
199 // |
|
200 void CSIPManagedProfile::SetParameterL(TUint32 aParam, TUint32 aVal) |
|
201 { |
|
202 switch (aParam) |
|
203 { |
|
204 case KSIPAccessPointId: |
|
205 iSIPProfile->SetIapId(aVal); |
|
206 break; |
|
207 case KSIPProfileId: |
|
208 case KSIPProviderName: |
|
209 case KSIPSigComp: |
|
210 case KSIPSecurityNegotiation: |
|
211 case KSIPAutoRegistration: |
|
212 case KSIPUserAor: |
|
213 case KSIPProfileRegistered: |
|
214 case KSIPRegisteredAors: |
|
215 case KSIPNegotiatedSecurityMechanism: |
|
216 case KSIPDefaultProfile: |
|
217 case KSIPContactHeaderParams: |
|
218 case KSIPRegistrar: |
|
219 case KSIPOutboundProxy: |
|
220 case KSIPDigestUserName: |
|
221 case KSIPDigestRealm: |
|
222 case KSIPServerAddress: |
|
223 case KSIPPrivateIdentity: |
|
224 case KSIPDigestPassword: |
|
225 case KSIPHeaders: |
|
226 case KSIPContactHeaderUser: |
|
227 User::Leave(KErrNotFound); |
|
228 case KSIPSnapId: |
|
229 __ASSERT_ALWAYS((aVal>0),User::Leave(KErrArgument)); |
|
230 default: |
|
231 iSIPProfile->SetExtensionParameterL(aParam, aVal); |
|
232 } |
|
233 } |
|
234 |
|
235 // ----------------------------------------------------------------------------- |
|
236 // CSIPManagedProfile::SetParameterL |
|
237 // ----------------------------------------------------------------------------- |
|
238 // |
|
239 void CSIPManagedProfile::SetParameterL(TUint32 aParam, TBool aVal) |
|
240 { |
|
241 switch (aParam) |
|
242 { |
|
243 case KSIPDefaultProfile: |
|
244 __ASSERT_ALWAYS(aVal, User::Leave(KErrArgument)); |
|
245 iSIPProfile->SetDefault(aVal); |
|
246 break; |
|
247 case KSIPSigComp: |
|
248 iSIPProfile->EnableSigComp(aVal); |
|
249 break; |
|
250 case KSIPAutoRegistration: |
|
251 iSIPProfile->SetAutoRegistrationEnabled(aVal); |
|
252 break; |
|
253 case KSIPSecurityNegotiation: |
|
254 iSIPProfile->EnableSecurityNegotiation(aVal); |
|
255 break; |
|
256 case KSIPProfileId: |
|
257 case KSIPProviderName: |
|
258 case KSIPAccessPointId: |
|
259 case KSIPUserAor: |
|
260 case KSIPProfileRegistered: |
|
261 case KSIPRegisteredAors: |
|
262 case KSIPNegotiatedSecurityMechanism: |
|
263 case KSIPContactHeaderParams: |
|
264 case KSIPRegistrar: |
|
265 case KSIPOutboundProxy: |
|
266 case KSIPDigestUserName: |
|
267 case KSIPDigestRealm: |
|
268 case KSIPServerAddress: |
|
269 case KSIPPrivateIdentity: |
|
270 case KSIPDigestPassword: |
|
271 case KSIPHeaders: |
|
272 case KSIPContactHeaderUser: |
|
273 case KSIPSoIpTOS: |
|
274 case KSIPSnapId: |
|
275 User::Leave(KErrNotFound); |
|
276 default: |
|
277 iSIPProfile->SetExtensionParameterL(aParam, aVal); |
|
278 } |
|
279 } |
|
280 |
|
281 // ----------------------------------------------------------------------------- |
|
282 // CSIPManagedProfile::SetParameterL |
|
283 // ----------------------------------------------------------------------------- |
|
284 // |
|
285 void CSIPManagedProfile::SetParameterL(TUint32 aServerType, |
|
286 TUint32 aParam, const TDesC8& aVal) |
|
287 { |
|
288 switch (aParam) |
|
289 { |
|
290 case KSIPDigestRealm: |
|
291 case KSIPDigestUserName: |
|
292 case KSIPDigestPassword: |
|
293 iSIPProfile->SetServerParameterL(aServerType, aParam, aVal); |
|
294 break; |
|
295 case KSIPServerAddress: |
|
296 iSIPProfile->SetServerL(aServerType, aVal); |
|
297 break; |
|
298 case KSIPProfileId: |
|
299 case KSIPProviderName: |
|
300 case KSIPAccessPointId: |
|
301 case KSIPSigComp: |
|
302 case KSIPSecurityNegotiation: |
|
303 case KSIPAutoRegistration: |
|
304 case KSIPUserAor: |
|
305 case KSIPProfileRegistered: |
|
306 case KSIPRegisteredAors: |
|
307 case KSIPNegotiatedSecurityMechanism: |
|
308 case KSIPDefaultProfile: |
|
309 case KSIPContactHeaderParams: |
|
310 case KSIPRegistrar: |
|
311 case KSIPOutboundProxy: |
|
312 case KSIPPrivateIdentity: |
|
313 case KSIPContactHeaderUser: |
|
314 case KSIPSoIpTOS: |
|
315 case KSIPSnapId: |
|
316 User::Leave(KErrNotFound); |
|
317 default: |
|
318 TBuf8<KParameterbufLength> buf; |
|
319 buf.Format(KSIPProfileExtenstionParameter, aParam); |
|
320 iSIPProfile->SetServerExtensionParameterL( |
|
321 aServerType, buf, aVal); |
|
322 } |
|
323 } |
|
324 |
|
325 // ----------------------------------------------------------------------------- |
|
326 // CSIPManagedProfile::SetParameterL |
|
327 // ----------------------------------------------------------------------------- |
|
328 // |
|
329 void CSIPManagedProfile::SetParameterL(TUint32 aParam, |
|
330 const MDesC8Array& aVal) |
|
331 { |
|
332 switch (aParam) |
|
333 { |
|
334 case KSIPContactHeaderParams: |
|
335 iSIPProfile->SetContactHeaderParamsL(aVal); |
|
336 break; |
|
337 case KSIPHeaders: |
|
338 iSIPProfile->SetSIPHeadersL(aVal); |
|
339 break; |
|
340 case KSIPProfileId: |
|
341 case KSIPProviderName: |
|
342 case KSIPAccessPointId: |
|
343 case KSIPSigComp: |
|
344 case KSIPSecurityNegotiation: |
|
345 case KSIPAutoRegistration: |
|
346 case KSIPUserAor: |
|
347 case KSIPProfileRegistered: |
|
348 case KSIPRegisteredAors: |
|
349 case KSIPNegotiatedSecurityMechanism: |
|
350 case KSIPDefaultProfile: |
|
351 case KSIPRegistrar: |
|
352 case KSIPOutboundProxy: |
|
353 case KSIPDigestUserName: |
|
354 case KSIPDigestRealm: |
|
355 case KSIPServerAddress: |
|
356 case KSIPPrivateIdentity: |
|
357 case KSIPDigestPassword: |
|
358 case KSIPContactHeaderUser: |
|
359 case KSIPSoIpTOS: |
|
360 case KSIPSnapId: |
|
361 User::Leave(KErrNotFound); |
|
362 default: |
|
363 iSIPProfile->SetExtensionParameterL(aParam, aVal); |
|
364 } |
|
365 } |