|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Header declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 #ifndef SEN_BASE_IDENTITY_H |
|
29 #define SEN_BASE_IDENTITY_H |
|
30 |
|
31 //INCLUDES |
|
32 #include <SenBaseFragment.h> |
|
33 |
|
34 #include "msenidentity.h" |
|
35 |
|
36 |
|
37 // CONSTANTS |
|
38 _LIT8( KIdentityElementLocalName, "Identity" ); |
|
39 _LIT8( KServiceIDElementLocalName, "ServiceID" ); |
|
40 |
|
41 // FORWARD DECLARATIONS |
|
42 class CSenIdentityProvider; |
|
43 |
|
44 //TYPEDEFS |
|
45 typedef RPointerArray<CSenIdentityProvider> RIdentityProviderList; |
|
46 |
|
47 // CLASS DECLARATION |
|
48 class CSenBaseIdentity : public CSenBaseFragment, |
|
49 public MSenIdentity |
|
50 { |
|
51 public: // Constructors and destructor |
|
52 |
|
53 /** |
|
54 * Two-phased constructor. |
|
55 */ |
|
56 IMPORT_C static CSenBaseIdentity* NewL(TPtrC8 aIMEI); |
|
57 IMPORT_C static CSenBaseIdentity* NewLC(TPtrC8 aIMEI); |
|
58 |
|
59 /** |
|
60 * Destructor |
|
61 */ |
|
62 IMPORT_C ~CSenBaseIdentity(); |
|
63 |
|
64 // New functions |
|
65 |
|
66 /** |
|
67 * A getter. |
|
68 * @param aService the service description |
|
69 * @return a pointer to IdentityProvider |
|
70 */ |
|
71 virtual CSenIdentityProvider* IdentityProviderL( |
|
72 MSenServiceDescription& aService ); |
|
73 |
|
74 /** |
|
75 * A getter. |
|
76 * @param aIdentityProviderId an URI of the service (endpoint or contract) |
|
77 * @return a pointer to IdentityProvider |
|
78 */ |
|
79 virtual CSenIdentityProvider* IdentityProviderL( const TDesC8& aUri ); |
|
80 |
|
81 /** |
|
82 * A getter. |
|
83 * @param aIdpList an array of ProviderIDs |
|
84 * @param strict if set to true only an IdentityProvider from the List |
|
85 * will be returned, and null if none of the list entries is known to the |
|
86 * current active Identity. |
|
87 * @return a pointer to IdentityProvider |
|
88 */ |
|
89 virtual CSenIdentityProvider* IdentityProviderL( |
|
90 const CDesC8Array& aIdpList, |
|
91 TBool aStrict); |
|
92 |
|
93 /** |
|
94 * A getter. |
|
95 * @param aService the service description |
|
96 * @param aIdpList an array of ProviderIDs |
|
97 * @param strict if set to true only an IdentityProvider from the List |
|
98 * will be returned, and null if none of the list entries is known to the |
|
99 * current active Identity. |
|
100 * @return a pointer to IdentityProvider |
|
101 */ |
|
102 virtual CSenIdentityProvider* IdentityProviderL( |
|
103 MSenServiceDescription& aService, |
|
104 const CDesC8Array& aIdpList, |
|
105 TBool aStrict); |
|
106 |
|
107 /** |
|
108 * A getter. |
|
109 * @return a pointer to IdentityProvider |
|
110 */ |
|
111 virtual CSenIdentityProvider* IdentityProviderL(); |
|
112 |
|
113 /** |
|
114 * Register an IdentityProvider for the current active Identity. |
|
115 * @param aIdp a registered IdentityProvider |
|
116 * @return KErrNone or system-wide error code. |
|
117 */ |
|
118 virtual TInt RegisterIdentityProviderL(CSenIdentityProvider* aIdp ); |
|
119 |
|
120 virtual TInt UpdateIdentityProviderL(CSenIdentityProvider& aIdp); |
|
121 |
|
122 /** |
|
123 * Unregister an IdentityProvider for the current active Identity. |
|
124 * @param aIdp an unregistered IdentityProvider |
|
125 * @return true if successful. |
|
126 */ |
|
127 virtual TInt UnregisterIdentityProviderL(CSenIdentityProvider& aIdp ); |
|
128 |
|
129 /** |
|
130 * Associate a service to an IdentityProvider. |
|
131 * @param aServiceID the contract or endpoint of a service |
|
132 * @param aProviderID the id of an IdentityProvider |
|
133 * @return true if successful. Failure may be caused by non-existence |
|
134 * of the IdentityProvider for the current user. |
|
135 */ |
|
136 virtual TBool AssociateServiceL( const TDesC8& aServiceID, |
|
137 const TDesC8& aProviderID ); |
|
138 |
|
139 /** |
|
140 * Dissociate a service from an IdentityProvider. |
|
141 * @param aServiceID the contract or endpoint of a service |
|
142 * @param aProviderID the id of an IdentityProvider |
|
143 * @return true if successful. Failure may be caused by non-existence |
|
144 * of the IdentityProvider for the current user. |
|
145 */ |
|
146 virtual TBool DissociateServiceL(const TDesC8& aServiceID, |
|
147 const TDesC8& aProviderID ); |
|
148 |
|
149 /** |
|
150 * Creates the element. Overrides CSenBaseFragment |
|
151 * StartElementL-function |
|
152 * @param aNsUri name space URI |
|
153 * @param aLocalName local name |
|
154 * @param aQName cue name |
|
155 * @param apAttrs XML attributes |
|
156 */ |
|
157 virtual void StartElementL(const TDesC8& aNsUri, |
|
158 const TDesC8& aLocalName, |
|
159 const TDesC8& aQName, |
|
160 const RAttributeArray& aAttributes); |
|
161 |
|
162 void EndElementL(const TDesC8& aNsUri, |
|
163 const TDesC8& aLocalName, |
|
164 const TDesC8& aQName); |
|
165 |
|
166 virtual HBufC8* AsXmlL(); |
|
167 virtual HBufC* AsXmlUnicodeL(); |
|
168 virtual void WriteAsXMLToL(RWriteStream& aWriteStream); |
|
169 |
|
170 /** |
|
171 * A Type getter. |
|
172 * @return a pointer to the type |
|
173 */ |
|
174 virtual const TDesC8& Type(); |
|
175 |
|
176 /** |
|
177 * A Name getter. |
|
178 * @return a pointer to the name |
|
179 */ |
|
180 virtual const TDesC8& Name(); |
|
181 |
|
182 /** |
|
183 * A UserName getter. |
|
184 * @return a pointer to the user name |
|
185 */ |
|
186 virtual const TDesC8& UserName(); |
|
187 |
|
188 /** |
|
189 * Checks if Identity already has an identity provider with given data. |
|
190 * Existing identity provider can still have more data than the pattern. |
|
191 * @param aContains will contain the boolean value on return. ETrue if |
|
192 * contains, EFalse otherwise. |
|
193 * @param aIDP the pattern identity provider. |
|
194 * @return KErrNone or system-wide error code. |
|
195 */ |
|
196 virtual TInt ContainsIdentityProviderL( TBool& aContains, |
|
197 CSenIdentityProvider& aIDP); |
|
198 |
|
199 |
|
200 /** |
|
201 * Method for finding an identity provider. |
|
202 * @param aIdp Identity provider to be searched |
|
203 * @param apMatch ref-to-pointer to the found identity provider or |
|
204 * NULL if not found. Ownership is NOT transferred. |
|
205 * @return KErrNotFound if no match was found. |
|
206 * or otherwise the iProviderList index of found IdP. |
|
207 */ |
|
208 virtual TInt FindMatchingIdentityProviderL(CSenIdentityProvider &aIdp, |
|
209 CSenIdentityProvider*& apMatch); |
|
210 |
|
211 virtual const RIdentityProviderList& IdentityProvidersL() const; |
|
212 |
|
213 private: |
|
214 |
|
215 /** |
|
216 * C++ default constructor. |
|
217 */ |
|
218 CSenBaseIdentity(TPtrC8 aIMEI); |
|
219 |
|
220 /** |
|
221 * By default Symbian 2nd phase constructor is private. |
|
222 */void ConstructL(); |
|
223 |
|
224 // New functions |
|
225 |
|
226 /** |
|
227 * A getter. |
|
228 * @param aProviderID the providers ID |
|
229 * @return a pointer to IdentityProvider |
|
230 */ |
|
231 CSenIdentityProvider* IdentityProviderNamed( const TDesC8& aProviderID ); |
|
232 TInt IdentityProviderNamed( const TDesC8& aProviderID, |
|
233 CSenIdentityProvider*& apMatch); |
|
234 |
|
235 #ifdef __CRYPTO_HW__ |
|
236 void EncryptPasswordL(const TDesC8& aData, TDes8& aCipherText); |
|
237 |
|
238 void DecryptPasswordL(const TDesC8& aData, TDes8& aCipherText); |
|
239 |
|
240 #endif // __CRYPTO_HW__ |
|
241 private: //Data |
|
242 RIdentityProviderList iProviderList; |
|
243 CSenIdentityProvider* iProvider; |
|
244 TPtrC8 iIMEI; |
|
245 }; |
|
246 |
|
247 #endif // SEN_BASE_IDENTITY_H |
|
248 |
|
249 // End of File |