|
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 |
|
105 /** |
|
106 * SIP Registrar |
|
107 */ |
|
108 const TUint32 KSIPRegistrar = 130; |
|
109 |
|
110 /** |
|
111 * SIP Outbound Proxy |
|
112 */ |
|
113 const TUint32 KSIPOutboundProxy = 131; |
|
114 |
|
115 /** |
|
116 * HTTP Digest user name which value is type of TDesC8 |
|
117 */ |
|
118 const TUint32 KSIPDigestUserName = 150; |
|
119 |
|
120 /** |
|
121 * HTTP Digest realm which value is type of TDesC8 |
|
122 */ |
|
123 const TUint32 KSIPDigestRealm = 151; |
|
124 |
|
125 /** |
|
126 * SIP server's address which value is of type TDesC8 |
|
127 */ |
|
128 const TUint32 KSIPServerAddress = 152; |
|
129 |
|
130 // CLASS DECLARATION |
|
131 /** |
|
132 * @publishedAll |
|
133 * @released |
|
134 * |
|
135 * Class contains profile information of particular SIP service |
|
136 * provider. Class provides functions for quering profile parameter |
|
137 * values. |
|
138 * @lib sipprofilecli.lib |
|
139 */ |
|
140 class CSIPProfile: public CBase, public MSIPRegistrationContext |
|
141 { |
|
142 public: // Constructors and destructor |
|
143 /** |
|
144 * Destructor. |
|
145 * @capability NetworkServices |
|
146 */ |
|
147 IMPORT_C ~CSIPProfile(); |
|
148 |
|
149 public: // New functions |
|
150 /** |
|
151 * Gets profile type information |
|
152 * @return profile type information |
|
153 */ |
|
154 IMPORT_C const TSIPProfileTypeInfo& Type() const; |
|
155 |
|
156 /** |
|
157 * Gets profile parameter |
|
158 * @param aParam a parameter to get |
|
159 * @param aVal on return will contain parameter value |
|
160 * @return KErrNotFound if parameter was not found, KErrNone otherwise |
|
161 */ |
|
162 IMPORT_C TInt GetParameter(TUint32 aParam, TDesC8 const *& aVal) const; |
|
163 |
|
164 /** |
|
165 * Gets profile parameter |
|
166 * @param aParam a parameter to get |
|
167 * @param aVal on return will contain parameter value |
|
168 * @return KErrNotFound if parameter was not found, KErrNone otherwise |
|
169 */ |
|
170 IMPORT_C TInt GetParameter(TUint32 aParam, TUint32& aVal) const; |
|
171 |
|
172 /** |
|
173 * Gets profile parameter |
|
174 * @param aParam a parameter to get |
|
175 * @param aVal on return will contain parameter value |
|
176 * @return KErrNotFound if parameter was not found, KErrNone otherwise |
|
177 */ |
|
178 IMPORT_C TInt GetParameter(TUint32 aParam, TBool& aVal) const; |
|
179 |
|
180 /** |
|
181 * Gets profile parameter |
|
182 * @param aParam a parameter to get |
|
183 * @param aVal on return will contain parameter value |
|
184 * @return KErrNotFound if parameter was not found, KErrNone otherwise |
|
185 */ |
|
186 IMPORT_C TInt GetParameter(TUint32 aParam, MDesC8Array const *& aVal) const; |
|
187 |
|
188 /** |
|
189 * Gets profile parameter that is defined for a particular SIP server |
|
190 * @param aServer a SIP server type |
|
191 * @param aParam a parameter to get |
|
192 * @param aVal on return will contain parameter value |
|
193 * @return KErrNotFound if parameter was not found, KErrNone otherwise |
|
194 */ |
|
195 IMPORT_C TInt GetParameter(TUint32 aServerType, TUint32 aParam, TDesC8 const *& aVal) const; |
|
196 |
|
197 public: //Functions from base class |
|
198 /** |
|
199 * Tests if the registration context can be |
|
200 * used for creating SIP messages/dialogs |
|
201 * Profile can be used, when CSIPProfileRegistry::IsEnabled() == ETrue |
|
202 * and Status() == ERegistered. |
|
203 * @return ETrue if can be used, EFalse otherwise |
|
204 */ |
|
205 TBool IsContextActive() const; |
|
206 |
|
207 /** |
|
208 * |
|
209 * For internal use only |
|
210 * @return context id |
|
211 */ |
|
212 TUint32 ContextId() const; |
|
213 |
|
214 |
|
215 public: //New functions |
|
216 |
|
217 /** |
|
218 * Two-phased constructor. |
|
219 * @param aSIPRegistry a SIP profile client providing connection to SIP |
|
220 * profile server. |
|
221 */ |
|
222 |
|
223 static CSIPProfile* NewL(CSIPProfileRegistry* aSIPRegistry); |
|
224 |
|
225 /** |
|
226 * Two-phased constructor. |
|
227 * @param aSIPRegistry a SIP profile client providing connection to SIP |
|
228 * profile server. |
|
229 * Constructs an object and adds the pointer to the cleanup stack; |
|
230 */ |
|
231 |
|
232 static CSIPProfile* NewLC(CSIPProfileRegistry* aSIPRegistry); |
|
233 |
|
234 /** |
|
235 * Sets profiles enabled state |
|
236 * @param aEnabled ETrue if enabled |
|
237 */ |
|
238 |
|
239 void SetEnabled(TBool aEnabled); |
|
240 |
|
241 /** |
|
242 * Sets concrete profile that holds actual data |
|
243 * @param aProfile profile instance containing data |
|
244 */ |
|
245 |
|
246 void SetConcreteProfile(CSIPConcreteProfile* aProfile); |
|
247 |
|
248 /** |
|
249 * Clears concrete profile that holds actual data |
|
250 */ |
|
251 |
|
252 void ClearConcreteProfile(); |
|
253 |
|
254 /** |
|
255 * Gets concrete profile that holds actual data |
|
256 * @return concrete profile holding data |
|
257 */ |
|
258 |
|
259 CSIPConcreteProfile& ConcreteProfile(); |
|
260 |
|
261 /** |
|
262 * Gets concrete profile that holds actual data |
|
263 * @return concrete profile holding data |
|
264 */ |
|
265 |
|
266 const CSIPConcreteProfile& ConcreteProfile() const; |
|
267 |
|
268 /** |
|
269 * Checks if the profile is enabled |
|
270 * @return ETrue if enabled, EFalse otherwise |
|
271 */ |
|
272 |
|
273 TBool IsEnabled() const; |
|
274 |
|
275 /** |
|
276 * Gets last occurred error during registration |
|
277 * @return last occurred error code, KErrNone if no error |
|
278 */ |
|
279 TInt LastRegistrationError() const; |
|
280 |
|
281 /** |
|
282 * Checks if two profiles are equal |
|
283 * @return ETrue if equal |
|
284 */ |
|
285 TBool operator==(const CSIPProfile& |
|
286 aProfile) const; |
|
287 |
|
288 /** |
|
289 * sets pointer to registry for profile |
|
290 */ |
|
291 void SetRegistry(CSIPProfileRegistryBase* aRegistry); |
|
292 |
|
293 /** |
|
294 * Clears pointer to registry from profile |
|
295 */ |
|
296 void ClearRegistry(); |
|
297 |
|
298 protected: |
|
299 |
|
300 /** |
|
301 * Constructor. |
|
302 */ |
|
303 CSIPProfile(CSIPProfileRegistryBase* aRegistry); |
|
304 |
|
305 /** |
|
306 * 2nd phase constructor. |
|
307 */ |
|
308 void ConstructL(); |
|
309 |
|
310 protected: |
|
311 |
|
312 CSIPConcreteProfile* iSIPProfile; |
|
313 CSIPProfileRegistryBase* iSIPProfileRegistry; |
|
314 |
|
315 // Stub data |
|
316 |
|
317 public: |
|
318 |
|
319 TBool iEnabled; |
|
320 TBool iIsDefaultProfile; |
|
321 |
|
322 TSIPProfileTypeInfo iTypeInfo; |
|
323 |
|
324 // Value iTUint32Value is set to aVal when calling |
|
325 // GetParameter(TUint32 aParam, TUint32& aVal) |
|
326 // if iTUint32ValueError == KErrNone. |
|
327 // iTUint32ValueError is returned in any case |
|
328 TUint32 iTUint32Value; |
|
329 TInt iTUint32ValueError; |
|
330 |
|
331 // Value iTBoolValue is set to aVal when calling |
|
332 // GetParameter(TUint32 aParam, TBool& aVal) |
|
333 // if iTBoolValueError == KErrNone. |
|
334 // iTBoolValueError is returned in any case |
|
335 TBool iTBoolValue; |
|
336 TInt iTBoolValueError; |
|
337 |
|
338 CDesC8Array* iArray; |
|
339 |
|
340 // |
|
341 }; |
|
342 |
|
343 #endif // CSIPPROFILE_H |