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