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