williamr@2: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @file RHTTPTransaction.h williamr@2: @warning : This file contains Rose Model ID comments - please do not delete williamr@2: */ williamr@2: williamr@2: #ifndef __RHTTPTRANSACTION_H__ williamr@2: #define __RHTTPTRANSACTION_H__ williamr@2: williamr@2: // System includes williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: // Forward declarations williamr@2: class CHTTPTransaction; williamr@2: class CTransaction; williamr@2: class MHTTPTransactionCallback; williamr@2: class RHTTPSession; williamr@2: class TCertInfo; williamr@2: class CCertificate; williamr@2: williamr@2: williamr@2: //##ModelId=3C4C18860091 williamr@2: class RHTTPTransaction williamr@2: /** williamr@2: A HTTP Transaction. This encapsulates 1 HTTP request and williamr@2: response. A Transaction is associated with a session, and must be williamr@2: created using the session's CreateTransactionL method. williamr@2: @publishedAll williamr@2: @released williamr@2: @see RHTTPSession williamr@2: @see RHTTPSession::CreateTransactionL williamr@2: */ williamr@2: { williamr@2: public: williamr@2: /** williamr@2: Default (uninitialised) constructor williamr@2: */ williamr@2: //##ModelId=3C4C188600F5 williamr@2: inline RHTTPTransaction(); williamr@2: williamr@2: /** Submits a transaction. Once all the headers and other details williamr@2: have been set up, this call actualy causes the request to be williamr@2: made. williamr@2: @leave KErrNoMemory There was not enough memory. williamr@2: */ williamr@2: //##ModelId=3C4C188600ED williamr@2: IMPORT_C void SubmitL(THTTPFilterHandle aStart = williamr@2: THTTPFilterHandle::EClient); williamr@2: williamr@2: /** Notify HTTP of the availability of more request body data, williamr@2: when submitting body data in several parts. williamr@2: williamr@2: @param aStart The filter supplying the new data. This will almost always be the client (default value) williamr@2: @leave KErrNoMemory There was not enough memory. williamr@2: */ williamr@2: //##ModelId=3C4C188600EB williamr@2: IMPORT_C void NotifyNewRequestBodyPartL(THTTPFilterHandle aStart = williamr@2: THTTPFilterHandle::EClient); williamr@2: williamr@2: /** Sends a status message to all relevant filters. This function williamr@2: is predominantly used by filters, rather than by the client. williamr@2: @param aStatus The status message to send. williamr@2: @param aDirection The direction down the filter queue that this event williamr@2: will be propogated. williamr@2: @leave KErrNoMemory There was not enough memory. williamr@2: */ williamr@2: //##ModelId=3C4C188600E2 williamr@2: IMPORT_C void SendEventL(THTTPEvent aStatus, williamr@2: THTTPEvent::TDirection aDirection, williamr@2: THTTPFilterHandle aStart); williamr@2: williamr@2: /** Gets the response. Note that the returned response may not be williamr@2: valid if it hasn't been created yet. williamr@2: @see RHTTPMessage::IsValid() williamr@2: */ williamr@2: //##ModelId=3C4C188600E1 williamr@2: IMPORT_C RHTTPResponse Response() const; williamr@2: williamr@2: /// Gets the request. williamr@2: //##ModelId=3C4C188600DA williamr@2: IMPORT_C RHTTPRequest Request() const; williamr@2: williamr@2: /// Returns the session associated with the transaction. williamr@2: //##ModelId=3C4C188600D9 williamr@2: IMPORT_C RHTTPSession Session() const; williamr@2: williamr@2: /** Returns the transaction's property set. This is used by filters williamr@2: to store transaction-specific information, and by clients to williamr@2: specify things like reload or no cache behaviour. williamr@2: */ williamr@2: //##ModelId=3C4C188600D8 williamr@2: IMPORT_C RHTTPTransactionPropertySet PropertySet() const; williamr@2: williamr@2: /** Cancels the transaction. williamr@2: williamr@2: @param aStart The entity that is initiating the cancel (defaults williamr@2: to the client). See THTTPFilterHandle for the values this can take. williamr@2: */ williamr@2: //##ModelId=3C4C188600CF williamr@2: IMPORT_C void Cancel(THTTPFilterHandle aStart = williamr@2: THTTPFilterHandle::EClient); williamr@2: williamr@2: /** Closes the transaction and frees all owned resources. williamr@2: Transactions must be opened using RHTTPSession::OpenTransactionL. williamr@2: It is also closed when you close the session. williamr@2: */ williamr@2: //##ModelId=3C4C188600CE williamr@2: IMPORT_C void Close(); williamr@2: williamr@2: /** This function should be called by filters when they have williamr@2: failed due to running out of memory. It cancels the transaction williamr@2: and sends the synchronous events EUnrecoverableError and EFailed williamr@2: to the client to inform it of the failure. For instance in a williamr@2: filter that attempts to send an event to the client from a williamr@2: MHFRunError to inform the client of a failure, if the call to williamr@2: SendEventL leaves, Fail() may be used to 'give up'. */ williamr@2: //##ModelId=3C4C188600C7 williamr@2: IMPORT_C void Fail(THTTPFilterHandle aStart = williamr@2: THTTPFilterHandle::ECurrentFilter); williamr@2: williamr@2: /** Equality operator to check if this transaction is the same as that one. williamr@2: @param aTrans The transaction to compare this one to. williamr@2: */ williamr@2: //##ModelId=3C4C188600C5 williamr@2: TBool operator==(RHTTPTransaction aTrans) const; williamr@2: /** Inequality operator williamr@2: @param aTrans The transaction to compare this one to. williamr@2: */ williamr@2: //##ModelId=3C4C188600C3 williamr@2: TBool operator!=(RHTTPTransaction aTrans) const; williamr@2: /** Obtain this transaction's ID, which is unique within its williamr@2: session. This is mostly used for producing a williamr@2: slightly-meaningful way of identifying transactions in logging williamr@2: code. williamr@2: @return The transaction ID. williamr@2: */ williamr@2: //##ModelId=3C4C188600BB williamr@2: IMPORT_C TInt Id() const; williamr@2: williamr@2: /** Obtain the server certificate information for this transaction. This function williamr@2: should only be used for text-mode, for WSP use RHttpSession::ServerCert. williamr@2: @see RHttpSession::ServerCert williamr@2: @param aServerCert A client supplied object into which the certificate williamr@2: information will be placed. williamr@2: @return KErrNone if certificate has been completed, KErrNotSupported if williamr@2: this function is called for WSP. williamr@2: @deprecated v9.2 onwards - maintained for compatibility with v9.1 and before williamr@2: TCertInfo has been deprecated since v9.2. CCertificate may be used as an alternative. williamr@2: */ williamr@2: //##ModelId=3C4C188600B9 williamr@2: IMPORT_C TInt ServerCert(TCertInfo& aServerCert); williamr@2: williamr@2: /** Obtain the server certificate information for this transaction. This function williamr@2: should only be used for HTTP. WSP should use RHttpSession::ServerCert. williamr@2: @see RHttpSession::ServerCert williamr@2: @internalAll williamr@2: @prototype williamr@2: @return a CCertificate pointer to an CX509Certificate object. williamr@2: Calling code can safely cast to CX509Certificate if using "HTTP/TCP". williamr@2: NULL returned if certificate information not found. williamr@2: */ williamr@2: IMPORT_C const CCertificate* ServerCert(); williamr@2: williamr@2: /** Obtain the cipher suite information for this transaction. williamr@2: @return RString containing the cipher suite as per RFC2246. williamr@2: */ williamr@2: IMPORT_C RString CipherSuite(); williamr@2: williamr@2: /**Sets the HTTP data optimiser for the transaction. williamr@2: @param aHttpOptimiser An object of the implementation of interface, MHttpDataOptimiser, supplied by the client. williamr@2: @publishedPartner williamr@2: */ williamr@2: IMPORT_C void SetupHttpDataOptimiser (MHttpDataOptimiser& aHttpOptimiser); williamr@2: williamr@2: /**Returns the object of the MHttpDataOptimiser implementation class. williamr@2: @internalTechnology williamr@2: */ williamr@2: IMPORT_C MHttpDataOptimiser* HttpDataOptimiser (); williamr@2: williamr@2: private: williamr@2: friend class RHTTPSession; williamr@2: friend class CTransaction; williamr@2: williamr@2: private: williamr@2: //##ModelId=3C4C188600A7 williamr@2: CTransaction* iImplementation; williamr@2: }; williamr@2: williamr@2: inline TBool RHTTPTransaction::operator==(RHTTPTransaction aTrans) const williamr@2: { williamr@2: return (iImplementation == aTrans.iImplementation); williamr@2: }; williamr@2: inline TBool RHTTPTransaction::operator!=(RHTTPTransaction aTrans) const williamr@2: { williamr@2: return !(*this == aTrans); williamr@2: }; williamr@2: williamr@2: inline RHTTPTransaction::RHTTPTransaction() williamr@2: : iImplementation(NULL) williamr@2: { williamr@2: } williamr@2: williamr@2: williamr@2: #endif // __RHTTPTRANSACTION_H__