|
1 /* |
|
2 * Copyright (c) 2006-2006 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 WSSTAR_HANDLER_SESSION_CONTEXT_H |
|
29 #define WSSTAR_HANDLER_SESSION_CONTEXT_H |
|
30 |
|
31 // INCLUDES |
|
32 #include <e32std.h> |
|
33 #include <flogger.h> |
|
34 #include "msensessioncontext.h" |
|
35 #include "MSenServiceDescription.h" |
|
36 #include "msenmessagecontext.h" |
|
37 #include "msenremoteserviceconsumer.h" |
|
38 #include "wsstarcons.h" |
|
39 #include "wsstarmessagecontext.h" |
|
40 |
|
41 |
|
42 // DATA TYPES |
|
43 typedef RSenPointerMap<TDesC8, CSenWSDescription> RContextMapDescription; |
|
44 |
|
45 |
|
46 // FORWARD DECLARATIONS |
|
47 class MSenRemoteServiceSession; |
|
48 class CSenWSDescription; |
|
49 class CWSStarRSTResponse; |
|
50 class CWSStarServiceSession; |
|
51 class CWSStarPolicyHandler; |
|
52 |
|
53 /** |
|
54 * Implement Session Context. |
|
55 */ |
|
56 class CWSStarSessionContext : public CBase, public MSenSessionContext |
|
57 { |
|
58 |
|
59 public: |
|
60 static CWSStarSessionContext* NewL(CSenXmlReader* aParser, MSenServiceDescription* aSD, CWSStarPolicyHandler* aPolicyHandler = NULL); |
|
61 static CWSStarSessionContext* NewLC(CSenXmlReader* aParser, MSenServiceDescription* aSD, CWSStarPolicyHandler* aPolicyHandler = NULL); |
|
62 ~CWSStarSessionContext(); |
|
63 |
|
64 /** |
|
65 * Sets token context keys based on RST response. |
|
66 * |
|
67 * @param aRSTResponse parsed information about token. |
|
68 * @param aEntropy Entropy if provided by our plugin. |
|
69 * @return KErrNone if no error, one of system wide error codes otherwise |
|
70 */ |
|
71 TInt SetTokenKeysL(CWSStarRSTResponse& aRSTResponse, HBufC8* aClientEntropy, TBool aSignalConsumers,TBool aSCT = EFalse); |
|
72 |
|
73 //from SessionContext |
|
74 virtual const CSenWSDescription* GetSession(); |
|
75 virtual const CSenWSDescription* GetInitializer(); |
|
76 |
|
77 virtual TInt Add(const TDesC8& aKey, CSenWSDescription* aValue); |
|
78 virtual TInt Update(const TDesC8& aKey, CSenWSDescription* aValue); |
|
79 virtual const CSenWSDescription* GetSenWSDescriptionL(const TDesC8& aKey); |
|
80 |
|
81 //in fact, now relation between session and sessionCtx is 1 to 1, so no need for map & keys |
|
82 virtual TInt Add(const TDesC8& aKey, MSenRemoteServiceSession& aValue); // protected context |
|
83 virtual TInt Update(const TDesC8& aKey, MSenRemoteServiceSession& aValue); |
|
84 virtual const MSenRemoteServiceSession* GetSenRemoteServiceSessionL(const TDesC8& aKey); |
|
85 |
|
86 //from MContext |
|
87 virtual SenContext::TContextType Type() const; |
|
88 virtual SenContext::TContextDirection Direction() const; |
|
89 //desc - ownership transfered |
|
90 virtual TInt Add(const TDesC8& aKey, const TDesC8& aValue); |
|
91 virtual TInt Update(const TDesC8& aKey, const TDesC8& aValue); |
|
92 virtual const TDesC8* GetDesC8L(const TDesC8& aKey); |
|
93 virtual TInt Remove(const TDesC8& aKey); |
|
94 |
|
95 //Int handling methods doesnt take ownership. but create new object from passed value |
|
96 virtual TInt Add(const TDesC8& aKey, TInt aValue); |
|
97 virtual TInt Update(const TDesC8& aKey, TInt aValue); |
|
98 virtual const TInt* GetIntL(const TDesC8& aKey); |
|
99 virtual TInt Add(const TDesC8& aKey, CSenElement* aValue); |
|
100 virtual TInt Update(const TDesC8& aKey, CSenElement* aValue); |
|
101 virtual const CSenElement* GetSenElementL(const TDesC8& aKey) ; |
|
102 virtual TInt Add(const TDesC8& aKey, TAny* aValue); |
|
103 virtual TInt Update(const TDesC8& aKey, TAny* aValue) ; |
|
104 virtual TAny* GetAnyL(const TDesC8& aKey); //codescannerwarnings |
|
105 virtual const CSenXmlReader* GetParser(); |
|
106 virtual TInt Count() const; |
|
107 virtual TPtrC8 KeyAtL(TInt aIndex); |
|
108 virtual void Reset() ; |
|
109 |
|
110 inline virtual TInt SetDirection( SenContext::TContextDirection /* aDirection */ ) { return KErrNotSupported; } // not implemented |
|
111 |
|
112 // New methods |
|
113 |
|
114 /** |
|
115 * Update session context after incoming message |
|
116 * |
|
117 * @since S60 4.0 |
|
118 */ |
|
119 void UpdateFromMessageInContextL(CWSStarMessageContext& aMessageContext); |
|
120 |
|
121 /** |
|
122 * Update session context after outgoing message has been prepared, |
|
123 * to check which elements has been consumed. |
|
124 * |
|
125 * @since S60 4.0 |
|
126 */ |
|
127 void UpdateFromMessageOutContextL(CWSStarMessageContext& aMessageContext); |
|
128 |
|
129 /** |
|
130 * Share token. Copy SCT and MT into new star session |
|
131 * |
|
132 * @since S60 4.0 |
|
133 */ |
|
134 TInt ShareTokenWithL(CWSStarSessionContext* aWSStarSessionCtxDst, TBool& aMTwasReplaceBySCT); |
|
135 |
|
136 TInt UpdatePolicyL(CWSStarPolicyHandler* aPolicyHandler, MSenServiceDescription* aSD); |
|
137 |
|
138 private: |
|
139 void UpdateDesC8L(CWSStarMessageContext& aMessageContext, const TDesC8& aKey); |
|
140 |
|
141 |
|
142 protected: |
|
143 /** |
|
144 * Function: CWSStarSessionContext |
|
145 * |
|
146 * Discussion: Perform the first phase of two phase construction |
|
147 */ |
|
148 CWSStarSessionContext(CSenXmlReader* aParser); |
|
149 |
|
150 /** |
|
151 * Function: ConstructL |
|
152 * |
|
153 * Discussion: Perform the second phase construction of a |
|
154 * CImplementationClassPlus object. |
|
155 */ |
|
156 void ConstructL(MSenServiceDescription* aSD, CWSStarPolicyHandler* aPolicyHandler = NULL); |
|
157 |
|
158 private: |
|
159 MSenRemoteServiceConsumer* iRemoteServiceConsumer; |
|
160 CSenSoapEnvelope* iCurrentEnvelope; |
|
161 MSenRemoteServiceSession* iSession;//nbot owned, session keeped by DAO |
|
162 RContextMapDescription iDescriptions; |
|
163 RMapInt iInts; |
|
164 RMapDescriptors iDescs; |
|
165 CSenXmlReader* iParser;//not owned |
|
166 CSenElement* iBody; //owned, but handlers can consume it |
|
167 RPointerArray<HBufC8>* ipSignedParts; //owned array, Also elements |
|
168 TAny* ipConsumer; // not owned |
|
169 }; |
|
170 |
|
171 #endif // WSSTAR_HANDLER_SESSION_CONTEXT_H |
|
172 |
|
173 // END OF FILE |
|
174 |