williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description: Class implements (web) service credential functionality
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
|
williamr@2
|
20 |
|
williamr@2
|
21 |
|
williamr@2
|
22 |
|
williamr@2
|
23 |
|
williamr@2
|
24 |
|
williamr@2
|
25 |
#ifndef SEN_CREDENTIAL_H
|
williamr@2
|
26 |
#define SEN_CREDENTIAL_H
|
williamr@2
|
27 |
|
williamr@2
|
28 |
// INCLUDES
|
williamr@2
|
29 |
#include <e32base.h>
|
williamr@2
|
30 |
#include <s32strm.h>
|
williamr@2
|
31 |
#include <SenBaseFragment.h>
|
williamr@2
|
32 |
|
williamr@2
|
33 |
// CONSTANTS
|
williamr@2
|
34 |
_LIT8(KCredentialsName, "Credentials");
|
williamr@2
|
35 |
_LIT8(KEndpointName, "Endpoint");
|
williamr@2
|
36 |
_LIT8(KSecurityMechIdName, "SecurityMechID");
|
williamr@2
|
37 |
_LIT8(KNotOnOrAfterName, "NotOnOrAfter");
|
williamr@2
|
38 |
_LIT8(KConditionsName, "Conditions");
|
williamr@2
|
39 |
|
williamr@2
|
40 |
// FORWARD DECLARATIONS
|
williamr@2
|
41 |
class SenDateUtils;
|
williamr@2
|
42 |
|
williamr@2
|
43 |
// CLASS DECLARATION
|
williamr@2
|
44 |
|
williamr@2
|
45 |
/**
|
williamr@2
|
46 |
* Class implements (web) service credential functionality
|
williamr@2
|
47 |
* @lib SenServDesc.lib
|
williamr@2
|
48 |
* @since Series60 3.0
|
williamr@2
|
49 |
*/
|
williamr@2
|
50 |
class CSenCredential : public CSenBaseFragment
|
williamr@2
|
51 |
{
|
williamr@2
|
52 |
public: // Constructors and destructor
|
williamr@2
|
53 |
|
williamr@2
|
54 |
/**
|
williamr@2
|
55 |
* Two-phase constructor.
|
williamr@2
|
56 |
* @since Series60 3.0
|
williamr@2
|
57 |
* @param aNsUri The namespace URI of the new element
|
williamr@2
|
58 |
* @param aLocalName The local name of the new element
|
williamr@2
|
59 |
* @param aQName The qualified name of the new element
|
williamr@2
|
60 |
* @param aAttributes The attributes of the new element
|
williamr@2
|
61 |
* @return new CSenCredential instance pointer
|
williamr@2
|
62 |
* Leave codes:
|
williamr@2
|
63 |
* KErrSenInvalidCharacters if aLocalName or aQName contains
|
williamr@2
|
64 |
* illegal characters.
|
williamr@2
|
65 |
* KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.
|
williamr@2
|
66 |
*/
|
williamr@2
|
67 |
IMPORT_C static CSenCredential* NewL(const TDesC8& aNsUri,
|
williamr@2
|
68 |
const TDesC8& aLocalName,
|
williamr@2
|
69 |
const TDesC8& aQName,
|
williamr@2
|
70 |
const RAttributeArray& aAttributes);
|
williamr@2
|
71 |
|
williamr@2
|
72 |
/**
|
williamr@2
|
73 |
* Two-phase constructor.
|
williamr@2
|
74 |
* @since Series60 3.0
|
williamr@2
|
75 |
* @param aNsUri The namespace URI of the new element
|
williamr@2
|
76 |
* @param aLocalName The local name of the new element
|
williamr@2
|
77 |
* @param aQName The qualified name of the new element
|
williamr@2
|
78 |
* @param aAttributes The attributes of the new element
|
williamr@2
|
79 |
* @return new CSenCredential instance pointer, which is left on
|
williamr@2
|
80 |
* cleanup stack.
|
williamr@2
|
81 |
* Leave codes:
|
williamr@2
|
82 |
* KErrSenInvalidCharacters if aLocalName or aQName contains
|
williamr@2
|
83 |
* illegal characters.
|
williamr@2
|
84 |
* KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.
|
williamr@2
|
85 |
*/
|
williamr@2
|
86 |
IMPORT_C static CSenCredential* NewLC(const TDesC8& aNsUri,
|
williamr@2
|
87 |
const TDesC8& aLocalName,
|
williamr@2
|
88 |
const TDesC8& aQName,
|
williamr@2
|
89 |
const RAttributeArray& aAttributes);
|
williamr@2
|
90 |
|
williamr@2
|
91 |
/**
|
williamr@2
|
92 |
* Constructor with a possibility to set a parent.
|
williamr@2
|
93 |
* @since Series60 3.0
|
williamr@2
|
94 |
* @param aNsUri The namespace URI of the new element
|
williamr@2
|
95 |
* @param aLocalName The local name of the new element
|
williamr@2
|
96 |
* @param aQName The qualified name of the new element
|
williamr@2
|
97 |
* @param aAttributes The attributes of the new element
|
williamr@2
|
98 |
* @param aParent The parent element of the new element
|
williamr@2
|
99 |
* @return new CSenCredential instance pointer
|
williamr@2
|
100 |
* Leave codes:
|
williamr@2
|
101 |
* KErrSenInvalidCharacters if aLocalName or aQName contains
|
williamr@2
|
102 |
* illegal characters.
|
williamr@2
|
103 |
* KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.
|
williamr@2
|
104 |
*/
|
williamr@2
|
105 |
IMPORT_C static CSenCredential* NewL(const TDesC8& aNsUri,
|
williamr@2
|
106 |
const TDesC8& aLocalName,
|
williamr@2
|
107 |
const TDesC8& aQName,
|
williamr@2
|
108 |
const RAttributeArray& aAttributes,
|
williamr@2
|
109 |
CSenElement& aParent);
|
williamr@2
|
110 |
|
williamr@2
|
111 |
/**
|
williamr@2
|
112 |
* Constructor with a possibility to set a parent.
|
williamr@2
|
113 |
* @since Series60 3.0
|
williamr@2
|
114 |
* @param aNsUri The namespace URI of the new element
|
williamr@2
|
115 |
* @param aLocalName The local name of the new element
|
williamr@2
|
116 |
* @param aQName The qualified name of the new element
|
williamr@2
|
117 |
* @param aAttributes The attributes of the new element
|
williamr@2
|
118 |
* @param aParent The parent element of the new element
|
williamr@2
|
119 |
* @return new CSenCredential instance pointer, which is left on
|
williamr@2
|
120 |
* cleanup stack.
|
williamr@2
|
121 |
* Leave codes:
|
williamr@2
|
122 |
* KErrSenInvalidCharacters if aLocalName or aQName contains
|
williamr@2
|
123 |
* illegal characters.
|
williamr@2
|
124 |
* KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.
|
williamr@2
|
125 |
*/
|
williamr@2
|
126 |
IMPORT_C static CSenCredential* NewLC(const TDesC8& aNsUri,
|
williamr@2
|
127 |
const TDesC8& aLocalName,
|
williamr@2
|
128 |
const TDesC8& aQName,
|
williamr@2
|
129 |
const RAttributeArray& aAttributes,
|
williamr@2
|
130 |
CSenElement& aParent);
|
williamr@2
|
131 |
|
williamr@2
|
132 |
/**
|
williamr@2
|
133 |
* Constructor which copies itself from another credential.
|
williamr@2
|
134 |
* @since Series60 3.0
|
williamr@2
|
135 |
* @param aCredential credential to copy from.
|
williamr@2
|
136 |
* @return new CSenCredential instance pointer
|
williamr@2
|
137 |
*/
|
williamr@2
|
138 |
IMPORT_C static CSenCredential* NewL(const CSenCredential& aCredential);
|
williamr@2
|
139 |
|
williamr@2
|
140 |
/**
|
williamr@2
|
141 |
* Constructor which copies itself from another credential.
|
williamr@2
|
142 |
* @since Series60 3.0
|
williamr@2
|
143 |
* @param aCredential credential to copy from.
|
williamr@2
|
144 |
* @return new CSenCredential instance pointer, which is left on
|
williamr@2
|
145 |
* cleanup stack.
|
williamr@2
|
146 |
*/
|
williamr@2
|
147 |
IMPORT_C static CSenCredential* NewLC(const CSenCredential& aCredential);
|
williamr@2
|
148 |
|
williamr@2
|
149 |
/**
|
williamr@2
|
150 |
* Destructor.
|
williamr@2
|
151 |
*/
|
williamr@2
|
152 |
IMPORT_C virtual ~CSenCredential();
|
williamr@2
|
153 |
|
williamr@2
|
154 |
// New functions
|
williamr@2
|
155 |
|
williamr@2
|
156 |
/**
|
williamr@2
|
157 |
* Getter for the credential ID.
|
williamr@2
|
158 |
* @since Series60 3.0
|
williamr@2
|
159 |
* @return the ID
|
williamr@2
|
160 |
*/
|
williamr@2
|
161 |
IMPORT_C const TDesC8& Id();
|
williamr@2
|
162 |
|
williamr@2
|
163 |
/**
|
williamr@2
|
164 |
* Getter for the credential expiration time.
|
williamr@2
|
165 |
* @since Series60 3.0
|
williamr@2
|
166 |
* @return the the expiration time
|
williamr@2
|
167 |
*/
|
williamr@2
|
168 |
IMPORT_C TTime& ValidUntil();
|
williamr@2
|
169 |
|
williamr@2
|
170 |
/**
|
williamr@2
|
171 |
* Setter for the credential expiration time.
|
williamr@2
|
172 |
* @since Series60 3.0
|
williamr@2
|
173 |
* @param aTime The new expiration time
|
williamr@2
|
174 |
*/
|
williamr@2
|
175 |
IMPORT_C void SetValidUntil(TTime& aTime);
|
williamr@2
|
176 |
|
williamr@2
|
177 |
protected: // Functions from base classes
|
williamr@2
|
178 |
|
williamr@2
|
179 |
/**
|
williamr@2
|
180 |
* From CSenDomFragment Callback function which implement the XML content handler interface.
|
williamr@2
|
181 |
* @since Series60 3.0
|
williamr@2
|
182 |
* @param aNsUri The namespace URI of the new element
|
williamr@2
|
183 |
* @param aLocalName The local name of the new element
|
williamr@2
|
184 |
* @param aQName The qualified name of the new element
|
williamr@2
|
185 |
* @param aAttributes The attributes of the new element
|
williamr@2
|
186 |
*/
|
williamr@2
|
187 |
IMPORT_C virtual void StartElementL(const TDesC8& aNsUri,
|
williamr@2
|
188 |
const TDesC8& aLocalName,
|
williamr@2
|
189 |
const TDesC8& aQName,
|
williamr@2
|
190 |
const RAttributeArray& aAttributes);
|
williamr@2
|
191 |
|
williamr@2
|
192 |
private:
|
williamr@2
|
193 |
|
williamr@2
|
194 |
/**
|
williamr@2
|
195 |
* C++ default constructor.
|
williamr@2
|
196 |
*/
|
williamr@2
|
197 |
IMPORT_C CSenCredential();
|
williamr@2
|
198 |
|
williamr@2
|
199 |
/**
|
williamr@2
|
200 |
* By default Symbian 2nd phase constructor is private.
|
williamr@2
|
201 |
* @since Series60 3.0
|
williamr@2
|
202 |
* @param aNsUri is the XML namespace as UTF-8 descriptor
|
williamr@2
|
203 |
* @param aLocalName is the XML localname as UTF-8 descriptor
|
williamr@2
|
204 |
* @param aQName is the XML qualifiedname as UTF-8 descriptor
|
williamr@2
|
205 |
* @param aAttributes is the list of XML attributes
|
williamr@2
|
206 |
*/
|
williamr@2
|
207 |
IMPORT_C void ConstructL(const TDesC8& aNsUri,
|
williamr@2
|
208 |
const TDesC8& aLocalName,
|
williamr@2
|
209 |
const TDesC8& aQName,
|
williamr@2
|
210 |
const RAttributeArray& aAttributes);
|
williamr@2
|
211 |
|
williamr@2
|
212 |
/**
|
williamr@2
|
213 |
* By default Symbian 2nd phase constructor is private.
|
williamr@2
|
214 |
* @since Series60 3.0
|
williamr@2
|
215 |
* @param aNsUri is the XML namespace as UTF-8 descriptor
|
williamr@2
|
216 |
* @param aLocalName is the XML localname as UTF-8 descriptor
|
williamr@2
|
217 |
* @param aQName is the XML qualifiedname as UTF-8 descriptor
|
williamr@2
|
218 |
* @param aAttributes is the list of XML attributes
|
williamr@2
|
219 |
* @param aParent is the parent element, which may declare other
|
williamr@2
|
220 |
* namespaces.
|
williamr@2
|
221 |
*/
|
williamr@2
|
222 |
IMPORT_C void ConstructL(const TDesC8& aNsUri,
|
williamr@2
|
223 |
const TDesC8& aLocalName,
|
williamr@2
|
224 |
const TDesC8& aQName,
|
williamr@2
|
225 |
const RAttributeArray& aAttributes,
|
williamr@2
|
226 |
CSenElement& aParent);
|
williamr@2
|
227 |
|
williamr@2
|
228 |
/**
|
williamr@2
|
229 |
* By default Symbian 2nd phase constructor is private.
|
williamr@2
|
230 |
* @since Series60 3.0
|
williamr@2
|
231 |
* @param aCredential is the source credential to be copied.
|
williamr@2
|
232 |
*/
|
williamr@2
|
233 |
IMPORT_C void ConstructL(CSenCredential& aCredential);
|
williamr@2
|
234 |
|
williamr@2
|
235 |
// New functions
|
williamr@2
|
236 |
|
williamr@2
|
237 |
/**
|
williamr@2
|
238 |
* Setter for Credential ID
|
williamr@2
|
239 |
* @since Series60 3.0
|
williamr@2
|
240 |
* @param aId is the unique ID for this Credential
|
williamr@2
|
241 |
*/
|
williamr@2
|
242 |
void SetIdL(const TDesC8& aId);
|
williamr@2
|
243 |
|
williamr@2
|
244 |
private: // Data
|
williamr@2
|
245 |
// Unique ID for this credential. Owned.
|
williamr@2
|
246 |
HBufC8* iId;
|
williamr@2
|
247 |
// One may use SenDateUtils to convert from XML date descrtor to TTime
|
williamr@2
|
248 |
TTime iNotOnOrAfter;
|
williamr@2
|
249 |
};
|
williamr@2
|
250 |
|
williamr@2
|
251 |
#endif // SEN_CREDENTIAL_H
|
williamr@2
|
252 |
|
williamr@2
|
253 |
// End of File
|
williamr@2
|
254 |
|
williamr@2
|
255 |
|