|
1 /* |
|
2 * Copyright (c) 2008 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 #ifndef WSOVI_SERVICE_SESSION_H |
|
26 #define WSOVI_SERVICE_SESSION_H |
|
27 |
|
28 // INCLUDES |
|
29 #include "msenremoteserviceconsumer.h" |
|
30 #include "msenserviceinvocationframework.h" |
|
31 |
|
32 #include "wsoviplugin.h" |
|
33 #include "senwebservicesession.h" |
|
34 #include "wsovisessionconsumer.h" |
|
35 #include <xmlengfilecontainer.h> |
|
36 #include <xmlengchunkcontainer.h> |
|
37 #include <xmlengelement.h> |
|
38 |
|
39 class CWSOviCredentialObserver; |
|
40 class CSenHttpTransportProperties; |
|
41 |
|
42 // CONSTANTS |
|
43 namespace WSOviSession |
|
44 { |
|
45 _LIT8(KProviderIDTag, "<ProviderID>"); |
|
46 _LIT8(KProviderIDEndTag, "</ProviderID>"); |
|
47 _LIT8(KTrustAnchorTag, "<TrustAnchor>"); |
|
48 _LIT8(KTrustAnchorEndTag, "</TrustAnchor>"); |
|
49 _LIT8(KTrustAnchorElementLocalName, "TrustAnchor"); |
|
50 _LIT8(KTokenCreationTimeTag, "<TokenCreationTime>"); |
|
51 _LIT8(KTokenCreationTimeEndTag, "</TokenCreationTime>"); |
|
52 _LIT8(KTokenCreationTimeLocalName, "TokenCreationTime"); |
|
53 _LIT8(KTTLTag, "<TTL>"); |
|
54 _LIT8(KTTLEndTag, "</TTL>"); |
|
55 _LIT8(KTTLLocalName, "TTL"); |
|
56 _LIT8(KTokenSecretTag, "<TokenSecret>"); |
|
57 _LIT8(KTokenSecretEndTag, "</TokenSecret>"); |
|
58 _LIT8(KTokenSecretLocalName, "TokenSecret"); |
|
59 |
|
60 } |
|
61 |
|
62 |
|
63 |
|
64 // CLASS DECLARATION |
|
65 /** |
|
66 * WSOvi Service Session. |
|
67 * Represent session between client and service in ws* framework. |
|
68 */ |
|
69 class CWSOviServiceSession : public CSenWebServiceSession |
|
70 { |
|
71 |
|
72 friend class CWSOviPlugin; |
|
73 |
|
74 public: // Constructors and destructor |
|
75 |
|
76 static CWSOviServiceSession* NewL(MSIF& aFramework); |
|
77 static CWSOviServiceSession* NewLC(MSIF& aFramework); |
|
78 |
|
79 virtual ~CWSOviServiceSession(); |
|
80 |
|
81 // From SenServiceSession |
|
82 virtual MSenRemoteServiceConsumer* RemoteConsumerL( |
|
83 const TDesC8& aSenderID); |
|
84 |
|
85 virtual TBool Matches(MSenServiceDescription& aPattern); |
|
86 virtual TInt ScoreMatchL(MSenServiceDescription& aPattern); |
|
87 |
|
88 virtual void WriteExtensionsAsXMLToL(RWriteStream& aWriteStream); |
|
89 |
|
90 |
|
91 //From SenWebServiceSession |
|
92 virtual TInt SendL( const TDesC8& aMessage, |
|
93 const TDesC8& aTransportProperties, |
|
94 MSenRemoteServiceConsumer& aConsumer, |
|
95 TInt& aTxnId, |
|
96 HBufC8*& aRevalidationError ); |
|
97 |
|
98 virtual TInt SubmitL(const TDesC8& aMessage, |
|
99 const TDesC8& aTransportProperties, |
|
100 MSenRemoteServiceConsumer& aConsumer, |
|
101 HBufC8*& aResponse); |
|
102 |
|
103 virtual TInt SubmitSoapL(const TDesC8& aSoapMessage, |
|
104 const TDesC8& aTransportProperties, |
|
105 MSenRemoteServiceConsumer& aConsumer, |
|
106 HBufC8*& aResponse); |
|
107 |
|
108 virtual TInt SendSoapL( const TDesC8& aSoapMessage, |
|
109 const TDesC8& aTransportProperties, |
|
110 MSenRemoteServiceConsumer& aConsumer, |
|
111 TInt& aTxnId, |
|
112 HBufC8*& aRevalidationError ); |
|
113 |
|
114 |
|
115 virtual TInt SendErrorToConsumerL( const TInt aErrorCode, |
|
116 HBufC8* apError, |
|
117 const TInt aTxnId, |
|
118 MSenRemoteServiceConsumer& aConsumer, |
|
119 MSenProperties* aResponseTransportProperties ); |
|
120 virtual TInt SendToConsumerL(HBufC8* aMessage, |
|
121 const TInt aTxnId, |
|
122 MSenRemoteServiceConsumer& aConsumer, |
|
123 MSenProperties* aResponseTransportProperties = NULL); |
|
124 |
|
125 virtual TInt InitializeFromL(MSenServiceDescription& aDescription); |
|
126 |
|
127 |
|
128 |
|
129 /** |
|
130 add consumer. Eeach session has multiple consumers.From 3rd parties point of view |
|
131 its mean 2 connection per the same service description. |
|
132 */ |
|
133 virtual TInt AddConsumerL(MSenRemoteServiceConsumer& aConsumer); |
|
134 |
|
135 /** |
|
136 remove consumer |
|
137 */ |
|
138 virtual TInt RemoveConsumerL(MSenRemoteServiceConsumer& aConsumer); |
|
139 |
|
140 /** |
|
141 Framework specific method. Process message before sending to network |
|
142 In other words add specific headers, and store correlation info in proper consumer |
|
143 */ |
|
144 virtual TInt MessageForSendingL( CSenHttpTransportProperties*& aTP, |
|
145 const TDesC8& aSenderID); |
|
146 |
|
147 virtual TInt SetTransportPropertiesL( const TDesC8& aProperties, |
|
148 MSenRemoteServiceConsumer& aConsumer ); |
|
149 virtual TBool IsExpiredL(); |
|
150 /** |
|
151 * Clear credential for current session , make it invalid. |
|
152 * @since S60 5.0 |
|
153 */ |
|
154 void ClearCredentialL(); |
|
155 |
|
156 //GData token has undefined life time, threfore default FOREVER life time is set |
|
157 void SetMaxValidUntil(); |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 /** |
|
163 * Overload addcredential from WebServiceSession. Calucate also state, |
|
164 * @since S60 4.0 |
|
165 */ |
|
166 void AddCredentialL(const TDesC8& aSecurity, TTime aValidUntil); |
|
167 void AddCredentialL(RSenCredentialPtr aCredentialPtr, TTime aValidUntil); |
|
168 void SetProviderIDL(const TDesC8& aProviderId); |
|
169 TPtrC8 ProviderID(); |
|
170 void SetTrustAnchorL(const TDesC8& aURI); |
|
171 TPtrC8 TrustAnchor(); |
|
172 TInt ComputeStatusL(); |
|
173 void SetSessionContext(CWSOviSessionContext* aContext); |
|
174 CWSOviSessionContext* SessionContext(); |
|
175 |
|
176 void AddSecurityTokenToContextL(); |
|
177 |
|
178 void AddPropertiesFromSessionContextToCredentialL(); |
|
179 |
|
180 virtual void CredentialChanged(TSenCredentialChange aChange, TAny* aPointer); |
|
181 TInt RevalidateMobileTicketIfExpiredL(HBufC8*& aErrorMessage); |
|
182 TBool ExistConsumerL(); |
|
183 |
|
184 // Add ProviderID to primary keys (in addition to Endpoint, Contract and FrameworkID): |
|
185 TBool HasEqualPrimaryKeysL( MSenServiceDescription& aCandidate ); |
|
186 |
|
187 void ActiveTicketObserverL(); |
|
188 TInt ShareTokenWithL( CWSOviServiceSession* aWSStarSessionDst); |
|
189 |
|
190 private: |
|
191 |
|
192 /** |
|
193 * C++ default constructor. |
|
194 */ |
|
195 CWSOviServiceSession(TDescriptionClassType aType, MSIF& aFramework); |
|
196 |
|
197 /** |
|
198 * By default Symbian 2nd phase constructor is private. |
|
199 */ |
|
200 void ConstructL(); |
|
201 |
|
202 // New functions |
|
203 |
|
204 |
|
205 /** |
|
206 * To obtain consumer during processing INBOUND. We have to dispatch using wsa:RelatesTo |
|
207 */ |
|
208 TInt SessionConsumerL(CWSOviMessageContext*& aMessage, |
|
209 CWSOviSessionConsumer*& aSessionConsumer); |
|
210 |
|
211 /** |
|
212 * To obtain consumer during processing OUTBOUND. |
|
213 */ |
|
214 TInt SessionConsumerL( const TDesC8& aSenderID, CWSOviSessionConsumer*& aSessionConsumer); |
|
215 void CreateAndParseSoapMessageL(const TDesC8& aSoapMessage, CSenSoapMessage*& aMessage, HBufC8*& aBody); |
|
216 CSenHttpTransportProperties* ApplyTransportPropertiesLC(const TDesC8& aTransportProperties); |
|
217 void PrepareOutCtxL(const TDesC8& aMessageBody); |
|
218 void DestroyOutCtx(); |
|
219 TBool HasSuperClass( TDescriptionClassType aType ); |
|
220 TBool AmIHostletSession(); |
|
221 virtual void FillCredentialIdentifierL(CSenCredentialIdentifier& aIdentifier); |
|
222 |
|
223 CSenIdentityProvider* LookupIdentityProviderL(); |
|
224 void VerifyPermissionL(); |
|
225 void ClearCredentialPropertiesFromContext(); |
|
226 TInt CanHandleErrorL(); |
|
227 void AdaptEndpointL(TBool aToOrginal); |
|
228 CSenIdentityProvider* IdentityProviderFromCoreL(const TDesC8& aProviderID); |
|
229 |
|
230 //Data |
|
231 |
|
232 CWSOviMessageContext* iOutContext;//owned, live only within one sending |
|
233 CWSOviMessageContext* iInContext;//owned, live only within one sending |
|
234 CWSOviSessionContext* iSessionContext;//owned |
|
235 |
|
236 CWSOviCredentialObserver* iTokenObs; |
|
237 |
|
238 //trust anchor is a pointer to providerID. |
|
239 HBufC8* iTrustAnchor; |
|
240 TInt iSubmitState; |
|
241 TInt iRenewCounter; |
|
242 TInt iRetryCounter; |
|
243 HBufC8* iProviderID; |
|
244 HBufC8* iTransProp; |
|
245 TTime iClientTime; |
|
246 TTime iServerTime; |
|
247 HBufC8* iOrginalEndpoint; |
|
248 }; |
|
249 |
|
250 #endif // WSOvi_SERVICE_SESSION_H |
|
251 |
|
252 // End of File |
|
253 |