|
1 /* |
|
2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: The class providing profile data of SIP service provider |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CSIPPROFILE_H |
|
20 #define CSIPPROFILE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <e32std.h> |
|
25 #include <badesca.h> |
|
26 #include "sipregistrationcontext.h" |
|
27 #include "sipprofiletypeinfo.h" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CSIPConcreteProfile; |
|
31 class CSIPProfileRegistry; |
|
32 class CSIPProfileRegistryBase; |
|
33 |
|
34 /** |
|
35 * SIP Profile ID which value is type of TUint32 |
|
36 */ |
|
37 const TUint32 KSIPProfileId = 1; |
|
38 |
|
39 /** |
|
40 * SIP Provider Name which value is type of TDesC8 |
|
41 */ |
|
42 const TUint32 KSIPProviderName = 2; |
|
43 |
|
44 /** |
|
45 * Access Point ID which value is type of TUint32 |
|
46 */ |
|
47 const TUint32 KSIPAccessPointId = 3; |
|
48 |
|
49 /** |
|
50 * Signaling compression (SigComp) which value is type of TBool. |
|
51 * ETrue indicates that SigComp is enabled |
|
52 */ |
|
53 const TUint32 KSIPSigComp = 4; |
|
54 |
|
55 /** |
|
56 * Security Negotiation which value is type of TBool. ETrue indicates that |
|
57 * Security Negotiation is enabled |
|
58 */ |
|
59 const TUint32 KSIPSecurityNegotiation = 5; |
|
60 |
|
61 /** |
|
62 * Auto Registration which value is type of TBool. ETrue indicates that |
|
63 * profile is enabled for auto registration |
|
64 */ |
|
65 const TUint32 KSIPAutoRegistration = 6; |
|
66 |
|
67 /** |
|
68 * Defined user's address-of-record which value is type of TDesC8 |
|
69 */ |
|
70 const TUint32 KSIPUserAor = 7; |
|
71 |
|
72 /** |
|
73 * Registration which value is type of TBool. ETrue indicates that |
|
74 * profile is registered |
|
75 */ |
|
76 const TUint32 KSIPProfileRegistered = 8; |
|
77 |
|
78 /** |
|
79 * Uers's registered address-of-records which value is of type MDesC8Array. |
|
80 * Note that array will contain AORs only in case the profile is registered. |
|
81 */ |
|
82 const TUint32 KSIPRegisteredAors = 9; |
|
83 |
|
84 /** |
|
85 * Negotiated security mechanism during registration procedure which value |
|
86 * is of type TDesC8. |
|
87 * Note that descriptor will contain value only in case the profile is |
|
88 * registered. |
|
89 */ |
|
90 const TUint32 KSIPNegotiatedSecurityMechanism = 10; |
|
91 |
|
92 /** |
|
93 * Default profile which value is type of TBool. |
|
94 * ETrue indicates that profile is default |
|
95 */ |
|
96 const TUint32 KSIPDefaultProfile = 11; |
|
97 |
|
98 /** |
|
99 * "Contact" header parameters used during registration which value |
|
100 *is of type MDesC8Array. Array element contains one "Contact" header |
|
101 * parameter. |
|
102 */ |
|
103 const TUint32 KSIPContactHeaderParams = 12; |
|
104 const TUint32 KSIPRegisteredContact = 13; |
|
105 const TUint32 KSIPSnapId = 14; |
|
106 const TUint32 KSIPContactHeaderUser = 15; |
|
107 const TUint32 KSIPSoIpTOS = 16; |
|
108 |
|
109 const TUint32 KSIPRegistrar = 130; |
|
110 |
|
111 /** |
|
112 * SIP Outbound Proxy |
|
113 */ |
|
114 const TUint32 KSIPOutboundProxy = 131; |
|
115 |
|
116 /** |
|
117 * HTTP Digest user name which value is type of TDesC8 |
|
118 */ |
|
119 const TUint32 KSIPDigestUserName = 150; |
|
120 |
|
121 /** |
|
122 * HTTP Digest realm which value is type of TDesC8 |
|
123 */ |
|
124 const TUint32 KSIPDigestRealm = 151; |
|
125 |
|
126 /** |
|
127 * SIP server's address which value is of type TDesC8 |
|
128 */ |
|
129 const TUint32 KSIPServerAddress = 152; |
|
130 |
|
131 // CLASS DECLARATION |
|
132 /** |
|
133 * @publishedAll |
|
134 * @released |
|
135 * |
|
136 * Class contains profile information of particular SIP service |
|
137 * provider. Class provides functions for quering profile parameter |
|
138 * values. |
|
139 * @lib sipprofilecli.lib |
|
140 */ |
|
141 class CSIPProfile: public CBase,public MSIPRegistrationContext |
|
142 { |
|
143 public: // Constructors and destructor |
|
144 /** |
|
145 * Destructor. |
|
146 * @capability NetworkServices |
|
147 */ |
|
148 IMPORT_C ~CSIPProfile(); |
|
149 |
|
150 public: // New functions |
|
151 /** |
|
152 * Gets profile type information |
|
153 * @return profile type information |
|
154 */ |
|
155 IMPORT_C const TSIPProfileTypeInfo& Type() const; |
|
156 |
|
157 /** |
|
158 * Gets profile parameter |
|
159 * @param aParam a parameter to get |
|
160 * @param aVal on return will contain parameter value |
|
161 * @return KErrNotFound if parameter was not found, KErrNone otherwise |
|
162 */ |
|
163 IMPORT_C TInt GetParameter(TUint32 aParam, TDesC8 const *& aVal) const; |
|
164 |
|
165 /** |
|
166 * Gets profile parameter |
|
167 * @param aParam a parameter to get |
|
168 * @param aVal on return will contain parameter value |
|
169 * @return KErrNotFound if parameter was not found, KErrNone otherwise |
|
170 */ |
|
171 IMPORT_C TInt GetParameter(TUint32 aParam, TUint32& aVal) const; |
|
172 |
|
173 /** |
|
174 * Gets profile parameter |
|
175 * @param aParam a parameter to get |
|
176 * @param aVal on return will contain parameter value |
|
177 * @return KErrNotFound if parameter was not found, KErrNone otherwise |
|
178 */ |
|
179 IMPORT_C TInt GetParameter(TUint32 aParam, TBool& aVal) const; |
|
180 |
|
181 /** |
|
182 * Gets profile parameter |
|
183 * @param aParam a parameter to get |
|
184 * @param aVal on return will contain parameter value |
|
185 * @return KErrNotFound if parameter was not found, KErrNone otherwise |
|
186 */ |
|
187 IMPORT_C TInt GetParameter(TUint32 aParam, MDesC8Array const *& aVal) const; |
|
188 |
|
189 /** |
|
190 * Gets profile parameter that is defined for a particular SIP server |
|
191 * @param aServer a SIP server type |
|
192 * @param aParam a parameter to get |
|
193 * @param aVal on return will contain parameter value |
|
194 * @return KErrNotFound if parameter was not found, KErrNone otherwise |
|
195 */ |
|
196 IMPORT_C TInt GetParameter(TUint32 aServerType, TUint32 aParam, TDesC8 const *& aVal) const; |
|
197 |
|
198 public: //Functions from base class |
|
199 /** |
|
200 * Tests if the registration context can be |
|
201 * used for creating SIP messages/dialogs |
|
202 * Profile can be used, when CSIPProfileRegistry::IsEnabled() == ETrue |
|
203 * and Status() == ERegistered. |
|
204 * @return ETrue if can be used, EFalse otherwise |
|
205 */ |
|
206 TBool IsContextActive() const; |
|
207 |
|
208 /** |
|
209 * |
|
210 * For internal use only |
|
211 * @return context id |
|
212 */ |
|
213 TUint32 ContextId() const; |
|
214 |
|
215 |
|
216 public: //New functions |
|
217 |
|
218 /** |
|
219 * Two-phased constructor. |
|
220 * @param aSIPRegistry a SIP profile client providing connection to SIP |
|
221 * profile server. |
|
222 */ |
|
223 |
|
224 static CSIPProfile* NewL(CSIPProfileRegistry* aSIPRegistry); |
|
225 |
|
226 /** |
|
227 * Two-phased constructor. |
|
228 * @param aSIPRegistry a SIP profile client providing connection to SIP |
|
229 * profile server. |
|
230 * Constructs an object and adds the pointer to the cleanup stack; |
|
231 */ |
|
232 |
|
233 static CSIPProfile* NewLC(CSIPProfileRegistry* aSIPRegistry); |
|
234 |
|
235 /** |
|
236 * Sets profiles enabled state |
|
237 * @param aEnabled ETrue if enabled |
|
238 */ |
|
239 |
|
240 void SetEnabled(TBool aEnabled); |
|
241 |
|
242 /** |
|
243 * Sets concrete profile that holds actual data |
|
244 * @param aProfile profile instance containing data |
|
245 */ |
|
246 |
|
247 void SetConcreteProfile(CSIPConcreteProfile* aProfile); |
|
248 |
|
249 /** |
|
250 * Clears concrete profile that holds actual data |
|
251 */ |
|
252 |
|
253 void ClearConcreteProfile(); |
|
254 |
|
255 /** |
|
256 * Gets concrete profile that holds actual data |
|
257 * @return concrete profile holding data |
|
258 */ |
|
259 |
|
260 CSIPConcreteProfile& ConcreteProfile(); |
|
261 |
|
262 /** |
|
263 * Gets concrete profile that holds actual data |
|
264 * @return concrete profile holding data |
|
265 */ |
|
266 |
|
267 const CSIPConcreteProfile& ConcreteProfile() const; |
|
268 |
|
269 /** |
|
270 * Checks if the profile is enabled |
|
271 * @return ETrue if enabled, EFalse otherwise |
|
272 */ |
|
273 |
|
274 TBool IsEnabled() const; |
|
275 |
|
276 /** |
|
277 * Gets last occurred error during registration |
|
278 * @return last occurred error code, KErrNone if no error |
|
279 */ |
|
280 TInt LastRegistrationError() const; |
|
281 |
|
282 /** |
|
283 * Checks if two profiles are equal |
|
284 * @return ETrue if equal |
|
285 */ |
|
286 TBool operator==(const CSIPProfile& |
|
287 aProfile) const; |
|
288 |
|
289 /** |
|
290 * sets pointer to registry for profile |
|
291 */ |
|
292 void SetRegistry(CSIPProfileRegistryBase* aRegistry); |
|
293 |
|
294 /** |
|
295 * Clears pointer to registry from profile |
|
296 */ |
|
297 void ClearRegistry(); |
|
298 |
|
299 protected: |
|
300 |
|
301 /** |
|
302 * Constructor. |
|
303 */ |
|
304 CSIPProfile(CSIPProfileRegistryBase* aRegistry); |
|
305 |
|
306 /** |
|
307 * 2nd phase constructor. |
|
308 */ |
|
309 void ConstructL(); |
|
310 |
|
311 protected: |
|
312 |
|
313 CSIPConcreteProfile* iSIPProfile; |
|
314 CSIPProfileRegistryBase* iSIPProfileRegistry; |
|
315 |
|
316 // Stub data |
|
317 |
|
318 public: |
|
319 TBuf8<25> iRegistrarPassword; |
|
320 TBuf8<25> iProxyPassword; |
|
321 TBuf8<25> iProviderNameValue; |
|
322 TBuf8<25> iUserAorValue; |
|
323 TUint iAccessPointIdValue; |
|
324 TUint iSnapIdValue; |
|
325 TBool iSigCompValue; |
|
326 TBool iAutoRegistrationValue; |
|
327 TBool iSecurityNegotiationValue; |
|
328 TBool iAllowAutoRegistrationOnlyOnHomeNetworkValue; |
|
329 |
|
330 TBool iEnabled; |
|
331 TBool iIsDefaultProfile; |
|
332 |
|
333 TSIPProfileTypeInfo iTypeInfo; |
|
334 |
|
335 // Value iTUint32Value is set to aVal when calling |
|
336 // GetParameter(TUint32 aParam, TUint32& aVal) |
|
337 // if iTUint32ValueError == KErrNone. |
|
338 // iTUint32ValueError is returned in any case |
|
339 TUint32 iTUint32Value; |
|
340 TInt iTUint32ValueError; |
|
341 |
|
342 // Value iTBoolValue is set to aVal when calling |
|
343 // GetParameter(TUint32 aParam, TBool& aVal) |
|
344 // if iTBoolValueError == KErrNone. |
|
345 // iTBoolValueError is returned in any case |
|
346 TBool iTBoolValue; |
|
347 TInt iTBoolValueError; |
|
348 |
|
349 CDesC8Array* iArray; |
|
350 |
|
351 // |
|
352 }; |
|
353 |
|
354 #endif // CSIPPROFILE_H |