williamr@2
|
1 |
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
|
williamr@2
|
17 |
|
williamr@2
|
18 |
/**
|
williamr@2
|
19 |
@file RHTTPTransaction.h
|
williamr@2
|
20 |
@warning : This file contains Rose Model ID comments - please do not delete
|
williamr@2
|
21 |
*/
|
williamr@2
|
22 |
|
williamr@2
|
23 |
#ifndef __RHTTPTRANSACTION_H__
|
williamr@2
|
24 |
#define __RHTTPTRANSACTION_H__
|
williamr@2
|
25 |
|
williamr@2
|
26 |
// System includes
|
williamr@2
|
27 |
#include <http/thttpevent.h>
|
williamr@2
|
28 |
#include <http/rhttpresponse.h>
|
williamr@2
|
29 |
#include <http/rhttprequest.h>
|
williamr@2
|
30 |
#include <http/rhttptransactionpropertyset.h>
|
williamr@2
|
31 |
#include <http/thttpfilterhandle.h>
|
williamr@2
|
32 |
#include <http/mhttpdataoptimiser.h>
|
williamr@2
|
33 |
|
williamr@2
|
34 |
// Forward declarations
|
williamr@2
|
35 |
class CHTTPTransaction;
|
williamr@2
|
36 |
class CTransaction;
|
williamr@2
|
37 |
class MHTTPTransactionCallback;
|
williamr@2
|
38 |
class RHTTPSession;
|
williamr@2
|
39 |
class TCertInfo;
|
williamr@2
|
40 |
class CCertificate;
|
williamr@2
|
41 |
|
williamr@2
|
42 |
|
williamr@2
|
43 |
//##ModelId=3C4C18860091
|
williamr@2
|
44 |
class RHTTPTransaction
|
williamr@2
|
45 |
/**
|
williamr@2
|
46 |
A HTTP Transaction. This encapsulates 1 HTTP request and
|
williamr@2
|
47 |
response. A Transaction is associated with a session, and must be
|
williamr@2
|
48 |
created using the session's CreateTransactionL method.
|
williamr@2
|
49 |
@publishedAll
|
williamr@2
|
50 |
@released
|
williamr@2
|
51 |
@see RHTTPSession
|
williamr@2
|
52 |
@see RHTTPSession::CreateTransactionL
|
williamr@2
|
53 |
*/
|
williamr@2
|
54 |
{
|
williamr@2
|
55 |
public:
|
williamr@2
|
56 |
/**
|
williamr@2
|
57 |
Default (uninitialised) constructor
|
williamr@2
|
58 |
*/
|
williamr@2
|
59 |
//##ModelId=3C4C188600F5
|
williamr@2
|
60 |
inline RHTTPTransaction();
|
williamr@2
|
61 |
|
williamr@2
|
62 |
/** Submits a transaction. Once all the headers and other details
|
williamr@2
|
63 |
have been set up, this call actualy causes the request to be
|
williamr@2
|
64 |
made.
|
williamr@2
|
65 |
@leave KErrNoMemory There was not enough memory.
|
williamr@2
|
66 |
*/
|
williamr@2
|
67 |
//##ModelId=3C4C188600ED
|
williamr@2
|
68 |
IMPORT_C void SubmitL(THTTPFilterHandle aStart =
|
williamr@2
|
69 |
THTTPFilterHandle::EClient);
|
williamr@2
|
70 |
|
williamr@2
|
71 |
/** Notify HTTP of the availability of more request body data,
|
williamr@2
|
72 |
when submitting body data in several parts.
|
williamr@2
|
73 |
|
williamr@2
|
74 |
@param aStart The filter supplying the new data. This will almost always be the client (default value)
|
williamr@2
|
75 |
@leave KErrNoMemory There was not enough memory.
|
williamr@2
|
76 |
*/
|
williamr@2
|
77 |
//##ModelId=3C4C188600EB
|
williamr@2
|
78 |
IMPORT_C void NotifyNewRequestBodyPartL(THTTPFilterHandle aStart =
|
williamr@2
|
79 |
THTTPFilterHandle::EClient);
|
williamr@2
|
80 |
|
williamr@2
|
81 |
/** Sends a status message to all relevant filters. This function
|
williamr@2
|
82 |
is predominantly used by filters, rather than by the client.
|
williamr@2
|
83 |
@param aStatus The status message to send.
|
williamr@2
|
84 |
@param aDirection The direction down the filter queue that this event
|
williamr@2
|
85 |
will be propogated.
|
williamr@2
|
86 |
@leave KErrNoMemory There was not enough memory.
|
williamr@2
|
87 |
*/
|
williamr@2
|
88 |
//##ModelId=3C4C188600E2
|
williamr@2
|
89 |
IMPORT_C void SendEventL(THTTPEvent aStatus,
|
williamr@2
|
90 |
THTTPEvent::TDirection aDirection,
|
williamr@2
|
91 |
THTTPFilterHandle aStart);
|
williamr@2
|
92 |
|
williamr@2
|
93 |
/** Gets the response. Note that the returned response may not be
|
williamr@2
|
94 |
valid if it hasn't been created yet.
|
williamr@2
|
95 |
@see RHTTPMessage::IsValid()
|
williamr@2
|
96 |
*/
|
williamr@2
|
97 |
//##ModelId=3C4C188600E1
|
williamr@2
|
98 |
IMPORT_C RHTTPResponse Response() const;
|
williamr@2
|
99 |
|
williamr@2
|
100 |
/// Gets the request.
|
williamr@2
|
101 |
//##ModelId=3C4C188600DA
|
williamr@2
|
102 |
IMPORT_C RHTTPRequest Request() const;
|
williamr@2
|
103 |
|
williamr@2
|
104 |
/// Returns the session associated with the transaction.
|
williamr@2
|
105 |
//##ModelId=3C4C188600D9
|
williamr@2
|
106 |
IMPORT_C RHTTPSession Session() const;
|
williamr@2
|
107 |
|
williamr@2
|
108 |
/** Returns the transaction's property set. This is used by filters
|
williamr@2
|
109 |
to store transaction-specific information, and by clients to
|
williamr@2
|
110 |
specify things like reload or no cache behaviour.
|
williamr@2
|
111 |
*/
|
williamr@2
|
112 |
//##ModelId=3C4C188600D8
|
williamr@2
|
113 |
IMPORT_C RHTTPTransactionPropertySet PropertySet() const;
|
williamr@2
|
114 |
|
williamr@2
|
115 |
/** Cancels the transaction.
|
williamr@2
|
116 |
|
williamr@2
|
117 |
@param aStart The entity that is initiating the cancel (defaults
|
williamr@2
|
118 |
to the client). See THTTPFilterHandle for the values this can take.
|
williamr@2
|
119 |
*/
|
williamr@2
|
120 |
//##ModelId=3C4C188600CF
|
williamr@2
|
121 |
IMPORT_C void Cancel(THTTPFilterHandle aStart =
|
williamr@2
|
122 |
THTTPFilterHandle::EClient);
|
williamr@2
|
123 |
|
williamr@2
|
124 |
/** Closes the transaction and frees all owned resources.
|
williamr@2
|
125 |
Transactions must be opened using RHTTPSession::OpenTransactionL.
|
williamr@2
|
126 |
It is also closed when you close the session.
|
williamr@2
|
127 |
*/
|
williamr@2
|
128 |
//##ModelId=3C4C188600CE
|
williamr@2
|
129 |
IMPORT_C void Close();
|
williamr@2
|
130 |
|
williamr@2
|
131 |
/** This function should be called by filters when they have
|
williamr@2
|
132 |
failed due to running out of memory. It cancels the transaction
|
williamr@2
|
133 |
and sends the synchronous events EUnrecoverableError and EFailed
|
williamr@2
|
134 |
to the client to inform it of the failure. For instance in a
|
williamr@2
|
135 |
filter that attempts to send an event to the client from a
|
williamr@2
|
136 |
MHFRunError to inform the client of a failure, if the call to
|
williamr@2
|
137 |
SendEventL leaves, Fail() may be used to 'give up'. */
|
williamr@2
|
138 |
//##ModelId=3C4C188600C7
|
williamr@2
|
139 |
IMPORT_C void Fail(THTTPFilterHandle aStart =
|
williamr@2
|
140 |
THTTPFilterHandle::ECurrentFilter);
|
williamr@2
|
141 |
|
williamr@2
|
142 |
/** Equality operator to check if this transaction is the same as that one.
|
williamr@2
|
143 |
@param aTrans The transaction to compare this one to.
|
williamr@2
|
144 |
*/
|
williamr@2
|
145 |
//##ModelId=3C4C188600C5
|
williamr@2
|
146 |
TBool operator==(RHTTPTransaction aTrans) const;
|
williamr@2
|
147 |
/** Inequality operator
|
williamr@2
|
148 |
@param aTrans The transaction to compare this one to.
|
williamr@2
|
149 |
*/
|
williamr@2
|
150 |
//##ModelId=3C4C188600C3
|
williamr@2
|
151 |
TBool operator!=(RHTTPTransaction aTrans) const;
|
williamr@2
|
152 |
/** Obtain this transaction's ID, which is unique within its
|
williamr@2
|
153 |
session. This is mostly used for producing a
|
williamr@2
|
154 |
slightly-meaningful way of identifying transactions in logging
|
williamr@2
|
155 |
code.
|
williamr@2
|
156 |
@return The transaction ID.
|
williamr@2
|
157 |
*/
|
williamr@2
|
158 |
//##ModelId=3C4C188600BB
|
williamr@2
|
159 |
IMPORT_C TInt Id() const;
|
williamr@2
|
160 |
|
williamr@2
|
161 |
/** Obtain the server certificate information for this transaction. This function
|
williamr@2
|
162 |
should only be used for text-mode, for WSP use RHttpSession::ServerCert.
|
williamr@2
|
163 |
@see RHttpSession::ServerCert
|
williamr@2
|
164 |
@param aServerCert A client supplied object into which the certificate
|
williamr@2
|
165 |
information will be placed.
|
williamr@2
|
166 |
@return KErrNone if certificate has been completed, KErrNotSupported if
|
williamr@2
|
167 |
this function is called for WSP.
|
williamr@2
|
168 |
@deprecated v9.2 onwards - maintained for compatibility with v9.1 and before
|
williamr@2
|
169 |
TCertInfo has been deprecated since v9.2. CCertificate may be used as an alternative.
|
williamr@2
|
170 |
*/
|
williamr@2
|
171 |
//##ModelId=3C4C188600B9
|
williamr@2
|
172 |
IMPORT_C TInt ServerCert(TCertInfo& aServerCert);
|
williamr@2
|
173 |
|
williamr@2
|
174 |
/** Obtain the server certificate information for this transaction. This function
|
williamr@2
|
175 |
should only be used for HTTP. WSP should use RHttpSession::ServerCert.
|
williamr@2
|
176 |
@see RHttpSession::ServerCert
|
williamr@2
|
177 |
@internalAll
|
williamr@2
|
178 |
@prototype
|
williamr@2
|
179 |
@return a CCertificate pointer to an CX509Certificate object.
|
williamr@2
|
180 |
Calling code can safely cast to CX509Certificate if using "HTTP/TCP".
|
williamr@2
|
181 |
NULL returned if certificate information not found.
|
williamr@2
|
182 |
*/
|
williamr@2
|
183 |
IMPORT_C const CCertificate* ServerCert();
|
williamr@2
|
184 |
|
williamr@2
|
185 |
/** Obtain the cipher suite information for this transaction.
|
williamr@2
|
186 |
@return RString containing the cipher suite as per RFC2246.
|
williamr@2
|
187 |
*/
|
williamr@2
|
188 |
IMPORT_C RString CipherSuite();
|
williamr@2
|
189 |
|
williamr@2
|
190 |
/**Sets the HTTP data optimiser for the transaction.
|
williamr@2
|
191 |
@param aHttpOptimiser An object of the implementation of interface, MHttpDataOptimiser, supplied by the client.
|
williamr@2
|
192 |
@publishedPartner
|
williamr@2
|
193 |
*/
|
williamr@2
|
194 |
IMPORT_C void SetupHttpDataOptimiser (MHttpDataOptimiser& aHttpOptimiser);
|
williamr@2
|
195 |
|
williamr@2
|
196 |
/**Returns the object of the MHttpDataOptimiser implementation class.
|
williamr@2
|
197 |
@internalTechnology
|
williamr@2
|
198 |
*/
|
williamr@2
|
199 |
IMPORT_C MHttpDataOptimiser* HttpDataOptimiser ();
|
williamr@2
|
200 |
|
williamr@2
|
201 |
private:
|
williamr@2
|
202 |
friend class RHTTPSession;
|
williamr@2
|
203 |
friend class CTransaction;
|
williamr@2
|
204 |
|
williamr@2
|
205 |
private:
|
williamr@2
|
206 |
//##ModelId=3C4C188600A7
|
williamr@2
|
207 |
CTransaction* iImplementation;
|
williamr@2
|
208 |
};
|
williamr@2
|
209 |
|
williamr@2
|
210 |
inline TBool RHTTPTransaction::operator==(RHTTPTransaction aTrans) const
|
williamr@2
|
211 |
{
|
williamr@2
|
212 |
return (iImplementation == aTrans.iImplementation);
|
williamr@2
|
213 |
};
|
williamr@2
|
214 |
inline TBool RHTTPTransaction::operator!=(RHTTPTransaction aTrans) const
|
williamr@2
|
215 |
{
|
williamr@2
|
216 |
return !(*this == aTrans);
|
williamr@2
|
217 |
};
|
williamr@2
|
218 |
|
williamr@2
|
219 |
inline RHTTPTransaction::RHTTPTransaction()
|
williamr@2
|
220 |
: iImplementation(NULL)
|
williamr@2
|
221 |
{
|
williamr@2
|
222 |
}
|
williamr@2
|
223 |
|
williamr@2
|
224 |
|
williamr@2
|
225 |
#endif // __RHTTPTRANSACTION_H__
|