1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/http/rhttptransaction.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,225 @@
1.4 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// 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
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +
1.20 +
1.21 +/**
1.22 + @file RHTTPTransaction.h
1.23 + @warning : This file contains Rose Model ID comments - please do not delete
1.24 +*/
1.25 +
1.26 +#ifndef __RHTTPTRANSACTION_H__
1.27 +#define __RHTTPTRANSACTION_H__
1.28 +
1.29 +// System includes
1.30 +#include <http/thttpevent.h>
1.31 +#include <http/rhttpresponse.h>
1.32 +#include <http/rhttprequest.h>
1.33 +#include <http/rhttptransactionpropertyset.h>
1.34 +#include <http/thttpfilterhandle.h>
1.35 +#include <http/mhttpdataoptimiser.h>
1.36 +
1.37 +// Forward declarations
1.38 +class CHTTPTransaction;
1.39 +class CTransaction;
1.40 +class MHTTPTransactionCallback;
1.41 +class RHTTPSession;
1.42 +class TCertInfo;
1.43 +class CCertificate;
1.44 +
1.45 +
1.46 +//##ModelId=3C4C18860091
1.47 +class RHTTPTransaction
1.48 +/**
1.49 +A HTTP Transaction. This encapsulates 1 HTTP request and
1.50 +response. A Transaction is associated with a session, and must be
1.51 +created using the session's CreateTransactionL method.
1.52 +@publishedAll
1.53 +@released
1.54 +@see RHTTPSession
1.55 +@see RHTTPSession::CreateTransactionL
1.56 +*/
1.57 + {
1.58 + public:
1.59 + /**
1.60 + Default (uninitialised) constructor
1.61 + */
1.62 + //##ModelId=3C4C188600F5
1.63 + inline RHTTPTransaction();
1.64 +
1.65 + /** Submits a transaction. Once all the headers and other details
1.66 + have been set up, this call actualy causes the request to be
1.67 + made.
1.68 + @leave KErrNoMemory There was not enough memory.
1.69 + */
1.70 + //##ModelId=3C4C188600ED
1.71 + IMPORT_C void SubmitL(THTTPFilterHandle aStart =
1.72 + THTTPFilterHandle::EClient);
1.73 +
1.74 + /** Notify HTTP of the availability of more request body data,
1.75 + when submitting body data in several parts.
1.76 +
1.77 + @param aStart The filter supplying the new data. This will almost always be the client (default value)
1.78 + @leave KErrNoMemory There was not enough memory.
1.79 + */
1.80 + //##ModelId=3C4C188600EB
1.81 + IMPORT_C void NotifyNewRequestBodyPartL(THTTPFilterHandle aStart =
1.82 + THTTPFilterHandle::EClient);
1.83 +
1.84 + /** Sends a status message to all relevant filters. This function
1.85 + is predominantly used by filters, rather than by the client.
1.86 + @param aStatus The status message to send.
1.87 + @param aDirection The direction down the filter queue that this event
1.88 + will be propogated.
1.89 + @leave KErrNoMemory There was not enough memory.
1.90 + */
1.91 + //##ModelId=3C4C188600E2
1.92 + IMPORT_C void SendEventL(THTTPEvent aStatus,
1.93 + THTTPEvent::TDirection aDirection,
1.94 + THTTPFilterHandle aStart);
1.95 +
1.96 + /** Gets the response. Note that the returned response may not be
1.97 + valid if it hasn't been created yet.
1.98 + @see RHTTPMessage::IsValid()
1.99 + */
1.100 +//##ModelId=3C4C188600E1
1.101 + IMPORT_C RHTTPResponse Response() const;
1.102 +
1.103 + /// Gets the request.
1.104 + //##ModelId=3C4C188600DA
1.105 + IMPORT_C RHTTPRequest Request() const;
1.106 +
1.107 + /// Returns the session associated with the transaction.
1.108 + //##ModelId=3C4C188600D9
1.109 + IMPORT_C RHTTPSession Session() const;
1.110 +
1.111 + /** Returns the transaction's property set. This is used by filters
1.112 + to store transaction-specific information, and by clients to
1.113 + specify things like reload or no cache behaviour.
1.114 + */
1.115 + //##ModelId=3C4C188600D8
1.116 + IMPORT_C RHTTPTransactionPropertySet PropertySet() const;
1.117 +
1.118 + /** Cancels the transaction.
1.119 +
1.120 + @param aStart The entity that is initiating the cancel (defaults
1.121 + to the client). See THTTPFilterHandle for the values this can take.
1.122 + */
1.123 + //##ModelId=3C4C188600CF
1.124 + IMPORT_C void Cancel(THTTPFilterHandle aStart =
1.125 + THTTPFilterHandle::EClient);
1.126 +
1.127 + /** Closes the transaction and frees all owned resources.
1.128 + Transactions must be opened using RHTTPSession::OpenTransactionL.
1.129 + It is also closed when you close the session.
1.130 + */
1.131 + //##ModelId=3C4C188600CE
1.132 + IMPORT_C void Close();
1.133 +
1.134 + /** This function should be called by filters when they have
1.135 + failed due to running out of memory. It cancels the transaction
1.136 + and sends the synchronous events EUnrecoverableError and EFailed
1.137 + to the client to inform it of the failure. For instance in a
1.138 + filter that attempts to send an event to the client from a
1.139 + MHFRunError to inform the client of a failure, if the call to
1.140 + SendEventL leaves, Fail() may be used to 'give up'. */
1.141 + //##ModelId=3C4C188600C7
1.142 + IMPORT_C void Fail(THTTPFilterHandle aStart =
1.143 + THTTPFilterHandle::ECurrentFilter);
1.144 +
1.145 + /** Equality operator to check if this transaction is the same as that one.
1.146 + @param aTrans The transaction to compare this one to.
1.147 + */
1.148 + //##ModelId=3C4C188600C5
1.149 + TBool operator==(RHTTPTransaction aTrans) const;
1.150 + /** Inequality operator
1.151 + @param aTrans The transaction to compare this one to.
1.152 + */
1.153 + //##ModelId=3C4C188600C3
1.154 + TBool operator!=(RHTTPTransaction aTrans) const;
1.155 + /** Obtain this transaction's ID, which is unique within its
1.156 + session. This is mostly used for producing a
1.157 + slightly-meaningful way of identifying transactions in logging
1.158 + code.
1.159 + @return The transaction ID.
1.160 + */
1.161 + //##ModelId=3C4C188600BB
1.162 + IMPORT_C TInt Id() const;
1.163 +
1.164 + /** Obtain the server certificate information for this transaction. This function
1.165 + should only be used for text-mode, for WSP use RHttpSession::ServerCert.
1.166 + @see RHttpSession::ServerCert
1.167 + @param aServerCert A client supplied object into which the certificate
1.168 + information will be placed.
1.169 + @return KErrNone if certificate has been completed, KErrNotSupported if
1.170 + this function is called for WSP.
1.171 + @deprecated v9.2 onwards - maintained for compatibility with v9.1 and before
1.172 + TCertInfo has been deprecated since v9.2. CCertificate may be used as an alternative.
1.173 + */
1.174 + //##ModelId=3C4C188600B9
1.175 + IMPORT_C TInt ServerCert(TCertInfo& aServerCert);
1.176 +
1.177 + /** Obtain the server certificate information for this transaction. This function
1.178 + should only be used for HTTP. WSP should use RHttpSession::ServerCert.
1.179 + @see RHttpSession::ServerCert
1.180 + @internalAll
1.181 + @prototype
1.182 + @return a CCertificate pointer to an CX509Certificate object.
1.183 + Calling code can safely cast to CX509Certificate if using "HTTP/TCP".
1.184 + NULL returned if certificate information not found.
1.185 + */
1.186 + IMPORT_C const CCertificate* ServerCert();
1.187 +
1.188 + /** Obtain the cipher suite information for this transaction.
1.189 + @return RString containing the cipher suite as per RFC2246.
1.190 + */
1.191 + IMPORT_C RString CipherSuite();
1.192 +
1.193 + /**Sets the HTTP data optimiser for the transaction.
1.194 + @param aHttpOptimiser An object of the implementation of interface, MHttpDataOptimiser, supplied by the client.
1.195 + @publishedPartner
1.196 + */
1.197 + IMPORT_C void SetupHttpDataOptimiser (MHttpDataOptimiser& aHttpOptimiser);
1.198 +
1.199 + /**Returns the object of the MHttpDataOptimiser implementation class.
1.200 + @internalTechnology
1.201 + */
1.202 + IMPORT_C MHttpDataOptimiser* HttpDataOptimiser ();
1.203 +
1.204 +private:
1.205 + friend class RHTTPSession;
1.206 + friend class CTransaction;
1.207 +
1.208 + private:
1.209 + //##ModelId=3C4C188600A7
1.210 + CTransaction* iImplementation;
1.211 + };
1.212 +
1.213 +inline TBool RHTTPTransaction::operator==(RHTTPTransaction aTrans) const
1.214 + {
1.215 + return (iImplementation == aTrans.iImplementation);
1.216 + };
1.217 +inline TBool RHTTPTransaction::operator!=(RHTTPTransaction aTrans) const
1.218 + {
1.219 + return !(*this == aTrans);
1.220 + };
1.221 +
1.222 +inline RHTTPTransaction::RHTTPTransaction()
1.223 + : iImplementation(NULL)
1.224 + {
1.225 + }
1.226 +
1.227 +
1.228 +#endif // __RHTTPTRANSACTION_H__