Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
1 // Copyright (c) 2001-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
20 @warning : This file contains Rose Model ID comments - please do not delete
23 #ifndef __RHTTPSESSION_H__
24 #define __RHTTPSESSION_H__
29 #include <http/rhttpconnectioninfo.h>
30 #include <http/rhttpfiltercollection.h>
31 #include <http/rhttptransaction.h>
32 #include <http/mhttpdataoptimiser.h>
34 // Forward declarations
35 class MHTTPTransactionCallback;
37 class MHTTPSessionEventCallback;
38 class MHTTPFilterCreationCallback;
43 Constant to represent any HTTP Status code when registering filters.
47 const TInt KAnyStatusCode = -1;
50 //##ModelId=3C4C187B0280
53 A session handle. A session is a set of HTTP transactions using
54 the same connection settings (e.g. proxy) and the same set of filters.
55 Multi-homing support provided by HTTP framework enables clients to
56 specify Connection preferences through the session property
57 EHttpSocketConnection.
59 Note that RHTTPSession (and consequently the whole of HTTP)
60 depends on the active scheduler; a scheduler must be installed
61 when the session is opened and it must be running if a transaction
62 is actually to do anything.
70 @post The session is closed. (It must be opened with OpenL)
72 //##ModelId=3C4C187B02EF
73 inline RHTTPSession();
75 /** Sets the session event callback.
76 Until it is set all incoming session events are consumed
78 //##ModelId=3C4C187B02EA
79 IMPORT_C void SetSessionEventCallback(MHTTPSessionEventCallback* aSessionEventCallback);
81 /** Send an session event
82 @param aEvent. The session event to sent.
84 //##ModelId=3C4C187B02E6
85 IMPORT_C void SendSessionEventL(THTTPSessionEvent aStatus, THTTPSessionEvent::TDirection aDirection,
86 THTTPFilterHandle aStart = THTTPFilterHandle::EClient);
88 /** Fail the session event
90 IMPORT_C void FailSessionEvent(THTTPFilterHandle aStart = THTTPFilterHandle::EClient);
92 //##ModelId=3A49F701013F
93 /** Opens the session using the default protocol HTTP/TCP.
94 This function leaves with an apropriate code if the open failed.
95 @pre The session is closed. An active scheduler is installed.
96 @post The session is open.
98 //##ModelId=3C4C187B02DA
99 IMPORT_C void OpenL();
101 /** Opens the session using the protocol indicated by the parameter passed in.
102 This function leaves with an apropriate code if the open failed.
103 @param aProtocol The protocol required
104 @pre The session is closed. An active scheduler is installed.
105 @post The session is open.
107 //##ModelId=3C4C187B02DB
108 IMPORT_C void OpenL(const TDesC8& aProtocol);
110 /** Opens the session using the protocol indicated by the parameter passed in.
111 This method should be used if configuring the installed filters is required.
112 Once construction if the session is complete the callback method passed in is
113 called passing in a TFilterConfigurationIterator to allow the filters that
114 are installed to be configured.
115 This function leaves with an apropriate code if the open failed.
116 @param aProtocol The protocol required
117 @param aSessionCallback The pointer to the object providing the call back method
118 @pre The session is closed. An active scheduler is installed.
119 @post The session is open.
121 //##ModelId=3C4C187B02DD
122 IMPORT_C void OpenL(const TDesC8& aProtocol, MHTTPFilterCreationCallback* aSessionCallback);
124 /** This is a static methods that lists all the available protocols by adding the
125 prorocol descriptors to the descriptor array passed in. Any existing data in the
126 descriptor array passed in is deleted.
127 This function leaves if the descriptor array can not be updated with the appropriate
129 @param aProtocolArray A pointer array to heap based descriptors. The data in this
130 array will be deleted and filled with descriptors containing the available protocols
133 //##ModelId=3C4C187B02D4
134 IMPORT_C static void ListAvailableProtocolsL(RPointerArray<HBufC8>& aProtocolArray);
136 /** Creates a transaction.
137 @pre The session is open
138 @param aURI The URI that the request will be sent to.
139 @param aCallback A callback for all status events relating to
141 @param aMethod The HTTP method to use (default: GET)
142 @leave KErrNoMemory There was not enough memory.
144 //##ModelId=3C4C187B02D0
145 IMPORT_C RHTTPTransaction OpenTransactionL(const TUriC8& aURI,
146 MHTTPTransactionCallback& aCallback,
147 RStringF aMethod = RStringF());
149 /** Closes the session. All transactions will be stopped and closed
150 @post The session and all open transactions in it are closed.
152 //##ModelId=3C4C187B02C8
153 IMPORT_C void Close();
156 //##ModelId=3C4C187B02C7
157 IMPORT_C static const TStringTable& GetTable();
159 /** Accessor for the HTTP string pool.
160 @return A handle for the string pool used in HTTP.
162 //##ModelId=3C4C187B02C6
163 IMPORT_C RStringPool StringPool() const;
165 /** Accessor for the connection info for this session, and which
166 is used for all transactions in the session. Note that by and
167 large, the connection info should be set up before the first
168 transaction is created. @return A handle to the connection
170 //##ModelId=3C4C187B02BE
171 IMPORT_C RHTTPConnectionInfo ConnectionInfo() const;
173 /** Accessor for the filter collection. Note that the filter
174 collection can't be edited after the first transaction has
176 //##ModelId=3C4C187B02BD
177 inline RHTTPFilterCollection FilterCollection() const;
180 /** Accessor for the session headers. These are headers that will get added to each request
181 They only become part of the transaction headers when a transaction is submitted and they will not
182 replace headers that already exist in the transaction request
184 //##ModelId=3C4C187B02BC
185 IMPORT_C RHTTPHeaders RequestSessionHeadersL();
188 /** Accessor for the response session headers. These are headers that will get added to each response if the
189 corresponding header doesn't already exist
191 //##ModelId=3C4C187B02B6
192 IMPORT_C RHTTPHeaders ResponseSessionHeadersL();
194 /** Equality operator.
195 @param aTrans The session to compare this one to.
197 //##ModelId=3C4C187B02B4
198 TBool operator==(RHTTPSession aTrans) const;
199 /** Inequality operator
200 @param aTrans The session to compare this one to.
203 //##ModelId=3C4C187B02B2
204 TBool operator!=(RHTTPSession aTrans) const;
206 /** Obtain the server certificate information for this session. This function
207 should only be used for WSP, for text-mode use RHttpTransaction::ServerCert.
208 @see RHttpTransaction::ServerCert
209 @param aServerCert A client supplied object into which the certificate
210 information will be placed.
211 @return KErrNone if certificate has been completed, KErrNotSupported if
212 this function is called for text-mode.
213 @deprecated v9.2 onwards - maintained for compatibility with v9.1 and before
214 TCertInfo has been deprecated since v9.2. CCertificate may be used as an alternative.
216 //##ModelId=3C4C187B02AA
217 IMPORT_C TInt ServerCert(TCertInfo& aServerCert);
220 /** Obtain the server certificate information for this session. This function
221 should only be used for WSP. HTTP should use RHttpTransaction::ServerCert.
222 @see RHttpSession::ServerCert
225 @return a CCertificate pointer to an CWTLSCertificate object.
226 Calling code can safely cast to CWTLSCertificate if using "WSP/WSP".
227 NULL returned if certificate information not found.
229 IMPORT_C const CCertificate* RHTTPSession::ServerCert();
231 /** Connect this WSP session. This function does nothing when called for text-mode.
233 //##ModelId=3C4C187B02A9
234 IMPORT_C void ConnectL();
236 /** Disconnect this WSP session. This function does nothing when called for text-mode.
238 //##ModelId=3C4C187B02A8
239 IMPORT_C void DisconnectL();
241 /**Set the default Proxy for Http Session. This function reads default proxy information,if available, from CommsDat
242 and uses it for the current Session.
245 IMPORT_C void SetupDefaultProxyFromCommsDatL();
247 /**Sets the HTTP data optimiser for the session.
248 @param aHttpOptimiser An object of the implementation of interface, MHttpDataOptimiser, supplied by the client.
251 IMPORT_C void SetupHttpDataOptimiser (MHttpDataOptimiser& aHttpOptimiser);
253 /**Returns the object of the MHttpDataOptimiser implementation class.
256 IMPORT_C MHttpDataOptimiser* HttpDataOptimiser ();
259 friend class RHTTPFilterCollection;
260 friend class CHTTPSession;
262 //##ModelId=3C4C187B0296
263 CHTTPSession* iImplementation;
266 inline RHTTPSession::RHTTPSession()
272 inline RHTTPFilterCollection RHTTPSession::FilterCollection() const
274 RHTTPFilterCollection c;
275 c.iImplementation = iImplementation;
279 inline TBool RHTTPSession::operator==(RHTTPSession aTrans) const
281 return (iImplementation == aTrans.iImplementation);
283 inline TBool RHTTPSession::operator!=(RHTTPSession aTrans) const
285 return !(*this == aTrans);
290 inline RHTTPSession RHTTPFilterCollection::Session() const
293 s.iImplementation = iImplementation;
300 #endif // __RHTTPSESSION_H__