|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file CNwssMethodInfo.h |
|
18 */ |
|
19 |
|
20 #ifndef __CNWSSCONNECTGUARD_H__ |
|
21 #define __CNWSSCONNECTGUARD_H__ |
|
22 |
|
23 // System includes |
|
24 #include <e32base.h> |
|
25 #include <stringpool.h> |
|
26 #include <wsp/wsptypes.h> |
|
27 |
|
28 class CUri8; |
|
29 class TUriC8; |
|
30 class MWspCOMethodInvoker; |
|
31 class MWspCOMethodCallback; |
|
32 class MWspCOSessionCallback; |
|
33 |
|
34 /** |
|
35 @class CNwssConnectGuard |
|
36 @since 7.0 |
|
37 This class encapsulates the functionality to ensure that the Wsp CO Session |
|
38 states tables are honoured by the NWSS WAP Stack. Specifically, during WTLS |
|
39 connection, there is a gap from when the S-Connect.req is received from the |
|
40 protocol handler to when the RWSPCOConn receives that primitive. During this |
|
41 time the protocol handler thinks that the Wsp CO Session state is Connecting |
|
42 and will method invocation and allow the S-Disconnect.req primitive to be sent. |
|
43 |
|
44 If a T-MethodInvoke.req is received by the transport handler, this class will |
|
45 store the information and send the primitive once it is told that the |
|
46 S-Connect.req has been sent to the WAP Stack. |
|
47 |
|
48 Also, if the S-Disconnect.req is received by the transport handler, it can use |
|
49 this class to send the T-MethodAbort.ind (if necessary) and the S-Disconnect.ind. |
|
50 |
|
51 Similarly, if the transport handler receives T-MethodAbort.req. |
|
52 */ |
|
53 //##ModelId=3C9B094D0363 |
|
54 class CNwssConnectGuard : public CActive |
|
55 { |
|
56 public: // Methods |
|
57 |
|
58 /** @fn NewL(MWspCOMethodInvoker& aMethodInvoker, MWspCOSessionCallback& aSessionCallback) |
|
59 Static factory c'tor. |
|
60 @since 7.0 |
|
61 @param aMethodInvoker A reference to the Wsp CO method invoker. |
|
62 @param aSessionCallback A reference to the Wsp CO session callback. |
|
63 */ |
|
64 //##ModelId=3C9B094E0094 |
|
65 static CNwssConnectGuard* NewL(MWspCOMethodInvoker& aMethodInvoker, MWspCOSessionCallback& aSessionCallback); |
|
66 |
|
67 /** @fn ~CNwssConnectGuard() |
|
68 Standard destructor. |
|
69 @since 7.0 |
|
70 */ |
|
71 //##ModelId=3C9B094E008A |
|
72 ~CNwssConnectGuard(); |
|
73 |
|
74 /** @fn SendDisconnectInd() |
|
75 Sends the S-Disconnect.ind primitive to the Wsp CO Session callback. If a |
|
76 T-MethodInvoke.req was received, then the T-MethodAbort.ind primitive is sent |
|
77 to the Wsp CO Method callback. |
|
78 @since 7.0 |
|
79 @param aReason A parameter that indicates the reason for the |
|
80 disconnection. |
|
81 */ |
|
82 //##ModelId=3C9B094E0082 |
|
83 void SendDisconnectInd(Wap::TWspReason aReason); |
|
84 |
|
85 /** @fn SendMethodInvokeReq() |
|
86 Sends the S-MethodInvoke.req primitive. |
|
87 @since 7.0 |
|
88 */ |
|
89 //##ModelId=3C9B094E0081 |
|
90 void SendMethodInvokeReq(); |
|
91 |
|
92 /** @fn SendMethodAbortInd() |
|
93 Sends the T-MethodAbort.ind primitive to the Wsp CO Method callback. |
|
94 @since 7.0 |
|
95 */ |
|
96 //##ModelId=3C9B094E0080 |
|
97 void SendMethodAbortInd(); |
|
98 |
|
99 /** @fn ReceivedMethodInvokeReqL(MWspCOMethodCallback& aMethodCallback, RStringF aMethod, const TUriC8& aRequestUri, const TDesC8& aRequestHeaders, const TDesC8& aRequestBody) |
|
100 Stores the method invocation information. |
|
101 @warning Will panic with EMORExceeded if there already is method info stored. |
|
102 @param aMethodCallback A reference to the Wsp CO method callback |
|
103 object for this method. |
|
104 @param aMethod The method type. |
|
105 @param aRequestUri A reference to the request Uri. |
|
106 @param aRequestHeaders A reference to a buffer with the request |
|
107 header data. |
|
108 @param aRequestBody A reference to a buffer with the request |
|
109 */ |
|
110 //##ModelId=3C9B094E004E |
|
111 void ReceivedMethodInvokeReqL( |
|
112 MWspCOMethodCallback& aMethodCallback, |
|
113 RStringF aMethod, |
|
114 const TUriC8& aRequestUri, |
|
115 const TDesC8& aRequestHeaders, |
|
116 const TDesC8& aRequestBody |
|
117 ); |
|
118 |
|
119 private: // Methods from CActive |
|
120 |
|
121 //##ModelId=3C9B094E0045 |
|
122 virtual void RunL(); |
|
123 |
|
124 //##ModelId=3C9B094E0044 |
|
125 virtual void DoCancel(); |
|
126 |
|
127 private: // Methods |
|
128 |
|
129 /** @fn CNwssConnectGuard(MWspCOMethodInvoker& aMethodInvoker, MWspCOSessionCallback& aSessionCallback) |
|
130 Constuctor. |
|
131 @since 7.0 |
|
132 @param aMethodInvoker A reference to the Wsp CO method invoker. |
|
133 @param aSessionCallback A reference to the Wsp CO session callback. |
|
134 */ |
|
135 //##ModelId=3C9B094E0031 |
|
136 CNwssConnectGuard(MWspCOMethodInvoker& aMethodInvoker, MWspCOSessionCallback& aSessionCallback); |
|
137 |
|
138 /** @fn ResetMethodInfo() |
|
139 Resets the method info. Releases resources. |
|
140 @since 7.0 |
|
141 */ |
|
142 //##ModelId=3C9B094E0030 |
|
143 void ResetMethodInfo(); |
|
144 |
|
145 /** @fn CompleteSelf() |
|
146 Completes the request. |
|
147 @since 7.0 |
|
148 */ |
|
149 //##ModelId=3C9B094E0026 |
|
150 void CompleteSelf(); |
|
151 |
|
152 private: // Attributes |
|
153 |
|
154 /** A reference to the Wsp CO method invoker object. |
|
155 */ |
|
156 //##ModelId=3C9B094E001E |
|
157 MWspCOMethodInvoker& iMethodInvoker; |
|
158 |
|
159 /** A reference to the Wsp CO session callback. |
|
160 */ |
|
161 //##ModelId=3C9B094D03E6 |
|
162 MWspCOSessionCallback& iSessionCallback; |
|
163 |
|
164 /** A reference to the Wsp CO method callback object for this method. |
|
165 */ |
|
166 //##ModelId=3C9B094D03D3 |
|
167 MWspCOMethodCallback* iMethodCallback; |
|
168 |
|
169 /** The method type. |
|
170 */ |
|
171 //##ModelId=3C9B094D03C9 |
|
172 RStringF iMethod; |
|
173 |
|
174 /** The request Uri. |
|
175 */ |
|
176 //##ModelId=3C9B094D03BD |
|
177 CUri8* iRequestUri; |
|
178 |
|
179 /** The request header data. |
|
180 */ |
|
181 //##ModelId=3C9B094D03AB |
|
182 HBufC8* iRequestHeaders; |
|
183 |
|
184 /** The request body data. |
|
185 */ |
|
186 //##ModelId=3C9B094D03A1 |
|
187 HBufC8* iRequestBody; |
|
188 |
|
189 /** A flag indicating that an S-Disconnect.ind be sent |
|
190 */ |
|
191 //##ModelId=3C9B094D0397 |
|
192 TBool iSendDisconnect; |
|
193 |
|
194 /** A parameter that indicates the reason for the S-Disconnect.ind |
|
195 */ |
|
196 //##ModelId=3C9B094D038D |
|
197 Wap::TWspReason iDisconnectReason; |
|
198 |
|
199 }; |
|
200 |
|
201 #endif // __CNWSSCONNECTGUARD_H__ |